From: Jinkun Jang Date: Tue, 12 Mar 2013 06:07:37 +0000 (+0900) Subject: Tizen 2.1 base X-Git-Tag: 2.1b_release X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2F2.1b_release;p=toolchains%2Fbison.git Tizen 2.1 base --- diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 0000000..3575535 --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,1111 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +1.1 Quick configuration advice +============================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You should use +the more recent version of the GNU `gettext' library. I.e. if the file +`intl/VERSION' shows that the library which comes with this package is +more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.3 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, +and `CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your language by running the +command `locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.4 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" +area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +1.5 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of July +2006. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo + +----------------------------------------------------+ + GNUnet | [] | + a2ps | [] [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | [] | + ap-utils | | + aspell | [] [] [] [] | + bash | [] [] [] | + batchelor | [] | + bfd | | + bibshelf | [] | + binutils | [] | + bison | [] [] | + bison-runtime | [] | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | | + cpplib | [] [] [] | + cryptonit | [] | + darkstat | [] () [] | + dialog | [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] () [] | + fileutils | [] [] | + findutils | [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | | + gawk | [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] [] [] | + gip | [] | + gliv | [] | + glunarclock | [] | + gmult | [] [] | + gnubiff | () | + gnucash | () () [] | + gnucash-glossary | [] () | + gnuedu | | + gnulib | [] [] [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | | + gpe-edit | [] | + gpe-filemanager | | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-package | | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | () () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + gretl | | + gsasl | | + gss | | + gst-plugins | [] [] [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] () | + gtkam | [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] | + id-utils | [] [] | + impost | | + indent | [] [] [] | + iso_3166 | [] [] | + iso_3166_1 | [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | [] | + iso_639 | [] [] | + jpilot | [] | + jtag | | + jwhois | | + kbd | [] [] [] [] | + keytouch | | + keytouch-editor | | + keytouch-keyboa... | | + latrine | () | + ld | [] | + leafpad | [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] | + libgpg-error | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | | + libiconv | [] [] | + libidn | [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] | + make | [] [] | + man-db | [] () [] [] | + minicom | [] [] [] | + mysecretdiary | [] [] | + nano | [] [] () [] | + nano_1_0 | [] () [] [] | + opcodes | [] | + parted | | + pilot-qof | [] | + psmisc | [] | + pwdutils | | + python | | + qof | | + radius | [] | + recode | [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] | + sharutils | [] [] [] [] [] [] | + shishi | | + silky | | + skencil | [] () | + sketch | [] () | + solfege | | + soundtracker | [] [] | + sp | [] | + stardict | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | () () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] | + xchat | [] [] [] [] [] | + xkeyboard-config | | + xpad | [] [] | + +----------------------------------------------------+ + af am ar az be bg bs ca cs cy da de el en en_GB eo + 11 0 1 2 8 21 1 42 43 2 62 99 18 1 16 16 + + es et eu fa fi fr ga gl gu he hi hr hu id is it + +--------------------------------------------------+ + GNUnet | | + a2ps | [] [] [] () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] [] | + aspell | [] [] [] | + bash | [] [] [] | + batchelor | [] [] | + bfd | [] | + bibshelf | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] | + cflow | | + clisp | [] [] | + console-tools | | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] | + cpplib | [] [] | + cryptonit | [] | + darkstat | [] () [] [] [] | + dialog | [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] | + error | [] [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] [] | + findutils | [] [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | [] [] | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] [] | + gcc | [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] | + gip | [] [] [] | + gliv | () | + glunarclock | [] [] [] | + gmult | [] [] [] | + gnubiff | () () | + gnucash | () () () | + gnucash-glossary | [] [] | + gnuedu | [] | + gnulib | [] [] [] [] [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] [] | + gpe-conf | [] | + gpe-contacts | [] [] | + gpe-edit | [] [] [] [] | + gpe-filemanager | [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] | + gpsdrive | () () [] () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] [] [] [] [] | + gretl | [] [] [] | + gsasl | [] | + gss | [] | + gst-plugins | [] [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] [] | + gstreamer | [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] [] | + impost | [] [] | + indent | [] [] [] [] [] [] [] [] [] [] | + iso_3166 | [] [] [] | + iso_3166_1 | [] [] [] [] [] [] [] | + iso_3166_2 | [] | + iso_3166_3 | [] | + iso_4217 | [] [] [] [] | + iso_639 | [] [] [] [] [] | + jpilot | [] [] | + jtag | [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | [] [] [] | + ld | [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] [] [] | + libgpg-error | | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] | + libiconv | [] | + libidn | [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] [] | + lynx | [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] [] [] [] [] [] | + man-db | () | + minicom | [] [] [] [] | + mysecretdiary | [] [] [] | + nano | [] () [] [] [] [] | + nano_1_0 | [] [] [] [] [] | + opcodes | [] [] [] [] | + parted | [] [] [] [] | + pilot-qof | | + psmisc | [] [] [] | + pwdutils | | + python | | + qof | | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] | + sed | [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] [] | + shishi | | + silky | [] | + skencil | [] [] | + sketch | [] [] | + solfege | [] | + soundtracker | [] [] [] | + sp | [] | + stardict | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] [] | + texinfo | [] [] | + textutils | [] [] [] [] [] | + tin | [] () | + tp-robot | [] [] [] [] | + tuxpaint | [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | () | + wdiff | [] [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] | + xchat | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + es et eu fa fi fr ga gl gu he hi hr hu id is it + 89 21 16 2 41 119 61 14 1 8 1 6 61 30 0 53 + + ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + +--------------------------------------------------+ + GNUnet | | + a2ps | () [] [] () | + aegis | () | + ant-phone | [] | + anubis | [] [] [] | + ap-utils | [] | + aspell | [] [] | + bash | [] | + batchelor | [] [] | + bfd | | + bibshelf | [] | + binutils | | + bison | [] [] [] | + bison-runtime | [] [] [] | + bluez-pin | [] [] [] | + cflow | | + clisp | [] | + console-tools | | + coreutils | [] | + cpio | | + cpplib | [] | + cryptonit | [] | + darkstat | [] [] | + dialog | [] [] | + diffutils | [] [] [] | + doodle | | + e2fsprogs | [] | + enscript | [] | + error | [] | + fetchmail | [] [] | + fileutils | [] [] | + findutils | [] | + flex | [] [] | + fslint | [] [] | + gas | | + gawk | [] [] | + gbiff | [] | + gcal | | + gcc | | + gettext-examples | [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] | + gip | [] [] | + gliv | [] | + glunarclock | [] [] | + gmult | [] [] | + gnubiff | | + gnucash | () () | + gnucash-glossary | [] | + gnuedu | | + gnulib | [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] | + gpe-beam | [] | + gpe-calendar | [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | [] | + gpe-edit | [] [] | + gpe-filemanager | [] | + gpe-go | [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] | + gpe-today | [] | + gpe-todo | | + gphoto2 | [] [] | + gprof | | + gpsdrive | () () () | + gramadoir | () | + grep | [] [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins | [] | + gst-plugins-base | | + gst-plugins-good | [] | + gstreamer | [] | + gtick | [] | + gtkam | [] | + gtkorphan | [] | + gtkspell | [] [] | + gutenprint | | + hello | [] [] [] [] [] [] [] [] | + id-utils | [] | + impost | | + indent | [] [] | + iso_3166 | [] | + iso_3166_1 | [] [] | + iso_3166_2 | [] | + iso_3166_3 | [] | + iso_4217 | [] [] [] | + iso_639 | [] [] | + jpilot | () () () | + jtag | | + jwhois | [] | + kbd | [] | + keytouch | [] | + keytouch-editor | | + keytouch-keyboa... | | + latrine | [] | + ld | | + leafpad | [] [] | + libc | [] [] [] [] [] | + libexif | | + libextractor | | + libgpewidget | [] | + libgpg-error | | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | | + libidn | [] [] | + lifelines | [] | + lilypond | | + lingoteach | [] | + lynx | [] [] | + m4 | [] [] | + mailutils | | + make | [] [] [] | + man-db | () | + minicom | [] | + mysecretdiary | [] | + nano | [] [] [] | + nano_1_0 | [] [] [] | + opcodes | [] | + parted | [] [] | + pilot-qof | | + psmisc | [] [] [] | + pwdutils | | + python | | + qof | | + radius | | + recode | [] | + rpm | [] [] | + screem | [] | + scrollkeeper | [] [] [] [] | + sed | [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] | + shishi | | + silky | [] | + skencil | | + sketch | | + solfege | | + soundtracker | | + sp | () | + stardict | [] [] | + system-tools-ba... | [] [] [] [] | + tar | [] [] [] | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | | + tp-robot | [] | + tuxpaint | [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] | + vorbis-tools | [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] | + xchat | [] [] [] [] | + xkeyboard-config | [] | + xpad | [] [] [] | + +--------------------------------------------------+ + ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + 40 24 2 1 1 3 1 2 3 21 0 15 1 101 5 3 + + nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + +------------------------------------------------------+ + GNUnet | | + a2ps | () [] [] [] [] [] [] | + aegis | () () | + ant-phone | [] [] | + anubis | [] [] [] | + ap-utils | () | + aspell | [] [] | + bash | [] [] [] | + batchelor | [] [] | + bfd | | + bibshelf | [] | + binutils | [] [] | + bison | [] [] [] [] [] | + bison-runtime | [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] [] | + cflow | [] | + clisp | [] | + console-tools | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cpplib | [] | + cryptonit | [] [] | + darkstat | [] [] [] [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] [] | + fileutils | [] [] [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + fslint | [] [] [] [] | + gas | | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gimp-print | [] [] | + gip | [] [] [] [] | + gliv | [] [] [] [] | + glunarclock | [] [] [] [] [] [] | + gmult | [] [] [] [] | + gnubiff | () | + gnucash | () [] | + gnucash-glossary | [] [] [] | + gnuedu | | + gnulib | [] [] [] [] [] | + gnunet-gtk | [] | + gnutls | [] [] | + gpe-aerial | [] [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] [] | + gpe-calendar | [] [] [] [] [] [] [] [] | + gpe-clock | [] [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] [] | + gpe-contacts | [] [] [] [] [] | + gpe-edit | [] [] [] [] [] [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] [] [] [] | + gpe-login | [] [] [] [] [] [] [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] [] | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] | + gretl | [] | + gsasl | [] [] | + gss | [] [] [] | + gst-plugins | [] [] [] [] | + gst-plugins-base | [] | + gst-plugins-good | [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] | + gtkorphan | [] | + gtkspell | [] [] [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + impost | [] | + indent | [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] | + iso_3166_1 | [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] [] [] [] | + iso_4217 | [] [] [] [] | + iso_639 | [] [] [] [] | + jpilot | | + jtag | [] | + jwhois | [] [] [] [] | + kbd | [] [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | [] [] | + ld | [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] [] | + libgpewidget | [] [] [] [] [] [] [] | + libgpg-error | [] [] | + libgphoto2 | [] | + libgphoto2_port | [] [] [] | + libgsasl | [] [] [] [] | + libiconv | | + libidn | [] [] () | + lifelines | [] [] | + lilypond | | + lingoteach | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailutils | [] [] [] [] | + make | [] [] [] [] | + man-db | [] [] | + minicom | [] [] [] [] [] | + mysecretdiary | [] [] [] [] | + nano | [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] | + parted | [] | + pilot-qof | [] | + psmisc | [] [] | + pwdutils | [] [] | + python | | + qof | [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + rpm | [] [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] | + silky | [] | + skencil | [] [] [] | + sketch | [] [] [] | + solfege | [] | + soundtracker | [] [] | + sp | | + stardict | [] [] [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] | + tin | () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | | + wdiff | [] [] [] [] [] [] | + wget | [] [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] [] | + xpad | [] [] [] | + +------------------------------------------------------+ + nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + 0 2 3 58 31 53 5 76 72 5 42 48 12 51 130 2 + + tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + +---------------------------------------------------+ + GNUnet | [] | 2 + a2ps | [] [] [] | 19 + aegis | | 0 + ant-phone | [] [] | 6 + anubis | [] [] [] | 11 + ap-utils | () [] | 4 + aspell | [] [] [] | 14 + bash | [] | 11 + batchelor | [] [] | 9 + bfd | | 1 + bibshelf | [] | 7 + binutils | [] [] [] | 9 + bison | [] [] [] | 19 + bison-runtime | [] [] [] | 16 + bluez-pin | [] [] [] [] [] [] | 28 + cflow | [] [] | 4 + clisp | | 6 + console-tools | [] [] | 5 + coreutils | [] [] | 17 + cpio | [] [] [] | 9 + cpplib | [] [] [] [] | 11 + cryptonit | | 5 + darkstat | [] () () | 15 + dialog | [] [] [] [] [] | 30 + diffutils | [] [] [] [] | 28 + doodle | [] | 6 + e2fsprogs | [] [] | 10 + enscript | [] [] [] | 16 + error | [] [] [] [] | 18 + fetchmail | [] [] | 12 + fileutils | [] [] [] | 18 + findutils | [] [] [] | 17 + flex | [] [] | 15 + fslint | [] | 9 + gas | [] | 3 + gawk | [] [] | 15 + gbiff | [] | 5 + gcal | [] | 5 + gcc | [] [] [] | 6 + gettext-examples | [] [] [] [] [] [] | 26 + gettext-runtime | [] [] [] [] [] [] | 28 + gettext-tools | [] [] [] [] [] | 19 + gimp-print | [] [] | 12 + gip | [] [] | 12 + gliv | [] [] | 8 + glunarclock | [] [] [] | 15 + gmult | [] [] [] [] | 15 + gnubiff | [] | 1 + gnucash | () | 2 + gnucash-glossary | [] [] | 9 + gnuedu | [] | 2 + gnulib | [] [] [] [] [] | 28 + gnunet-gtk | | 1 + gnutls | | 2 + gpe-aerial | [] [] | 14 + gpe-beam | [] [] | 14 + gpe-calendar | [] [] [] [] | 19 + gpe-clock | [] [] [] [] | 20 + gpe-conf | [] [] | 14 + gpe-contacts | [] [] | 10 + gpe-edit | [] [] [] [] | 19 + gpe-filemanager | [] | 5 + gpe-go | [] [] | 14 + gpe-login | [] [] [] [] [] | 20 + gpe-ownerinfo | [] [] [] [] | 20 + gpe-package | [] | 5 + gpe-sketchbook | [] [] | 16 + gpe-su | [] [] [] | 19 + gpe-taskmanager | [] [] [] | 19 + gpe-timesheet | [] [] [] [] | 18 + gpe-today | [] [] [] [] [] | 20 + gpe-todo | [] | 6 + gphoto2 | [] [] [] [] | 20 + gprof | [] [] | 11 + gpsdrive | | 4 + gramadoir | [] | 7 + grep | [] [] [] [] | 33 + gretl | | 4 + gsasl | [] [] | 6 + gss | [] | 5 + gst-plugins | [] [] [] | 15 + gst-plugins-base | [] [] [] | 9 + gst-plugins-good | [] [] [] | 18 + gstreamer | [] [] [] | 17 + gtick | [] | 11 + gtkam | [] | 13 + gtkorphan | [] | 7 + gtkspell | [] [] [] [] [] [] | 26 + gutenprint | | 3 + hello | [] [] [] [] [] | 39 + id-utils | [] [] | 14 + impost | [] | 4 + indent | [] [] [] [] | 25 + iso_3166 | [] [] [] | 15 + iso_3166_1 | [] [] | 20 + iso_3166_2 | | 2 + iso_3166_3 | [] [] | 9 + iso_4217 | [] [] | 14 + iso_639 | [] | 14 + jpilot | [] [] [] [] | 7 + jtag | [] | 3 + jwhois | [] [] [] | 13 + kbd | [] [] | 12 + keytouch | [] | 4 + keytouch-editor | | 2 + keytouch-keyboa... | | 2 + latrine | [] [] | 8 + ld | [] [] [] [] | 8 + leafpad | [] [] [] [] | 23 + libc | [] [] [] | 23 + libexif | [] | 4 + libextractor | [] | 5 + libgpewidget | [] [] [] | 19 + libgpg-error | [] | 4 + libgphoto2 | [] | 8 + libgphoto2_port | [] [] [] | 11 + libgsasl | [] | 8 + libiconv | [] | 4 + libidn | [] [] | 10 + lifelines | | 4 + lilypond | | 2 + lingoteach | [] | 6 + lynx | [] [] [] | 15 + m4 | [] [] [] | 18 + mailutils | [] | 8 + make | [] [] [] | 20 + man-db | [] | 6 + minicom | [] | 14 + mysecretdiary | [] [] | 12 + nano | [] [] | 15 + nano_1_0 | [] [] [] | 18 + opcodes | [] [] | 10 + parted | [] [] [] | 10 + pilot-qof | [] | 3 + psmisc | [] | 10 + pwdutils | [] | 3 + python | | 0 + qof | [] | 2 + radius | [] | 6 + recode | [] [] [] | 25 + rpm | [] [] [] [] | 14 + screem | [] | 2 + scrollkeeper | [] [] [] [] | 26 + sed | [] [] [] | 22 + sh-utils | [] | 15 + shared-mime-info | [] [] [] [] | 23 + sharutils | [] [] [] | 23 + shishi | | 1 + silky | [] | 4 + skencil | [] | 7 + sketch | | 6 + solfege | | 2 + soundtracker | [] [] | 9 + sp | [] | 3 + stardict | [] [] [] [] | 11 + system-tools-ba... | [] [] [] [] [] [] [] | 37 + tar | [] [] [] [] | 19 + texinfo | [] [] [] | 15 + textutils | [] [] [] | 17 + tin | | 1 + tp-robot | [] [] [] | 10 + tuxpaint | [] [] [] | 16 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux | [] [] [] | 20 + vorbis-tools | [] [] | 11 + wastesedge | | 1 + wdiff | [] [] | 22 + wget | [] [] [] | 19 + xchat | [] [] [] [] | 28 + xkeyboard-config | [] [] [] [] | 11 + xpad | [] [] [] | 14 + +---------------------------------------------------+ + 77 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + 172 domains 0 1 1 78 39 0 135 13 1 50 3 54 0 2054 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If July 2006 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at +`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. + +1.6 Using `gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`translation@iro.umontreal.ca' to make the `.pot' files available to +the translation teams. + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..0a3ca6f --- /dev/null +++ b/AUTHORS @@ -0,0 +1,8 @@ +Authors of GNU Bison. + +Bison was written primarily by Robert Corbett. + +Richard Stallman made it Yacc-compatible. + +Wilfred Hansen of Carnegie Mellon University added multicharacter +string literals and other features. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, 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, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..f28a847 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,21115 @@ +2008-12-11 Joel E. Denny + + Version 2.4.1. + * NEWS: Set version and date. + * lib/Makefile.am: Update copyright year. + * tests/atlocal.in: Update copyright year. + +2008-12-11 Joel E. Denny + + Semicolon feature removal is not about future language support. + * NEWS: The semicolon feature is no longer active for newer languages, + so don't claim that it causes trouble for them. + +2008-12-11 Joel E. Denny + + * gnulib: Update submodule to HEAD. + +2008-12-09 Akim Demaille + + Update data/README. + * data/README: Document glr.cc, lalr1.java, m4sugar and xslt. + +2008-12-05 Eric Blake + + Build testsuite with newer autoconf. + * tests/output.at (m4_expand): Don't override in newer autoconf, + where the underlying implementation changed. + * tests/cxx-type.at (_AT_RESOLVED_GLR_OUTPUT) + (_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_AMBIG_GLR_OUTPUT) + (_AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) + (_AT_VERBOSE_GLR_STDERR): Expand to double-quoted strings, + since some of them contain unbalanced ')'. + +2008-11-19 Joel E. Denny + + * NEWS: Clarify a little. + +2008-11-19 Joel E. Denny + + * NEWS: Update for recent changes. + +2008-11-18 Joel E. Denny + + Fix unexpanded macros in GLR defines file. + Reported by Csaba Raduly at + . + * THANKS (Csaba Raduly): Add. + * data/glr.c: Fix overquoting on b4_prefix for yylval and yylloc. + * tests/calc.at (_AT_DATA_CALC_Y): If %defines is specified, generate + lexer in a separate module that includes the defines file. + (AT_CHECK_CALC): Use AT_FULL_COMPILE and request compilation of lexer + source. + * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Push AT_DEFINES_IF. + Adjust AT_LOC and AT_VAL to use AT_NAME_PREFIX. + (AT_BISON_OPTION_POPDEFS): Pop AT_DEFINES_IF. + (AT_DATA_SOURCE_PROLOGUE): New. + (AT_DATA_GRAMMAR_PROLOGUE): Use AT_DATA_SOURCE_PROLOGUE. + (AT_DATA_SOURCE): New. + (AT_FULL_COMPILE): New, copied from master branch and extended to + support an additional source file. + +2008-11-17 Joel E. Denny + + Don't let maintainer-*-check targets force a version update. + * cfg.mk (_is-dist-target): Implement. maintainer-check* was already + handled. + +2008-11-17 Di-an Jan + + * doc/bison.texinfo: Synchronize ``Detail Node Listing''. + Align menus. Adjust word wrapping. Use node names for menu names. + (Examples): Don't abbreviate node names. + (LocalWords): Remove abbreviations. + (Copying): Make description a sentence. + (Java Action Features): Remove period to match the rest of menu. + +2008-11-11 Paolo Bonzini + + * bootstrap.conf: Replace m4/warning.m4 with warnings module. + * configure.ac: Adjust usage. + * lib/Makefile.am: Replace $(WARNING_CFLAGS) with $(WARN_CFLAGS). + * src/Makefile.am: Replace $(WARNING_CFLAGS) with $(WARN_CFLAGS). + * tests/atlocal.in: Replace $(WARNING_*FLAGS) with $(WARN_*FLAGS). + +2008-11-07 Joel E. Denny + + Don't add a semicolon to actions for %skeleton or %language. + It breaks Java test cases as reported by Akim Demaille. + * src/scan-code.l: Implement. + +2008-11-07 Joel E. Denny + + Clean up %skeleton and %language priority implementation. + * src/getargs.c (skeleton_prio): Use default_prio rather than 2, and + remove static qualifier because others will soon need to see it. + (language_prio): Likewise. + (getargs): Use command_line_prio rather than 0. + * src/getargs.h (command_line_prio, grammar_prio, default_prio): New + enum fields. + (skeleton_prio): Extern it. + (language_prio): Extern it. + * src/parse-gram.y: Use grammar_prio rather than 1. + +2008-11-04 Akim Demaille + + * NEWS: Mention the trailing semicolon in action. + +2008-11-04 Akim Demaille + + Reformat NEWS. + * NEWS: Use more outline-mode markup. + Suggested by Jim Meyering. + +2008-11-04 Joel E. Denny + + Fix user actions without a trailing semicolon. + Reported by Sergei Steshenko at + . + * THANKS (Sergei Steshenko): Add. + * src/scan-code.l (SC_RULE_ACTION): Fix it. + * tests/regression.at (Fix user actions without a trailing semicolon): + New test case. + +2008-11-02 Joel E. Denny + + Initiate further development. + * NEWS: Create an empty section for new entries. + * gnulib: Update submodule to HEAD. + +2008-11-02 Joel E. Denny + + * NEWS: Version 2.4. + +2008-11-02 Joel E. Denny + + Prepare for next release. + * NEWS: Briefly mention changes since 2.3b. + * README: Say GNU m4 1.4.6, which we've been requiring in release + announcements already, not 1.4.3, which breaks the build. + +2008-11-02 Joel E. Denny + + Say %language is experimental. + We're thinking of extending it's effect on output file naming. See the + thread at + . + * NEWS: Say it's experimental. + * doc/bison.texinfo (Decl Summary): Say it's experimental, and so don't + recommend it over %skeleton for now. + (Bison Options): Likewise. + (C++ Bison Interface): Use %skeleton not %language. + (Calc++ Parser): Use %skeleton not %language. + * src/getargs.c (usage): Say it's experimental. + +2008-11-01 Di-an Jan + Paolo Bonzini + + Support all Java parser class modifiers. + * data/java.m4 (b4_percent_define_get3): New. + (b4_final_if, b4_strictfp_if): New. + * data/lalr1.java (final, strictfp, extends, implements): Support. + * doc/bison.texinfo (final, strictfp, extends, implements): Add + documentation. + * tests/java.at (AT_CHECK_JAVA_MINIMAL): New. + (AT_CHECK_JAVA_MINIMAL_W_LEXER): New. + (AT_CHECK_JAVA_GREP): New. + (Java parser class modifiers): New test. + (Java parser class extends and implements): New test. + + Model exception propagation better with throws and lex_throws. + * data/java.m4 (b4_list2): New. + (throws): Change default. + * data/lalr1.java (yyaction): Add throws. + (parse): Add lex_throws in addition to throws. + * doc/bison.texinfo (throws, lex_throws): Add documentation. + * tests/java.at (Java throws specifications): New test. + + Improve documentation for Java parsers. + * doc/bison.texinfo (Java Parsers): Add subsections. + Don't quote first argument of %define. + (Java Bison Interface): Document output files. Move documentation + of parser class and merge into Java Parser Interface. Document + features that error out. Document directives with no effect. + Move note about Javadoc higher. + (Java Semantic Values): Explicitly mention stype. + Document that generic types cannot be used. + (Java Location Values): Use @deftypeivar. Document constructors. + Correct return value for toString. + (Java Parser Interface): List undocumented constants/fields. + Move documentation of fields added by %parse-param closer to list + of members. Document that token names are added as fields. + Document constructors accurately. Remove error method. + (Java Scanner Interface): Move note on %pure-parser to Java Bison + Interface. Describe %code lexer and yylex accutately. + Remove documentation that does not match the code. + (Java Action Features): New. + (Java Differences): Add reference. Add item on semantic values. + Add note about @{ ... @}. Clarify %% epilogue placement. + (Java Declarations Summary): New. + + Fix Java skeleton. + * data/java.m4 (b4_prefix): Correct quoting for m4_define_default. + (b4_remove_comma): Quote test argument. + (b4_identification): Remove "bison" field. + * tests/java.at (Java parser class and package names): New test. + (Java %parse-param and %lex-param): New test. + (Java stype, position_class and location_class): New test. + +2008-10-31 Di-an Jan + + * data/lalr1.jave: Update copyright years. + (YYParser): Correct name of "generated from" file in Javadoc: + use b4_file_name instead of @ofile@. + (Location constructor): Correct Javadoc parameter name. + (yylloc): Add missing opening m4 quote after b4_location_if. + This removes a stray [ in the Javadoc of Lexer.getStartPos. + (Lexer.yyerror): Fix incorrect m4 and Javadoc. + (YYParser constructor): Correct Javadoc parameter name. + +2008-10-30 Joel E. Denny + + Always put auxiliary code files in the same dir as other output files. + * src/files.c (compute_file_name_parts): When the user specifies + --output but not --file-prefix, extract the directory prefix from the + file prefix not from the grammar file name. This affects the location + of files like location.hh generated by the C++ skeleton. The includes + in the other output files require this fix. + * tests/output.at (AT_CHECK_OUTPUT): Automatically create directories + for expected output files. + (Output files): Add a test for the above. + +2008-10-29 Joel E. Denny + + * gnulib: Update submodule to HEAD. + +2008-10-28 Joel E. Denny + + Update copyright year. + * src/files.c: Here. + +2008-10-28 Di-an Jan (tiny change) + + Don't overwrite the input file. + * src/files.c (output_file_name_check): Fatal error if using input file + for output. + * tests/output.at: (AT_CHECK_CONFLICTING_OUTPUT): Add return status + argument. + (Conflicting output files): Add test. + +2008-10-28 Akim Demaille + + Space changes. + * data/lalr1.cc: Formatting changes. + +2008-10-28 Akim Demaille + + Don't define debugging functions when !YYDEBUG. + * data/lalr1.cc (debug_stream, set_debug_stream) + (debug_level_type, debug_level, set_debug_level): Don't + declare them when YYDEBUG is not defined. + The implementation are already YYDEBUG-aware. + +2008-10-28 Akim Demaille + + Prefer "continue" for empty loop bodies. + * etc/bench.pl.in: Use "continue" instead of {}. + +2008-10-28 Akim Demaille + + Space and comments changes. + * data/c++.m4, data/glr.c, data/lalr1.cc: Copyright year changes. + * data/c.m4, data/lalr1.cc: Space changes. + +2008-10-28 Akim Demaille + + Make gnulib a submodule. + * gnulib: New. + * .gitmodules (gnulib): New. + +2008-10-18 Joel E. Denny + + Fix yyerror_range for user-defined location type in C++. Reported by + Georg Sauthoff at + . + * data/lalr1.cc (parse): Change type of yyerror_range to location_type. + * THANKS (Georg Sauthoff): Add. + +2008-10-18 Joel E. Denny + + Update several administrative files mainly to facilitate releasing. + * HACKING (Administrivia): Make the git-merge-changelog notes more + helpful. + (Test suite): Don't say lalr1.cc is not exercised in the test suite. + (Release Procedure): Update for git and add numerous details that were + previously missing. + * Makefile.am (EXTRA_DIST): Remove Makefile.cfg and Makefile.maint. + * maint.mk (announcement): Don't list bison as a bootstrap tool so + that announcements don't claim we bootstrapped with whatever bison + happened to be in PATH. Add flex as a bootstrap tool. + * Makefile.maint: Remove, previously replaced by maint.mk. + * Makefile.cfg: Remove, and migrate settings to... + * cfg.mk: ... here for the sake of `make announcement'. + * bootstrap.conf (gnulib_modules): Add announce-gen. + * README: Say GNU Bison instead of just Bison. Suggested by Karl + Berry. + +2008-10-08 Di-an Jan (tiny change) + + Small but important bugfixes for the Java skeleton. + * data/lalr1.java (yyerror): Change Location to b4_location_type. + (yy_symbol_print): Call toString on yyvaluep. + +2008-08-29 Akim Demaille + + Clarify UPDATED use. + * doc/bison.texinfo: It refers to the last edition of this file, + not to the release date of Bison. + Reported by Joel E. Denny. + +2008-08-29 Akim Demaille + + * README: Update FAQ pointer. + Reported by Joel E. Denny. + +2008-08-27 Eric Blake + + Resync m4sugar from autoconf. + * data/m4sugar/m4sugar.m4 (m4_defn, m4_popdef, m4_undefine) + (m4_init): Adjust to latest m4.git changes. + (m4_mapall_sep, _m4_list_cmp, m4_version_compare): Reduce side + effects. + * data/m4sugar/foreach.m4 (_m4_shiftn): Fix off-by-one bug. + (_m4_list_cmp): Reduce side effects. + +2008-08-27 Akim Demaille + + Check yyerrok in calc.at. + * tests/calc.at (calc.y): Use yyerrok on "( error )". + (AT_CHECK_CALC): Add a check that ensures that yyerrok works as + expected. + +2008-08-27 Akim Demaille + + Support yyerrok in lalr1.cc. + YYBACKUP is still to import back into lalr1.cc. + * data/lalr1.cc (yyerrork, yyclearin, YYRECOVERING): Define. + +2008-08-26 Joel E. Denny + + For maintainer-check*, don't recompile for a $(VERSION) update. + * cfg.mk: New file. + (_is-dist-target): Override the one in GNUmakefile. + * Makefile.am (EXTRA_DIST): Add cfg.mk. + +2008-08-26 Joel E. Denny + + Update for recent change to gnulib. + * src/parse-gram.y: Don't include strverscmp.h. It comes from + string.h now. + +2008-08-15 Eric Blake + + Remaining m4sugar merge from autoconf. + * data/m4sugar/m4sugar.m4: Copy entire file from autoconf. + * data/m4sugar/foreach.m4: New file, copied from autoconf. + * data/Makefile.am (dist_m4sugar_DATA): Distribute it. + * src/output.c (output_skeleton): Tell m4 how to find it. + + Partial m4sugar merge from autoconf: m4_map. + * data/m4sugar/m4sugar.m4 (m4_fst): Delete. + (m4_map, m4_map_sep, _m4_map): Rewrite more efficiently. + (m4_apply, _m4_apply, m4_mapall, m4_mapall_sep): New macros. + * data/java.m4 (b4_token_enums): Use more efficient short-circuit + for empty list. + * data/c.m4 (b4_token_defines, b4_token_enums, b4_c_ansi_formals): + Likewise. + (b4_parse_param_for): Avoid m4_fst, now that autoconf no longer + declares it. + +2008-08-07 Joel E. Denny + + Keep .version and PACKAGE_VERSION in sync. + * Makefile.am ($(top_srcdir)/.version): Declare configure as a + dependency, and add comments justifying this in more detail. Discussed + starting at + . + +2008-08-06 Eric Blake + + Partial m4sugar merge from autoconf: m4_shiftn. + * data/m4sugar/m4sugar.m4 (m4_shiftn): Faster implementation. + (m4_shift2, m4_shift3): New macros. + (m4_case, m4_bmatch, m4_bpatsubsts, m4_join): Adjust clients. + * data/c.m4 (b4_c_function_def, b4_c_ansi_function_def) + (b4_c_ansi_function_decl, b4_c_function_call): Likewise. + * data/java.m4 (b4_remove_comma): Likewise. + + Partial m4sugar merge from autoconf: m4_wrap vs. m4 1.6. + * data/m4sugar/m4sugar.m4 (m4_unquote, m4_wrap_lifo): New macros. + (m4_wrap): Guarantee FIFO order, in spite of m4 1.6. + (m4_init): Consolidate wrapped text into single m4_wrap. + * data/bison.m4 (b4_check_user_names_wrap): Stick with LIFO order + in wrapped text. + +2008-08-05 Eric Blake + + Partial m4sugar merge from autoconf: builtins, version.m4. + * data/m4sugar/m4sugar.m4 (changeword): Nuke. + (m4_prepend): Remove, as it is unused and inherently quadratic, + whereas m4_append is linear in newer m4. + (m4_mkstemp): New builtin. + (m4_symbols): Make rename conditional. + (m4_version_prereq): Ensure fatal error if used in bison, which + intentionally lacks version.m4. + + Fix comments in m4sugar. + * data/m4sugar/m4sugar.m4: Comment changes, borrowed from autoconf. + +2008-08-02 Joel E. Denny + + Update for recent .gitignore fix in Gnulib. + * bootstrap: Back out 2008-07-18 hack now that gnulib-tool creates + anchored .gitignore entries. + +2008-08-02 Joel E. Denny + + Set gnu or gnits strictness. + * configure.ac (AM_INIT_AUTOMAKE): Set gnu strictness during + development and gnits strictness for releases. Based on Eric Blake's + suggestion at + . + +2008-07-31 Paolo Bonzini + + * NEWS: Clarify documentation of %language. + +2008-07-31 Paolo Bonzini + + Support usage of git-merge-changelog. + * .gitattributes: New. + * HACKING: Document usage of git-merge-changelog. + * bootstrap: Install git-merge-changelog entries in .git/config + if appropriate. + +2008-07-27 Joel E. Denny + + Remove remaining dependence on CVS Id keyword. + * ChangeLog: For the sake of people still using CVS, don't use dollars + when mentioning Id. + * data/xslt/bison.xsl: Remove Id from header comments, where it was + unusual anyway. + * data/xslt/xml2dot.xsl: Likewise. + * data/xslt/xml2text.xsl: Likewise. + * data/xslt/xml2xhtml.xsl: Likewise. + * doc/Doxyfile.in (PROJECT_NUMBER): Don't use ID. + * doc/Makefile.am (neutralize): Remove, no longer needed. + (.x.1): Don't use neutralize. + (edit): Don't substitute for ID. + (Doxyfile): Don't define Id, and thus don't depend on ChangeLog. + +2008-07-27 Joel E. Denny + + Fix dependence on computed configure variables. + * doc/Makefile.am (common_dep): Depend on $(top_srcdir)/configure not + $(top_srcdir)/configure.ac so that changes to computed variables, such + as PACKAGE_VERSION, are seen. + * tests/Makefile.am ($(srcdir)/package.m4): Likewise. + +2008-07-20 Joel E. Denny + + Update copyright dates for recent changes. + * Makefile.am: Here. + * src/Makefile.am: Here. + * src/reduce.c: Here. + * tests/reduce.at: Here. + +2008-07-18 Joel E. Denny + + Use git-version-gen for version names between releases. + * .cvsignore (.tarball-version, GNUmakefile, *~): Add. + * .gitignore (/.tarball-version, /GNUmakefile, /*~): Add. + * .prev-version: New. + * .version.in: Remove. + * ChangeLog: Remove the Id previously used for capturing the CVS + revision. + * GNUmakefile: Remove, now copied from Gnulib. + * Makefile.am: Add code suggested by comments in + build-aux/git-version-gen. + (EXTRA_DIST): Remove GNUmakefile, handled by Gnulib. Add maint.mk, + .prev-version, and .version. + * NEWS (2.3b+): Rename to... + (?.?): ... this because we're dropping the "+" version naming scheme, + but, in general, we still can't be sure of our next release name. + * bootstrap: Add a quick hack to remove from .gitignore the + GNUmakefile entry that gnulib adds. We already have a /GNUmakefile + entry. This should really be fixed in gnulib instead. + * bootstrap.conf (gnulib_modules): Add gnumakefile. + * configure.ac (AC_INIT): Set version name by invoking + build-aux/git-version-gen. + (AC_CONFIG_FILES): Remove .version, now generated by + build-aux/git-version-gen. + * maint.mk: New, copied from coreutils. + * doc/.cvsignore (bison.1): Add. + * doc/.gitignore (/bison.1): Add. + * doc/bison.1: Remove, generated. + * src/.cvsignore (revision.c): Remove. + * src/.gitignore (/revision.c): Remove. + * src/Makefile.am (bison_SOURCES): Remove revision.c and revision.h. + (BUILT_SOURCES): Remove revision.c. + (revision.c): Remove. + * src/getargs.c (version): Don't print revision after the VERSION. + * src/revision.h: Remove. + +2008-07-16 Joel E. Denny + + Fix untranslatable composition of sentences. Reported by Goran + Uddeborg at + . + * THANKS (Goran Uddeborg): Add. + * src/reduce.c (reduce_print): Report the number of nonterminals and + rules useless in the grammar in separate sentences. + * tests/reduce.at (Useless Rules): Update output. + (Reduced Automaton): Likewise. + (Underivable Rules): Likewise. + (Empty Language): Likewise. + +2008-07-15 Joel E. Denny + + Fix some .gitignore and .cvsignore problems. + * bootstrap (insert_sorted_if_absent): Replace all uses with... + (insert_vc_ignore): ... this new function, which prepends `/' to all + .gitignore entries before passing them to insert_sorted_if_absent. + * bootstrap.conf (vc_ignore): Set to '.cvsignore .gitignore' so that + .cvsignore files are maintained even though Bison developers run + bootstrap while using Git. + * .cvsignore (*.patch *.log log patches applied): Remove, apparently + unneeded by Bison. + (gnulib): Add. + * .gitignore (/*.patch *.log log patches applied): Remove, broken and + unneeded. Reported by Eric Blake. + * lib/.gitignore (/*~): Add. + * po/.cvsignore, runtime-po/.cvsignore: Sync with .gitignore. + * examples/calc++/.gitignore (/calc++.exe): Add. Reported by Eric + Blake. + * src/.gitignore (/bison.exe): Add. Reported by Eric Blake. + +2008-07-15 Joel E. Denny + + Improve forward-compatibility with GNU M4. Reported by Eric Blake at + . + * bootstrap.conf (gnulib_modules): Add unsetenv. + * lib/.gitignore, lib/.cvsignore (/unsetenv.c): Add. + * m4/.gitignore, m4/.cvsignore (/environ.m4): Add. + (/setenv.m4): Add. + * src/output.c (output_skeleton): For the m4 invocation, pass -dV as + the first argument because it may become position-dependent, and unset + POSIXLY_CORRECT so Bison's skeletons have access to GNU M4 extensions. + Add comments explaining these issues in more detail. + +2008-07-14 Joel E. Denny + + Add .gitignore everywhere based on .cvsignore. + * .gitignore: New. + * build-aux/.gitignore: New. + * data/.gitignore: New. + * doc/.gitignore: New. + * etc/.gitignore: New. + * examples/.gitignore: New. + * examples/calc++/.gitignore: New. + * lib/.gitignore: New. + * m4/.gitignore: New. + * po/.gitignore: New. + * runtime-po/.gitignore: New. + * src/.gitignore: New. + * tests/.gitignore: New. + +2008-05-27 Joel E. Denny + + * NEWS (2.3b+): New section, empty for now. + * configure.ac (AC_INIT): 2.3b -> 2.3b+. + +2008-05-27 Joel E. Denny + + * NEWS (2.3b): Update release date since there has been a delay in + getting the announcements and tarballs out. + +2008-05-23 Joel E. Denny + + * NEWS: Version 2.3b. + * configure.ac (AC_INIT): Likewise. + (PACKAGE_COPYRIGHT_YEAR): Update to 2008. + +2008-05-23 Joel E. Denny + + * HACKING: Don't say don't mention HACKING in the ChangeLog. We've + been doing it for years. + (Test suite): Mention maintainer-push-check and maintainer-xml-check. + (Release Procedure): Add FIXME about make alpha being unmaintained. + +2008-05-13 Joel E. Denny + + * data/yacc.c: Reformat m4 a little for readability. + * src/lalr.c (build_relations): Correct comment. + +2008-05-12 Juan Manuel Guerrero + + DJGPP specific issue. + * djgpp/config.sed: Fixes required to run configure scripts generated + by autoconf 2.62. + +2008-05-07 Joel E. Denny + + * HACKING (Release Procedure): translation@iro.umontreal.ca is now + coordinator@translationproject.org. + +2008-05-06 Joel E. Denny + + * THANKS: Add Eric Blake. + +2008-04-23 Eric Blake + + Revert prior patch, by working around autoconf regression. + * tests/output.at (m4_expand): Add workaround for autoconf 2.62. + ("Output file name: ("): Uncomment test. + ("Output file name: )"): Likewise. + Based on an idea from Noah Misch. + +2008-04-21 Joel E. Denny + + Work-around an Autoconf 2.62 AT_SETUP bug that was not present in + 2.61. Reported by Juan Manuel Guerrero at + . + * tests/output.at ("Output file name: ("): Comment out test case for + now. + ("Output file name: )"): Likewise. + +2008-04-21 Joel E. Denny + + * GNUmakefile: Update git-version-gen invocation so make dist + succeeds. + +2008-04-21 Joel E. Denny + + Update to the current gnulib CVS repository, and fix trigraph handling + in Bison. + * bootstrap: Update gnulib CVS repository URL. + (symlink_to_dir): Encapsulate the code that guarantees the destination + directory exists into... + (check_dst_dir): ... this new function, and... + (cp_mark_as_generated): ... reuse it here so that bootstrap doesn't + fail when copying files into lib/uniwidth/. + * src/output.c (prepare_symbols): When writing yytname muscles, where + symbol names will be encoded in C-string literals, tell quotearg to + escape trigraphs. This used to be the default in gnulib. + * tests/regression.at (Token definitions): Because of the change in + gnulib's quotearg behavior, string_as_id in parse-gram.y no longer + escapes trigraphs in symbol names. Thus, yytname no longer has + trigraphs unnecessarily doubly escaped. Update test case output. + Extend test case to be sure Bison's own error messages will no longer + have trigraphs in symbol names unnecessarily escaped once. + +2008-04-20 Joel E. Denny + + Fix make dist infinite loop reported by Juan Manuel Guerrero at + . + * .cvsignore: Add .version. + * .version.in: New. + * bootstrap.conf (gnulib_modules): Add git-version-gen. + * configure.ac (AC_CONFIG_FILES): Add .version. + * build-aux/.cvsignore: Add git-version-gen. + +2008-03-08 Joel E. Denny + + * NEWS (2.3a+): Mention that -g now takes an argument. + * doc/bison.texinfo (Bison Options): Reword -W entry a little for + consistency. Update the -g and -x entries now that they take + arguments. Use brackets to indicate optional arguments. + * src/getargs.c (usage): Explain the relationship between arguments of + long and short options more completely. Document --defines and -d + separately since the former takes an argument but, for POSIX Yacc, the + latter does not. + (short_options): Let -W take an optional argument like --warnings. + (getargs): Sort cases. + +2008-02-28 Akim Demaille + + * doc/bison.texinfo: Fix a few typos. + +2008-02-28 Akim Demaille + + * doc/bison.texinfo (Bison Options): Document -W. + Based on Joel E. Denny's NEWS entry, and Automake's documentation. + +2008-02-28 Akim Demaille + + * src/getargs.c (short_options): Split and sort for readability. + -g and -x take optional arguments, just like their long options. + * build-aux/cross-options.pl: Use /x to make the regexp easier to + understand. + Fix the handling of $opt which resulted in all the argument to be + considered as optional. + +2008-02-22 Joel E. Denny + + * NEWS (2.3a+): Don't say %language is experimental. Mention Java and + say its interface is experimental. + * doc/bison.texinfo (Decl Summary): In the %language entry, mention + Java. + (Bison Options): In the -L and --language entry, mention Java. + (Java Bison Interface): Say the interface is experimental. + * src/getargs.c (usage): Mention -L and --language. + + * NEWS (2.3a+): Say the push parsing interface is experimental. + * doc/bison.texinfo (Push Decl): Likewise. + (Decl Summary): Likewise in the "%define api.push_pull" entry. + (Push Parser Function): Likewise. + (Pull Parser Function): Likewise. + (Parser Create Function): Likewise. + (Parser Delete Function): Likewise. + (Table of Symbols): Likewise in the yypstate_delete, yypstate_new, + yypull_parse, and yypush_parse entries. + + * NEWS (2.3a+): Mention XML support, and say the schema is + experimental. + * doc/bison.texinfo (Bison Options): Mention -x and --xml. + * src/getargs.c (usage): Say the XML schema is experimental. + + * NEWS (2.3a+): Say option instead of flag. + +2008-02-21 Wojciech Polak + + * data/xslt/xml2xhtml.xsl (xsl:template match="/"): Change footer + text. + +2008-02-20 Joel E. Denny + + Fix impure push parser compile error reported by Bob Rossi at + . + * data/yacc.c: Clean up whitespace in the output a little. + (yypstate_allocated): Define for impure push parsers regardless of + whether the pull interface is also requested. + * tests/push.at (Push Parsing: Multiple impure instances): Extend to + check impure push parsers without the pull interface. + + * data/yacc.c (yypstate_new): Don't try to invoke yyerror since + yyerror takes arguments specified by %parse-param while yypstate_new + does not. + * doc/bison.texinfo (Parser Create Function): Document that + yypstate_new returns 0 for multiple impure parser instances. + * tests/push.at (Push Parsing: Multiple impure instances): Update + expected stderr output. + +2008-02-19 Joel E. Denny + + * runtime-po/POTFILES.in (push.c): Remove. + +2008-02-17 Joel E. Denny + + * data/Makefile.am (dist_pkgdata_DATA): Remove push.c. + * data/push.c: Rename to... + * data/yacc.c: ... this, overwriting it. + * etc/bench.pl.in (bench_grammar): `%pure-parser'-> `%define api.pure'. + `%push-pull-parser' -> `%define api.push_pull "both"'. + Remove old yacc.c tests, and update push.c tests to yacc.c. + +2008-02-17 Joel E. Denny + + * data/bison.m4 (b4_percent_code_get): Output %code block comments like + `"%code top" blocks' instead of `%code "top" blocks'. + * data/push.c: Import yacc.c changes from 2008-01-09 and 2007-08-03. + Clean up whitespace in the output a little. + +2008-02-16 Joel E. Denny + + Fix documentation problems reported by Tim Josling at + . + * NEWS (2.3a+): Mention removal of --no-parser, -n, and %no-parser. + * doc/bison.texinfo (Token Decl): Token numbers are *nonnegative* + integers. Explain the effect of literal string aliases on error + messages. Copy token 0 documentation from the C++ skeleton + documentation. + +2008-02-16 Joel E. Denny + + Accept a token number in a %left, %right, or %nonassoc for POSIX + conformance. Reported by Tim Josling at + . + * NEWS (2.3a+): Mention. + * doc/bison.texinfo (Precedence Decl): Describe how literal strings + and code numbers are treated by precedence declarations. + * src/parse-gram.y (precedence_declaration): Use symbols.prec instead + of symbols.1. + (symbols.prec): New, just like symbols.1 but uses symbol.prec instead + of symbol. + (symbol.prec): New, just like symbol but allows INT. + * src/symtab.c (symbol_user_token_number_set): Remove an aver that no + longer holds. + * tests/regression.at (Token number in precedence declaration): New + test case. + +2008-02-06 Juan Manuel Guerrero + + DJGPP specific issues. + * djgpp/config.bat: Add filenames that are not 8.3 clean and that must + be changed. Copyright timestamp adjusted. + * djgpp/config.sed: Add filenames that are not 8.3 clean and that must + be changed. Copyright timestamp adjusted. + * djgpp/config.site: Copyright timestamp adjusted. + * djgpp/config_h.sed: Copyright timestamp adjusted. + * djgpp/djunpack.bat: Copyright timestamp adjusted. + * djgpp/fnchnage.lst: Add filenames that are not 8.3 clean to the + filename translation list. + * djgpp/subpipe.c (init_subpipe): Check the environment variables + TMPDIR, TMP and TEMP, in that order, to determinate where the temp + files shall be created. Before trying to use the temp dir where the + environment variable points to check that the dir really exists. If + not default to the cwd as temp dir. Copyright timestamp adjusted. + * djgpp/subpipe.h: Copyright timestamp adjusted. + * djgpp/testsuite.sed: Copyright timestamp adjusted. + +2008-01-30 Paul Eggert + + * doc/bison.texinfo: Update Back-Cover text to reflect new GNU wording. + +2008-01-09 Paul Eggert + + * data/yacc.c (yyparse): Correct the comment when locations aren't used. + Problem reported by Claudio Saavedra in + . + +2008-01-05 Wojciech Polak + + * data/xslt/xml2xhtml.xsl (xsl:template match="/"): Precede an XHTML + document's title with the input grammar file name. + +2007-12-22 Joel E. Denny + + Automate regression testing of the XML/XSLT implementation. Discussed + starting at + . + * configure.ac (XSLTPROC): New substitution. + * Makefile.am (maintainer-xml-check): New phony target invoking... + * tests/Makefile.am (maintainer-xml-check): ... this new phony target + invoking make maintainer-check with BISON_TEST_XML=1. + * tests/atlocal.in (XSLTPROC): New. + * tests/local.at (AT_BISON_CHECK): New macro to (1) instruct Valgrind + not to report reachable memory when Bison is expected to have a + non-zero exit status and (2) to compare XML/XSLT output with --graph + and --report=all output for every working grammar when + BISON_TEST_XML=1. + (AT_BISON_CHECK_NO_XML): Likewise, but skip XML checks. + (AT_BISON_CHECK_XML): New. + (AT_QUELL_VALGRIND): New. + * tests/testsuite.at (ORIGINAL_AT_CHECK): Remove this and... + (AT_CHECK): ... don't redefine this since this was the old way to + quell Valgrind. + * tests/actions.at: Rewrite all AT_CHECK invocations for bison as + AT_BISON_CHECK invocations. + * tests/c++.at: Likewise. + * tests/calc.at: Likewise. + * tests/conflicts.at: Likewise. + * tests/cxx-type.at: Likewise. + * tests/existing.at: Likewise. + * tests/glr-regression.at: Likewise. + * tests/headers.at: Likewise. + * tests/input.at: Likewise. + * tests/java.at: Likewise. + * tests/output.at: Likewise. + * tests/push.at: Likewise. + * tests/reduce.at: Likewise. + * tests/regression.at: Likewise. + * tests/sets.at: Likewise. + * tests/skeletons.at: Likewise. + * tests/synclines.at: Likewise. + * tests/torture.at: Likewise. + (Big triangle): Use AT_BISON_CHECK_NO_XML instead since this grammar + tends to hang xsltproc. + (Big horizontal): Likewise. + +2007-12-08 Joel E. Denny + + In XML output, remove redundant class attribute on symbol element. + * data/xslt/bison.xsl (xsl:key name="bison:symbolByName"): New. + * data/xslt/xml2xhtml.xsl (xsl:template match="symbol"): Use it to + look up a symbol to determine whether it's a nonterminal or terminal. + * src/gram.c (rule_rhs_print_xml): Remove class attribute. + * src/state.c (state_rule_lookahead_tokens_print_xml): Likewise. + + Add prec/assoc information to XML output. + * src/gram.c (grammar_rules_print_xml): For each rule that has a + %prec, add a percent_prec attribute. + * src/print-xml.c (print_grammar): For each terminal that has a + precedence or associativity, add a prec or assoc attribute. + (xml_indent): New. + (xml_puts): Use xml_indent. + (xml_printf): Use xml_indent. + * src/print-xml.h (xml_indent): Prototype. + + * tests/existing.at (GNU pic Grammar): Fix a rule miscopied from + . + +2007-12-08 Joel E. Denny + + * data/xslt/bison.xsl (bison:ruleNumber): Rename to... + (bison:ruleByNumber): ... this for clarity. + * data/xslt/xml2dot.xsl (xsl:template match="item"): Update. + * data/xslt/xml2text.xsl (xsl:template match="item"): Update. + (xsl:template match="reduction"): Update. + (xsl:template match="item"): Update. + (xsl:template match="reduction"): Update. + + In the XML output, don't print the list of rules where symbols appear. + Compute it in XSLT instead. Discussed at + . + * data/xslt/bison.xsl (bison:ruleByLhs): New. + (bison:ruleByRhs): New. + * data/xslt/xml2text.xsl (xsl:template match="terminal"): Use + bison:ruleByRhs. + (xsl:template match="terminal/rule"): Remove. + (xsl:template match="nonterminal"): Use bison:ruleByLhs and + bison:ruleByRhs. + (xsl:template match="nonterminal/left/rule|nonterminal/right/rule"): + Remove. + * data/xslt/xml2xhtml.xsl (xsl:template match="terminal"): Use + bison:ruleByRhs and mode="number-link" for rule template. + (xsl:template match="terminal/rule"): Remove. + (xsl:template match="nonterminal"): Use bison:ruleByLhs and + bison:ruleByRhs and mode="number-link" for rule template. + (xsl:template match="nonterminal/left/rule|nonterminal/right/rule"): + Rewrite as... + (xsl:template match="rule" mode="number-link"): ... this. + * src/print-xml.c (print_grammar): Don't print the list of rules. + +2007-12-01 Joel E. Denny + + Don't let --report affect XML output; always print all information. + Discussed at + . + * src/conflicts.c (log_resolution): Implement. + * src/print-xml.c (print_core): Implement. + (print_state): Implement. + (print_xml): Implement. + + * NEWS (2.3a+): Fix quotes. + * src/parse-gram.y (prologue_declaration): For consistency with -v, + don't let %verbose clear the list specified by --report. + +2007-11-26 Akim Demaille + + * data/Makefile.am (dist_pkgdata_DATA): Ship and install bison.xsl. + +2007-11-24 Joel E. Denny + + In the XML output, list useless and unused symbols and rules with the + useful ones and add a "usefulness" attribute. Discussed starting at + . + * src/gram.c (grammar_rules_partial_print_xml): Remove. + (grammar_rules_print_xml): Print all rules instead of just those + useful in the grammar, and add a "usefulness" attribute. + * src/gram.h (grammar_rules_partial_print_xml): Remove prototype. + * src/print-xml.c (print_rules_useless_in_parser): Remove. + (print_grammar): Print all nonterminals instead of just useful ones, + and add a "usefulness" attribute to nonterminals and terminals. + (print_xml): Don't print a separate "reductions" or + "rules-useless-in-parser" element. + * src/reduce.c (reduce_output): Use reduce_token_unused_in_grammar. + (reduce_xml): Remove. + (reduce_token_unused_in_grammar): New. + (reduce_nonterminal_useless_in_grammar): New. + * src/reduce.h (reduce_xml): Remove prototype. + (reduce_token_unused_in_grammar): Add prototype. + (reduce_nonterminal_useless_in_grammar): Add prototype. + * data/xslt/xml2text.xsl: Update for XML changes. + * data/xslt/xml2xhtml.xsl: Update for XML changes. + * tests/reduce.at (Useless Terminals): Update output. + (Useless Rules): Update output. + (Reduced Automaton): Update output. + + Say "Terminals unused in grammar" instead of "Unused terminals". + * NEWS (2.3a+): Update. + * doc/bison.texinfo (Understanding): Update example output. + * src/reduce.c (reduce_output): Implement. + * data/xslt/xml2text.xsl: Implement. + * data/xslt/xml2xhtml.xsl: Implement. + +2007-11-18 Joel E. Denny + + Accept --report-file=FILE to override the default `.output' filename. + * NEWS (2.3a+): Mention. + * doc/bison.texinfo (Bison Options): Add an entry. + * src/files.c (compute_output_file_names): Don't override + spec_verbose_file if already set. + * src/getargs.c (usage): Document --report-file. + (REPORT_FILE_OPTION): New anonymous enum member. + (long_options): Add entry for it. + (getargs): Add case for it setting spec_verbose_file. + + * build-aux/cross-options.pl: Don't record a short option just because + there's an arg. + * doc/.cvsignore: Add yacc.1. + +2007-11-14 Akim Demaille + + * doc/yacc.1.in: New. + * configure.ac, doc/Makefile.am: Adjust. + * configure.ac (PACKAGE_COPYRIGHT_YEAR): New substitution, and new + config.h symbol. + Use AC_SUBST for assignments too. + * src/getargs.c (version): Use PACKAGE_COPYRIGHT_YEAR. + +2007-11-10 Joel E. Denny + + * src/gram.c: Remove comments that duplicate comments in gram.h. + + When reporting useless rules and nonterminals, say "useless in grammar" + instead of "useless", and say "useless in parser" instead of "never + reduced". Discussed starting at + . + * NEWS (2.3a+): Mention this change. + * data/xslt/xml2text.xsl: Update output text and expected input XML + element names to match changes below. + * data/xslt/xml2xhtml.xsl: Likewise. + (xsl:template match="bison-xml-report"): Add missing entry in Table of + Contents: "Rules useless in parser due to conflicts". + * doc/bison.texinfo (Decl Summary): Reword a little. + (Understanding): Update example output for changes below. + * src/gram.c: (rule_useful_p): Rename to... + (rule_useful_in_grammar_p): ... this. + (rule_useless_p): Rename to... + (rule_useless_in_grammar_p): ... this. + (rule_never_reduced_p): Rename to... + (rule_useless_in_parser_p): ... this. + (grammar_rules_print): Update for renames. + (grammar_rules_print_xml): Update for renames. + (grammar_rules_never_reduced_report): Rename to... + (grammar_rules_useless_report): ... this since it is used for either + kind of useless rule. + * src/gram.h: Reword comments and update function names in prototypes. + * src/main.c (main): Say "rule useless in parser due to conflicts". + * src/print-xml.c (print_rules_never_reduced): Rename to... + (print_rules_useless_in_parser): ... this, and rename output XML + element "rules-never-reduced" to "rules-useless-in-parser". + (print_xml): Update for rename. + * src/print.c (print_results): Say "Rules useless in parser due to + conflicts". + * src/reduce.c (reduce_grammar_tables): Say "rule useless in grammar". + (nonterminals_reduce): Say "nonterminal useless in grammar". + (reduce_output): Say "Nonterminals useless in grammar". + Say "Rules useless in grammar". + (reduce_xml): Rename output XML element "useless" to + "useless-in-grammar". + (reduce_print): Don't report the count of grammatically useless rules + as "rules never reduced" just because %yacc is specified. + In the correct report of this count, say nonterminal(s) and rule(s) + "useless in grammar". + * tests/conflicts.at (S/R in initial): Update expected output. + (Defaulted Conflicted Reduction): Likewise. + (Unreachable States After Conflict Resolution): Likewise. + * tests/existing.at (GNU pic Grammar): Likewise. + * tests/reduce.at (Useless Nonterminals): Likewise. + (Useless Rules): Likewise. + (Reduced Automaton): Likewise. + (Underivable Rules): Likewise. + (Empty Language): Likewise. + +2007-11-09 Joel E. Denny + + * data/bison.m4 (b4_cat): Put a newline after the end delimiter of the + here document and before the EOF so that BSD's implementation of Bourne + shell doesn't parse the delimiter as part of the here document. + * doc/.cvsignore: Add cross-options.texi. + * src/getargs.c (usage): Add a blank line after the warning categories. + +2007-11-08 Paolo Bonzini + + * data/lalr1.java (Lexer): Remove usage of b4_pure_if. + +2007-11-05 Akim Demaille + + Remove Id: from bison.1. + * doc/Makefile.am (remove_time_stamp): Include the sed invocation. + (perl -0777 -pi -e 's/\.PP\nId): New. + (.x.1): Use it to ignore the version control revision. + +2007-11-05 Akim Demaille + + * build-aux/Makefile.am: Ship cross-options.pl. + * doc/Makefile.am: Always refer to cross-options.texi with + $(srcdir). + (MAINTAINERCLEANFILES): Add it. + +2007-11-04 Akim Demaille + + Generate the long/short option cross-table. + * build-aux/cross-options.pl: New. + * doc/Makefile.am (cross-options.texi): New. + * doc/bison.texinfo: Use it. + +2007-11-04 Akim Demaille + + Generate bison.1 using help2man. + * doc/common.x, doc/bison.x: New. + * doc/Makefile.am (bison.1, .x.1): New. + The code is taken from autoconf-2.61/man/Makefile.am. + * configure.ac: Look for help2man. + +2007-11-04 Akim Demaille + + Complete --help. + * src/getargs.c (usage): Document -W, make it clear that -d, + -g and -x have optional arguments. + +2007-11-04 Akim Demaille + + Find sha1sum when named gsha1sum. + * bootstrap (find_tool): New. + ($SHA1SUM): New. + +2007-10-28 Joel E. Denny + + Deprecate %pure-parser and add `%define api.pure'. Discussed starting + at + . + * NEWS (2.3a+): Mention. + * data/bison.m4 (b4_pure_if): Don't define it here. + * data/c.m4 (b4_identification): Depend 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 api.push_pull. Define + YYPURE, YYPUSH, and YYPULL accordingly. + * data/glr.c: Define b4_pure_if based on `%define api.pure' unless + glr.cc has already defined b4_pure_flag. + * data/push.c: Define b4_pure_if based on `%define api.pure'. + Remove YYPUSH and YYPULL since they're back in b4_identification again. + * data/yacc.c: Define b4_pure_if based on `%define api.pure'. + * doc/bison.texinfo (Pure Decl): Update. + (Push Decl): Update. + (Decl Summary): Add api.pure to %define entry. + In %pure-parser entry, say it's deprecated and reference %define. + (Pure Calling): Update. + (Error Reporting): Update. + (C++ Scanner Interface): Update. + (How Can I Reset the Parser): Update. + (Table of Symbols): In %pure-parser entry, say it's deprecated and + reference %define. + * src/getargs.c (pure_parser): Remove global variable. + * src/getargs.h (pure_parser): Remove extern. + * src/output.c (prepare): Don't define pure_flag muscle. + * src/parse-gram.y (prologue_declaration): Implement %pure-parser as a + wrapper around `%define api.pure'. + * tests/calc.at (Simple LALR Calculator): Update. + (Simple GLR Calculator): Update. + * tests/cxx-type.at (GLR: Resolve ambiguity, pure, no locations): + Update. + (GLR: Resolve ambiguity, pure, locations): Update. + (GLR: Merge conflicting parses, pure, no locations): Update. + (GLR: Merge conflicting parses, pure, locations): Update. + * tests/glr-regression.at (Uninitialized location when reporting + ambiguity): Update + * tests/input.at (Unused %define api.pure): New test case. + * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Update definition for + AT_PURE_IF and AT_PURE_AND_LOC_IF. + * tests/push.at (Push Parsing: Memory Leak for Early Deletion): Update. + +2007-10-28 Joel E. Denny + + %define push_pull -> %define api.push_pull. Discussed starting at + . + * data/push.c: Expect the new name. + * data/yacc.c: Likewise. + * doc/bison.texinfo (Push Decl): Update. + (Decl Summary): Update %define entry. + (Push Parser Function): Update. + (Pull Parser Function): Update. + (Parser Create Function): Update. + (Parser Delete Function): Update. + * tests/calc.at (Simple LALR Calculator): Update. + * tests/input.at (%define enum variables): Update. + * tests/push.at (Push Parsing: Memory Leak for Early Deletion): Update. + (Push Parsing: Multiple impure instances): Update. + (Push Parsing: Unsupported Skeletons): Update. + * tests/torture.at (Exploding the Stack Size with Alloca): Update. + (Exploding the Stack Size with Malloc): Update. + + * NEWS (2.3a+): Add an entry for the push parser, and clean up the + other entries some. + +2007-10-27 Joel E. Denny + + For the XML output's terminal element, rename @number to @token-number, + and add @symbol-number. In the nonterminal element, rename @number to + @symbol-number. Discussed starting at + . + * data/xslt/xml2text.xsl (xsl:template match="terminal"): Update for + renames. + (xsl:template match="nonterminal"): Likewise. + * data/xslt/xml2xhtml.xsl (xsl:template match="terminal"): Likewise. + (xsl:template match="nonterminal"): Likewise. + * src/print-xml.c (print_grammar): Implement. + +2007-10-21 Joel E. Denny + + * data/xslt/xml2dot.xsl (xsl:template match="automaton/state"): After + 2007-10-11 change, the child elements here are items not rules. + (xsl:template match="item"): New. + (xsl:template match="rule"): Update for new reduced itemset. + (xsl:template match="point"): Remove. + (xsl:template match="empty"): For consistency with --graph, don't + output "/* empty */". + * data/xslt/xml2text.xsl (xsl:template match="terminal"): When invoking + line-wrap, don't pass a negative value as first-line-length since this + won't work with the following changes. + (xsl:template name="line-wrap"): Simplify slightly. + (xsl:template name="ws-search"): Eliminate recursion. + * src/print_graph.c (print_core): Don't print a reduction's lookahead + set next to an item whose dot is not at the end of the RHS even if it + happens to be associated with the same rule. + +2007-10-19 Joel E. Denny + + Add %define lr.keep_unreachable_states. + * NEWS (2.3a+): Mention it in the entry for unreachable state removal. + * doc/bison.texinfo (Decl Summary): Mention it in the %define entry. + * src/main.c (main): Implement it. + * tests/conflicts.at (Unreachable States After Conflict Resolution): + Extend to test it, and fix a typo. + +2007-10-19 Joel E. Denny + + * NEWS (2.3a+): Add entry for recent .output file lookahead set fix. + * doc/bison.texinfo (Understanding): Remove a bogus lookahead set in + the example .output text. + * tests/regression.at (Extra lookahead sets in report): Improve wording + of comments. + +2007-10-17 Wojciech Polak + + * src/print-xml.c (print_grammar): Renamed + and attributes: + "type" to "number" and "symbol" to "name". + * data/xslt/xml2text.xsl (xsl:template match="terminal"): + Use new attribute names. + (xsl:template match="nonterminal"): Likewise. + * data/xslt/xml2xhtml.xsl: Likewise. + +2007-10-17 Joel E. Denny + + * doc/bison.texinfo (Bison Options): Add entry for --print-datadir. + (Option Cross Key): Likewise. + + * src/print-xml.c (print_core): Don't print a reduction's lookahead set + next to an item whose dot is not at the end of the RHS even if it + happens to be associated with the same rule. + * src/print.c (print_core): Likewise. + * tests/conflicts.at (Unresolved SR Conflicts): Update output. + (Resolved SR Conflicts): Update output. + * tests/regression.at (Extra lookahead sets in report): New test case. + +2007-10-11 Wojciech Polak + + * src/print-xml.c (print_core): Remove item set + redundancy. + * data/xslt/bison.xsl (bison:ruleNumber): New key. + Improve processing time. Suggested by Joel E. Denny. + * data/xslt/xml2dot.xsl (xsl:template name="escape"): + Write xsl:param "required" attribute as comment. + * data/xslt/xml2text.xsl (xsl:template match="item"): New. + (xsl:template match="rule"): Support new reduced itemset. + (xsl:template match="point"): Remove. + * data/xslt/xml2xhtml.xsl: Likewise. + +2007-10-09 Joel E. Denny + + * src/getargs.c (version): Update copyright year. + +2007-10-09 Joel E. Denny + + Make xml2dot.xsl and --graph produce the same output. + * data/xslt/xml2dot.xsl (xsl:template match="rule"): Use a ` ' + instead of a `\n'. That is, don't add escapes yet or they'll be doubly + escaped later. + (xsl:template name="output-node"): Use the new escape template instead + of the string-replace template directly. + (xsl:template name="output-edge"): Likewise. + (xsl:template name="escape"): New, escapes backslashes and newlines in + addition to quotation marks. + * src/graphviz.c (start_graph, output_node, output_edge): Add + whitespace to output for legibility. + + Make xml2text.xsl and --report produce the same output, and remove the + XML "conflicts" element since a conflict summary is easily extracted + from the automaton. + * data/xslt/bison.xsl: New. + (xsl:template match="state" mode="bison:count-conflicts): New. + * data/xslt/xml2text.xsl: Import bison.xsl. + (xsl:template match="bison-xml-report"): Instead of styling the + "conflicts" element, style the "automaton" element with mode + "conflicts". Unlike the former, the latter lists S/R and R/R + conflicts for a state on the same line. + (xsl:template match="conflicts"): Remove. + (xsl:template match="conflict"): Remove. + (xsl:template match="terminal"): Line-wrap the list of rules in which + the terminal is used. + (xsl:template match="nonterminal"): Likewise for nonterminals. + (xsl:template match="automaton" mode="conflicts"): New. + (xsl:template match="state" mode="conflicts"): New. + (xsl:template name="line-wrap"): New. + (xsl:template name="ws-search"): New. + * data/xslt/xml2xhtml.xsl: Import bison.xsl. + (xsl:template match="bison-xml-report"): Instead of styling the + "conflicts" element, style the "automaton" element with mode + "conflicts." + (xsl:template match="conflicts"): Remove. + (xsl:template match="conflict"): Remove. + (xsl:template match="automaton" mode="conflicts"): New. + (xsl:template match="state" mode="conflicts): New. + * src/conflicts.c (conflicts_output_xml): Remove. + * src/conflicts.h (conflicts_output_xml): Remove prototype. + * src/print-xml.c (print_xml): Don't invoke conflicts_output_xml. + * src/print.c (print_grammar): Consistently wrap at the 66th column so + the corresponding XSLT is easier. Also, never wrap between a word and + the comma that follows it. + +2007-10-08 Joel E. Denny + + Improve C++ namespace support. Discussed starting at + . + * data/c++.m4: (b4_namespace_ref, b4_namespace_open, + b4_namespace_close): New macros that interpret the %define variable + "namespace" so its value can contain "::" to indicate nested + namespaces. + * data/glr.cc (b4_namespace): Don't define, and replace all uses with + the above macros. + * data/lalr1.cc (b4_namespace): Likewise. + * data/location.cc (b4_namespace): Likewise. + * doc/bison.texinfo (Decl Summary): Move `%define push_pull' entry + inside a new table in the general %define entry. Document `%define + namespace' there as well. Point the %name-prefix entry to it since it + explains it more completely in the case of C++. + (C++ Bison Interface): Mention `%define namespace' instead of + %name-prefix. + (Table of Symbols): Remove the `%define push_pull' entry. The %define + entry suffices. + * tests/c++.at (Relative namespace references): New test case. + (Absolute namespace references): New test case. + (Syntactically invalid namespace references): New test case. + * tests/input.at (C++ namespace reference errors): New test case. + +2007-10-08 Joel E. Denny + + Add syncline support and location accessor to internal %define + interfaces. + * data/bison.m4 (b4_percent_define_get_loc): New. + (b4_percent_define_get_syncline): New. + (b4_percent_define_flag_if): Use b4_percent_define_get_loc. + (b4_percent_define_default): Record defining location as line 1 rather + than 0 for the sake of synchronizing #line's, and define + b4_percent_define_syncline(VARIABLE). + (b4_percent_define_check_values): Use b4_percent_define_get_loc. + * src/muscle_tab.c (muscle_syncline_grow): New. + (muscle_code_grow): Use muscle_syncline_grow. + (muscle_percent_define_insert): Use muscle_percent_define_get_loc, and + define b4_percent_define_syncline(VARIABLE). + (muscle_percent_define_get_loc): New. + (muscle_percent_define_get_syncline): New. + (muscle_percent_define_flag_if): Use muscle_percent_define_get_loc, and + remove some unused variables. + (muscle_percent_define_default): Record defining location as line 1 + rather than 0 for the sake of synchronizing #line's, and define + b4_percent_define_syncline(VARIABLE). + (muscle_percent_define_check_values): Use + muscle_percent_define_get_loc. + * src/muscle_tab.h (muscle_percent_define_get_loc): Prototype. + (muscle_percent_define_get_syncline): Prototype. + * tests/skeletons.at (%define Boolean variables: invalid skeleton + defaults): Update output for location change. + (Complaining during macro argument expansion): Extend to test + b4_percent_define_get_loc and b4_percent_define_get_syncline errors. + +2007-10-07 Joel E. Denny + + Fix some error-reporting macro bugs. + * data/bison.m4 (b4_cat): New. + (b4_error, b4_error_at): Use b4_cat to send error directives directly + to stdout so they don't become arguments to other macros. Update + comments and add examples. + (b4_warn, b4_warn_at, b4_complain, b4_complain_at): Update comments and + add examples. + (b4_fatal, b4_fatal_at): Likewise, and invoke m4_exit(1) immediately + after printing the error directive so that M4 doesn't report subsequent + problems that are induced by this problem. + * src/scan-skel.l: Recognize @` digraph outside of directive arguments + instead of just in them. Recognize @\n in both places. Both expand to + the empty string. Needed by b4_cat. + * tests/skeletons.at (Complaining during macro argument expansion): + New test case. + (Fatal errors make M4 exit immediately): New test case. + +2007-10-04 Joel E. Denny + + Implement --print-datadir. + * src/getargs.c (usage): Mention. + (PRINT_DATADIR_OPTION): New anonymous enum member. + (long_options): Add entry for it. + (getargs): Add case for it calling compute_pkgdatadir. + * src/output.c (output_skeleton): Encapsulate data directory + computation from here... + (prepare): ... and from here... + (compute_pkgdatadir): ... into this new function. + * src/output.h (compute_pkgdatadir): Prototype. + +2007-09-29 Joel E. Denny + + * src/print-xml.c (escape_bufs): New static global variable + replacing... + (xml_escape_n): ... the static local variable buf here. + (print_xml): Free memory for escape_bufs. + * src/reduce.c (reduce_xml): XML-escape terminal symbol tags. + +2007-09-25 Joel E. Denny + + Replace `%push-parser' and `%push-pull-parser' with + `%define push_pull "push"' and `%define push_pull "both"'. + `%define push_pull "pull"' is the default. + * doc/bison.texinfo (Push Decl, Push Parser Function, + Pull Parser Function, Parser Create Function, Parser Delete Function): + Update declarations. + (Decl Summary, Table of Symbols): Replace %push-parser and + %push-pull-parser entries with a %define push_pull entry. + * data/bison.m4 (b4_percent_define_check_values): New macro. + (b4_pull_if, b4_push_if, b4_use_push_for_pull_if): Move these + definitions... + * data/c.m4 (b4_identification): ... and the YYPUSH and YYPULL cpp + definitions... + * data/push.c: ... to here and compute them from the value of the + %define variable push_pull. + * data/c-skel.m4: Instead of choosing the push.c skeleton for push + parsing requests here... + * data/yacc.c: ... hack this to switch to push.c any time + b4_use_push_pull_flag or the %define variable push_pull is set. This + will go away when we mv push.c yacc.c. + * data/c++-skel.m4, data/glr.c, data/java-skel.m4: Don't report that + push parsing is not supported since unused %define variables are + reported anyway. + * src/getargs.c, src/getargs.h (pull_parser, push_parser): Remove. + * src/muscle_tab.h (muscle_percent_define_check_values): Update + comments for consistency with b4_percent_define_check_values. + * src/output.c (prepare): Don't insert b4_pull_flag and b4_push_flag + muscles. + * src/parse-gram.y (PERCENT_PUSH_PARSER, PERCENT_PUSH_PULL_PARSER): + Remove. + (prologue_declaration): Remove %push-parser and %push-pull-parser + rules. + * src/scan-gram.l (%push-parser, %push-pull-parser): Remove rules. + * tests/calc.at: Update declarations. + * tests/input.at (%define enum variables): New test case. + * tests/push.at (Push Parsing: Memory Leak for Early Deletion): Update + declaration. + (Push Parsing: Multiple impure instances): Update declaration. + (Push Parsing: Unsupported Skeletons): New test case. + * tests/torture.at (Exploding the Stack Size with Alloca): Update + declaration. + (Exploding the Stack Size with Malloc): Update declaration. + +2007-09-24 Wojciech Polak + + Add XSLT transformations. + + * data/xslt/xml2dot.xsl: Transform XML into DOT. + * data/xslt/xml2text.xsl: Transform XML into plain text. + * data/xslt/xml2xhtml.xsl: Transform XML into XHTML. + * data/Makefile.am (xsltdir): New variable. + (dist_xslt_DATA): Add xslt/*.xsl files. + +2007-09-23 Paul Eggert + + * src/conflicts.c (log_resolution): Fix indenting bugs I introduced. + Problem reported by Wojciech Polak. + * src/print-xml.c (xml_puts): Work even if LEVEL exceeds INT_MAX/2. + (xml_printf): Undo change I made on 21 September; that is, + indent 2 spaces, not 1. + +2007-09-23 Joel E. Denny + + Pacify ./configure --enable-gcc-warnings. + * src/print-xml.c, src/print-xml.h (xml_puts): Make third argument + `char const *' instead of `char *'. + * src/state.c (state_rule_lookahead_tokens_print_xml): Remove unused + local variable `sep'. + +2007-09-21 Paul Eggert + + * src/gram.c (rule_rhs_print_xml): Now static, since it isn't used + elsewhere. + * src/print-xml.c: Prefer "const" after types; that's more consistent. + (xml_printf): Indent just 1 space for level. + (e_char, xlate_char): Remove. + (xml_escape_string): Rewrite to avoid undefined behavior (used + storage that was freed from the stack). + (xml_escape_n): Don't bother checking for subscript error. + +2007-09-21 Wojciech Polak + + Add Bison XML Automaton Report. + + Add support for an -x option to generate an XML report. + It is not documented yet. + * src/print-xml.c: New file. + * src/print-xml.h: Likewise. + * lib/timevar.def (TV_XML): New var. + * src/Makefile.am (bison_SOURCES): Add print-xml.c, print-xml.h. + * src/conflicts.c: Include print-xml.h. + (solved_conflicts_xml_obstack): New var. + (log_resolution, conflicts_solve, conflicts_free): + Add support for XML report. + (conflicts_output_val): New function. + * src/conflicts.h (conflicts_output_val): New decl. + * src/files.c (spec_xml_file): New var. + (compute_output_file_names, output_file_names_free): Add XML support. + * src/files.h (spec_xml_file): New decl. + * src/getargs.c (xml_flag): New var. + (usage, short_options, long_options, getargs): Add XML support. + * src/getargs.h (xml_flag): New decl. + * src/gram.c: Include print-xml.h. + (rule_lhs_print_xml, rule_rhs_print_xml): + (grammar_rules_partial_print_xml, grammar_rules_print_xml): + New functions. + * src/gram.h: Declare external ones. + * src/main.c: Include print-xml.h. + (main): Add XML support. + * src/reduce.c: Include print-xml.h. + (reduce_xml): New function. + * src/reduce.h: Declare it. + * src/state.c: Include print-xml.h. + (state_new): Add XML support. + (state_rule_lookahead_tokens_print_xml): New function. + * src/state.h: Declare it. + (struct state): New member solved_conflicts_xml. + * src/symtab.c (symbol_class_get_string): New function. + * src/symtab.h: Declare it. + +2007-09-21 Paul Eggert + + * GNUmakefile: Switch to coreutils's version. + * bootstrap: Likewise. + * Makefile.cfg: Adjust to new GNUmakefile. + * README-hacking: Likewise. + + Import from gnulib: + + 2006-08-18 Paul Eggert + Bruno Haible + + * m4/bison-i18n.m4 (BISON_I18N): Also handle the case where yacc exists + and is a script that invokes bison. Tighten the code. Add comments. + +2007-08-28 Joel E. Denny + + Spell "boolean" as "Boolean". Reported by Akim Demaille. + * data/bison.m4 (b4_percent_define_flag_if): Fix complaint. + * doc/bison.texinfo (Decl Summary): Fix. + * src/muscle_tab.c (muscle_percent_define_flag_if): Fix complaint. + * tests/input.at (Boolean %define variables): Update output. + * tests/skeletons.at (%define boolean variables: invalid skeleton + defaults): Rename to... + (%define Boolean variables: invalid skeleton defaults): ... this and + update output. + +2007-08-17 Joel E. Denny + + In impure push mode, don't allow more than one yypstate to be allocated + since multiple impure parsers would corrupt yynerrs. + * data/push.c (yypstate_allocated): New static global variable + initialized to 0. + (yypull_parse): If yypstate_new returns 0, don't report it as memory + exhaustion if yypstate_allocated is 1, but still return 2. + (yypstate_new): Invoke yyerror and return 0 if yypstate_allocated is + already 1. Otherwise, set it to 1. + (yypstate_delete): Set it to 0. + * tests/push.at (Push Parsing: Multiple impure instances): New test + case. + +2007-08-17 Bob Rossi + + * doc/bison.texinfo (Push Decl): Document the push parser. + (Table of Symbols): Ditto. + (Pure Decl): Ditto. + (Decl Summary): Ditto. + (Multiple Parsers, Push Parser Function, Pull Parser Function, + Parser Create Function, Parser Delete Function): + Add new push parser symbols. + (Table of Symbols): Document push-parser, push-pull-parser, + yypush_parse, yypull_parse, yypstate_new and yypstate_delete. + +2007-08-15 Paul Eggert + + Update to GPLv3. + * doc/gpl-3.0.texi: New file. + * doc/gpl.texi: Remove. + * COPYING, GNUmakefile, HACKING, Makefile.am, Makefile.cfg: + * Makefile.maint, NEWS, PACKAGING, README, README-alpha: + * README-hacking, TODO, bootstrap, bootstrap.conf: + * configure.ac, data/Makefile.am, data/README, data/bison.m4: + * data/c++-skel.m4, data/c++.m4, data/c-skel.m4, data/c.m4: + * data/glr.c, data/glr.cc, data/java-skel.m4, data/java.m4: + * data/lalr1.cc, data/lalr1.java, data/location.cc: + * data/push.c, data/yacc.c, data/m4sugar/m4sugar.m4: + * djgpp/Makefile.maint, djgpp/README.in, djgpp/config.bat: + * djgpp/config.sed, djgpp/config.site, djgpp/config_h.sed: + * djgpp/djunpack.bat, djgpp/subpipe.c, djgpp/subpipe.h: + * djgpp/testsuite.sed, doc/Makefile.am, doc/bison.texinfo: + * doc/fdl.texi, doc/refcard.tex, etc/Makefile.am, etc/README: + * etc/bench.pl.in, examples/Makefile.am, examples/extexi: + * examples/calc++/Makefile.am, lib/Makefile.am, lib/abitset.c: + * lib/abitset.h, lib/bbitset.h, lib/bitset.c, lib/bitset.h: + * lib/bitset_stats.c, lib/bitset_stats.h, lib/bitsetv-print.c: + * lib/bitsetv-print.h, lib/bitsetv.c, lib/bitsetv.h: + * lib/ebitset.c, lib/ebitset.h, lib/get-errno.c: + * lib/get-errno.h, lib/lbitset.c, lib/lbitset.h: + * lib/libiberty.h, lib/main.c, lib/subpipe.c, lib/subpipe.h: + * lib/timevar.c, lib/timevar.def, lib/timevar.h: + * lib/vbitset.c, lib/vbitset.h, lib/yyerror.c: + * m4/c-working.m4, m4/cxx.m4, m4/m4.m4, m4/subpipe.m4: + * m4/timevar.m4, src/LR0.c, src/LR0.h, src/Makefile.am: + * src/assoc.c, src/assoc.h, src/closure.c, src/closure.h: + * src/complain.c, src/complain.h, src/conflicts.c: + * src/conflicts.h, src/derives.c, src/derives.h, src/files.c: + * src/files.h, src/flex-scanner.h, src/getargs.c: + * src/getargs.h, src/gram.c, src/gram.h, src/graphviz.c: + * src/lalr.c, src/lalr.h, src/location.c, src/location.h: + * src/main.c, src/muscle_tab.c, src/muscle_tab.h: + * src/nullable.c, src/nullable.h, src/output.c, src/output.h: + * src/parse-gram.c, src/parse-gram.h, src/parse-gram.y: + * src/print.c, src/print.h, src/print_graph.c: + * src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c: + * src/reduce.h, src/relation.c, src/relation.h: + * src/revision.h, src/scan-code.h, src/scan-code.l: + * src/scan-gram.h, src/scan-gram.l, src/scan-skel.h: + * src/scan-skel.l, src/state.c, src/state.h, src/symlist.c: + * src/symlist.h, src/symtab.c, src/symtab.h, src/system.h: + * src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h: + * tests/Makefile.am, tests/actions.at, tests/c++.at: + * tests/calc.at, tests/conflicts.at, tests/cxx-type.at: + * tests/existing.at, tests/glr-regression.at: + * tests/headers.at, tests/input.at, tests/java.at: + * tests/local.at, tests/output.at, tests/push.at: + * tests/reduce.at, tests/regression.at, tests/sets.at: + * tests/skeletons.at, tests/synclines.at, tests/testsuite.at: + * tests/torture.at: + Update to GPLv3. + +2007-08-11 Joel E. Denny + + Get rid of broken %no-parser, -n, and --no-parser implementation and + documentation. + * TODO: Don't mention them. + * doc/bison.1: Likewise. + * doc/bison.texinfo (Decl Summary): Likewise. + (Bison Options): Likewise. + (Option Cross Key): Likewise. + * src/getargs.c (no_parser_flag): Remove global variable. + (usage): Don't print description of -n and --no-parser. + (long_options): Remove --no-parser entry here. + (getargs): Remove -n case in the switch here. + * src/getargs.h (no_parser_flag): Remove extern. + * tests/regression.at (Web2c Actions): Remove comment that mentions + --no-parser. + +2007-08-11 Joel E. Denny + + * tests/push.at (Push Parsing: Memory Leak for Early Deletion): Do not + name user variables starting with `yy'. Just pass NULL instead of a + dummy local &yylval to yypush_parse. + * tests/torture.at (AT_DATA_STACK_TORTURE): Do not name user variables + starting with `yy'. + +2007-08-03 Joel E. Denny + + * data/yacc.c (yyexhaustedlab): Define it when YYERROR_VERBOSE is + true since it's then always used regardless of whether yyoverflow is + defined. Reported by Christian Burger at + . + * THANKS: Add Christian Burger. + + * ChangeLog: For changes in doc/bison.texinfo, consistently reference + node names: say "Decl Summary" not "Bison Declaration Summary". + +2007-07-28 Joel E. Denny + + * src/muscle_tab.c (muscle_percent_define_flag_if): In order to + determine whether this function has already complained about an invalid + value for a %define boolean variable, don't check whether Bison has + ever examined the value. As written, the check was a tautology. + Instead, record and check for this complaint using a separate muscle. + +2007-07-27 Joel E. Denny + + Fix push parsing memory leak reported by Brandon Lucia at + . + * THANKS: Add Brandon Lucia. + * data/push.c (yypstate_delete): Free the stack if it was reallocated + but the parse never completed and thus freed it. + * tests/Makefile.am (TESTSUITE_AT): Add push.at. + * tests/testsuite.at: Include push.at. + * test/push.at: New. + (Push Parsing: Memory Leak for Early Deletion): New test case. + +2007-07-17 Joel E. Denny + + Improve handling of multiple S/R conflicts in the same state and of S/R + conflicts involving multiple reductions. + * src/conflicts.c (resolve_sr_conflict): Don't assign the error action + set for a state here or Bison will abort if it is reassigned on a + later conflicted reduction in the same state. + Similarly, don't finalize and assign the solved conflicts report here + or it will be lost if it is reassigned on a later conflicted reduction + in the same state. + (set_conflicts): Instead, assign them both here after all S/R conflicts + in the state have been fully examined. + * src/print.c (shift_set): Rename to... + (no_reduce_set): ... this. + (print_reductions): Update for rename, and add %nonassoc error action + tokens to no_reduce_set so that, when printing the first remaining + reduction on an error action token, the reduction is enclosed in + brackets. + (print_results): Update for rename. + * tests/conflicts.at (Solved conflicts report for multiple reductions + in a state): New test case. + (%nonassoc error actions for multiple reductions in a state): New test + case. + + * src/main.c (main): Don't depend on C99 features. + +2007-07-16 Joel E. Denny + + * build-aux/.cvsignore: Add compile. + * lib/.cvsignore: Add charset.alias, ref-add.sed, ref-del.sed, and + uniwidth. + +2007-07-10 Joel E. Denny + + * bootstrap (slurp): Create target directories that don't exist. + Specifically, we need lib/uniwidth/ because of recent Gnulib changes. + +2007-07-09 Joel E. Denny + + * LR0.c (new_itemsets): Fix wording in comments: say item index rather + than item number. + * closure.c (closure): Likewise. + * state.h (reductions): Comment sorting of rules. + (state): Comment sorting of items. + +2007-07-02 Joel E. Denny + + Fix C++ test cases after recent Gnulib changes. Discussed starting at + . + * examples/calc++/Makefile.am (DEFAULT_INCLUDES): Override Automake's + definition in order to avoid Gnulib headers since we don't use config.h + here. + * tests/output.at (AT_CHECK_OUTPUT_FILE_NAME): Use AT_DATA_GRAMMAR + rather than AT_DATA so that config.h is included. + +2007-07-01 Joel E. Denny + + * data/glr.c (yy_yypstack, yypstates, yypdumpstack): Use YYFPRINTF + instead of fprintf. Guard these functions with #if YYDEBUG instead of + #ifdef YYDEBUG for consistency with all other uses of YYDEBUG in Bison + and so that YYFPRINTF is guaranteed to be defined here. + +2007-05-29 Joel E. Denny + + * src/muscle_tab.c (muscle_percent_define_invalid_value): Replace + with... + (muscle_percent_define_check_values): ... this more helpful function. + Again, it's not used yet, but it will be. + * src/muscle_tab.h: Likewise. + + Improve some comments in parser table construction. + * src/LR0.c (new_itemsets): Explain sorting of itemset and kernel_base. + (generate_states): Don't mention ruleset, which is internal to closure. + * src/closure.c (closure): Explain sorting of core and itemset, which + is required for this function to behave correctly. + * src/closure.h (closure): Mention sorting. + +2007-05-28 Joel E. Denny + + * src/lalr.c (state_lookahead_tokens_count): For code readability, + move the check for disabled transitions to an aver since conflict + resolution hasn't happened yet. + + * src/lalr.c (state_lookahead_tokens_count): Remove the check that + labels a state as inconsistent just because it has error transitions. + The original form of this check appeared in revision 1.1 of lalr.c, + which was committed on 1991-12-21. Now (at least), changing the + consistency label on such a state appears to have no useful effect in + any of the places it is examined, which I enumerate below. The key + point to understanding each item in this enumeration is that a state + with an error transition is labelled consistent in the first place only + if it has no rules, so the check cannot matter for states that have + rules. (1) Labelling a state as inconsistent will cause set_conflicts + to try to identify its conflicts, and a state must have *rules* to have + conflicts. (2) Labelling a state as inconsistent will affect how + action_row sets the default *rule* for the state. (3) Labelling a + state as inconsistent will cause build_relations to add lookback edges + to *rules* in that state. + * src/state.h (struct state): Word the comment for member consistent + more carefully. + +2007-05-27 Joel E. Denny + + Don't depend on C99 features. + * src/conflicts.c (conflicts_update_state_numbers): Fix for-loop. + * src/lalr.c (lalr_update_state_numbers): Fix for-loop. + * src/reader.c (check_and_convert_grammar): Fix for-loop. + * src/state.c (state_mark_reachable_states): Fix for-loop. + (state_remove_unreachable_states): Fix for-loop. + + Don't widen struct state with member reachable just to temporarily + record reachability. Instead, use a local bitset. + * src/state.h (struct state): Remove member. + * src/state.c (state_new): Don't initialize it. + (state_mark_reachable_states): Rename to... + (state_record_reachable_states): ... this, and use bitset. + (state_remove_unreachable_states): Use bitset. + +2007-05-26 Joel E. Denny + + * src/Makefile.am (yacc): Quote target action commands properly so + that the yacc script isn't corrupt. Reported by Hans Aberg at + . + + * data/glr.c (yylval): As in yacc.c, don't extern in the header for + the case of pure parsers. Reported by Frans Englich at + . + * THANKS: Add Frans Englich. + + * NEWS (2.3a+): In the %code entry, reference section `Bison + Declaration Summary' from the manual now since the %code summary has + moved there. + * doc/bison.texinfo (Prologue Alternatives): Mention that directives + in the rules section must be terminated by semicolons. + +2007-05-20 Joel E. Denny + + Extend the front-end API for %define variables to more completely + mirror the back-end. This will be useful in the future. + * data/bison.m4 (b4_percent_define_get, b4_percent_define_ifdef): + Update comments to mention the new front-end counterparts of these + macros. + * src/muscle_tab.c (MUSCLE_COMMON_DECODE): New macro with common code + for muscle_string_decode and muscle_location_decode. + (muscle_string_decode): New static function. + (muscle_location_decode): Use MUSCLE_COMMON_DECODE. + (muscle_percent_define_get, muscle_percent_define_ifdef): New + functions. + (muscle_percent_define_flag_if): Use muscle_percent_define_ifdef and + muscle_percent_define_get to mimic the b4_percent_define_flag_if + implementation more closely. + (muscle_percent_define_invalid_value): New function. + * src/muscle_tab.h (muscle_percent_define_get, + muscle_percent_define_ifdef, muscle_percent_define_invalid_value): + Prototype. + +2007-05-07 Joel E. Denny + + * NEWS (2.3a+): Mention yesterday's state-removal change. + (2.3a): Remove the %language entry, which was added after 2.3a. + * src/LR0.c, src/closure.c, src/closure.h, src/conflicts.c, + src/conflicts.h, src/lalr.c, src/lalr.h, src/print.c, + src/print_graph.c, src/state.c, src/state.h, tests/conflicts.at, + tests/existing.at: Update copyright date. + +2007-05-06 Joel E. Denny + + If conflict resolution makes states unreachable, remove those states, + report rules that are then unused, and don't report conflicts in those + states. + * src/conflicts.c, src/conflicts.h (conflicts_update_state_numbers): + New global function. + * src/lalr.c, src/lalr.h (lalr_update_state_numbers): New global + function. + * src/main.c (main): After conflict resolution, remove the unreachable + states and update all data structures that reference states by number. + * src/state.c (state_new): Initialize each state's reachable member to + false. + (state_mark_reachable_states): New static function. + (state_remove_unreachable_states): New global function. + * src/state.h (struct state): Add member bool reachable. + (state_remove_unreachable_states): Prototype. + * tests/conflicts.at (Unreachable States After Conflict Resolution): + New test case. + * tests/existing.at (GNU pic Grammar): Update test case output now that + an unused rule is discovered. + +2007-05-06 Joel E. Denny + + Minor code cleanup in parser table construction. + * src/LR0.c (new_itemsets): Use item_number_is_symbol_number. + (new_itemsets, save_reductions): Update for rename to nitemset. + * src/closure.c (nritemset): Rename to... + (nitemset): ... this since the "r" appears to meaningless and isn't + used in the comments. + (closure): Update for rename. + * src/closure.h (nritemset): Update extern to... + (nitemset): ... this. + * src/lalr.c (LA): Fix a typo in comments. + * src/print.c (print_core): Update for rename to nitemset. + * src/print_graph.c (print_graph): Likewise. + * src/state.h: Fix some typos in header comments. + +2007-04-04 Paul Eggert + + * THANKS: Use ASCII for Sebastien Fricker's name. Bison source + still sticks to ASCII. Sorry! + + * README-hacking: New file, taken mostly from coreutils, with changes + for Bison. Contains much of the contents of: + * README-cvs: Remove. + * bootstrap: Sync from gnulib. + * build-aux/.cvsignore: Remove *.t, mkinstalldirs. + * lib/.cvsignore: Add wchar.h, wctype.h. Remove exit.h. + +2007-03-10 Joel E. Denny + + * doc/bison.texinfo (Destructor Decl): Fix typo reported by Sebastian + Setzer. + (Java Differences): Fix some typos. + * THANKS: Add Sebastian Setzer. + +2007-03-07 Paolo Bonzini + + * data/java.m4 (b4_single_class_if): Remove. + (b4_abstract_if): Look at "%define abstract". + (b4_lexer_if): New. + (b4_union_name): Rename... + (b4_yystype): ... to this. Map to "%define stype". + (b4_rhs_value, b4_parse_param_decl, b4_lex_param_decl, + b4_maybe_throws): Fix quoting. + (b4_lex_param_call): Move below to keep b4_*_param_decl close. + * data/lalr1.java (Lexer interface): Always define. + (Lexer interface within parser class): Remove. + (YYLexer class): New, used when "%code lexer" is present. + (constructor): When "%code lexer" is used, pass %lex-param + to the lexer constructor. + (yylex, yyparse): Remove %lex-param from method invocations + (YYStack, yyaction, yyparse): Rename b4_union_name to b4_yystype. + + * doc/bison.texinfo (Java Bison Interface): Mention "%define + abstract". Rename "%define union_name" to "%define stype". + Rename method names according to previous patch. + (Java Scanner Interface): Describe "%code lexer" instead of + "%pure-parser" and "%define single_class". + (Java Differences): Mention "%code lexer". + + * tests/java.at (_AT_DATA_JAVA_CALC_Y): Remove final argument. + Include scanner here, using macros from tests/local.at. + (AT_DATA_CALC_Y): Remove final argument. + (_AT_CHECK_JAVA_CALC): Likewise. + (AT_CHECK_JAVA_CALC): Likewise. Test all four combinations + of %locations and %error-verbose. + (main): Test with and without %lex-param. + * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Push AT_LEXPARAM_IF. + (AT_BISON_OPTION_POPDEFS): Pop it. + +2007-03-07 Juan Manuel Guerrero + + DJGPP spefic issue. Inhibit the use of disallowed characters for + file name genertion on Win98, WinXP, etc. These are |<>":?*\ + and concern testsuite case 46. + * Makefile.am: djgpp/testsuite.sed added to EXTRA_DIST + * djgpp/testsuite.sed: Inhibit the use of disallowed characters. + * djgpp/config.bat: Inhibit the use of disallowed characters. + +2007-03-02 Joel E. Denny + + Miscellaneous %define and %code cleanup. + * data/bison.m4 (b4_percent_define_flag_if): Correct comments on how + values are interpreted. + * doc/bison.texinfo (Decl Summary): Clean up and extend %define + documentation a little more. + * src/muscle_tab.c (MUSCLE_USER_NAME_CONVERT, + muscle_percent_define_insert, muscle_percent_code_grow): New + functions/macros. + * src/muscle_tab.h (muscle_percent_define_insert, + muscle_percent_code_grow): Prototype. + * src/parse-gram.y (prologue_declaration): Use + muscle_percent_define_insert and muscle_percent_code_grow when parsing + %define and %code directives. + + Make it easy to share %define boolean variables between the front-end + and back-end. Though not used yet, this will be useful in the future. + * data/bison.m4 (b4_check_user_names): Rewrite comments to talk about + Bison uses of names rather than just skeleton uses of names. + (b4_percent_define_get, b4_percent_define_ifdef): Rename + b4_percent_define_skeleton_variables(VARIABLE) to + b4_percent_define_bison_variables(VARIABLE). + (b4_percent_code_get, b4_percent_code_ifdef): Rename + b4_percent_code_skeleton_qualifiers(QUALIFIER) to + b4_percent_code_bison_qualifiers(QUALIFIER). + (b4_check_user_names_wrap): Update for renames. + * src/muscle_tab.c, src/muscle_tab.h (muscle_percent_define_flag_if, + muscle_percent_define_default): New functions mimicking + b4_percent_define_flag_if and b4_percent_define_default. + + For %define variables, report locations for invalid values and + redefinitions. + * data/bison.m4 (b4_percent_define_flag_if): Read + b4_percent_define_loc(VARIABLE) to report the location of an invalid + value for VARIABLE. + (b4_percent_define_default): Save a special location in + b4_percent_define_loc(VARIABLE) in case the default value for VARIABLE + must later be reported as invalid. + * src/muscle_tab.c (muscle_location_grow, muscle_location_decode): New + functions. + (muscle_percent_define_insert): Record the location of VARIABLE in + muscle percent_define_loc(VARIABLE), and use it to report the previous + location for a redefinition. + (muscle_percent_define_flag_if): Update like b4_percent_define_flag_if. + (muscle_percent_define_default): Update like b4_percent_define_default. + (muscle_grow_user_name_list): Rename to... + (muscle_user_name_list_grow): ... this for consistency and use + muscle_location_grow. + * src/muscle_tab.h (muscle_location_grow): Prototype. + * tests/input.at (%define errors): Update expected output. + * tests/skeletons.at (%define boolean variables: invalid skeleton + defaults): New test case. + +2007-02-28 Joel E. Denny + + * src/print.c (lookahead_set, state_default_rule): Remove. + (print_reductions): Replace state_default_rule invocation with + equivalent use of yydefact, which was computed in token_actions in + tables.c. + (print_results): Don't allocate lookahead_set. + +2007-02-27 Paolo Bonzini + + * data/lalr1.java: Prefix all private members with yy. + +2007-02-24 Joel E. Denny + + Use YYFPRINTF instead of fprintf where appropriate. Reported by + Sebastien Fricker at + . + * THANKS: Add Sebastien Fricker. + * data/glr.c, data/push.c, data/yacc.c (yy_reduce_print): Implement. + * doc/bison.texinfo (Tracing): Make it clearer that YYFPRINTF must + accept a variable number of arguments. + +2007-02-19 Joel E. Denny + + * bootstrap: Remove occurrences of .#bootmp from lib/Makefile. + +2007-02-13 Juan Manuel Guerrero + + * djgpp/config.bat: Adjustments concerning the use of autoconf 2.61. + * djgpp/config.sed: Adjustments concerning the use of autoconf 2.61. + * djgpp/config.site: Adjustments concerning the use of autoconf 2.61. + +2007-02-11 Paul Eggert + + Undo my 2007-02-07 change, switching back to the c-strcase module + introduced in the 2007-02-03 change. Bruno Haible reported that + the 2007-02-07 change would be dangerous in Turkish if we add a + language whose name contains "i", since "i" is not lowercase "I" + in Turkish. + * bootstrap.conf (gnulib_modules): Add c-strcase. Remove strcase. + * lib/.cvsignore: Add c-ctype.c, c-ctype.h, c-strcase.h, + c-strcasecomp.c, c-strncasecmp.c. Remove strcasecmp.c, strncasecmp.c. + * m4/.cvsignore: Remove strcase.m4. + * src/getargs.c: Revert 2007-02-07 change, as follows. + Include c-strcase.h. + (language_argmatch): Use c_strcasecmp rather than strcasecmp. + +2007-02-11 Bruno Haible + + Enable the Java related testsuite tests when the only Java compiler + found is a gcj < 4.3. Discussed at + . + * configure.ac (gt_JAVACOMP): Don't specify a target_version. + +2007-02-11 Joel E. Denny + + * data/Makefile.am: Update copyright date. + * data/push.c (yypull_parse): Report memory exhaustion and return 2 if + yypstate_new returns NULL. + (yypstate_new): Return NULL if malloc does. + * src/reader.c (packgram): Move translation of rule actions from the + beginning of packgram to... + (check_and_convert_grammar): ... here right before packgram is invoked + so it's easier to write more complete comments, and remove redundant + code. + +2007-02-10 Joel E. Denny + + As in semantic actions, make @$ in %initial-action, %destructor, and + %printer imply %locations. + * src/scan-code.l (SC_SYMBOL_ACTION): Set locations_flag = true when + scanning @$. + * tests/actions.at (AT_CHECK_ACTION_LOCATIONS): New macro supporting... + (@$ in %initial-action implies %locations, + @$ in %destructor implies %locations, + @$ in %printer implies %locations): ... these new test cases. + +2007-02-07 Paul Eggert + + Undo most of the 2007-02-03 change, switching to the strcase module + now that gnulib strcase has been fixed. + * bootstrap.conf (gnulib_modules): Remove c-strcase. Add strcase. + * lib/.cvsignore: Remove c-ctype.c, c-ctype.h, c-strcase.h, + c-strcasecomp.c, c-strncasecmp.c. Add strcasecmp.c, strncasecmp.c + * m4/.cvsignore: Add strcase.m4. + * src/getargs.c: Revert 2007-02-03 change, as follows. + Don't include c-strcase.h. + (language_argmatch): Use strcasecmp rather than c_strcasecmp. + strcasecmp has "unspecified behavior" outside the POSIX locale, + but it works fine in practice if at least one argument is ASCII, + as is the case in Bison. + +2007-02-07 Paolo Bonzini + + * tests/java.at: Skip tests if only one of javac/java is present. + Reported by Joel E. Denny. + * tests/atlocal.in: Adjust copyright years. + +2007-02-05 Paolo Bonzini + + * data/lalr1.java (Stack): Work around old verifiers that disallow + access to the private fields of an inner class, from the outer class. + We can make Stack's fields public because user code doesn't have access + to the instance of Stack used by parse(). Reported by Paul Eggert. + +2007-02-03 Paul Eggert + + * .cvsignore: Add javacomp.sh, javaexec.sh. Is this really + the right spot for these files? + * bootstrap.conf (gnulib_modules): Add c-strcase. + * lib/.cvsignore: Add c-ctype.c c-ctype.h, c-strcasecomp.c, + c-strncasecmp.c. + * src/getargs.c: Include c-strcase.h. + (language_argmatch): Use c_strcasecmp rather than strcasecmp, + to avoid unspecified behavior. + +2007-02-01 Joel E. Denny + + * doc/bison.texinfo (Decl Summary): Correct typo. + +2007-01-30 Paolo Bonzini + + * data/bison.m4 (b4_percent_define_flag_if): Don't treat 0 as false. + Complain if the value does not match empty, "true" or "false". + * data/c++.m4: Adjust default definitions of %define variables. + * data/java.m4: Adjust default definitions of %define variables. + * doc/bison.texinfo (Decl Summary): Adjust the %define entry according + to above behavior. + * tests/input.at (Boolean %define variables): Test new behavior. + +2007-01-29 Paolo Bonzini + + * NEWS: Mention java. + * TODO: Remove things that are done. + * bootstrap.conf: Add javacomp-script and javaexec-script. + * configure.ac: Invoke gt_JAVACOMP and gt_JAVAEXEC. + + * data/Makefile.am: Add new files. + * data/java-skel.m4: New. + * data/java.m4: New. + * data/lalr1.java: New. + + * doc/bison.texinfo: Put "A Complete C++ Example" under + C++ Parsers. Add Java Parsers. Put C++ Parsers and Java Parsers + under Other Languages. + + * src/getargs.c (valid_languages): Add Java. + * src/getargs.h (struct bison_language): Update size of string fields. + + * tests/Makefile.am: Add java.at. + * tests/atlocal.in: Add CONF_JAVA and CONF_JAVAC. + * tests/java.at: New. + * tests/testsuite.at: Include it. + +2007-01-28 Joel E. Denny + + Clean up. + * src/scan-skel.l (at_directive_perform): Add at_directive_argc and + at_directive_argv arguments so these no longer have to be global + variables. Also, update the implementation for the following changes. + (fail_for_at_directive_too_many_args, + fail_for_at_directive_too_few_args): Add at_directive_name argument. + (at_directive_name): Remove as at_directive_argv[0] will be used for + this now. + (AT_DIRECTIVE_ARGC_MAX): Increment to make space in at_directive_argv + for the directive name. + (at_directive_argc, at_directive_argv): Make these local within + skel_lex instead of global. + (INITIAL): Update directive start action for above changes. + (SC_AT_DIRECTIVE_ARG): Rename to... + (SC_AT_DIRECTIVE_ARGS): ... this, and update for above changes. + (SC_AT_DIRECTIVE_SKIP_WS): Update. + (scan_skel): Move yylex_destroy to... + (skel_scanner_free): ... here. + * tests/skeletons.at (installed skeleton file name): Rename to... + (installed skeleton file names): ... this. + +2007-01-27 Joel E. Denny + + * ChangeLog: For changes in doc/bison.texinfo, consistently reference + node names: say "Table of Symbols" not "Bison Symbols", and say "Decl + Summary" not "Directives". + * doc/bison.texinfo (Decl Summary, Calc++ Parser): Cross-reference the + %code entry in "Decl Summary" rather than the one in "Table of Symbols" + since the former is now the more complete one. + (Prologue Alternatives): Likewise and do the same for %defines. + (Table of Symbols): Add summary of %code, add summary of %define, and + move full %code documentation to... + (Decl Summary): ... here for consistency with other entries in these + sections. + Move %define entry in order to keep this list alphabetized. + Reword %define entry a little to put less emphasis on the skeleton + concept, which most users shouldn't have to think about. + +2007-01-26 Paul Eggert + + Adjust to recent gnulib changes. + * lib/.cvsignore: Remove stpcpy.h, strndup.h, strnlen.h. + Add string.h, string_.h, unistd_.h, wchar_.h. + * m4/.cvsignore: Add gnulib-common.m4, string_h.m4, wchar.m4. + * src/system.h: Don't include ; this is now done by + . + +2007-01-23 Paolo Bonzini + + Simplify implementation of unqualified %code, implement macros for + uniform treatment of boolean %define flags. Document %define. + * data/bison.m4 (b4_percent_define_ifdef, b4_percent_define_flag_if, + b4_percent_code_ifdef): New. + (b4_percent_code_get): Map unqualified %code to b4_percent_code(). + * data/c++.m4: Define default value for global_tokens_and_yystype. + * data/glr.cc: Likewise. + * data/location.cc: Use b4_percent_define_flag_if. + + * doc/bison.texinfo (Decl Summary): Document %define. + + * src/parse-gram.y (Unqualified %code): Change muscle name to + b4_percent_code(). + (content.opt): Default to empty. + +2007-01-17 Joel E. Denny + + Implement support for relative and absolute skeleton file names. + Discussed starting at + . + * doc/bison.texinfo (Decl Summary): Document in %skeleton entry. + (Bison Options): Document in --skeleton entry. + * src/output.c (output_skeleton): Use strncpy rather than strcpy since + full_skeleton can't necessarily hold all of pkgdatadir. + If the specified skeleton file name contains a `/', don't prepend + pkgdatadir. + * src/parse-gram.y (prologue_declaration): If the specified skeleton + file name contains a `/', prepend the grammar file directory. + * tests/Makefile.am (TESTSUITE_AT): Add skeletons.at. + * skeletons.at: New file. + (relative skeleton file names): New test case. + (installed skeleton file names): New test case. + * tests/testsuite.at: Include skeletons.at. + + * bootstrap: Update copyright to 2007. + +2007-01-17 Paolo Bonzini + + * bootstrap: Remove occurrences of .#bootmp from the files. + +2007-01-17 Akim Demaille + + * doc/bison.texinfo (Calc++ Parser): Don't try to alias + nonterminals. + Use per-type %printer. + +2007-01-17 Joel E. Denny + + * NEWS, data/c++-skel.m4, data/c++.m4, data/c-skel.m4, data/c.m4, + data/glr.c, data/glr.cc, data/lalr1.cc, data/location.cc, + djgpp/config.site, src/files.c, src/files.h, src/main.c, + src/muscle_tab.c, src/muscle_tab.h, src/parse-gram.y, src/reader.h, + src/scan-skel.h, src/scan-skel.l, tests/actions.at, tests/calc.at, + tests/glr-regression.at, tests/input.at, tests/local.at, + tests/output.at, tests/torture.at: Update copyright to 2007. + +2007-01-16 Akim Demaille + + * doc/bison.texinfo (Calc++ Parsing Driver): Let "parse" return an + error code. + (Calc++ Scanner): Exit with failure if we can't open the input + file. + Accept "-" standing for stdin. + (Calc++ Top Level): Print the result only if the parsing was + successful. + +2007-01-16 Akim Demaille + + * data/lalr1.cc (yy_reduce_print_): Add a missing end-of-line. + +2007-01-15 Paolo Bonzini + and Joel E. Denny + + Clean up %define and %code implementation in M4 some. Most + importantly, rename all related macros to be in the b4_percent_define + and b4_percent_code namespaces. Also, complete support for `.' in + %define variable names and %code qualifiers. + * data/bison.m4 (b4_check_user_names): Check for special + "SKELETON-NAMESPACE(name)" macros instead of using two nested + m4_foreach loops. + (b4_get_percent_define, b4_get_percent_code): Rename to... + (b4_percent_define_get, b4_percent_code_get): ... these. + Extend documentation with examples. + For SKELETON-NAMESPACE (as documented for b4_check_user_names), use + b4_percent_define_skeleton_variables and + b4_percent_code_skeleton_qualifiers. + Expect any value for the %define variable `foo' to be stored in the + macro named `b4_percent_define(foo)'; expect any %code blocks for the + qualifier `foo' to be stored in a macro named `b4_percent_code(foo)'; + expect any unqualified %code blocks to be stored in a macro named + `b4_percent_code_unqualified'. + Use m4_indir so that %define variable names and %code qualifiers can + contain `.', which is allowed by the grammar parser. + (b4_percent_define_default): New macro to set a default value for a + %define variable. + (m4_wrap): Update wrapped code, and fix some underquoting. + (b4_check_user_names_wrap): Update and define outside the m4_wrap. + Expect grammar uses of %define variables and %code qualifiers to be + defined in b4_percent_define_user_variables and + b4_percent_code_user_qualifiers. + * data/c++.m4: Use b4_percent_define_default rather than + m4_define_default. Fix some underquoting. Skeleton usage of %define + variable define_location_comparison now implies skeleton usage of + %define variable filename_type. + * data/glr.c, data/glr.cc, data/lalr1.cc, data/location.cc, + data/push.c, data/yacc.c: Update macro names. + * src/parse-gram.y (prologue_declaration, grammar_declaration): Update + muscle names. + +2007-01-14 Juan Manuel Guerrero + + DJGPP specific issues. + + * djgpp/config.site: Set ac_cv_path_mkdir to a sane DJGPP specific + default. Set gl_cv_absolute_wctype_h to a sane DJGPP specific default. + +2007-01-09 Joel E. Denny + + * tests/glr-regression.at: Use AT_PARSER_CHECK rather than AT_CHECK to + run parsers in all tests so that Valgrind is invoked during + maintainer-check-valgrind. + (Duplicate representation of merged trees): Free all semantic values. + (Duplicated user destructor for lookahead): Likewise. + +2007-01-09 Joel E. Denny + + * tests/local.at (AT_PARSER_CHECK): Add a PRE argument to specify a + command-line prefix. + * tests/torture.at (Exploding the Stack Size with Alloca): Stderr is + ignored, so use that PRE to set --log-fd=1 in VALGRIND_OPTS so we don't + miss Valgrind messages. + (Exploding the Stack Size with Malloc): Likewise. + +2007-01-09 Joel E. Denny + + Ignore YYSTACK_USE_ALLOCA for push parsers since the stacks can't be + locals. Reported by Juan Manuel Guerrero at + . + * data/push.c: Enclose the #ifdef YYSTACK_USE_ALLOCA in b4_push_if. + Fix some indentation also. + * tests/torture.at (Exploding the Stack Size with Alloca): Add comment + explaining this issue. + +2007-01-09 Paolo Bonzini + and Joel E. Denny + + Simplify union and prologue handling, and escape union and lex/parse + params with digraphs. + * data/bison.m4 (b4_pre_prologue, b4_post_prologue): Set their default + values to the empty string since these are no longer guaranteed + initialized by the front-end. + * data/glr.c, data/glr.cc, data/lalr1.cc, data/push.c, data/yacc.c: Add + braces around b4_user_stype since this is no longer done by the + front-end. + * src/files.c, src/files.h (pre_prologue_obstack, + post_prologue_obstack): Remove. + * src/muscle_tab.c (muscle_pair_list_grow): Don't duplicate header + comments here. Use MUSCLE_OBSTACK_SGROW so that values are escaped + with digraphs. This fixes lex params and parse params. + * src/muscle_tab.h (muscle_pair_list_grow): Update comments. + * src/output.c (prepare): Remove muscle insertion of the prologues. + (output): Remove freeing of pre_prologue_obstack and + post_prologue_obstack. + * src/parse-gram.y (prologue_declaration): Use muscle_code_grow rather + than prologue_augment for prologue parsing so you don't need prologue + obstacks. + (grammar_declaration): For %union RHS, use `braceless' instead of + "{...}" so that braces are already stripped and code is escaped with + digraphs. + * src/reader.c (prologue_augment): Remove. + (reader): Remove initialization of pre_prologue_obstack and + post_prologue_obstack. + * src/reader.h (prologue_augment): Remove. + + * data/c.m4: Remove stray parenthesis. + +2007-01-08 Joel E. Denny + + Remove quotes from variables names in %define directives and from + qualifiers in %code directives, and restrict the characters that are + allowed in them to M4-friendly ones. For %define, continue to support + the quoted form as a deprecated feature. Discussed starting at + . + * NEWS (2.3a+): Add entry for the change to %define. Update entry for + %code. + * doc/bison.texinfo (Prologue Alternatives): Update. + (Decl Summary): In %defines entry, update mention of `%code requires' + and `%code provides'. + (C++ Location Values): Update %define uses. + (Calc++ Parser Interface): Likewise. + (Calc++ Parser): Likewise, and update `%code requires' uses. + (Table of Symbols): Update %code documentation. + * src/parse-gram.y (prologue_declaration): For %define variables, use + `variable' instead of `STRING'. + (grammar_declaration): For %code qualifiers, use `ID' instead of + `STRING'. + (variable): New nonterminal that takes an `ID' or a `STRING'. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Update %code + and %define uses. + * tests/calc.at (_AT_DATA_CALC_Y): Update %define use. + * tests/input.at (Reject unused %code qualifiers): Update %code uses. + (%define errors): Update %define uses. + +2007-01-08 Joel E. Denny + + * src/parse-gram.y (prologue_declaration): Use MUSCLE_INSERT_STRING + instead of muscle_insert for %define values so that M4-special + characters are replaced with digraphs. + * tests/input.at (%define errors): Extend to check weird values. + +2007-01-08 Joel E. Denny + + Instead of having skeletons declare all valid %define variables and + %code qualifiers, provide macros that retrieve the associated values + and build these lists automatically. Thus Bison will now warn when a + variable or qualifier is not used by the skeleton in the current + invocation regardless of whether it might sometimes be used by that + skeleton in other invocations. Also, move all %define value macros to + the b4_percent_define_ namespace, and remove the %define "NAME" {CODE} + form, which is replaced by %code. + * data/bison.m4 (b4_check_for_unrecognized_names): Rename to... + (b4_check_user_names): ... this, and change the series of valid name + arguments to a single list argument for names used in the skeleton + similar to the existing list argument for names used in the grammar. + Warn instead of complaining. + (b4_get_percent_define, b4_get_percent_code): New to retrieve %define + values and %code code, to format %code code properly, and to build + lists of all %define variables and %code qualifiers used in the + skeleton: b4_skeleton_percent_define_variables and + b4_skeleton_percent_code_qualifiers. + (b4_check_percent_define_variables, b4_check_percent_code_qualifiers): + Remove, and... + (m4_wrap): ... m4_wrap b4_check_user_names invocations instead so that + the skeleton names lists can finish building first. In place of + b4_used_percent_define_variables and b4_used_percent_code_qualifiers, + expect the lists b4_user_percent_define_variables and + b4_user_percent_code_qualifiers. + * data/c++.m4: Where setting default values for b4_parser_class_name, + b4_location_type, b4_filename_type, b4_namespace, and + b4_define_location_comparison, update their names to the + b4_percent_define_ namespace. + * data/glr.c: Don't use b4_check_percent_define_variables and + b4_check_percent_code_qualifiers. Use b4_get_percent_code. + * data/glr.cc, data/lalr1.cc: Likewise, and use b4_get_percent_define. + (b4_parser_class_name, b4_namespace): Define these using + b4_get_percent_define for parser_class_name and namespace. + * data/location.cc: Use b4_get_percent_define. + * data/push.c: Don't use b4_check_percent_define_variables and + b4_check_percent_code_qualifiers. Use b4_get_percent_code. + * data/yacc.c: Likewise, and don't call m4_exit in + b4_use_push_for_pull_if or m4_wrap code will never execute. + * src/muscle_tab.c, src/muscle_tab.h (muscle_grow_used_name_list): + Rename to... + (muscle_grow_user_name_list): ... this for consistency with the + terminology used in bison.m4. + * src/parse-gram.y (prologue_declaration): Prepend "percent_define_" to + %define variable names, and rename muscle used_percent_define_variables + to user_percent_define_variables. + (grammar_declaration): Rename muscle used_percent_code_qualifiers to + user_percent_code_qualifiers. + (content): Remove. + (content.opt): Replace content RHS with STRING RHS so %define "NAME" + {CODE} form is no longer accepted. + * tests/input.at (Reject bad %code qualifiers): Rename to... + (Reject unused %code qualifiers): ... this, and update test output. + (%define error): Update test output. + +2007-01-07 Joel E. Denny + + Check for unrecognized %define variables similar to checking for + unrecognized %code qualifiers. Check for redefined %define variables. + * data/bison.m4 (b4_check_for_unrecognized_names): New macro that + generalizes... + (b4_check_percent_code_qualifiers): ... this, which now wraps it. + (b4_check_percent_define_variables): New, also wraps it. + * data/glr.c: Unless glr.cc is wrapping glr.c, declare no valid %define + variables using b4_check_percent_define_variables. + * data/glr.cc, data/lalr1.cc: Declare the valid %define variables as + all those exercised in the test suite and all those listed in the + `Default values' section of c++.m4. Are there others? + * data/push.c, data/yacc.c: Declare no valid %define variables. + * src/muscle_tab.c, src/muscle_tab.h (muscle_find_const): New function, + similar to muscle_find, but it works even when the muscle stores a + const value. + (muscle_grow_used_name_list): New function for constructing the used + name list muscles that b4_check_for_unrecognized_names requires. + * src/parse-gram.y (prologue_declaration): Warn if a variable is + %define'd more than once. Define the b4_used_percent_define_variables + muscle with muscle_grow_used_name_list. + (grammar_declaration): Abbreviate %code code with + muscle_grow_used_name_list. + * tests/input.at (%define errors): New. + +2007-01-06 Joel E. Denny + + Provide warn_at, complain_at, and fatal_at function callbacks to the + skeletons, and use this for %code qualifier complaints. + * data/bison.m4 (b4_error_at): New, invoked by... + (b4_warn_at, b4_complain_at, b4_fatal_at): ... these new macros to wrap + the skeleton scanner's new @warn_at(...@), @complain_at(...@), and + @fatal_at(...@) directives. + (b4_check_percent_code_qualifiers): Rewrite to expect locations for + qualifiers in b4_used_percent_code_qualifiers and to use + b4_complain_at. + * src/location.c, src/location.h (boundary_set_from_string): New global + function. + * src/muscle_tab.c, src/muscle_tab.h (muscle_boundary_grow): New global + function. + * src/parse-gram.y (grammar_declaration): Add locations for qualifiers + to b4_used_percent_code_qualifiers. + * src/scan-skel.l (fail_for_at_directive_too_few_args): New static + function. + (AT_DIRECTIVE_ARGC_MAX): Increase for boundary arguments. + (lineno): Rename to... + (out_lineno): ... this so I don't misunderstand it again. + (SC_AT_DIRECTIVE_SKIP_WS): Don't increment out_lineno for newlines + here; these newlines are in the input but not the output file. + (SC_AT_DIRECTIVE_ARG): Likewise. Extract directive execution to... + (at_directive_perform): ... this new static function, and add handling + of new @warn_at(...@), @complain_at(...@), and @fatal_at(...@) + directives. + * tests/input.at (Reject bad %code qualifiers): Update test output with + locations and extend. + + * tests/output.at (Output file name: [, Output file name: ]): Remove + bogus comment about these tests failing. + +2007-01-06 Joel E. Denny + + Clean up b4_check_percent_code_qualifiers a little. + * data/bison.m4 (b4_check_percent_code_qualifiers): Expect qualifiers + in b4_used_percent_code_qualifiers to be double-M4-quoted. Rewrite + documentation and add examples. + * src/parse-gram.y (grammar_declaration): Double-M4-quote those + qualifiers here. + +2007-01-05 Joel E. Denny + + Don't use m4_divert since it makes m4_divert_push and m4_divert_pop + unreliable -- especially when they're hidden inside another macro. + * data/bison.m4, data/c++-skel.m4, data/c++.m4, data/c-skel.m4, + data/c.m4: Remove m4_divert(-1). + * data/glr.c, data/glr.cc, data/lalr1.cc, data/location.cc, + data/push.c, data/yacc.c: Likewise, and replace m4_divert(0) with + m4_divert_push(0) and m4_divert_pop(0). + * src/output.c (output_skeleton): Don't add an m4_divert_push(0) and + an m4_wrap([m4_divert_pop(0)]) to the M4. Diversion -1, which is + pushed and popped by m4sugar, should be first on the stack. + + Provide warn, complain, and fatal function callbacks to the skeletons. + This provides more flexibility than m4_fatal, improves the error + message format, and captures messages for translation. Discussed + starting at + . + * data/bison.m4 (b4_error): New, invoked by... + (b4_warn, b4_complain, b4_fatal): ... these new macros to wrap the + skeleton scanner's new @warn(...@), @complain(...@), and @fatal(...@) + directives. Because these M4 macros might be called when the current + diversion is -1 or 0, m4_divert_push and m4_divert_pop is used; thus + the previous removal of uses of m4_divert, which caused trouble. + (b4_check_percent_code_qualifiers): Use b4_complain instead of + m4_fatal to report unrecognized %code qualifiers. + * data/c++-skel.m4: Use b4_complain instead of m4_fatal to report C++ + push parser requests. + * data/glr.c: Use b4_complain instead of m4_fatal to report + non-deterministic push parser requests. + Update @output usage to @output(...@) form. + * data/glr.cc, data/lalr1.cc: Use b4_fatal instead of m4_fatal to + report missing %defines. Update @output usage to @output(...@) form. + * data/location.cc, data/push.c, data/yacc.c: Update @output usage to + @output(...@) form. + * src/main.c (main): Invoke skel_scanner_free. + * src/scan-skel.h (skel_scanner_free): Prototype new function. + * src/scan-skel.l (FLEX_NO_OBSTACK): Don't define; we now need the + obstack_for_string from flex-scanner.h. + (YY_DECL): Use to declare skel_lex static. + (decode_at_digraphs): Remove; now handled in the new + SC_AT_DIRECTIVE_ARG start condition. + (fail_for_at_directive_too_many_args, fail_for_invalid_at): New static + functions. + (at_directive_name, AT_DIRECTIVE_ARGC_MAX, at_directive_argc, + at_directive_argv): New static globals. + (INITIAL): Use fail_for_invalid_at. + Don't parse `@output file_name\n' or `@basename(...@)'. Instead, + recognize the start of a generalized `@directive(...@)' form and + start... + (SC_AT_DIRECTIVE_ARG): ... this new start condition to parse the + directive args (using the new obstack_for_string), to decode the + contained @ diagraphs, and to perform the directive. It recognizes + @basename(...@), @warn(...@), @complain(...@), @fatal(...@), and + @output(...@). + (SC_AT_DIRECTIVE_SKIP_WS): New start condition started by + SC_AT_DIRECTIVE_ARG to skip whitespace after the argument delimiter, + `@,'. + (scan_skel): Initialize obstack_for_string on the first call. + (skel_scanner_free): New function to free obstack_for_string. + * tests/input.at (Reject bad %code qualifiers): Update test output. + +2007-01-04 Joel E. Denny + + Consolidate the 4 prologue alternative directives (%code, %requires, + %provides, and %code-top) into a single %code directive with an + optional qualifier field. Discussed at + . + * NEWS (2.3a+): Rewrite the existing entry for the prologue + alternatives. + * doc/bison.texinfo (Prologue Alternatives): Update. + (Decl Summary): Update to %code "requires" and %code "provides". + (Calc++ Parser): Update to %code "requires". + (Table of Symbols): Remove entries for %requires, %provides, and + %code-top. Rewrite %code entry, and add a %code "QUALIFIER" entry. + * data/bison.m4 (b4_user_provides, b4_user_requires): Remove as these + are replaced by b4_percent_code_provides and b4_percent_code_requires, + which are skeleton-specific. + (b4_check_percent_code_qualifiers): New. A skeleton can use this to + declare what %code qualifiers it supports and to complain if any other + qualifiers were used in the grammar. + * data/glr.cc: Update to use b4_user_code([b4_percent_code_requires]) + and b4_user_code([b4_percent_code_provides]) in place of + b4_user_requires and b4_user_provides. + * data/glr.c, data/lalr1.cc, data/push.c, data/yacc.c: Likewise. + Add b4_user_code([b4_percent_code_top]) and + b4_user_code([b4_percent_code]). + Invoke b4_check_percent_code_qualifiers. + * src/parse-gram.y (PERCENT_CODE_TOP, PERCENT_PROVIDES, + PERCENT_REQUIRES): Remove. + (grammar_declaration): Remove RHS's for %code-top, %provides, and + %requires. Rewrite the %code RHS as the unqualified form defining the + muscle b4_percent_code. Add another RHS for the qualified %code form, + which defines muscles of the form b4_percent_code_QUALIFIER and the + b4_used_percent_code_qualifiers muscle. + * src/scan-gram.l (PERCENT_CODE_TOP, PERCENT_PROVIDES, + PERCENT_REQUIRES): Remove. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Update to use + %code "requires" and %code "provides". + * tests/input.at (Reject bad %code qualifiers): New. + +2007-01-03 Joel E. Denny + + Use the new code_props interface for destructors and printers. + * src/symtab.h (symbol, semantic_type): Remove destructor_location and + printer_location members, and change the type of the destructor and + printer members to code_props. + (symbol_destructor_set, symbol_destructor_get, symbol_printer_set, + symbol_printer_get, semantic_type_destructor_set, + semantic_type_printer_set, default_tagged_destructor_set, + default_tagless_destructor_set, default_tagged_printer_set, + default_tagless_printer_set): Use code_props in arguments and return + types in place of char const * and location. + (symbol_destructor_location_get, symbol_printer_location_get): Remove + since the locations are now contained in the return of + symbol_destructor_get and symbol_printer_get. + * src/output.c (symbol_destructors_output, symbol_printers_output): + Replace with... + (symbol_code_props_output): ... this to eliminate duplicate code. + (output_skeleton): Update to use symbol_code_props_output. + * src/reader.c (symbol_should_be_used): Update use of + symbol_destructor_get. + * src/symlist.c (symbol_list_destructor_set, symbol_list_printer_set): + Update uses of the various _destructor_set and _printer_set functions. + * src/symtab.c: (default_tagged_destructor_location, + default_tagless_destructor_location, default_tagged_printer_location, + default_tagless_printer_location): Remove since we... + (default_tagged_destructor, default_tagless_destructor, + default_tagged_printer, default_tagless_printer): ... change the type + of these to code_props. + (symbol_new, semantic_type_new, symbol_destructor_set, + semantic_type_destructor_set, symbol_destructor_get, + symbol_printer_set, semantic_type_printer_set, symbol_printer_get, + symbol_check_alias_consistency, default_tagged_destructor_set, + default_tagless_destructor_set, default_tagged_printer_set, + default_tagless_printer_set): Update. + (symbol_destructor_location_get, symbol_printer_location_get): Remove. + (SYMBOL_CODE_PRINT): New similar to SYMBOL_ATTR_PRINT but for + code_props members. + (symbol_print): Use SYMBOL_CODE_PRINT. + +2007-01-03 Joel E. Denny + + Use the new code_props interface for rule actions. + * src/symlist.h (symbol_list): Replace action, action_location, and + used members with a code_props action_props member. + * src/reader.c (symbol_should_be_used, grammar_rule_check, + grammar_midrule_action, grammar_current_rule_merge_set, + grammar_current_rule_symbol_append, packgram): Update. + * src/scan-code.h (translate_rule_action): Remove, no longer used. + * src/scan-code.l (handle_action_dollar): Update. + (translate_rule_action): Remove, no longer used. + * src/symlist.c (symbol_list_sym_new, symbol_list_syms_print): Update. + +2007-01-02 Joel E. Denny + + Use the new code_props interface in parse-gram.y. + * src/parse-gram.y (prologue_declaration, braceless, epilogue.opt): + Update all uses of translate_* functions to use the new code_props + interface and to use gram_scanner_last_string_free and + code_scanner_last_string_free where possible. + (grammar_declaration): symbol_list_destructor_set and + symbol_list_printer_set now perform the translation, so don't do it + here. Use gram_scanner_last_string_free where possible. + * src/scan-code.h, src/scan-code.l (translate_symbol_action, + translate_code): Remove, no longer used. + * src/symlist.h, src/symlist.c (symbol_list_destructor_set, + symbol_list_printer_set): Perform code translation here rather than + depending on the caller to do so. + + * src/symlist.h (struct symbol_list): Correct some documentation typos. + * src/scan-gram.h (gram_last_string): Remove declaration. + * src/scan-gram.l (last_string): Declare it static. + +2007-01-02 Joel E. Denny + + Encapsulate code properties and related functionality for the various + destructors, printers, and actions into a code_props structure and + interface. This patch merely implements code_props in scan-code.h and + scan-code.l. Future patches will rewrite other modules to use it. + Discussed starting at + . + * src/location.h (EMPTY_LOCATION_INIT): Define so that it's easier to + consistently initialize const structs that have an empty location + field. + * src/location.c (empty_location): Initialize with EMPTY_LOCATION_INIT + to ensure consistency. + * src/scan-code.h (code_props): New structure. + (code_props_none_init, CODE_PROPS_NONE_INIT, code_props_none): New + function, macro, and const global variable for initializing a + code_props with no code. + (code_props_plain_init, code_props_symbol_action_init, + code_props_rule_action_init, code_props_translate_code): The rest of + the new code_props functional interface. Among other things, the init + functions set the code_props kind field so that + code_props_translate_code will know whether to behave like + translate_symbol_action, translate_rule_action, or translate_code. + These old translate functions must remain until all other modules are + updated to use the new code_props interface. + (code_scanner_last_string_free): New function similar to + gram_scanner_last_string_free. + (code_scanner_free): Add documentation. + * src/scan-code.l: Implement the new interface. + (code_lex): Make it static, add a code_props* argument, and remove the + rule argument. + (last_string): New static global similar to the one in scan-gram.l. + (SC_RULE_ACTION): Update to use the code_props* argument to code_lex + instead of rule. + (SC_SYMBOL_ACTION): For $$, set the is_value_used member of the + code_props since Bison may one day use this information for destructors + and printers. + (<*><>): Use STRING_FINISH so that last_string is set. + (handle_action_dollar): Use symbol_list_n_get and set used flag + directly since symbol_list_n_used_set is removed. + (translate_action): Add a code_props* argument and remove the rule, + action, and location arguments. Pass the code_props* on to code_lex. + (translate_rule_action, translate_symbol_action, translate_code): + Rewrite as wrappers around the new code_props interface. + * src/symlist.h, src/symlist.c (symbol_list_n_used_set): Remove since + it would eventually need to break the encapsulation of code_props. + +2007-01-01 Joel E. Denny + + * etc/.cvsignore: New. + +2007-01-01 Joel E. Denny + + Add maintainer-push-check to run maintainer-check using push parsing in + place of pull parsing where available. + * Makefile.am (maintainer-push-check): New. + * data/bison.m4 (b4_use_push_for_pull_if): New. + * data/push.c: Redefine b4_push_if and b4_use_push_for_pull_if + appropriately based on their existing values. + (yypush_parse): Don't print push-parser-specific diagnostics if push + parsing is being used in place of pull parsing. + * data/yacc.c: If push parsing should replace pull parsing, redirect to + push.c. + * src/output.c (prepare): Check BISON_USE_PUSH_FOR_PULL environment + variable, and insert b4_use_push_for_pull_flag into muscles. + * tests/Makefile.am (maintainer-push-check): New. + +2006-12-31 Joel E. Denny + + * data/push.c (yypush_parse): Set yynew = 1 at the end of a parse + (whether successful or failed) so that yypush_parse can be invoked + again to start a new parse using the same yypstate. + * tests/torture.at (AT_DATA_STACK_TORTURE): For push mode, extend to + check multiple yypull_parse invocations on the same yypstate. For pull + mode, extend to check multiple yyparse invocations. + (Exploding the Stack Size with Alloca): Extend to try with + %push-pull-parser. + (Exploding the Stack Size with Malloc): Likewise. + + * tests/calc.at (Simple LALR Calculator): Don't specify + %skeleton "push.c" since %push-pull-parser implies that now. + * tests/headers.at (export YYLTYPE): Don't check for the push + declarations. Otherwise, this test case can't be used to see if push + mode can truly emulate pull mode. + * tests/input.at (Torturing the Scanner): Likewise. + * tests/local.at (AT_YACC_OR_PUSH_IF, AT_PUSH_IF): Remove. + (AT_YYERROR_SEES_LOC_IF): Rather than AT_YACC_OR_PUSH_IF, use + AT_YACC_IF, which now includes the case of push mode since %skeleton + need not be used for push mode. This will be more intuitive once + push.c is renamed to yacc.c. + +2006-12-31 Joel E. Denny + + For push mode, convert yyparse from a macro to a function, invoke yylex + instead of passing a yylexp argument to yypull_parse, and don't + generate yypull_parse or yyparse unless %push-pull-parser is declared. + Discussed starting at + . + * data/bison.m4 (b4_pull_if): New. + * data/c.m4 (b4_identification): Define YYPULL similar to YYPUSH. + * data/push.c: Improve M4 quoting a little. + (b4_generate_macro_args, b4_parenthesize): Remove. + (yyparse): If there's a b4_prefix, #define this to b4_prefix[parse] + any time a pull parser is requested. + Don't #define this as a wrapper around yypull_parse. Instead, when + both push and pull are requested, make it a function that does that + same thing. + (yypull_parse): If there's a b4_prefix, #define this to + b4_prefix[pull_parse] when both push and pull are requested. + Don't define this as a function unless both push and pull are + requested. + Remove the yylexp argument and hard-code yylex invocation instead. + * etc/bench.pl.in (bench_grammar): Use %push-pull-parser instead of + %push-parser. + * src/getargs.c (pull_parser): New global initialized to true. + * getargs.h (pull_parser): extern it. + * src/output.c (prepare): Insert pull_flag muscle. + * src/parse-gram.y (PERCENT_PUSH_PULL_PARSER): New token. + (prologue_declaration): Set both push_parser and pull_parser = true for + %push-pull-parser. Set push_parser = true and pull_parser = false for + %push-parser. + * src/scan-gram.l: Don't accept %push_parser as an alternative to + %push-parser since there's no backward-compatibility concern here. + Scan %push-pull-parser. + * tests/calc.at (Simple LALR(1) Calculator): Use %push-pull-parser + instead of %push-parser. + * tests/headers.at (export YYLTYPE): Make yylex static, and don't + prototype it in the module that calls yyparse. + * tests/input.at (Torturing the Scanner): Likewise. + * tests/local.at (AT_PUSH_IF): Check for %push-pull-parser as well. + +2006-12-26 Joel E. Denny + + Update etc/bench.pl. Optimize push mode a little (the yyn change + deserves most of the credit). + * Makefile.am (SUBDIRS): Add etc subdirectory. + * configure.ac (AC_CONFIG_FILES): Add etc/bench.pl and etc/Makefile. + * data/push.c (b4_declare_parser_state_variables): Move yyn, yyresult, + yytoken, yyval, and yyloc declarations to... + (yyparse or yypush_parse): ... here to improve performance. For + yypush_parse invocations after the first, be sure to assign yyn its old + value again. + (yypstate_new): Don't bother initializing the yyresult field since the + initial value isn't used. + (yyn, yyresult, yytoken, yyval, yyloc): For each NAME in this list, + remove the #define that, in push mode, set it to yyps->NAME. + * etc/Makefile.am: New. + * etc/bench.pl: Remove and build it instead from... + * etc/bench.pl.in: ... this new file. Use @abs_top_builddir@ to invoke + "tests/bison" from the build directory by default rather than just + invoking "bison" from $PATH. + (calc_grammar): Update push parser code: don't declare yylval globally, + don't define yyparse_wrapper, and don't #define yyparse. + (bench_grammar): Update to check all working combinations of yacc.c, + push.c, impure, pure, pull, and push. + +2006-12-25 Joel E. Denny + + For push mode, add pull wrappers around yypush_parse. + * data/push.c: (b4_generate_macro_args, b4_parenthesize): New macros. + (yypull_parse): New function wrapping yypush_parse. + (yyparse): New #define wrapping yypull_parse. + * tests/calc.at (_AT_DATA_CALC_Y): Call yyparse even when %push-parser + is declared. + * tests/headers.at (export YYLTYPE): Make yylex global. For push mode, + prototype yylex in the module that calls yyparse, and don't prototype + yyparse there. Otherwise, the yyparse expansion won't compile. + * tests/input.at (Torturing the Scanner): Likewise. + +2006-12-25 Joel E. Denny + + Enable push parsers to operate in impure mode. Thus, %push-parser no + longer implies %pure-parser. The point of this change is to move + towards being able to test the push parser code by running the entire + test suite as if %push-parser had been declared. + * data/push.c (yypush_parse): For impure mode, remove the + yypushed_char, yypushed_val, and yypushed_loc arguments. + Instead, declare these as local variables initialized to the global + yychar, yylval, and yylloc. + For the first yypush_parse invocation only, restore the initial values + of these global variables when it's time to read a token since they + have been overwritten. + * src/parse-gram.y (prologue_declaration): Don't set pure_parser for + %push-parser. + * tests/calc.at (Simple LALR(1) Calculator): Always declare + %pure-parser along with %push-parser since this test case was designed + for pure push parsers. + * tests/local.at (AT_PURE_OR_PUSH_IF): Remove unused. + (AT_YACC_OR_PUSH_IF): New. + (AT_YYERROR_SEES_LOC_IF): Fix enough that the test suite passes, but + add a note that it's still wrong for some cases (as it has been for a + while). + (AT_PURE_LEX_IF): Use AT_PURE_IF instead of AT_PURE_OR_PUSH_IF since + %push-parser no longer implies %pure-parser. + +2006-12-20 Joel E. Denny + + Remove some unnecessary differences between the pull parser code and + the push parser code. This patch enables yynerrs in push mode. + * data/push.c: Reformat M4 a little. + (b4_yyerror_range): Remove and convert all uses to just yyerror_range. + (b4_declare_scanner_communication_variables): Don't omit yynerrs just + because push mode is on. Instead, if pure mode is on, move yynerrs + to... + (b4_declare_parser_state_variables): ... here. + (yynerrs, yyerror_range): For push mode, #define each NAME in this list + to yyps->NAME so it can be used in yypush_parse. + (yypush_parse): Don't omit uses of yynerrs in push mode. + +2006-12-20 Joel E. Denny + + Fix bug such that the first pushed token's value and location are + sometimes overwritten (sometimes by %initial-action) before being used. + * data/push.c (yypush_parse): Rename arguments yynchar, yynlval, and + yynlloc to yypushed_char, yypushed_val, and yypushed_loc for clarity. + For the first yypush_parse invocation, initialize yychar to YYEMPTY to + more closely mimic the pull parser logic. + Don't copy the pushed token to yychar, yylval, and yylloc until it's + time to read a token, which is after any initialization of yylval and + yylloc. + (gottoken): Rename label to... + (yyread_pushed_token): ... for clarity and to avoid infringing on the + user namespace. + +2006-12-20 Joel E. Denny + + Rearrange initialization of the parser state variables so that the + skeleton doesn't have to have a copy for pull mode and another for push + mode. This patch also fixes at least a bug such that yylloc was not + initialized (with b4_location_initial_line and + b4_location_initial_column) upon calling yypush_parse. However, that + initialization now overwrites the first token's location; + %initial-action assigning @$ already did the same thing, and both bugs + will be fixed in a later patch. + * data/push.c (b4_yyssa): Remove and convert all uses to just yyssa. + (b4_declare_parser_state_variables): Remove initialization of yytoken, + yyss, yyvs, yyls, and yystacksize. + (yypstate_new): Remove initialization of some yypstate fields: yystate, + yyerrstatus, yytoken, yyss, yyvs, yyls, yystacksize, yyssp, yyvsp, and + yylsp. + (yyssa, yyvsa, yylsa): For push mode, #define each NAME in this list to + yyps->NAME so it can be used in yypush_parse. + (yyparse or yypush_parse): For yypush_parse, don't print the + "Starting parse" diagnostic for invocations after the first. + Add initialization of yytoken, yyss, yyvs, yyls, and yystacksize; for + yypush_parse, only do it for the first invocation. + Allow yystate, yyerrstatus, yyssp, yyvsp, yylsp, and yylloc + initialization to occur in yypush_parse but only on the first + invocation. + +2006-12-19 Joel E. Denny + + * data/push.c: Add CPP guards around push parser declarations in both + the header and the code file. + In the code file, move the push parser declarations to the same place + they appear in the header file. + Clean up the M4 some, especially the inconsistent underquoting in + some b4_c_function_def and b4_c_function_decl uses. + +2006-12-19 Joel E. Denny + + Encapsulate the push parser state variables into an M4 macro so the + push skeleton doesn't have to list them again for pull mode's yyparse. + For push mode, remove yypush_parse's local equivalents of these + variables to eliminate unnecessary copying between the two sets at + run-time. This patch also fixes at least a bug related to multiple + %initial-action invocations in push mode. + * data/push.c (b4_declare_parser_variables): Rename to... + (b4_declare_scanner_communication_variables): ... this for clarity and + update both uses. + (b4_declare_yyparse_variables): Remove and move its contents to the one + spot where it was invoked. + (b4_declare_parser_state_variables): New macro containing the parser + state variables required by push mode. + (struct yypstate): Replace all fields but yynew with + b4_declare_parser_state_variables. + (yystate, yyn, yyresult, yyerrstatus, yytoken, yyss, yyssp, yyvs, + yyvsp, yyls, yylsp, yystacksize, yyval, yyloc): For push mode, #define + each NAME in this list to yyps->NAME so it can be used in yypush_parse. + (yyparse or yypush_parse): For yyparse in pull mode, replace local + parser state variable declarations with + b4_declare_parser_state_variables. + Don't initialize parser state variables when calling yypush_parse since + yypstate_new already does that. + Invoke the user's initial action only upon the first yypush_parse + invocation. + Remove all code that copies between the local parser state variables + and the yypstate. + +2006-12-19 Joel E. Denny + + * data/push.c (union yyalloc): Rename yyss, yyvs, and yyls fields to + prevent a name collision in a future patch where these names will + sometimes be #define'd. + (YYSTACK_RELOCATE): Add an argument to select a union yyalloc field + since it no longer has the same name as the existing argument. + (yyparse or yypush_parse): Update all uses of YYSTACK_RELOCATE. + +2006-12-19 Paolo Bonzini + and Joel E. Denny + + * doc/bison.texinfo (Decl Summary): In the %language entry, mention + that the argument is case-insensitive, and there's no `=' here. + For the %skeleton entry, mention that %language is better. + (Bison Options): Likewise for --language and --skeleton. Move the + --skeleton entry so that the `Tuning the parser' section is sorted + alphabetically on long options. + (C++ Bison Interface): Don't use the word skeleton. Don't explain the + %language directive in detail here; cross-reference the %language + documentation instead. + (Calc++ Parser): Use `%require "@value{VERSION}"' rather than + `%require "2.3b"' so that the example is always up-to-date. + (Table of Symbols): Add entries for %language and %skeleton. + * examples/extexi (normalize): Instead of replacing every %require + argument with the current Bison version, just substitute for + `@value{VERSION}'. This guarantees that we're testing what actually + appears in the documentation. + * examples/calc++/Makefile.am ($(calc_extracted)): Use `$(VERSION)' + rather than `@VERSION@'. + +2006-12-18 Paul Eggert + + * NEWS: Reword the %language news a bit, and put it earlier. + + * src/getargs.c (skeleton_arg): Last arg is now location const *. + Rewrite to simplify the logic. + (language_argmatch): Likewise. + (program_name): We now own this var. + * src/getargs.h (struct bison_language): Use char[] rather than + const char *. + + * doc/bison.texinfo (Decl Summary, Bison Options): Don't claim + Java is supported. + * src/complain.c (program_name): Remove decl; no longer needed. + * src/main.c (program_name): Remove; now belongs to getargs. + +2006-12-18 Paolo Bonzini + + * NEWS: Document %language. + + * data/Makefile.am (dist_pkgdata_DATA): Add c-skel.m4, c++-skel.m4. + + * data/c-skel.m4, data/c++-skel.m4: New files. + * data/glr.c: Complain on push parsers. + + * doc/bison.texinfo (C++ Parser Interface): Prefer %language + over %skeleton. + (Decl Summary): Document %language and %skeleton. + (Command line): Document -L. + + * examples/extexi: Rewrite %require directive. + * examples/calc++/Makefile.am: Pass VERSION to extexi. + + * src/files.c (compute_exts_from_gc): Look in language structure + for .y extension. + (compute_file_name_parts): Check whether .tab should be added. + * src/getargs.c (valid_languages, skeleton_prio, language_prio): + (language, skeleton_arg, language_argmatch): New. + (long_options): Add --language. + (getargs): Use skeleton_arg, add -L/--language. + * src/getargs.h: Include location.h. + (struct bison_language, language, skeleton_arg, language_argmatch): New. + * src/output.c (prepare): Pick default skeleton from struct language. + Don't dispatch C skeletons here. + * src/parse-gram.y (PERCENT_LANGUAGE): New. + (prologue_declaration): Add "%language" rule, use skeleton_arg. + * src/scan-gram.l ("%language"): New rule. + + * tests/calc.at: Test %skeleton and %language. + * tests/local.at (AT_SKEL_CC_IF): Look for %language. + (AT_GLR_IF): Look for %skeleton "glr.cc". + (AT_LALR1_CC_IF, AT_GLR_CC_IF): Rewrite. + (AT_YACC_IF): Reject %language. + +2006-12-18 Paul Eggert + + * src/symtab.h (struct semantic_type): Remove the tag 'semantic_type', + since it wasn't used; only the typedef name 'semantic_type' is needed. + Also, omit trailing white space. + + * bootstrap: Sync from coreutils. + (gnulib_extra_files): Add build-aux/announce.gen. + (slurp): Adjust .gitignore files like .cvsignore files. + * build-aux/announce-gen: Remove from CVS, since bootstrap + now creates this. + +2006-12-16 Joel E. Denny + + Make %push-parser imply %pure-parser. This fixes several bugs; see + . + * src/parse-gram.y (prologue_declaration): For %push-parser, also set + pure_parser = true. + * data/push.c: Don't bother testing b4_push_if when deciding whether + to expand b4_declare_parser_variables globally. + (yypush_parse): Likewise in here. + + * data/push.c (yypush_parse): Add b4_parse_param to arguments. + (yy_reduce_print): Reformat M4 for readability. + +2006-12-15 Bob Rossi + and Joel Denny + + * data/push.c (yypstate): Add typedef, and update all uses of + struct yypstate to just yypstate. + * tests/calc.at (_AT_DATA_CALC_Y): Update here as well. + +2006-12-14 Bob Rossi + + * data/push.c (yypush_parse): Declare prototype regardless of + %locations option. + +2006-12-14 Bob Rossi + + * data/push.c (yyparse): Remove the prototype and the #define when in + push-parser mode. + +2006-12-13 Bob Rossi + + * data/push.c (yypstate_init): Rename to... + (yypstate_new): ... this and use b4_c_function_def. + (yypstate_delete): New. + (yypush_parse): Change parameters yynval and yynlloc to be const. + * tests/calc.at (_AT_DATA_CALC_Y): Use new yypstate_new and + yypstate_delete functions. + +2006-12-13 Joel E. Denny + + * configure.ac (AC_PREREQ): Require Autoconf 2.61 because of our + strange test case titles. Reported by Bob Rossi. + +2006-12-13 Paul Eggert + + * TODO: Add pointer to Sylvain Schmitz's work on static detection + of potential ambiguities in GLR grammers. + +2006-12-12 Joel E. Denny + + * tests/testsuite.at (AT_CHECK): When checking if $1 starts with + `bison ', use m4_index instead of m4_substr since chopping up a string + containing M4-special characters causes problems here. + + Fix a couple of bugs related to special characters in user-specified + file names, and make it easier for skeletons to compute output file + names with the same file name prefix as Bison-computed output file + names. + * data/glr.cc, data/push.c, data/yacc.c: In @output, use + b4_parser_file_name and b4_spec_defines_file instead of + @output_parser_name@ and @output_header_name@, which are now redundant. + * data/glr.c, data/lalr1.cc: Likewise. Also, in header #include's, use + b4_parser_file_name, b4_spec_defines_file, and the new + @basename(FILENAME@) instead of @output_parser_name@ and + @output_header_name@, which inappropriately escaped the file names as + C string literals. + * src/files.c (all_but_ext): Remove static qualifier. + (compute_output_file_names): Move `free (all_but_ext)' to... + (output_file_names_free): ... here since all_but_ext is needed later. + * src/files.h (all_but_ext): Extern. + * src/muscle_tab.h (MUSCLE_INSERT_STRING_RAW): New macro that does + exactly what MUSCLE_INSERT_STRING used to do. + (MUSCLE_INSERT_STRING): Use MUSCLE_OBSTACK_SGROW so that M4-special + characters are escaped properly. + * src/output.c (prepare): Define muscle file_name_all_but_ext as + all_but_ext. + For pkgdatadir muscle, maintain previous functionality by using + MUSCLE_INSERT_STRING_RAW instead of MUSCLE_INSERT_STRING. The problem + is that b4_pkgdatadir is used inside m4_include in the skeletons, so + digraphs would never be expanded. Hopefully no one has M4-special + characters in his Bison installation path. + * src/scan-skel.l: Don't parse @output_header_name@ and + @output_parser_name@ anymore since they're now redundant. + In @output, use decode_at_digraphs. + Parse a new @basename command that invokes last_component. + (decode_at_digraphs): New. + (BASE_QPUTS): Remove unused. + * tests/output.at (AT_CHECK_OUTPUT_FILE_NAME): New macro. + (Output file name): New tests. + +2006-12-09 Joel E. Denny + + Warn about output files that are generated by the skeletons and that + conflict with other output files. + * data/glr.c: Don't generate the header file here when glr.cc does. + * src/files.c (file_names, file_names_count): New static globals. + (compute_output_file_names): Invoke output_file_name_check for files + not generated by the skeletons and remove existing checks. + (output_file_name_check): New function that warns about conflicting + output file names. + (output_file_names_free): Free file_names. + * src/files.h (output_file_name_check): Declare. + * src/scan-skel.l: Invoke output_file_name_check for files generated by + the skeletons. + * tests/output.at (AT_CHECK_CONFLICTING_OUTPUT): New. + (Conflicting output files): New tests. + +2006-12-09 Ralf Wildenhues + + * doc/bison.texinfo: Fix a couple of typos. + +2006-12-08 Bob Rossi + + * data/push.c: (yypvarsinit, yypvars, struct yypvars, yypushparse): + Rename to... + (yypstate_init, yypstate, struct yypstate, yypush_parse): ... these and + update all uses. + (b4_yyssa, b4_yyerror_range, yypstate_init): Rename pv to yyps. + (yypush_parse): Rename yypvars argument to yyps and remove redundant + local pv. + (yypstate_init, yypush_parse): Declare in Bison-generated header file. + * tests/calc.at (_AT_DATA_CALC_Y): Use newly named functions. + +2006-12-07 Bob Rossi + and Joel Denny + + * data/push.c (yypvarsinit): Change return type from void* to struct + yypvars*. No longer cast to void* on return. + (struct yypvars): Remove yylen since it need not be remembered between + yypushparse invocations. + (yypushparse): Don't copy between yylen and pv->yylen. + +2006-12-05 Bob Rossi + + * data/push.c (yychar_set, yylval_set, yylloc_set): Delete. + (yypushparse): Add yynchar, yynlval, yynlloc parameters. + (b4_declare_parser_variables): Do not declare yynerrs for push mode. + (struct yypvars): Remove b4_declare_parser_variables. + (yypvarsinit): Remove init code for removed variables. + (global scope): Do not declare b4_declare_parser_variables if + push or pure mode. + (yypushparse): Add b4_declare_parser_variables. + Init new local variables, and remove init code for removed + yypvars variables. + (yyparse): Delete. + * tests/calc.at (_AT_DATA_CALC_Y): Call yypushparse for push mode + and yyparse for other modes. + (AT_CHECK_CALC_LALR): Added '%skeleton "push.c"' for push tests. + * tests/local.at (AT_PUSH_IF, AT_PURE_OR_PUSH_IF): Added. + (AT_YYERROR_SEES_LOC_IF): push-parser makes this false. + (AT_PURE_LEX_IF): True if pure or push parser. + +2006-12-05 Joel E. Denny + + Document Yacc prologue alternatives and default %destructor's and + %printer's as experimental. Don't mention Java yet. Discussed at + . + * NEWS (2.3a+): Say they're experimental. Remove any mention of Java. + (2.3a): Annotate this entry to say the old forms of these features were + also experimental. + * doc/bison.texinfo (Prologue Alternatives, Freeing Discarded Symbols, + Table of Symbols): Say they're experimental. Comment out any mention + of Java (we'll want this back eventually). + +2006-12-01 Joel E. Denny + + Support a file name argument to %defines. Deprecate `=' in + %file-prefix, %name-prefix, and %output. Discussed at + . + * NEWS (2.3a+): Mention. + * doc/bison.texinfo (Decl Summary, Table of Symbols): Add entry for new + form of %defines, and remove `=' from entries for %file-prefix, + %name-prefix, and %output. + * src/parse-gram.y (prologue_declaration): Implement. + * tests/calc.at (Simple LALR Calculator, Simple GLR Calculator, Simple + LALR1 C++ Calculator, Simple GLR C++ Calculator): Remove the `=' from + all but one occurrence of %name-prefix. + * tests/headers.at (export YYLTYPE): Remove the `=' from %name-prefix. + * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Likewise. + * tests/output.at (AT_CHECK_OUTPUT): Remove the `=' from all but one + occurrence of each of %file-prefix and %output. Add check for %defines + with argument. + * tests/reduce.at (Useless Terminals, Useless Nonterminals, + Useless Rules, Reduced Automaton, Underivable Rules, Empty Language): + Remove the `=' from %output. + +2006-11-21 Joel E. Denny + + Don't escape $ in test case titles since Autoconf 2.61 now does that + correctly. + * tests/actions.at (Default %printer and %destructor are not for error + or $undefined): Here. + (Default %printer and %destructor are not for $accept): Here. + * tests/input.at (Invalid $n and @n): Here. + +2006-11-20 Joel E. Denny + + Rename to <>. Discussed starting at + . + * NEWS (2.3a+): Update. + * doc/bison.texinfo (Freeing Discarded Symbols, Table of Symbols): + Update. + * src/parse-gram.y (TYPE_TAG_NONE, generic_symlist_item): Implement. + * src/scan-gram.l (INITIAL): Implement. + * src/symlist.c (symbol_list_default_tagless_new): Update comment. + * src/symlist.h (symbol_list, symbol_list_default_tagless_new): Update + comment. + * tests/actions.at (Default tagless %printer and %destructor, + Default tagged and per-type %printer and %destructor, + Default %printer and %destructor are not for error or $undefined, + Default %printer and %destructor are not for $accept, + Default %printer and %destructor for mid-rule values): Update. + * tests/input.at (Default %printer and %destructor redeclared, + Unused values with default %destructor): Update. + +2006-11-17 Joel E. Denny + + Don't let %prec take a nonterminal. + * src/reader.c (grammar_current_rule_prec_set): Make the %prec symbol a + token. + * tests/input.at (%prec takes a token): New test checking that %prec + won't take a nonterminal. + +2006-11-10 Joel E. Denny + + * tests/testsuite.at (AT_CHECK): Don't miss an exit value of 0 because + it was double-quoted. + * src/Makefile.am (YACC): Use --warnings=all,error so that Bison's own + grammar is maintained with Bison's highest standards. + * src/getargs.c: Fix some typos in Doxygen comments. + +2006-11-10 Joel E. Denny + + Fix memory leaks in scanners generated by at least Flex 2.5.9 and + later. Reported by Paul Eggert in + . + * src/flex-scanner.h (yylex_destroy): Define for Flex before 2.5.9. + * src/scan-code.l (translate_action): Don't bother invoking + yy_delete_buffer (YY_CURRENT_BUFFER) before creating the first buffer. + (code_scanner_free): Instead of invoking + yy_delete_buffer (YY_CURRENT_BUFFER) directly, invoke yylex_destroy, + which frees more. + * src/scan-gram.l (gram_scanner_free): Likewise. + * src/scan-skel.l (scan_skel): Likewise. + +2006-11-09 Joel E. Denny + + * src/files.c (tr): Change return type to void. + * src/muscle_tab.c (muscle_insert): Free storage in case muscle_grow + has been called previously for the same key. + (muscle_find): Return storage instead of value so that + --enable-gcc-warnings doesn't produce warnings that the return discards + const. aver that the value and storage are the same since storage + could potentially be NULL when value is not. + * tests/testsuite.at (AT_CHECK): Treat an unspecified exit value the + same as 0. + +2006-11-08 Paul Eggert + + * bootstrap.conf (excluded_files): Exclude m4/codeset.m4 (undoing + the earlier change today), m4/intl.m4, m4/intldir.m4. This gives + us a slightly cleaner distribution, and also works. + * m4/.cvsignore: Add inline.m4, wint_t.m4 to accommodate recent + gnulib changes. + +2006-11-08 Joel E. Denny + and Paul Eggert + + Don't let Bison leak memory except when it complains. + * src/files.h (parser_file_name, spec_verbose_file, spec_graph_file): + (spec_defines_file, dir_prefix): Now char *, not const char *, + since they are freed. + * src/files.c: Likewise. + (all_but_ext, all_but_tab_ext, src_extension, header_extension): + Likewise. + (tr): Now operates in-place. All uses changed. + (compute_exts_from_gf, compute_exts_from_src): Don't leak temporary + values. + (compute_file_name_parts, compute_output_file_names): Don't store + read-only data in variables that will be freed. + (compute_output_file_names): Free all_but_ext, all_but_tab_ext, + src_extension, and header_extension. + (output_file_names_free): New public function to free + spec_verbose_file, spec_graph_file, spec_defines_file, + parser_file_name, and dir_prefix. + * src/getargs.c (getargs): Don't store read-only data in variables that + will be freed. + * src/main.c (main): Invoke output_file_names_free, code_scanner_free + (which previously existed but was unused), and quotearg_free. + * src/muscle_tab.h (muscle_insert): value arg is now a `char const *'. + * src/muscle_tab.c: Likewise. + (muscle_entry): Make the value char const *, + and add a new storage member that is char * and can be freed. + (muscle_entry_free): New private function. + (muscle_init): Use it instead of free. + (muscle_insert, muscle_grow): Update and use new storage member. + (muscle_code_grow): Free the string passed to muscle_grow + since it's not needed anymore. + * src/parse-gram.y (%union): Make `chars' member a `char const *', and + add a new `char *code' member. + ("{...}"): Declare semantic type as code. + * src/scan-code.h (translate_rule_action): + (translate_symbol_action, translate_code, translate_action): Return + `char const *' rather than `char *' since external code should not free + these strings. + * src/scan-code.l: Likewise. + * src/scan-gram.l (): Use val->code for BRACED_CODE, + which is "{...}" in the parser. + * tests/Makefile.am (maintainer-check-valgrind): Set + VALGRIND_OPTS='--leak-check=full --show-reacheable=yes' before invoking + Valgrind. + * tests/calc.at (_AT_DATA_CALC_Y): fclose the FILE* so Valgrind doesn't + complain. + * tests/testsuite.at (AT_CHECK): Redefine so that running Bison and + expecting a non-zero exit status sets --leak-check=summary and + --show-reachable=no for Valgrind. Bison unabashedly leaks memory in + this case, and we don't want to hear about it. + +2006-11-08 Paul Eggert + + * bootstrap (runtime-po/Makevars): Derive from po/Makevars + instead of from the template, to simplify configuration a bit. + * bootstrap.conf (excluded_files): Don't exclude m4/codeset.m4 + and m4/wint_t.m4, as they are needed with the latest gnulib. + +2006-10-31 Joel E. Denny + + Disable unset/unused mid-rule value warnings by default, and recognize + --warnings=midrule-values to enable them. Discussed starting at + . + * NEWS (2.3a+): Mention. + * src/getargs.c, src/getargs.h (warnings_args, warnings_types, enum + warnings): Add entry for midrule-values subargument. + * src/reader.c (symbol_should_be_used): Don't return true just because + the value is a set/used mid-rule value unless + --warnings=midrule-values was specified. + * tests/input.at (Unused values, Unused values before symbol + declarations): Run tests with and without --warnings=midrule-values. + + * src/reader.c (check_and_convert_grammar): Use symbol_list_free rather + than LIST_FREE directly. + +2006-10-31 Joel E. Denny + + Finish implementing --warnings=error, which should not be implied by + --warnings=all (or by its synonyms -W and --warnings without + subarguments). + * src/complain.c (set_warning_issued): New function to report that + warnings are being treated as errors and to record an error if so. + Invoke... + (warn_at, warn): ... here. + * src/getargs.c (warnings_args, warnings_types): Reorder so that + "error - warnings are errors" does not appear above "all - all of the + above". + (getargs): For -W and --warnings without subarguments, don't let + FLAGS_ARGMATCH set warnings_error in warnings_flag. + * src/getargs.h (enum warnings): Unset warnings_error in warnings_all. + +2006-10-31 Joel E. Denny + + * src/getargs.c (flags_argmatch): Don't cause segmentation fault for + empty subargument list. For example: `bison --warnings= parser.y'. + +2006-10-21 Joel E. Denny + + * data/push.c, data/yacc.c: Make sure there's a newline at the end of + the parser header file so that gcc doesn't warn. + +2006-10-21 Joel E. Denny + + Split the default %destructor/%printer into two kinds: <*> and . + Discussed starting at + . + * NEWS (2.3a+): Mention. + * doc/bison.texinfo (Freeing Discarded Symbols): Document this and the + previous change today related to mid-rules. + (Table of Symbols): Remove %symbol-default and add <*> and . + * src/parse-gram.y (PERCENT_SYMBOL_DEFAULT): Remove. + (TYPE_TAG_ANY): Add as <*>. + (TYPE_TAG_NONE): Add as . + (generic_symlist_item): Remove RHS for %symbol-default and add RHS's + for <*> and . + * src/scan-gram.l (PERCENT_SYMBOL_DEFAULT): Remove. + (TYPE_TAG_ANY, TYPE_TAG_NONE): Add. + * src/symlist.c (symbol_list_default_new): Split into tagged and + tagless versions. + (symbol_list_destructor_set, symbol_list_printer_set): Split + SYMLIST_DEFAULT case into SYMLIST_DEFAULT_TAGGED and + SYMLIST_DEFAULT_TAGLESS. + * src/symlist.h: Update symbol_list_default*_new prototypes. + (symbol_list.content_type): Split enum value SYMLIST_DEFAULT into + SYMLIST_DEFAULT_TAGGED and SYMLIST_DEFAULT_TAGLESS. + * src/symtab.c (default_destructor, default_destructor_location, + default_printer, default_printer_location): Split each into tagged and + tagless versions. + (symbol_destructor_get, symbol_destructor_location_get, + symbol_printer_get, symbol_printer_location_get): Implement tagged + default and tagless default cases. + (default_destructor_set, default_printer_set): Split each into tagged + and tagless versions. + * src/symtab.h: Update prototypes. + * tests/actions.at (Default %printer and %destructor): Rename to... + (Default tagless %printer and %destructor): ... this, and extend. + (Per-type %printer and %destructor): Rename to... + (Default tagged and per-type %printer and %destructor): ... this, and + extend. + (Default %printer and %destructor for user-defined end token): Extend. + (Default %printer and %destructor are not for error or $undefined): + Update. + (Default %printer and %destructor are not for $accept): Update. + (Default %printer and %destructor for mid-rule values): Extend. + * tests/input.at (Default %printer and %destructor redeclared): Extend. + (Unused values with default %destructor): Extend. + +2006-10-21 Joel E. Denny + + Don't apply the default %destructor/%printer to an unreferenced midrule + value. Mentioned at + . + * src/symtab.c (dummy_symbol_get): Name all dummy symbols initially + like $@n instead of just @n so that the default %destructor/%printer + logic doesn't see them as user-defined symbols. + (symbol_is_dummy): Check for both forms of the name. + * src/reader.c (packgram): Remove the `$' from each midrule symbol + name for which the midrule value is referenced in any action. + * tests/actions.at (Default %printer and %destructor for mid-rule + values): New test. + * tests/regression.at (Rule Line Numbers, Web2c Report): Update output + for change to dummy symbol names. + +2006-10-20 Joel E. Denny + + Warn about unset midrule $$ if the corresponding $n is used. + * src/reader.c (symbol_should_be_used): Check midrule parent rule for + $n usage. + (packgram): Before invoking grammar_rule_check on any rule, make sure + all actions have already been scanned in order to set `used' flags. + Otherwise, checking that a midrule's $$ is set will not always work + properly because the midrule check must forward-reference the midrule's + parent rule. + * tests/input.at (AT_CHECK_UNUSED_VALUES): Extend to check the new + warning. + +2006-10-20 Joel E. Denny + + More improvements to the documentation of the prologue alternatives: + * NEWS (2.3a+): Mention the new `Prologue Alternatives' section in the + Bison manual. + * doc/bison.texinfo (Prologue Alternatives): Correct some errors. Add + some text to clarify the relative importance of the new directives and + to show how these directives may be viewed as code labels. + +2006-10-16 Joel E. Denny + + Similar to the recently removed %before-header, add %code-top as the + alternative to the pre-prologue. Mentioned at + . + Also, let the prologue alternatives appear in the grammar section. + * src/parse-gram.y (PERCENT_CODE_TOP): New token. + (prologue_declaration): Move the existing prologue alternatives to... + (grammar_declaration): ... here and add %code-top. + * src/scan-gram.l (PERCENT_CODE_TOP): New token. + + Clean up and extend documentation for the prologue alternatives. + * NEWS (2.3a+): Describe prologue alternatives. + * doc/bison.texinfo (Prologue): Move discussion of prologue + alternatives to... + (Prologue Alternatives): ... this new section, and extend it to discuss + all 4 directives in detail. + (Table of Symbols): Clean up discussion of prologue alternatives and + add %code-top. + +2006-10-16 Juan Manuel Guerrero + + DJGPP specific issues. + + * djgpp/config.bat: config.hin has been moved to lib. Adjust + config.bat accordingly. + * djgpp/config.sed: Adjust config.sed for the use of autoconf 2.60. + * djgpp/config.site: Likewise. + +2006-10-16 Paolo Bonzini + + Replace %*-header with %provides, %requires, %code. See discussion at + http://lists.gnu.org/archive/html/bison-patches/2006-10/msg00002.html + + * data/bison.m4 (b4_user_requires, b4_user_provides): New. + (b4_user_start_header): Remove. + * data/glr.c: Use new macros instead of b4_*start_header + and b4_*end_header. + * data/glr.cc: Likewise. + * data/lalr1.cc: Likewise. + * data/push.c: Likewise. + * data/yacc.c: Likewise. + + * doc/bison.texinfo: Remove %before-header, rename + %{start,end,after}-header to %requires, %provides, %code. + + * src/parse-gram.y: Likewise (also rename token names accordingly). + * src/scan-gram.l: Likewise. + * tests/actions.at: Likewise. + +2006-10-14 Paul Eggert + + * lib/Makefile.am (AM_CFLAGS): Remove $(WERROR_CFLAGS). + Problem reported by Joel E. Denny. + +2006-10-14 Jim Meyering + + (Sync from coreutils.) + Work also when the working directory (with e.g. coreutils sources) + is version controlled with git, rather than CVS. + * bootstrap (CVS_only_file): Test for the existence of README-cvs, + rather than CVS. + In messages and comments, say e.g., "checked-out sources", + rather than "CVS sources". + (version_controlled_file): New function. Work for git as well as + for CVS. Don't use grep's -q option. + (slurp): Call it here, in place of CVS-specific code. + +2006-10-14 Joel E. Denny + + Fix testsuite for ./configure --enable-gcc-warnings: + * configure.ac (gcc-warnings): Move -Wall before -Wno-sign-compare. + Otherwise, gcc 4.1.0 (at least) warns about sign comparisons in + __AT_CHECK_PRINTER_AND_DESTRUCTOR in tests/actions.at. + * test/input.at (Torturing the Scanner): #include for abort. + * test/regression.at (Diagnostic that expects two alternatives): + Likewise. + +2006-10-12 Paul Eggert + + * bootstrap.conf (gnulib_modules): Add config-h. + * djgpp/subpipe.c: Include unconditionally; don't + worry about HAVE_CONFIG_H. + * lib/abitset.c: Likewise. + * lib/bitset.c: Likewise. + * lib/bitset_stats.c: Likewise. + * lib/bitsetv-print.c: Likewise. + * lib/bitsetv.c: Likewise. + * lib/ebitset.c: Likewise. + * lib/get-errno.c: Likewise. + * lib/lbitset.c: Likewise. + * lib/subpipe.c: Likewise. + * lib/timevar.c: Likewise. + * lib/vbitset.c: Likewise. + * lib/bitset.c: Include "bitset.h" first, to test interface. + * lib/bitset_stats.c: Include "bitset_stats.h" first. + * lib/bitsetv-print.c: Include "bitsetv-print.h" first. + * lib/bitsetv.c: Include "bitsetv.h" first. + * lib/get-errno.c: Include "get-errno.h" first. + * m4/.cvsignore: Add config-h.m4. + * tests/actions.at (Default %printer and %destructor for ...): + Adjust expected line numbers in output to reflect removal of #if + HAVE_CONFIG_H lines. + * tests/glr-regression.at (Missed %merge type warnings when ...): + Likewise. + * tests/regression.at (Braced code in declaration in rules section): + Likewise. + * tests/atlocal.in (CPPFLAGS): Don't define HAVE_CONFIG_H. + * tests/local.at (AT_DATA_GRAMMAR_PROLOGUE): + Include unconditionally. + + * bootstrap: Sync from coreutils, as follows: + + 2006-10-11 Paul Eggert + + * bootstrap (symlink_to_gnulib): Fix bug: the dot_dots shell + variable was sometimes used without being initialized. This + messed up the installation of the INSTALL file in some cases. + + 2006-10-09 Paul Eggert + + * bootstrap (usage, main program, symlink_to_gnulib): Add option + --copy. Inspired by a suggestion from Bruno Haible. + + 2006-10-03 Jim Meyering + + * bootstrap: Undo last change to this file, since now gnulib-tool + sticks with the automake default in generating dependencies. + +2006-10-12 Paul Eggert + + * configure.ac: Use AC_PROG_CC_STDC; this is more modern than + the old AC_PROG_CC / AM_PROG_CC_STDC combination. + + * doc/bison.1: Add copyright notice. + + * data/glr.c: Don't include ; not used. + + * NEWS: The -g and --graph options now output graphs in Graphviz + DOT format, not VCG format. + * doc/bison.1: Likewise. + * doc/bison.texinfo (Understanding, Bison Options): Likewise. + * THANKS: Add Satya Kiran Popuri, who proposed the initial version + of this change in + . + * TODO: Remove Graphviz entry. + * src/Makefile.am (bison_SOURCES): Add graphviz.c and graphviz.h; + remove vcg.c, vcg.h, vcg_defaults.h. + * src/vcg.c, src/vcg.h, src/vcg_defaults.h: Remove. + * src/graphviz.c, src/graphviz.h: New files. + * src/files.c (compute_output_file_names): Output .dot, not .vcg. + * src/files.h: Make comment more generic. + * src/main.c (main): Likewise. + * src/print_graph.h: Likewise. + * src/getargs.c (usage): Make usage description more generic. + * src/print_graph.c: Include graphviz.h rather than vcg.h. + (static_graph, fgraph): Remove. All uses changed to pass + arguments instead of sharing a static var. + (print_core, print_actions, print_state, print_graph): + Output graphviz format rather than VCG format. + * tests/.cvsignore: Remove *.vcg; add *.dot. + * tests/output.at: Expect *.dot files, not *.vcg files. + + * data/Makefile.am (dist_pkgdata_DATA): Add bison.m4; this + accommodates the 2006-10-08 change. + +2006-10-11 Bob Rossi + + * data/push.c (yypushparse, yypvarsinit, yypvars): Wrap in b4_push_if. + (b4_yyssa, b4_yyerror_range): New macros. + (struct yypvars): Remove yyssa_ptr and yyerror_range_ptr fields. + (yypvarsinit): Remove init of removed fields. + (yypushparse): Remove use of removed fields; use new macros instead. + +2006-10-11 Paul Eggert + + * data/push.c (yypushparse): Fix memory leak if yymsg is malloced + in a push parser. Reindent slightly to match yacc.c better. + +2006-10-11 Bob Rossi + + * data/push.c (struct yypvars): Remove yymsgbuf, yymsgbuf_ptr, yymsg, + yymsg_alloc fields. + (yypvarsinit, yypushparse): Remove init of removed fields. + (yypushparse): Use yymsgbuf instead of yymsgbuf_ptr. + +2006-10-09 Paul Eggert + + * THANKS: Add Paolo Bonzini and Bob Rossi. + +2006-10-08 Paolo Bonzini + + * data/c.m4 (b4_copyright, b4_epilogue, b4_location_initial_column, + b4_location_initial_line, p4_parse_param, b4_ints_in, b4_flag_if, + b4_define_flag_if and uses, b4_basename, b4_syncline, b4_user_code, + b4_define_user_cde and uses): Remove. + (b4_comment, b4_prefix, b4_sync_start): New. + * data/bison.m4: New file, with most of the content removed from c.m4. + * src/muscle_tab.h: Use "do {...} while(0)" throughout. + * src/output.c (output_skeleton): Pass bison.m4. + (prepare): Pass glr_flag and nondeterministic_flag. Pass prefix + only if specified. + +2006-10-05 Paul Eggert + + Fix test failure reported by Tom Lane in + + and try to make such failures easier to catch in the future. + * data/glr.c (YYTRANSLATE): Don't check for nonpositive arg; + that's now the caller's responsibility. + (yyprocessOneStack, yyrecoverSyntaxError, yyparse): + Set yychar = YYEOF if it's negative. + * tests/actions.at (yylex): Abort if asked to read past EOF. + * tests/conflicts.at (yylex): Likewise. + * tests/cxx-type.at (yylex): Likewise. + * tests/glr-regression.at (yylex): Likewise. + * tests/input.at (yylex): Likewise. + * tests/regression.at (yylex): Likewise. + * tests/torture.at (yylex): Likewise. + +2006-10-01 Paul Eggert + + Fix problems with translating English-language diagnostics. + * bootstrap: Fix bug introduced in recent bootstrap changes, with + respect to bison-runtime pot generation. The YY_ stuff + wasn't being captured. + * bootstrap.conf (XGETTEXT_OPTIONS_RUNTIME): New var. + * po/POTFILES.in: Add src/location.c, src/scan-code.l. + * runtime-po/POTFILES.in: Add data/push.c. + +2006-09-29 Paul Eggert + + Merge bootstrap changes from coreutils. + + 2006-09-28 Jim Meyering + + Automatically generated dependencies are important even + when all of the sources in a directory come from gnulib. + * bootstrap (gnulib_tool): Remove the "no-dependencies" automake + option that gnulib-tool adds to what becomes our lib/gnulib.mk. + + 2006-09-23 Jim Meyering + + * bootstrap (gnulib_tool_options): Add "--local-dir gl". + + 2006-09-20 Paul Eggert + + * bootstrap: Add support for --force. + (usage): New function. Describe usage less tersely. + (CVS_only_file): New var. + +2006-09-21 Paul Eggert + + * data/push.c (YYPUSH_MORE): Make it an enum instead. + (yypushparse): Use YYPUSH_MORE instead of the mystery constant. + Adjust white space and comments to match GNU style better. + +2006-09-20 Bob Rossi + + * data/push.c (yyresult_get): Remove function. + (YYPUSH_MORE): Add #define. + (yypushparse): Modify return value. + +2006-09-20 Paul Eggert + + * stamp-h.in: Remove; no longer needed. + * .cvsignore: Replace autom4te.cache and config.cache with *.cache. + Remove config.h, config.hin, intl (no longer created). + * lib/.cvsignore: Add config.h, config.hin, configmake.h, inttypes.h, + stamp-h1. + + Sync bootstrap from coreutils, as follows: + + 2006-09-18 Paul Eggert + + * bootstrap (symlink_to_gnulib): New function. + (cp_mark_as_generated): Use it, to prefer symlinks-to-gnulib + to copies-of-gnulib. + (cp_mark_as_generated, slurp, gnulib_files): + Avoid making a copy if it's the same as the old version. + (gnulib_files): Add support for this variable (used by Bison). + +2006-09-20 Paul Eggert + + * src/getargs.c (usage): Rework to use conventions similar to + coreutils, to make translation a bit easier and the code a bit + smaller. Problem reported by Tim Van Holder. + +2006-09-15 Paul Eggert + + Use some of gnulib's new modules, taken from coreutils. + + * bootstrap: Sync from coreutils, except add support for gnulib_files. + * bootstrap.conf: New file. + (gnulib_modules): Add configmake, inttypes, unistd. + (XGETTEXT_OPTIONS): Add complain, complain_at, + fatal, fatal_at, warn, warn_at, unexpected_end. + * configure.ac (AC_CONFIG_HEADERS): config.h is now in lib, not here. + (gl_USE_SYSTEM_EXTENSIONS): Remove; gl_EARLY now does this. + (gl_EARLY): Add. + (AM_STDBOOL_H): Remove; gl_INIT now dows this. + (gl_INIT): Add + (GNULIB_AUTOCONF_SNIPPET): Remove. + (AM_GNU_GETTEXT): Add; require formatstring macros since that's + the pickiest. + * lib/.cvsignore: Add inttypes_.h. + * lib/Makefile.am: Include gnulib.mk first so we can append to it. + (AM_CFLAGS): Add WERROR_CFLAGS, to be more like coreutils. + (BUILT_SOURCES, EXTRA_DIST, MOSTLYCLEANFILES): Remove + no-longer-necessary initializations. + (lib_SOURCES): Remove, replacing by libbison_a_SOURCES. + * lib/subpipe.c: Include unconditionally, now that we + use the unistd module. + * src/system.h: Likewise. + * m4/.cvsignore: Remove *_gl.m4, gnulib.m4, inttypes_h.m4, uintmax_t.m4, + ulonglong.m4. Add gettext.m4, gnulib-cache.m4, gnulib-comp.m4, + gnulib-tool.m4, inttypes-h.m4, inttypes-pri.m4, inttypes.m4. + * src/Makefile.am (DEFS): Remove, since configmake does this for us. + (AM_CPPFLAGS): Remove -I../lib, since Automake does that for us. + * src/system.h: Include inttypes.h unconditionally, now that we + use the inttypes module. Don't bother to include stdint.h, since + inttypes.h now does that for us. + (LOCALEDIR): Remove, now that we use the configmake module. + * src/getargs.c: Include configmake.h. + * src/main.c: Likewise. + * src/output.c: Likewise. + * tests/atlocal.in (CPPFLAGS): Include from $abs_top_builddir/lib, + not from $abs_top_builddir, since config.h moved. + + + Port to GCC 2.95. First two problems reported by Michael Deutschmann in + . + + * src/parse-gram.y (symbol_declaration): Don't put statements + before declarations; it's not portable to C89. + * src/scan-code.l (handle_action_at): Likewise. + + * src/scan-code.l: Always initialize braces_level; the old code + left it uninitialized and therefore had undefined behavior. + + Don't attempt to redefine 'assert', since it runs afoul of + systems where standard headers (mistakenly) include . + Instead, define and use our own alternative, called 'aver'. + * src/reader.c: Don't include assert.h, since we no longer + use assert. + * src/scan-code.l: Likewise. + * src/system.h (assert): Remove, replacing with.... + (aver): New function, taking a bool arg. All uses changed. + * src/tables.c (pack_vector): Ensure that aver arg is bool, + not merely an integer. + +2006-09-15 Bob Rossi + + * data/Makefile.am (dist_pkgdata_DATA): Add push.c. + * data/c.m4 (YYPUSH): New. + (b4_push_if): New macro. Use it instead of #ifdef YYPUSH. + * src/getargs.c (push_parser): New var. + * src/getargs.h (push_parser): New declaration. + * src/output.c (prepare): Add macro insertion of `push_flag'. + * src/parse-gram.y (PERCENT_PUSH_PARSER): New token. + (prologue_declaration): Parse %push-parser. + * src/scan-gram.l: Scan new PERCENT_PUSH_PARSER token. + * tests/calc.at (_AT_CHECK_CALC_ERROR): Add "Return" and "Now" to + list of removed lines from the traces observed. + (AT_CHECK_CALC_LALR): Added push parser tests. + +2006-09-13 Paul Eggert + + * NEWS: Version 2.3a. + * configure.ac (AC_INIT): Likewise. + + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Remove + "#define YYSTYPE int" that caused "make maintainer-check" to fail + due to header ordering dependencies. I don't know why the #define + was there. + + Fix glr.cc and lalr1.cc's use of YYDEBUG so that there's zero + runtime cost when YYDEBUG is not defined, and so that some tests + that used to fail now work. Problem and initial suggestion by + Paolo Bonzini. + * data/c++.m4 (b4_parse_param_cons): Omit leading ','. + * data/glr.cc (b4_parser_class_name): + Initialize yycdebug_ only if YYDEBUG. Also, initialize yydebug_. + (debug_level, set_debug_level): Affect yydebug_, not ::yydebug. + (yydebug_) [YYDEBUG]: New member. + (yycdebug_): Now defined only if YYDEBUG. + * data/lalr1.cc (yydebug_, yycdebug_): Now defined only if YYDEBUG. + (YYCDEBUG) [!YYDEBUG]: Don't use yydebug_ and yycdebug_. + (b4_parser_class_name): Initialize yydebug_ and yycdebug_ only + if YYYDEBUG. + (debug_stream, set_debug_stream, debug_level, set_debug_level): + Define only if YYDEBUG. + * tests/calc.at (_AT_DATA_CALC_Y) [!YYDEBUG]: Omit call to + set_debug_level. + * tests/regression.at (_AT_DATA_DANCER_Y) [!YYDEBUG]: Likewise. + * tests/calc.at (AT_CHECK_CALC_GLR_CC): Uncomment calls to + AT_CHECK_CALC_GLR_CC that are working now. + +2006-09-12 Paul Eggert + + * data/glr.cc (YYERROR_VERBOSE, YYTOKEN_TABLE): Remove. + We don't need them in glr.cc, and glr.c defines them. + Defining YYERROR_VERBOSE to 0 here breaks glr.c, since glr.c + assumes that defining it to anything is the same as defining + it to 1. Problem reported by Paolo Bonzini. + +2006-09-12 Paolo Bonzini (tiny change) + + * data/c.m4 (b4_null, b4_case): Define. + * src/output.c (prepare_symbols): Use b4_null. + (user_actions_output): Use b4_case. + +2006-09-11 Paul Eggert + + * data/glr.c (b4_shared_declarations): Put start-header first, + before any #includes that we generate, so that feature-test + macros work. Problem reported by Michael Deutschmann in + . + * data/lalr1.cc: Likewise. + * doc/bison.texinfo (Prologue): Document that feature-test macros + should be defined before any Bison declarations. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Put defns + that depend on location.hh after, not before, Bison decls, since + we now include location.hh after the first user prologue. + + * doc/bison.texinfo (Calc++ Parser): Fix memory leak reported by + Sander Brandenburg in + . + Also, fix minor white space and comment issues. + (Prologue): Mention that it's better to define feature-test macros + before Bison declarations. Problem reported by Michael Deutschmann. + + * README-cvs: Fix typo: "&" should be "&&". Problem reported + by Jim Meyering. + * m4/.cvsignore: Add argmatch.m4. Remove obstack.m4, strerror_r.m4. + This adjusts to recent gnulib changes. + +2006-09-04 Joel E. Denny + + Finish implementation of per-type %destructor/%printer. Discussed + starting at + + and + . + * NEWS (2.3+): Add a description of this feature to the default + %destructor/%printer description. + * doc/bison.texinfo (Freeing Discarded Symbols): Likewise. + * src/symlist.c (symbol_list_destructor_set, symbol_list_printer_set): + Invoke semantic_type_destructor_set or semantic_type_printer_set when a + list node contains a semantic type. + * src/symtab.c, src/symtab.h: Extend with a table that associates + semantic types with their %destructor's and %printer's. + (semantic_type_from_uniqstr, semantic_type_get, + semantic_type_destructor_set, semantic_type_printer_set): New functions + composing the public interface of that table. + (symbol_destructor_get, symbol_destructor_location_get, + symbol_printer_get, symbol_printer_location_get): If there's no + per-symbol %destructor/%printer, look up the per-type before trying + the default. + * tests/actions.at (Per-type %printer and %destructor): New test case. + * tests/input.at (Default %printer and %destructor redeclared): + Extend to check that multiple occurrences of %symbol-default in a + single %destructor/%printer declaration is an error. + (Per-type %printer and %destructor redeclared, Unused values with + per-type %destructor): New test cases. + +2006-09-04 Joel E. Denny + + Require default %destructor/%printer to be declared using + %symbol-default instead of an empty symbol list, and start working on + new per-type %destructor/%printer. Discussed at + . + * NEWS (2.3+): Add %symbol-default to example. + * bison.texinfo (Freeing Discarded Symbols): Likewise. + (Table of Symbols): Add entry for %symbol-default. + * src/parse-gram.y (PERCENT_SYMBOL_DEFAULT): New token. + (generic_symlist, generic_symlist_item): New nonterminals for creating + a list in which each item is a symbol, semantic type, or + %symbol-default. + (grammar_declaration): Use generic_symlist in %destructor and %printer + declarations instead of symbols.1 or an empty list. + (symbol_declaration, precedence_declaration, symbols.1): Update actions + for changes to symbol_list. + * src/reader.c: Update for changes to symbol_list. + * src/scan-code.l: Likewise. + * src/scan-gram.l: Scan new PERCENT_SYMBOL_DEFAULT token. + * src/symlist.c, src/symlist.h: Extend such that a list node may + represent a semantic type or a %symbol-default in addition to just an + ordinary symbol. Add switched functions for setting %destructor's and + %printer's. + * tests/actions.at, tests/input.at: Add %symbol-default to all default + %destructor/%printer declarations. + +2006-08-23 Joel E. Denny + + Whether the default %destructor/%printer applies to a particular symbol + isn't a question of whether the user *declares* that symbol (in %token, + for example). It's a question of whether the user by any means + *defines* the symbol at all (by simply using a char token, for + example). $end is defined by Bison whereas any other token with token + number 0 is defined by the user. The error token is always defined by + Bison regardless of whether the user declares it with %token, but we + may one day let the user define error as a nonterminal instead. + * NEWS (2.3+): Say "user-defined" instead of "user-declared". + * doc/bison.texinfo (Freeing Discarded Symbols): Likewise, and document + the meaning of "user-defined". + * tests/actions.at (Default %printer and %destructor for user-declared + end token): Rename to... + (Default %printer and %destructor for user-defined end token): ... + this. + + * src/symtab.c (symbol_destructor_get, symbol_printer_get): In the + computation of whether to apply the default, don't maintain a list of + every Bison-defined symbol. Instead, just check for a first character + of '$', which a user symbol cannot have, and check for the error token. + +2006-08-21 Joel E. Denny + + Don't apply the default %destructor or %printer to the error token, + $undefined, or $accept. This change fits the general rule that the + default %destructor and %printer are only for user-declared symbols, + and it solves several difficulties that are described in the new test + cases listed below. + * src/symtab.c (symbol_destructor_get, symbol_printer_get): Implement. + * tests/actions.at (Default %printer and %destructor are not for error + or $undefined, Default %printer and %destructor are not for $accept): + New test cases. + +2006-08-19 Joel E. Denny + + Allow %start after the first rule. + * src/reader.c (grammar_current_rule_begin): Don't set the start symbol + when parsing the first rule. + (check_and_convert_grammar): Search for it here after all grammar + declarations have been parsed. Skip midrules, which have dummy LHS + nonterminals. + * src/symtab.c (symbol_is_dummy): New function. + * src/symtab.h (symbol_is_dummy): Declare it. + * tests/input.at (%start after first rule): New test. + +2006-08-18 Joel E. Denny + + Redo some of the previous commit: add back the ability to use + non-aliased/undeclared string literals since it might be useful to + those declaring %token-table. + * src/reader.c (check_and_convert_grammar): Undo changes in previous + commit: don't worry about complaints from symbols_pack. + * src/symtab.c (symbol_new, symbol_class_set, + symbol_check_alias_consistency): Undo changes in previous commit: count + each string literal as a new symbol and token, assign it a symbol + number, and don't complain about non-aliased string literals. + (symbols_pack): Since symbol_make_alias still does not decrement symbol + and token counts but does still set aliased tokens to the same number, + symbol_pack_processor now leaves empty slots in the symbols array. + Remove those slots. + * tests/regression.at (Undeclared string literal): Remove test case + added in previous commit since non-aliased string literals are allowed + again. + (Characters Escapes, Web2c Actions): Undo changes in previous commit: + remove unnecessary string literal declarations. + * tests/sets.at (Firsts): Likewise. + +2006-08-18 Joel E. Denny + + Don't allow an undeclared string literal, but allow a string literal to + be used before its declaration. + * src/reader.c (check_and_convert_grammar): Don't invoke packgram if + symbols_pack complained. + * src/symtab.c (symbol_new): Don't count a string literal as a new + symbol. + (symbol_class_set): Don't count a string literal as a new token, and + don't assign it a symbol number since symbol_make_alias does that. + (symbol_make_alias): It's not necessary to decrement the symbol and + token counts anymore. Don't assume that an alias declaration occurs + before any uses of the identifier or string, and thus don't assert that + one of them has the highest symbol number so far. + (symbol_check_alias_consistency): Complain if there's a string literal + that wasn't declared as an alias. + (symbols_pack): Bail if symbol_check_alias_consistency failed since + symbol_pack asserts that every token has been assigned a symbol number + although undeclared string literals have not. + * tests/regression.at (String alias declared after use, Undeclared + string literal): New test cases. + (Characters Escapes, Web2c Actions): Declare string literals as + aliases. + * tests/sets.at (Firsts): Likewise. + +2006-08-14 Joel E. Denny + + In the grammar scanner, STRING_FINISH unclosed constructs and return + them to the parser in order to improve error messages. + * src/scan-gram.l (SC_ESCAPED_STRING, SC_ESCAPED_CHARACTER, + SC_BRACED_CODE, SC_PROLOGUE): Implement. + * tests/input.at (Unclosed constructs): New test case. + * tests/regression.at (Invalid inputs): Update now that unclosed %{ is + seen. + + * src/scan-gram.h, src/scan-gram.l (gram_last_braced_code_loc): Remove + unused global. + +2006-08-13 Joel E. Denny + + Handle string aliases for character tokens correctly. + * src/symtab.c (symbol_user_token_number_set): If the token has an + alias, check and set its alias's user token number instead of its own, + which is set to indicate the alias. Previously, every occurrence of + the character token in the grammar overwrote that alias indicator with + the character code. + * tests/input.at (String aliases for character tokens): New test. + +2006-08-12 Joel E. Denny + + * src/parse-gram.y: Add `%expect 0' so we don't overlook conflicts. + +2006-08-11 Paul Eggert + + * bootstrap: Put in need-ngettext argument to AM_GNU_GETTEXT, + to prevent failures when building on older platforms. + Check for autopoint failure. + Set XGETTEXT_OPTIONS to values that check for C format strings, + so that translators are warned about them (this also helps + prevent core dumps). + + * lib/subpipe.c (create_subpipe): Use new gnulib pipe_safer + function, since it simplifies our code a bit. + + * configure.ac (AC_ARG_ENABLE): Use -Wextra -Wno-sign-compare + rather than -W, so we don't get bogus warnings about sign comparisons. + Add -Wpointer-arith, since that warning is useful (it reports code + that does not conform to C89 and that some compilers reject). + * data/c.m4, data/glr.c, data/lalr1.cc, data/yacc.c: Undo latest change, + since it's no longer needed. + +2006-08-10 Joel E. Denny + + Clean up scanners a bit. + * src/flex-scanner.h (FLEX_NO_OBSTACK): New macro that blocks obstack + definitions so gcc won't warn when obstack_for_string is unused. + * src/scan-code.l: config.h and system.h are already #include'd by + scan-code-c.c, so get rid of them here. + * src/scan-gram.l: Likewise. + * src/scan-skel.l: Likewise, and use flex-scanner.h without obstack + definitions rather than duplicating the rest of it. + * src/scan-gram-c.c, scan-skel-c.c: #include "system.h". + +2006-08-09 Joel E. Denny + + Suppress signed/unsigned comparison warnings for yycheck. + * data/c.m4 (b4_safest_int_type): New macro. + * data/glr.c, data/lalr1.cc: Wherever you compare yycheck[i] against + a signed int type, cast it to b4_safest_int_type first. + * data/yacc.c: Likewise. + (b4_safest_int_type): Overwrite the one from c.m4 since b4_int_type is + also overwritten. + +2006-08-09 Ralf Wildenhues (tiny change) + + * doc/bison.texinfo: Fix some typos. + +2006-08-02 Paul Eggert + + * m4/.cvsignore: Add inttypes_h.m4,lib-ld.m4, lib-prefix.m4, + po.m4, stdint_h.m4, uintmax_t.m4, ulonglong.m4, warning.m4. + + * bootstrap (gnulib_tool): Stop using --assume-autoconf; + the latest gnulib does this a different way. + (get_translations): Sharuzzaman Ahmat Raslan reported that the ms + translation was patched, so stop omitting it. + +2006-07-29 Joel E. Denny + + Enable declaration of default %printer/%destructor. Make the parser + use these for all user-declared grammar symbols for which the user does + not declare a specific %printer/%destructor. Thus, the parser uses it + for token 0 if the user declares it but not if Bison generates it as + $end. Discussed starting at + , + , + and + . + * NEWS (2.3+): Mention. + * doc/bison.texinfo (Actions in Mid-Rule): It's no longer impossible to + declare a %destructor for a mid-rule's semantic value. It's just + impossible to declare one specific to it. + (Freeing Discarded Symbols): Mention that @$ can be used in %destructor + code. Describe default %destructor form. + * src/parse-gram.y (grammar_declaration): Parse default + %printer/%destructor declarations. + * src/output.c (symbol_destructors_output): Use symbol_destructor_get + and symbol_destructor_location_get rather than accessing the destructor + and destructor_location members of struct symbol. + (symbol_printers_output): Likewise but for %printer's. + * src/reader.c (symbol_should_be_used): Likewise but for %destructor's + again. + * src/symtab.c (default_destructor, default_destructor_location, + default_printer, default_printer_location): New static global + variables to record the default %destructor and %printer. + (symbol_destructor_get, symbol_destructor_location_get, + symbol_printer_get, symbol_printer_location_get): New functions to + compute the appropriate %destructor and %printer for a symbol. + (default_destructor_set, default_printer_set): New functions to set the + default %destructor and %printer. + * src/symtab.h: Prototype all those new functions. + * tests/actions.at (Default %printer and %destructor): New test to + check that the right %printer and %destructor are called, that they're + not called for $end, and that $$ and @$ work correctly. + (Default %printer and %destructor for user-declared end token): New + test to check that the default %printer and %destructor are called for + a user-declared end token. + * tests/input.at (Default %printer and %destructor redeclared, Unused + values with default %destructor): New tests to check related grammar + warnings and errors. + +2006-07-29 Joel E. Denny + + Clean up handling of %destructor for the end token (token 0). + Discussed starting at + + and + . + + Make the skeletons consistent in how they pop the end token and invoke + its %destructor. + * data/glr.c (yyrecoverSyntaxError, yyparse): Don't pop the start + state, which has token number 0, since this would invoke the + %destructor for the end token. + * data/lalr1.cc (yy::parser::parse): Don't check for the final state + until after shifting the end token, or else it won't be popped. + * data/yacc.c (yyparse): Likewise. + + * data/glr.c (yyparse): Clear the lookahead after shifting it even when + it's the end token. Upon termination, destroy an unshifted lookahead + even when it's the end token. + * data/lalr1.cc (yy::parser::parse): Likewise. + * data/yacc.c (yyparse): Likewise. + + * src/reader.c (packgram): Don't check rule 0. This suppresses unused + value warnings for the end token when the user gives the end token a + %destructor. + + * tests/actions.at (Printers and Destructors): Test all the above. + +2006-07-24 Paul Eggert + + Update to latest gnulib and gettext versions. + * bootstrap (gnulib-modules): Remove hard-locale, stdio-safer. + Add fopen-safer. + (gnulib_files): Add m4/warning.m4. Don't worry about files + overwritten by autopoint. + Replace gt_INTL_SUBDIR_CORE with an empty body in m4/gettext_gl.m4. + Suppress "id", "ms", "tr" translations for now, since gettext 0.15 + rejects them. + Don't use autoreconf; instead, invoke autopoint etc. by hand, + so that we can remove the intl files at a better time. + (intl_files_to_remove): Remove aclocal.m4, since it gets + rebuilt anyway. Remove m4/inttypes_h.m4, m4/inttypes.m4, + m4/isc-posix.m4, m4/lib-ld.m4, m4/lib-prefix.m4, m4/po.m4, + m4/stdint_h.m4, m4/uintmax_t.m4, m4/ulonglong.m4. + Add m4/inttypes-h.m4, m4/lock.m4, m4/visibility.m4. + Remove datarootdir hack; no longer needed. + * configure.ac: Use gl_WARNING_CFLAGS rather than BISON_WARNING. + (AM_GNU_GETTEXT_VERSION): Bump from 0.12 to 0.15. + * lib/.cvsignore: Remove hard-locale.c, hard-locale.h, strdup.c, + strdup.h. + * m4/.cvsignore: Remove hard-locale.m4, strdup.m4. + * m4/warning.m4: Remove from CVS, since we now use gnulib's version. + +2006-07-20 Paul Eggert + + * bootstrap: Adjust to today's change to gnulib-tool by invoking + it with --assume-autoconf='latest-stable'. + +2006-07-13 Joel E. Denny + + * src/parse-gram.y (grammar_declaration): Don't confuse Doxygen (at + least 1.4.7 and 1.4.4) by putting a #line between `typedef union + YYSTYPE' and `{'. + * src/muscle_tab.h (muscle_grow): Replace the header comments with + those from muscle_tab.c since the old ones are misleading. + +2006-07-13 Akim Demaille + + Support %define "KEY" {VALUE}. + * src/scan-code.h, src/scan-code.l (translate_action) + (translate_rule_action, translate_symbol_action, translate_code): + Return char *, not const char *. + * src/parse-gram.y (declaration): Rename as... + (prologue_declaration): this. + (string_content): Remove this nonterminal, use STRING. + (braceless, content, content.opt): New nonterminal. + Use them. + (%define): Now accept content.opt, i.e., accept also BRACED_CODE + as value. + * src/scan-gram.l (getargs.h): Don't include it. + +2006-07-12 Paul Eggert + + * data/lalr1.cc (YYCDEBUG): Use 'if (yydebug_) (*yycdebug_)' + rather than a for-loop that declares a local bool variable. This + should work around a compatibility problem with a Cray x1e C++ + compiler reported by Hung Nguyen in + . + The for-loop was introduced in the 2004-11-17 change but I don't + know why it was needed. + +2006-07-12 Akim Demaille + + * data/c.m4: Comment changes. + +2006-07-10 Akim Demaille + + * src/complain.c (error_message, ERROR_MESSAGE): New. + To factor... + (fatal_at, fatal, warn_at, warn, complain_at, complain): these. + * src/complain.h, src/complain.c (warning_issued): Remove, unused. + +2006-07-09 Paul Eggert + + * NEWS: Instead of %union, you can define and use your own union type + YYSTYPE if your grammar contains at least one tag. + Your YYSTYPE need not be a macro; it can be a typedef. + * doc/bison.texinfo (Value Type, Multiple Types, Location Type): + (Union Decl, Decl Summary): Document this. + * data/glr.c (YYSTYPE): Implement this. + * data/glr.cc (YYSTYPE): Likewise. + * data/lalr1.cc (YYSTYPE): Likewise. + * data/yacc.c (YYSTYPE): Likewise. + * src/output.c (prepare): Output tag_seen_flag. + * src/parse-gram.y (declaration, grammar_declaration): + Use 'union_seen' rather than 'typed' to determine whether + %union has been seen, since grammars can now be typed without + %union. + (symbol_declaration, type.opt, symbol_def): + Keep track of whether a tag has been seen. + * src/reader.c (union_seen, tag_seen): New vars. + (typed): remove. + * src/reader.h (union_seen, tag_seen, typed): Likewise. + * src/scan-code.l (untyped_var_seen): New variable. + (handle_action_dollar): Adjust to above changes. + (handle_action_dollar, handle_action_at): + Improve overflow checking for outlandish numbers. + * tests/input.at (AT_CHECK_UNUSED_VALUES): Redo test to + avoid new diagnostics generated by above changes. + * tests/regression.at (YYSTYPE typedef): Add test to check + for type tags without %union. + + * src/symlist.c (symbol_list_length): Return int, not unsigned + int, since callers expect int. This may need to get revisited + once we have proper integer overflow checking. + + * src/scan-gram.h (gram_scanner_cursor): Remove decl, since this + object is now static. + + * src/getargs.c (flags_argmatch): Return void, not int, + to pacify ./configure --enable-gcc-warnings. + + * src/flex-scanner.h (STRING_FREE): Don't use FLEX_PREFIX (last_string) + since last_string is already defined to FLEX_PREFIX (last_string). + +2006-07-09 Akim Demaille + + Implement --warnings/-W. + * src/getargs.c (report_argmatch, trace_argmatch): Remove, + replaced by... + (flags_argmatch, FLAGS_ARGMATCH): this new function and macro. + Adjust callers. + * src/getargs.h, src/getargs.c (warnings, warnings_flags) + (warnings_args, warnings_types): New. + (getargs, short_options, long_options): Accept -W/--warnings. + Sort the options by alphabetical order, upper case letter right + before its lower case. + +2006-07-09 Joel E. Denny + + Change %merge result type clash warnings to errors. Discussed at + . + * src/reader.c (record_merge_function_type): Use complain_at. + * tests/glr-regression.at (Missed %merge type warnings when LHS type is + declared later): Update test case results. + +2006-07-09 Akim Demaille + + * src/getargs.h, src/getargs.c: Swap --report and --trace handling + to be in alphabetical order. + (trace_args): Spelling fixes. + +2006-07-09 Paul Eggert + + * data/yacc.c (YYID, yy_stack_print): Prefix local vars with "yy" + so they don't collide with user-defined macros. + (yy_stack_print): Don't assume that yytype_int16 promotes to int; + this was never guaranteed, and now that we're using gnulib stdint, + which defines int_fast16_t to long int, the problem is exposed. + +2006-07-08 Paul Eggert + + * data/c.m4 (b4_basename): Simplify a bit, since we don't + need the full POSIX semantics (and weren't implementing them + anyway). + + Adjust to Autoconf 2.60 and today's gnulib. + * bootstrap (gnulib_modules): Add stdint. + Remove special case for m4/onceonly_2_57.m4, since gnulib-tool + no longer copies it. + (intl_files_to_remove): Remove m4/longlong.m4 and m4/wchar_t.m4, + since stdint needs the former and wcwidth (which is now required + by mbswidth) needs the latter. + Append 'datarootdir = @datarootdir@' to po/Makefile.in.in, to + work around a compatibility glitch between gettext 0.14.6 and + Autoconf 2.60. + * configure.ac (AC_PREREQ): Require Autoconf 2.60. + Do not check for uintptr_t, since new stdint module does the right + thing. + * lib/.cvsignore: Remove alloca.c, alloca.h, alloca_.h. + Add stdint.h, stdint_.h, wcwidth.h. + * m4/.cvsignore: Remove alloca.m4, onceonly.m4. + Add absolute-header.m4, double-slash-root.m4, longlong.m4, + stdint.m4, wchar_t.m4, wcwidth.m4. + * src/files.c: Include and in the + usual order for ../lib/*.h files. + (file_name_split): Use last_component, not base_name, to adjust + to gnulib changes. + * src/parse-gram.h: Include in the usual order + for ../lib/*.h files. + (YYTYPE_INT16, YYTYPE_INT8, YYTYPE_UINT16, YYTYPE_UINT8): + Define unconditionally, since we now assume the stdint module. + * src/scan-skel.l: Include . + (BASE_QPUTS): Use last_component, not base_name. + * src/system.h: Include in the usual order + for ../lib/*.h files. Include unconditionally, + since we now use the stdint module. + (uintptr_t): Declare if UINTPTR_MAX is not defined, not + HAVE_UINTPTR_T, since we now use the stdint module. + (base_name): Remove decl, since files now include + to get the decl. + +2006-07-08 Akim Demaille + + * data/c.m4 (b4_location_initial_column, b4_location_initial_line): + New, default to 1. + * data/yacc.c, data/glr.c, data/location.cc: Use them. + * NEWS, doc/bison.texinfo: The initial column and line are 1 by + default. + * tests/calc.at: Adjust. + +2006-07-08 Akim Demaille + + * data/c.m4 (b4_basename): New. + (b4_syncline): Also output the location of its invocation (from + the skeleton). + (b4_user_action, b4_define_user_action, b4_user_actions) + (b4_user_initial_action, b4_user_post_prologue, b4_user_start_header) + (b4_user_stype): New. + * data/yacc.c, data/glr.c, data/lalr1.cc, data/glr.cc: Use them. + +2006-07-07 Joel E. Denny + + In the grammar file, the first column is 1 not 0 on the first line as + on every other line. + * src/parse-gram.y (%initial-action): Initialize @$ correctly. + * tests/input.at (Torturing the Scanner): Update output. + + * src/scan-gram.l (scanner_cursor): Declare it static. + +2006-07-07 Joel E. Denny + + In warnings, say "previous declaration" rather than "first + declaration". + * src/symtab.c (redeclaration): Do that here. + * src/reader.c (record_merge_function_type): In the case of a result + type clash, report the previous declaration rather than the very first + one in the grammar file. + * tests/glr-regression.at (Missed %merge type warnings when LHS type is + declared later): Add a third declaration to check this behavior. + * tests/input.at (Incompatible Aliases): Update output. + +2006-06-27 Akim Demaille + + * doc/Doxyfile.in: New. + * doc/Makefile.am: Use it. + * src/lalr.h, src/symtab.h: Initial doxygenation. + +2006-06-26 Joel E. Denny + + Don't miss %merge result type warnings just because the LHS types are + declared after the %merge. This continues the effort of the previous + patch. + * src/reader.c (get_merge_function): Don't set the merger type yet. + (record_merge_function_type): New function for setting the merger type + and checking for clashes. + (grammar_current_rule_merge_set): Set the location of the %merge for + the current rule. + (packgram): Invoke record_merge_function_type for each rule now that + all symbol type declarations have been parsed. + * src/reader.h (merger_list.type_declaration_location): New member + storing the location of the first %merge from which the type for this + merging function was derived. + * src/symlist.h (symbol_list.merger_declaration_location): New member + storing the location of a rule's %merge, if any. + * tests/glr-regression.at (Missed %merge type warnings when LHS type is + declared later): New test to catch the error fixed by the above patch. + +2006-06-26 Joel E. Denny + + Get action warnings (grammar_rule_check) right even when symbol + declarations appear after the rules. Discussed at + + and + . + Don't mistake the type of $$ in a midrule to be that of its parent + rule's $$. + * src/reader.c (grammar_current_rule_end): Don't invoke + grammar_rule_check yet since not all symbol declarations may have been + parsed yet. + (grammar_midrule_action): Likewise. + Don't record whether the midrule's $$ has been used yet since actions + haven't been translated yet. + Record the midrule's parent rule and its RHS index within the parent + rule. + (grammar_current_rule_action_append): Don't translate the action yet + since not all symbol declarations may have been parsed yet and, thus, + warnings about types for $$, $n, @$, and @n can't be reported yet. + (packgram): Translate the action and invoke grammar_rule_check now that + all symbol declarations have been parsed. + * src/scan-code.l (handle_action_dollar): Now that this is invoked + after parsing the entire grammar file, the symbol list here in the case + of a midrule is actually the midrule's empty RHS, so reference its + parent rule's RHS where necessary. + On the other hand, now that you can already know it's a midrule, you + aren't forced to think $$ has the same type as its parent rule's $$. + (handle_action_at): In the case of a midrule, reference the parent rule + where necessary. + * src/symlist.c (symbol_list_new): Initialize new midrule-related + members. + (symbol_list_length): Now that this is invoked after all rules have + been parsed, a NULL symbol (rather than a NULL symbol list node) + terminates a rule. symbol_list_print already does this correctly. + * src/symlist.h (symbol_list.midrule_parent_rule, + symbol_list.midrule_parent_rhs_index): New members so that midrules can + remember their relationships with their parents. + * tests/input.at (Type Clashes): Extend to catch the midrule $$ error + fixed by the above patch. + (_AT_UNUSED_VALUES_DECLARATIONS, AT_CHECK_UNUSED_VALUES): New m4 macros + implementing... + (Unused values): ... this old test case and... + (Unused values before symbol declarations): ... this new test case. + This one is the same as `Unused values' except that all symbol + declarations appear after the rules in order to catch the rest of the + errors fixed by the above patch. + +2006-06-26 Joel E. Denny + + More cleanup. + * src/reader.c (current_rule): Declare it static since it's no longer + used outside this file. + (grammar_current_rule_action_append): Remove redundant arguments from + translate_rule_action invocation. + * src/reader.h (current_rule): Remove this unused extern. + * src/scan-code.h (translate_rule_action): Remove redundant arguments. + * src/scan-code.l (translate_rule_action): Likewise. + +2006-06-25 Joel E. Denny + + Clean up yesterday's patch. + * parse-gram.y (rhs): Move grammar_midrule_action invocation from here + to... + * src/reader.c (grammar_current_rule_action_append): ... here for + consistency with grammar_current_rule_symbol_append. + * tests/regression.at (Braced code in declaration in rules section): + Make yyerror and yylex static as usual. + +2006-06-24 Joel E. Denny + + Fix bug that mistakes braced code in a declaration in the rules section + to be a rule action. Mentioned at + . + * src/scan-gram.l: Move midrule action detection from the start of the + scanning of any braced code to... + * src/parse-gram.y (rhs): ... the parsing of braced code as a rule + action. For readability, use $2 and @2 rather than the equivalent + global variables. + * tests/regression.at (Braced code in declaration in rules section): + New test to catch the error fixed by the above patch. + + Work on code readability some. + * src/scan-code.l (current_rule): Get rid of this misleading and + redundant declaration: it's actually extern'ed in reader.h. + (YY_DECL, code_lex, handle_action_dollar, handle_action_at, + translate_action): Add a rule argument and use it instead of the global + current_rule. + (translate_rule_action): This already receives current_rule through an + argument, so pass it on to translate_action instead of assigning + current_rule to current_rule. + (translate_symbol_action, translate_code): Pass rule = NULL to + translate_action. + +2006-06-23 Joel E. Denny + + Rename %before-definitions to %start-header and %after-definitions to + %end-header. Don't use these declarations to separate pre-prologue + blocks from post-prologue blocks. Add new order-independent + declarations %before-header and %after-header as alternatives to the + traditional Yacc pre-prologue and post-prologue blocks. Discussed at + . + * NEWS (2.3+): Update for these changes. + * data/glr.c (b4_before_definitions): Update to... + (b4_start_header): ... this. + (b4_after_definitions): Update to... + (b4_end_header): ... this. + * data/glr.cc: Likewise. + * data/lalr1.cc: Likewise. + * data/yacc.c: Likewise. + * doc/bison.texinfo (The prologue): Update names, and replace remaining + prologue blocks with %*-header declarations. + (Calc++ Parser): Likewise. + (Decl Summary): Update names. + (Table of Symbols): Update description. + * src/parse-gram.y (PERCENT_AFTER_DEFINITIONS): Update to... + (PERCENT_END_HEADER): ... this. + (PERCENT_BEFORE_DEFINITIONS): Update to... + (PERCENT_START_HEADER): ... this. + (PERCENT_AFTER_HEADER, PERCENT_BEFORE_HEADER): New tokens. + (declaration): Update token names and m4 macro names. + When parsing %end-header and %start-header, invoke translate_code + before muscle_code_grow, and no longer set global booleans to remember + whether these declarations have been seen. + Parse new %after-header and %before-header. + * src/reader.c (before_definitions, after_definitions): Remove. + (prologue_augment): Accept a new bool argument to specify whether to + augment the pre-prologue or post-prologue. + * src/reader.h (before_definitions, after_definitions): Remove these + extern's. + (prologue_augment): Add new bool argument. + * src/scan-gram.l (PERCENT_AFTER_DEFINITIONS): Update to... + (PERCENT_END_HEADER): ... this. + (PERCENT_BEFORE_DEFINITIONS): Update to... + (PERCENT_START_HEADER): ... this. + (PERCENT_AFTER_HEADER, PERCENT_BEFORE_HEADER): New tokens. + * tests/actions.at (Printers and Destructors): Update names. + +2006-06-22 Joel E. Denny + + Add comparison operators for C++ location classes. Discussed at + . + * data/c++.m4 (b4_define_location_comparison): New boolean %define + declaration indicating whether filename_type has an operator==. If + filename_type is `std::string', it defaults to `1', `0' otherwise. + * data/location.cc: Iff b4_define_location_comparison is `1', add + operator== and operator!= for class position and for class location. + + Some minor fixes. + * src/scan-action.l: Remove unused file. + * src/symtab.c (symbol_printer_set): Use printer_location not + destructor_location. + * src/symtab.h (struct symbol): Replace incorrect source comment for + printer members. + * tests/input.at (Incompatible Aliases): Update output with correct + printer location. + +2006-06-20 Joel E. Denny + + Don't put the pre-prologue in the header file. For the yacc.c code + file and the glr.c header and code files, move the pre-prologue before + the token definitions. Add new %before-definitions and + %after-definitions to declare code that will go in both the header file + and code file. Discussed at + , + , + and + . + * NEWS (2.3+): Describe these changes. + * data/glr.c (b4_pre_prologue): Move from within to before... + (b4_shared_declarations): ... this. + Add new b4_before_definitions before b4_token_enums. + Add new b4_after_definitions at the end. + * data/glr.cc (b4_pre_prologue): Replace with... + (b4_before_definitions): ... this in the header file. + (b4_after_definitions): New near the end of the header file. + * data/lalr1.cc (b4_pre_prologue): Move from the header file to the + code file right before including the header file. + (b4_before_definitions): New in the previous position of + b4_pre_prologue in the header file. + (b4_after_definitions): New near the end of the header file. + * data/yacc.c: Clean up some m4 quoting especially in the header file. + (b4_token_enums_defines): In the code file, move to right before + YYSTYPE for consistency with the header file. + (b4_before_definitions): New right before b4_token_enums_defines in + both the header and code file. + (b4_after_definitions): New right after YYLTYPE and yylloc in both the + header and code file. + * doc/bison.texinfo (Prologue): Show use of %before-definitions instead + of prologues for %union dependencies. + (Decl Summary): In %defines description, mention the effect of + %before-definitions and %after-definitions on the header file. + (Calc++ Parser): Forward declare driver in a %before-definitions rather + than in the pre-prologue so that make check succeeds. + (Table of Symbols): Add entries for %before-definitions and + %after-definitions. + * src/parse-gram.y (PERCENT_BEFORE_DEFINITIONS): New token for + %before-definitions. + (PERCENT_AFTER_DEFINITIONS): New token for %after-definitions. + (declaration): Parse those declarations and append to + b4_before_definitions and b4_after_definitions, respectively. + * src/reader.c (before_definitions, after_definitions): New bools to + track whether those declarations have been seen. + (prologue_augment): Add to the post-prologue if %union, + %before-definitions, or %after-definitions has been seen. + * src/reader.h (before_definitions, after_definitions): New extern's. + * src/scan-gram.l: Scan the new declarations. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Place the second + prologue block in a %before-definitions or a %after-definitions based + on whether the %union is declared. + * tests/regression.at (Early token definitions with --yacc, Early token + definitions without --yacc): Move tests for token definitions into the + post-prologue since token names are no longer defined in the + pre-prologue. + +2006-06-20 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_from_uniqstr): New. + (symbol_get): Use it. + * src/parse-gram.y: Use it. + +2006-06-19 Joel E. Denny + + * src/scan-gram.l: Remove unused declaration of last_string_1 so the + build succeeds when configured with --enable-gcc-warnings. + +2006-06-19 Paul Eggert + + * src/parse-gram.y (char_name): New function. + (CHAR, STRING, string_content): For %printer, properly escape. + (ID): Prefer fputs to fprintf. + (id): Reindent to be consistent with other rules. + Properly quote char. + + The Translation Project changed its way of publishing translations + to maintainers. I haven't received any responses to my request + for supporting the old way, or for documenting the new way. I + have modified 'bootstrap' to use screen scraping + (in this case, HTML scraping). This is unreliable and inelegant, + but I don't see any better way. Yuck. + * bootstrap (TP_URL, WGET_COMMAND): New vars. + (get_translations): New function, which uses HTML scraping to + deduce locations of latest translations. + Use this function to grab both bison and bison-runtime .po files. + Don't bother priming the pump for the runtime-po domain any more, + as it's now translated better than bison is. + +2006-06-19 Akim Demaille + + * src/scan-gram.l: No longer "parse" things after `%union' until + `{'. Rather, return a single "%union" token. + No longer make symbols: return strings, and leave the conversion + to symbols to the parser. + (SC_PRE_CODE, token_type): Remove. + * src/parse-gram.y (%union): New field `character'. + Sort tokens. + (CHAR): New token. + (ID, ID_COLON): Now that the scanner no longer makes them + identifiers, adjust all uses to invoke symbol_get. + (id_colon): New, wraps the conversion from string to symbol. + (%union): Accept a possible union_name. + (symbol): Now can be a char. + * data/c.m4 (b4_union_name): Leave a default value. + * data/glr.c, data/yacc.c: Use it. + +2006-06-11 Joel E. Denny + + For associating token numbers with token names for "yacc.c", don't use + #define statements unless `--yacc' is specified; always use enum + yytokentype. Most important discussions start at: + , + , + and + . + * NEWS (2.3+): Mention. + * data/c.m4 (b4_yacc_if): New. + (b4_token_enums_defines): Use b4_yacc_if to decide whether to add the + token #define's. + * doc/bison.texinfo (Bison Options): Describe the effect of `--yacc' + on token name definitions. + * src/getargs.c (usage): Capitalize `Yacc' in English. + * src/output.c (prepare): Define b4_yacc_flag. + * tests/regression.at (Early token definitions): Test that tokens names + are defined before the pre-prologue not just before the post-prologue. + Remove this test case and copy to... + (Early token definitions with --yacc): ... this to test #define's. + (Early token definitions without --yacc): ... and this to test enums. + +2006-06-11 Paul Eggert + + * NEWS: Reword the post-2.3 change to not be so optimistic about + removing the old "look-ahead" spelling. + Update previous look-ahead/lookahead change reports. + * REFERENCES: look-ahead -> lookahead (since that's + what he actually wrote). + * doc/refcard.tex: look ahead -> lookahead, + look-ahead -> lookahead + +2006-06-09 Joel E. Denny + + For consistency, use `lookahead' instead of `look-ahead' or + `look_ahead'. Discussed starting at + + and then at + . + * NEWS: For the next release, note the change to `--report'. + * TODO, doc/bison.1: Update English. + * doc/bison.texinfo: Update English. + (Understanding Your Parser, Bison Options): Document as + `--report=lookahead' rather than `--report=look-ahead'. + * src/conflicts.c: Update English in comments. + (lookahead_set): Rename from look_ahead_set. + (flush_reduce): Rename argument look_ahead_tokens to lookahead_tokens. + (resolve_sr_conflict): Rename local look_ahead_tokens to + lookahead_tokens, and update other uses. + (flush_shift, set_conflicts, conflicts_solve, count_sr_conflicts, + count_rr_conflicts, conflicts_free): Update uses. + * src/getargs.c (report_args): Move "lookahead" before alternate + spellings. + (report_types): Update uses. + (usage): For `--report' usage description, state `lookahead' spelling + rather than `look-ahead'. + * src/getargs.h (report.report_lookahead_tokens): Rename from + report_look_ahead_tokens. + * src/lalr.c: Update English in comments. + (compute_lookahead_tokens): Rename from compute_look_ahead_tokens. + (state_lookahead_tokens_count): Rename from + state_look_ahead_tokens_count. + Rename local n_look_ahead_tokens to n_lookahead_tokens. + (lookahead_tokens_print): Rename from look_ahead_tokens_print. + Rename local n_look_ahead_tokens to n_lookahead_tokens. + Update other uses. + Update English in output. + (add_lookback_edge, initialize_LA, lalr, lalr_free): Update uses. + * src/print.c: Update English in comments. + (lookahead_set): Rename from look_ahead_set. + (print_reduction): Rename argument lookahead_token from + look_ahead_token. + (print_core, state_default_rule, print_reductions, print_results): + Update uses. + * src/print_graph.c: Update English in comments. + (print_core): Update uses. + * src/state.c: Update English in comments. + (reductions_new): Update uses. + (state_rule_lookahead_tokens_print): Rename from + state_rule_look_ahead_tokens_print, and update other uses. + * src/state.h: Update English in comments. + (reductions.lookahead_tokens): Rename from look_ahead_tokens. + (state_rule_lookahead_tokens_print): Rename from + state_rule_look_ahead_tokens_print. + * src/tables.c: Update English in comments. + (conflict_row, action_row): Update uses. + * tests/glr-regression.at + (Incorrect lookahead during deterministic GLR, + Incorrect lookahead during nondeterministic GLR): Rename + print_look_ahead to print_lookahead. + * tests/torture.at: Update English in comments. + (AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR): Rename from + AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR. + (Many lookahead tokens): Update uses. + * data/glr.c: Update English in comments. + * lalr1.cc: Likewise. + * yacc.c: Likewise. + * src/conflicts.h: Likewise. + * src/lalr.h: Likewise. + * src/main.c: Likewise. + * src/output.c: Likewise. + * src/parse-gram.c: Likewise. + * src/tables.h: Likewise. + * tests/calc.at: Likewise. + +2006-06-08 Joel E. Denny + + * src/flex-scanner.h (yytext): Remove stray `*/' in #define. + +2006-06-07 Paul Eggert + + * TODO: Add request from Nelson H. F. Beebe to be able to install + Bison without installing the yacc script. + +2006-06-07 Joel E. Denny + + * src/flex-scanner.h: For the sake of Flex 2.5.4, don't #define yyleng + and yytext if they're already #define'd. + * src/flex-scanner.h, src/location.h: Move #include "system.h" to... + * src/scan-code-c.c: ... here. + * src/scan-code.l, src/scan-gram.l: ... and here. Also #include + . + +2006-06-07 Joel E. Denny + + Get Bison to build again when configured with --enable-gcc-warnings. + * src/location.c, src/location.h, src/main.c, src/scan-code.l: Add some + missing #include's. + * src/scan-code.l (handle_action_dollar, handle_action_at): Rename + loc argument as it shadows a global. + * src/scan-gram.l: Remove stray comma that prevents boundary_set + invocation. + + * src/.cvsignore: Add scan-code.c. + +2006-06-07 Akim Demaille + + * src/scan-gram.l: Move the "add a trailing ; to actions" code + to... + * src/scan-code.l: here. + * tests/input.at (Torturing the Scanner): Fix another location + error. + +2006-06-07 Akim Demaille + + * src/Makefile.am (BUILT_SOURCES): Fix the trailing backslash. + +2006-06-06 Akim Demaille + + Extract the parsing of user actions from the grammar scanner. + As a consequence, the relation between the grammar scanner and + parser is much simpler. We can also split "composite tokens" back + into simple tokens. + * src/gram.h (ITEM_NUMBER_MAX, RULE_NUMBER_MAX): New. + * src/scan-gram.l (add_column_width, adjust_location): Move to and + rename as... + * src/location.h, src/location.c (add_column_width) + (location_compute): these. + Fix the column count: the initial column is 0. + (location_print): Be robust to ending column being 0. + * src/location.h (boundary_set): New. + * src/main.c: Adjust to scanner_free being renamed as + gram_scanner_free. + * src/output.c: Include scan-code.h. + * src/parse-gram.y: Include scan-gram.h and scan-code.h. + Use boundary_set. + (PERCENT_DESTRUCTOR, PERCENT_PRINTER, PERCENT_INITIAL_ACTION) + (PERCENT_LEX_PARAM, PERCENT_PARSE_PARAM): Remove the {...} part, + which is now, again, a separate token. + Adjust all dependencies. + Whereever actions with $ and @ are used, use translate_code. + (action): Remove this nonterminal which is now useless. + * src/reader.c: Include assert.h, scan-gram.h and scan-code.h. + (grammar_current_rule_action_append): Use translate_code. + (packgram): Bound check ruleno, itemno, and rule_length. + * src/reader.h (gram_in, gram__flex_debug, scanner_cursor) + (last_string, last_braced_code_loc, max_left_semantic_context) + (scanner_initialize, scanner_free, scanner_last_string_free) + (gram_out, gram_lineno, YY_DECL_): Move to... + * src/scan-gram.h: this new file. + (YY_DECL): Rename as... + (GRAM_DECL): this. + * src/scan-code.h, src/scan-code.l, src/scan-code-c.c: New. + * src/scan-gram.l (gram_get_lineno, gram_get_in, gram_get_out): + (gram_get_leng, gram_get_text, gram_set_lineno, gram_set_in): + (gram_set_out, gram_get_debug, gram_set_debug, gram_lex_destroy): + Move these declarations, and... + (obstack_for_string, STRING_GROW, STRING_FINISH, STRING_FREE): + these to... + * src/flex-scanner.h: this new file. + * src/scan-gram.l (rule_length, rule_length_overflow) + (increment_rule_length): Remove. + (last_braced_code_loc): Rename as... + (gram_last_braced_code_loc): this. + Adjust to the changes of the parser. + Move all the handling of $ and @ into... + * src/scan-code.l: here. + * src/scan-gram.l (handle_dollar, handle_at): Remove. + (handle_action_dollar, handle_action_at): Move to... + * src/scan-code.l: here. + * src/Makefile.am (bison_SOURCES): Add flex-scanner.h, + scan-code.h, scan-code-c.c, scan-gram.h. + (EXTRA_bison_SOURCES): Add scan-code.l. + (BUILT_SOURCES): Add scan-code.c. + (yacc): Be robust to white spaces. + + * tests/conflicts.at, tests/input.at, tests/reduce.at, + * tests/regression.at: Adjust the column numbers. + * tests/regression.at: Adjust the error message. + +2006-06-06 Joel E. Denny + + * src/getargs.c (usage): Mention GLR not just LALR(1) in --help output. + Use Akim's wording from + . + +2006-06-06 Joel E. Denny + + Between Bison releases, manually append `+' to the previous Bison + release number, and use that as a signal to automatically print the + ChangeLog's CVS Id keyword from --version. Discussed starting at + . + * ChangeLog: Add Id header. + * configure.ac (AC_INIT): Append `+' to `2.3'. + * src/.cvsignore: Add revision.c. + * src/Makefile.am (bison_SOURCES): Add revision.c and revision.h. + (BUILT_SOURCES): Add revision.c. + (revision.c): New target rule. This file defines a new global variable + named revision. It initializes it with either the Id from ChangeLog + or, if VERSION doesn't contain `+', with the empty string. + * src/getargs.c (version): Print the value of revision. + * src/revision.h: Extern revision. + +2006-06-05 Paul Eggert + + * NEWS: Version 2.3. + * configure.ac (AC_INIT): Likewise. + +2006-05-30 Paul Eggert + + * data/glr.c (YYRECOVERING): Define to be a function-like macro + with no arguments, not as an object-like macro. This is for + compatibility with data/yacc.c. Problem reported by John P. Hartmann in + . + * doc/bison.texinfo (Action Features, Error Recovery, Table of Symbols): + Document this. + +2006-05-30 Joel E. Denny + + * src/getargs.c (usage): Back out yesterday's modification of the + --help output so that we don't have to wait for translation before + releasing 2.3. + +2006-05-29 Paul Eggert + + * doc/bison.texinfo (Introduction): Don't say "GLR grammar". + Problem reported by Akim Demaille. + +2006-05-29 Joel E. Denny + + * src/getargs.c (usage): Mention GLR not just LALR(1) in --help output. + +2006-05-26 Paul Eggert + + * data/yacc.c (yy_reduce_print): Omit trailing white space in + generated source code. Problem reported by Frans Englich in + . + +2006-05-22 Paul Eggert + + * Makefile.maint (gzip_rsyncable, GZIP_ENV): Compute within the + shell, not within 'make', so that 'make' by an ordinary builder + (using GNU make) does not worry about configuring gzip. This also + works around a bug reported independently by Keith Thompson and by + Georg Schwarz, whereby gzip 1.2.4 --help would output usage on + stderr rather than stdout, messing up the build logs. + +2006-05-21 Joel E. Denny + + * data/yacc.c (yyparse): Wrap the final return from yyparse inside YYID + to make sure that YYID will never be unused. This fixes a 'make + maintainer-check' failure caused by the recent changes to the 'Trivial + grammars' test case, which caused g++ 4.1.0 to complain that YYID was + not used. + * data/glr.c (yyparse): Wrap yyparse's return inside YYID just in case. + +2006-05-21 Joel E. Denny + + * data/glr.c (yyresolveLocations): Remove bogus YYASSERT that the + state before an empty RHS is always resolved here. Only the location + of that state is guaranteed to be resolved, and that's enough. This + fixes the remaining bug reported by Derek M. Jones in + . + * tests/glr-regression.at (Uninitialized location when reporting + ambiguity): Test the above case. + Also, the embedded comments in this test case claim it checks the case + of an empty RHS that has inherited the initial location. However, the + corresponding LHS was already resolved, so yyresolveLocations didn't + actually have reason to modify it. Fix this by forcing + nondeterministic operation at the beginning of the parse. + +2006-05-20 Paul Eggert + + * data/c.m4 (b4_yy_symbol_print_generate): + (b4_yy_symbol_print_generate): Use 'YYSTYPE const' rather than + 'const YYSTYPE', and similarly for YYLTYPE. This fixes one + of the bugs reported today by Derek M Jones in + . + * doc/bison.texinfo (Value Type): Document that YYSTYPE must be + defined to be a type name without parens or brackets. + (Location Type): Similarly for YYLTYPE. + * tests/regression.at (Trivial grammars): Put in a test for this + bug that will be caught by 'make maintainer-check' (though not, + alas, by 'make check' unless your compiler is picky). + +2006-05-19 Paul Eggert + + * NEWS: Version 2.2. + * configure.ac (AC_INIT): Likewise. + +2006-05-17 Joel E. Denny + + * data/glr.c (yyreportTree): Make room in yystates for the state + preceding the RHS. This fixes the segmentation fault reported by Derek + M. Jones in + . + (yyreportTree, yypdumpstack): Subtract 1 from yyrule before printing + to the user. Reported for yyreportTree by Derek M. Jones later in the + same thread. + * THANKS: Add Derek M. Jones. + Update my email address. + Fix typo in Steve Murphy's name. + +2006-05-14 Paul Eggert + + * data/glr.c (yyreportSyntaxError): Fix off-by-one error in + checking against YYLAST that caused the parser to miss a potential + alternative in its diagnostic. + Problem reported by Maria Jose Moron Fernandez in + . + * data/lalr1.cc (yysyntax_error_): Likewise. + * data/yacc.c (yysyntax_error): Likewise. + * tests/regression.at (_AT_DATA_DANCER_Y): Use static array for + tokens, in case we run into an older C compiler. + (_AT_DATA_EXPECT2_Y, AT_CHECK_EXPECT2): New macros. + Use them to check for the off-by-one error fixed above. + + * data/yacc.c (yytnamerr): Fix typo: local var should be of type + YYSIZE_T, not size_t. + * tests/regression.at (Trivial grammars): New test, to catch + the error fixed by the above patch. + +2006-05-14 Akim Demaille + + * doc/bison.texinfo (C++ Bison Interface): Clarify the naming + scheme. + Reported by Steve Murphy. + +2006-05-14 Akim Demaille + + * data/glr.cc, data/lalr1.cc: Using %defines is mandatory. + * data/glr.cc: b4_location_flag is now b4_locations_flag. + +2006-05-14 Akim Demaille + + Implement --trace=m4. + * src/getargs.c (trace_types, trace_args): Accept trace_m4. + * src/output.c (output_skeleton): When set, pass -dV to m4. + + Factor the handling of flags in m4. + * src/output.c (prepare): Rename the muscle names debug, defines, + error_verbose to debug_flag, defines_flag, error_verbose_flag. + * data/c.m4: Adjust. + (_b4_define_flag_if, b4_define_flag_if, b4_defines_if): New. + Use b4_define_flag_if to define other b4_FLAG_if macros. + (b4_location_if): As a consequence, rename as... + (b4_locations_if): this, for consistency. + Adjust all the skeletons. + +2006-05-14 Akim Demaille + + * etc/bench.pm: Shorten bench names. + +2006-05-14 Akim Demaille + + * src/output.h, src/output.c (error_verbose): Move to... + * src/getargs.h, src/getargs.c: here. + Sort the flags. + Adjust dependencies. + +2006-05-13 Paul Eggert + + * data/c.m4 (b4_copyright): Put the special exception for Bison + skeletons here, so we don't have to put it in each skeleton. All + uses changed. Suggested by Akim Demaille. Also, wrap the + copyright notice, in case it is longer than 80 columns. Replace + comma by newline after title. + +2006-05-11 Paul Eggert + + * doc/bison.texinfo (Calc++ Scanner): The flex behavior is an + incompatibility, not a bug. Mention that it wasn't fixed as of + flex 2.5.33. + +2006-05-11 Akim Demaille + + * examples/extexi: Enforce the precedence of concatenation over + >>. + Reported by Tommy Nordgren. + +2006-05-11 Akim Demaille + + * data/lalr1.cc (yytranslate_): Rename token as t to avoid clashes + with the member "token". + Reported by Martin Nylin. + +2006-05-08 Paul Eggert + + * data/glr.c: Switch to Bison 2.2 special-exception language in + the copyright notice. Use more-regular format for titles and + copyright notices. + * data/glr.cc: Likewise. + * data/location.cc: Likewise. + * data/yacc.cc: Likewise. + * doc/bison.texinfo (Conditions): Document this. + * NEWS: likewise. Upgrade version to 2.2. + +2006-04-27 Akim Demaille + + * data/glr.cc: Remove dead code. + +2006-04-25 Paul Eggert + + * bootstrap: Comment out the AM_CPPFLAGS line, since we don't use + that variable and the line breaks the bootstrap. Problem reported + by Juan M. Guerrero. + +2006-04-24 Akim Demaille + + * doc/bison.texinfo (Multiple start-symbols): New. + +2006-04-24 Akim Demaille + + * etc/README, etc/bench.pl: New. + +2006-04-03 Akim Demaille + + * src/scan-gram.l: Be robust to BRACED_CODE appearing before any + rule. + Reported by Mickael Labau. + * tests/input.at (Torturing the Scanner): Test it. + +2006-03-16 Paul Eggert + + * doc/bison.texinfo (Decl Summary): Don't mention yylloc twice. + Problem reported by Bob Rossi. + +2006-03-13 Paul Eggert + + * doc/bison.texinfo: Remove @shorttitlepage stuff; it wasn't used + and didn't really work. + For the index, use @ifnotinfo, not @iftex. + Minor cleanups of spacing and terminology. + +2006-03-12 Akim Demaille + + * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Fix the definition + of AT_NAME_PREFIX when %name-prefix is not used. + +2006-03-12 Akim Demaille + + Apply --prefix to C++ skeletons too: they change the namespace. + The test suite already exercize these cases. + * data/c++.m4 (b4_namespace): New. + * data/lalr1.cc, data/glr.cc, data/location.cc: Use it instead of `yy'. + * data/lalr1.cc (yytnameerr_): Move its definition into the namespace. + * data/yacc.c, data/glr.c: Remove a useless `[]'. + * doc/bison.texinfo: Document it. + (Option Cross Key): Use @multitable in all formats. It looks + nicer, even in TeX outputs. + (Rules): Use the same code whatever the output type is. + * tests/local.at (_AT_BISON_OPTION_PUSHDEFS) + (_AT_BISON_OPTION_POPDEFS): Support AT_NAME_PREFIX. + * tests/calc.at: Use it, instead of hard coding `yy'. + +2006-03-10 Akim Demaille + + * TODO: Remove dead items. + +2006-03-10 Akim Demaille + + * doc/FAQ: Remove, merged into... + * doc/bison.texinfo (FAQ): this. + * doc/Makefile.am (EXTRA_DIST): Adjust. + +2006-03-10 Akim Demaille + + * data/c.m4 (b4_token_enum): Always define the enum of tokens, + even if empty. + * data/lalrl1.cc, data/glr.cc (parser::token_type): New. + * doc/bison.texinfo (Calc++ Scanner): Use it. + +2006-03-09 Paul Eggert + + Fix two nits reported by twlevo, plus one more that I discovered. + + * src/assoc.h (assoc_to_string): Give a name to the arg, as + this is the usual Bison style. + * src/location.h (location_print): Likewise. + + * src/reader.h (token_name): Likewise. + +2006-03-08 Paul Eggert + + Fix some nits reported by twlevo. + * doc/FAQ: Remove ancient Y2K FAQ, replacing it with "secure" + and "POSIX". Use more-modern syntax for URLs. Mention C++ + and ask for Java. Don't hardwire OS version numbers. Add + copyright notice. + * m4/.cvsignore: Add unistd_h.m4, for latest gnulib. + * src/conflicts.c (solved_conflicts_obstack): Now static. + +2006-03-08 Joel E. Denny + + * doc/bison.texinfo (Introduction): Mention GLR and C++ as on the web + page. Say "you can use it" not "you may use it" as on the web page; + we're describing capabilities not granting permission. + +2006-03-06 Paul Eggert + + * data/glr.c (yyresolveLocations): Rename local variables to avoid + shadowing warnings. Use usual patter for iterating through RHS. + * tests/glr-regression.at + (Uninitialized location when reporting ambiguity): + Modify yylex so that it uses its argument, rather than trying + to rely on ARGSUSED (which doesn't work for gcc with warnings). + const char -> char const. + + * tests/Makefile.am ($(srcdir)/package.m4, maintainer-check-valgrind): + Don't use tabs inside commands; it messes up 'ps'. + Problem reported by twlevo. + +2006-03-06 Joel E. Denny + + * tests/glr-regression.at (Uninitialized location when reporting + ambiguity): New test case. + * data/glr.c (yyresolveLocations): New function, which uses + YYLLOC_DEFAULT. + (yyresolveValue): Invoke yyresolveLocations before reporting an + ambiguity. + * doc/bison.texinfo (Default Action for Locations): Note + YYLLOC_DEFAULT's usage for ambiguity locations. + (GLR Semantic Actions): Cross-reference those notes. + +2006-03-04 Joel E. Denny + + * tests/glr-regression.at (Leaked semantic values when reporting + ambiguity): Remove unnecessary union and type declarations. + (Leaked lookahead after nondeterministic parse syntax error): New test + case. + * data/glr.c (yyparse): Check for zero stacks remaining before + attempting to shift the lookahead so that you don't lose it. + +2006-03-02 Joel E. Denny + + Avoid memory leaks by not invoking longjmp in yyreportAmbiguity. + * tests/glr-regression.at (Leaked semantic values when reporting + ambiguity): New test case. + * data/glr.c (yyreportAmbiguity): Invoke yyyerror directly and return + yyabort rather than invoking yyFail, which invokes longjmp. Remove the + now unnecessary yystackp parameter. + (yyresolveValue): Return yyreportAmbiguity's result. Now the necessary + destructors can be called. + + * tests/glr-regression.at: Don't invoke bison with `-t' unnecessarily + in existing testcases. + +2006-03-02 Joel E. Denny + + Don't leak semantic values for parent RHS when a user action cuts the + parser, and clean up related code a bit. + * tests/glr-regression.at (Leaked merged semantic value if user action + cuts parse): Rename to... + (Leaked semantic values if user action cuts parse): ... this. Add check + for leaked parent RHS values. + * data/glr.c (yydestroyGLRState): In debugging output, distinguish + between an unresolved state (non-empty chain of semantic options) and + an incomplete one (signaled by an empty chain). + (yyresolveStates): Document the interface. Move all manipulation of a + successfully or unsuccessfully resolved yyGLRState to... + (yyresolveValue): ... here so that yyresolveValue always leaves a + yyGLRState with consistent data and thus is easier to understand. + Remove the yyvalp and yylocp parameters since they are always just + taken from the yys parameter. When reporting a discarded merged value + in debugging output, note that it is incompletely merged. Document the + interface. + (yyresolveAction): If resolving any of the RHS states fails, destroy + them all rather than leaking them. Thus, as long as user actions are + written to clean up the RHS correctly, yyresolveAction always cleans up + the RHS of a semantic option. Document the interface. + +2006-02-27 Paul Eggert + + * data/glr.c (yyexpandGLRStack): Catch an off-by-one error that + led to a segmentation fault in GNU Pascal. Problem reported + by Waldek Hebisch. + +2006-02-21 Joel E. Denny + + * doc/bison.texinfo (Mid-Rule Actions): Explain how to bury a + mid-rule action inside a nonterminal symbol in order to declare a + destructor for its semantic value. + +2006-02-16 Paul Eggert + + * data/yacc.c [(! defined yyoverflow || YYERROR_VERBOSE) && ! + YYSTACK_USE_ALLOCA && ! defined YYSTACK_ALLOC && defined + __cplusplus && ! defined _STDLIB_H && ! + ((defined YYMALLOC || defined malloc) && (defined YYFREE || + defined free))]: Include rather than rolling our own + declarations of malloc and free, to avoid problems with + incompatible declarations (using 'throw') C++'s stdlib.h. This + should fix Debian bug 340012 + , + reported by Guillaume Melquiond. + +2006-02-13 Paul Eggert + + * NEWS: Clarify symbols versus types in unused-value warnings. + + * configure.ac (AC_INIT): Bump version number. + +2006-02-13 Paul Eggert + + * NEWS: Version 2.1a. + * tests/headers.at (AT_TEST_CPP_GUARD_H): Declare yyerror and yylex, + since C99 requires this. + +2006-02-11 Paul Eggert + + * m4/c-working.m4: New file. + * configure.ac (BISON_TEST_FOR_WORKING_C_COMPILER): Use it. + +2006-02-10 Paul Eggert + + * Makefile.maint: Merge from coreutils. + +2006-02-09 Paul Eggert + + More portability fixes for problems summarized by Nelson H. F. Beebe. + + * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Catch a + configuration screwup "./configure CC=/opt/SUNWspro/bin/c89 + CFLAGS="-xarch=generic64" CXX=/opt/SUNWspro/bin/CC + LDFLAGS="-xarch=generic64" with Sun C 5.7 on Solaris 10; this + messes up because C++ code is compiled in 32-bit mode but linked + in 64-bit mode. + +2006-02-08 Paul Eggert + + More portability fixes for problems summarized by Nelson H. F. Beebe. + + * doc/bison.texinfo (Calc++ Scanner): Work around a bug in flex + 2.5.31. This resembles the 2005-10-10 patch to src/scan-skel.l. + + * examples/calc++/Makefile.am (check_PROGRAMS): Renamed from + nodist_PROGRAMS, since we don't need to actually compile the + example if we're just doing a plain 'make'. This avoids bothering + the installer unnecessarily about problems due to weird C++ + compilers. + +2006-02-06 Paul Eggert + + More portability fixes for problems summarized by Nelson H. F. Beebe. + + * tests/headers.at (AT_TEST_CPP_GUARD_H): Use #include <...> rather + than #include "...", and compile with -I'.'. The old method was + not portable, according to Posix and the C standard, and it does + not work with Sun C 5.7, where previous #line directives affect + the working directory used in later #include "..." directives. + +2006-02-06 Juan Manuel Guerrero + + Various DJGGP specific issues in /djgpp + +2006-02-02 Paul Eggert + + More portability fixes for problems summarized by Nelson H. F. Beebe. + + * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Check that + '#include ' works and that you can apply ++ to iterators. + +2006-02-01 Paul Eggert + + Work around portability problems summarized by Nelson H. F. Beebe in + . + + * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Check + that '#include ' works. + + * data/lalr1.cc (yytranslate_): No longer inline, to work around a + porting problem to g++ 3.4.3 on Darwin 7.9.0, where g++ complained + "warning: sorry: semantics of inline function static data `const + unsigned char translate_table[262]' are wrong (you'll wind up with + multiple copies)". + + * lib/bbitset.h (struct bitset_vtable): Rename members not, and, + or, xor to not_, and_, or_, and xor_, respectively. This works + around a bug in GCC 3.4.3 on Irix 6.5, which apparently has a + random system header somewhere that includes the equivalent of + . + + * tests/headers.at (AT_TEST_CPP_GUARD_H): Don't assume that "$CC + -E" works; it apparently doesn't work with PathScale EKO Compiler + Suite Version 2.0. + +2006-01-30 Joel E. Denny + + During deterministic GLR operation, user actions should be able to + influence the parse by changing yychar. To make this easier to fix and + to make glr.c easier to evolve in general, don't maintain yytoken in + parallel with yychar; just compute yytoken when needed. + * tests/glr-regression.at (Incorrect lookahead during deterministic + GLR): Check that setting yychar in a user action has the intended + effect. + * data/glr.c (yyGLRStack): Remove yytokenp member. + (yyclearin): Don't set *yytokenp. + (yyprocessOneStack, yyreportSyntaxError, yyrecoverSyntaxError): Examine + yychar rather than *yytokenp to determine the current lookahead. + Compute yytoken locally when needed. + (yyparse): Likewise. Remove the local yytoken that yytokenp used to + point to. + + * doc/bison.texinfo (Bison Options): Remove stray sentence fragment + after `--report' documentation. + +2006-01-30 Paul Eggert + + * src/parse-gram.y (grammar_declaration): Location of printer + symbol is @1, not list->location. Bug reported by twlevo. + * tests/input.at (Incompatible Aliases): Adjust to above change. + +2006-01-29 Paul Eggert + + * tests/input.at (AT_CHECK_UNUSED_VALUES): Remove. Instead, do + all the test at once. This makes the output easier to read in the + normal case. + + Fix a longstanding bug uncovered by bro-0.9a9/src/parse.y, which I + got from . The bug is that + when two actions appeared in succession, the second one was + scanned before the first one was added to the grammar rule + as a midrule action. Bison then output the incorrect warning + "parse.y:905.17-906.36: warning: unused value: $3". + * src/parse-gram.y (BRACED_CODE, action): These are no longer + associated with a value. + (rhs): Don't invoke grammar_current_rule_action_append. + (action): Invoke it here instead. + * src/reader.c (grammar_midrule_action): Now extern. + (grammar_current_rule_action_append): Don't invoke + grammar_midrule_action; that is now the scanner's job. + * src/reader.h (last_string, last_braced_code_loc): + (grammar_midrule_action): New decls. + * src/scan-gram.l (last_string): Now extern, sigh. + (last_braced_code_loc): New extern variable. + ("{"): Invoke grammar_midrule_action if the current + rule already has an action. + ("}"): Set last_braced_code_loc before returning. + * tests/input.at (AT_CHECK_UNUSED_VALUES): + Add some tests to check that the above changes fixed the bug. + +2006-01-27 Paul Eggert + + * src/reader.c (symbol_should_be_used): Renamed from symbol_typed_p. + All used changed. Check whether the symbol has a destructor, + not whether it is typed. + * tests/input.at (AT_CHECK_UNUSED_VALUES): Add a destructor, so + that the values are still reported as unused. All line numbers + adjusted. + +2006-01-23 Paul Eggert + + Work around a bug in bro 0.8, which underparenthesizes its + definition of YYLLOC_DEFAULT. + * data/glr.c: Change all uses of YYLLOC_DEFAULT to parenthesize + their arguments. + * data/lalr1.cc: Likewise. + * data/yacc.cc: Likewise. + +2006-01-22 Paul Eggert + + Work around a bug in Pike 7.0, and give the Pike folks a + better way to override the usual int widths. + * data/yacc.c (b4_int_type): Use yytype_uint8, etc., so that the + user can override the types. + (short): #undef, to work around a bug in Pike 7.0. + (yytype_uint8, yytype_int8, yytype_uint16, yytype_int16): New types. + (union yyalloc.yyss): Use yytype_int16 rather than short. + All uses changed. + (yysigned_char): Remove. + * src/parse-gram.y (YYTYPE_UINT8, YYTYPE_INT8, YYTYPE_UINT16): + (YYTYPE_INT16): New macros, to test the new facility in yacc.c. + * tests/regression.at (Web2c Actions): Adjust to above changes. + + * src/reader.c (check_and_convert_grammar): New function. + (reader): Close the input file even if something went wrong during + parsing. Minor file descriptor leak reported by twlevo. + + * src/assoc.c (assoc_to_string): Use a default: abort (); case + to pacify gcc -Wswitch-default. + * src/scan-gram.l (adjust_location): Use a default: break; case + to pacify gcc -Wswitch-default. + * src/scan-skel.h (skel_get_lineno, skel_get_in, skel_get_out): + (skel_get_leng, skel_get_text, skel_set_lineno, skel_set_in): + (skel_set_out, skel_get_debug, skel_set_debug, skel_lex_destroy): + Move these decls to scan-skel.l, since they don't need to be + visible elsewhere. + * src/scan-skel.l: Accept the above decls. + (skel_lex): New decl, to pacify GCC when unpatched flex 2.5.31 + is used. + +2006-01-21 Paul Eggert + + * Makefile.cfg (local-checks-to-skip): Add changelog-check, + since we don't want to insist on a version number at the start + of the changelog every time. + * Makefile.maint: Sync from coreutils a bit better. + (sc_trailing_blank): Renamed from sc_trailing_space. + All uses changed. + (sc_no_if_have_config_h, sc_require_config_h): + (sc_prohibit_assert_without_use): New rules. + (sc_obsolete_symbols): Don't catch Makefile.maint itself. + (sc_dd_max_sym_length): Fix leading spaces in rule. + (sc_system_h_headers): Prefix with @. + (sc_useless_cpp_parens, m4-check): Output line numbers. + (changelog-check): Allow version only in head. + * data/c.m4: Use "defined FOO" instead of "defined (FOO)", to + satisfy new Makefile.maint rule. + * data/glr.c: Likewise. + * data/glr.cc: Likewise. + * data/lalr1.cc: Likewise. + * data/yacc.c: Likewise. + * lib/ebitsetv.c: Likewise. + * lib/lbitset.c: Likewise. + * lib/subpipe.c: Likewise. + * lib/timevar.c: Likewise. + * src/system.h: Likewise. + * data/yacc.c (YYSTYPE): Don't generate trailing spaces in output. + * djgpp/Makefile.maint: Add copyright notice. + * djgpp/README.in: Likewise. + * djgpp/config.bat: Likewise. + * djgpp/config.site: Likewise. + * djgpp/config_h.sed: Likewise. + * djgpp/djunpack.bat: Likewise. + * djgpp/config.sed: Fix copyright notice to match standard format. + * djgpp/subpipe.h: Likewise. + * lib/bitsetv-print.c: Likewise. + * lib/bitsetv.c: Likewise. + * lib/subpipe.h: Likewise. + * lib/timevar.c: Likewise. + * lib/timevar.h: Likewise. + * djgpp/subpipe.c: Use standard recipe for config.h. + * lib/abitset.c: Likewise. + * lib/bitset.c: Likewise. + * lib/bitset_stats.c: Likewise. + * lib/bitsetv-print.c: Likewise. + * lib/bitsetv.c: Likewise. + * lib/ebitsetv.c: Likewise. + * lib/get-errno.c: Likewise. + * lib/lbitset.c: Likewise. + * lib/subpipe.c: Likewise. + * lib/timevar.c: Likewise. + * lib/vbitset.c: Likewise. + * tests/local.at: Likewise. + * src/scan-gram.l: Don't include verify.h, since system.h does + that for us. + * .x-sc_require_config_h: New file. + * .x-sc_unmarked_diagnostics: New file. + +2006-01-20 Paul Eggert + + Be a bit more systematic about using 'abort'. + * lib/abitset.c (abitset_test): Remove ATTRIBUTE_UNUSED; not needed. + * lib/bitset.c (bitset_bytes, bitset_init, bitset_op4_cmp): + Put 'default: abort ();' before some other case, to satisfy older + pedantic compilers. + * lib/bitset_stats.c (bitset_stats_init): Likewise. + * lib/ebitset.c (ebitset_elt_find, ebitset_op3_cmp): Likewise. + * lib/lbitset.c (lbitset_elt_find, lbitset_op3_cmp): Likewise. + * src/conflicts.c (resolve_sr_conflict): Likewise. + * src/vcg.c (get_color_str, get_textmode_str, get_shape_str): + (get_decision_str, get_orientation_str, get_node_alignment_str): + (get_arrow_mode_str, get_crossing_type_str, get_view_str): + (get_linestyle_str, get_arrowstyle_str): Likewise. + * src/conflicts.c (resolve_sr_conflict): + Use a default case rather than one for the one remaining enum + value, to catch invalid enum values as well. + * src/lalr.c (set_goto_map, map_goto): + Prefer "assert (FOO);" to "if (!FOO) abort ();". + * src/nullable.c (nullable_compute, token_definitions_output): + Likewise. + * src/reader.c (packgram, reader): Likewise. + * src/state.c (transitions_to, state_new, state_reduction_find): + Likewise. + * src/symtab.c (symbol_user_token_number_set, symbol_make_alias): + (symbol_pack): Likewise. + * src/tables.c (conflict_row, pack_vector): Likewise. + * src/scan-skel.l (QPUTS): Remove unnecessary parens. + (BASE_QPUTS, "@output ".*\n): Remove unnecessary asserts. + * src/system.h: Don't include . + (assert): New macro. + + * doc/bison.texinfo (Prologue, Rules, Actions, Union Decl, Action Decl): + (Destructor Decl, Parser Function, Pure Calling): + Describe rules for braces inside C code more carefully. + +2006-01-19 Paul Eggert + + Fix some porting glitches found by Nelson H. F. Beebe. + * lib/abitset.c (abitset_resize): Rewrite to avoid warnings from + compilers that don't understand that abort () does not return. + * src/state.c (transitions_to): Likewise. + * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Check + that '#include ' works. + * src/system.h (INT8_MIN, INT16_MIN, INT32_MIN, INT8_MAX): + (INT16_MAX, UINT8_MAX, INT32_MAX, UINT16_MAX, UINT32_MAX): + #undef if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901, + for the benefit of some pre-C99 compilers. + + * bootstrap: Undo changes to gnulib files that autoreconf made. + + Minor fixups to get 'make maintainer-check' to work. + * configure.ac: Don't use -Wnested-externs, as it's incompatible + with the new verify.h implementation. + * data/c.m4 (b4_yy_symbol_print_generate): YYUSE (yyoutput). + * data/glr.c (YYUSE): Depend on __GNUC__ as well. + * data/yacc.c (YYUSE): Likewise. + * data/lalr1.cc (yysyntax_error_): YYUSE (yystate). + * lib/subpipe.c (end_of_output_subpipe): The args are unused. + * src/parse-gram.y (declaration): Don't pass a string constant + to a function that expects char *, since GCC might complain + about the constant value. + * src/reader.c (symbol_typed_p): Add parens to pacify GCC. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): #undef yylloc and yylval + before #defining them. + * tests/glr-regression.at + (Incorrectly initialized location for empty right-hand side in GLR): + In yyerror, use the msg arg. + (Corrupted semantic options if user action cuts parse): + (Incorrect lookahead during deterministic GLR): + (Incorrect lookahead during nondeterministic GLR): + Don't name a local var 'index'; it shadows string.h's 'index'. + +2006-01-19 Akim Demaille + + * tests/calc.at (_AT_DATA_CALC_Y): Initialize the whole initial + location, not just parts of it. + +2006-01-18 Paul Eggert + + * NEWS: Document the fact that multiple %unions are now allowed. + * doc/bison.texinfo (Union Decl): Likewise. + * TODO: This feature is now implemented, so remove it from + the wishlist. + + * Makefile.maint: Merge with coreutils Makefile.maint. + (CVS_LIST): Use build-aux version if available. + (VERSION_REGEXP): New macro. + (syntax-check-rules): Add sc_no_if_have_config_h, + sc_prohibit_assert_without_use, sc_require_config_h, + sc_useless_cpp_parens. + (sc_obsolete_symbols): Check for O_NDELAY. + (sc_dd_max_sym_length): Track coreutils. + (sc_unmarked_diagnostics): Look in all files, not just *.c. + (sc_useless_cpp_parens): New rule. + (news-date-check): Look for version or today's date. + (changelog-check): Don't require version number near head. + (copyright-check): Use current year instead of hardwiring 2005. + (my-distcheck): Depend on $(release_archive_dir)/$(prev-tgz). + (announcement): Add --gpg-key-ID. + + * djgpp/config.sed: Add copyright notice, and replace "filesystem" + with "file system". + + Avoid undefined behavior that addressed just before the start of an + array. Problem reported by twlevo. + * src/reader.c (packgram): Prepend a new sentinel before ritem. + * src/lalr.c (build_relations): Rely on new sentinel. + * src/gram.c (gram_free): Adjust to new sentinel. + +2006-01-12 Joel E. Denny + + * data/glr.c (yyGLRStateSet): Rename yylookaheadStatuses to + yylookaheadNeeds. All uses updated. + (yysplitStack): Rename local yynewLookaheadStatuses to + yynewLookaheadNeeds. + * data/glr-regression.at (Incorrect lookahead during nondeterministic + GLR): In comments, change `lookahead status' to `lookahead need'. + +2006-01-11 Paul Hilfinger + + * data/glr.c (yysplitStack): A little stylistic rewrite. + +2006-01-11 Paul Hilfinger + + * data/glr.c (yyaddDeferredAction): Flesh out the comment. + +2006-01-11 Joel E. Denny + + * doc/bison.texinfo: Fix some typos. + (GLR Semantic Actions): New subsection discussing special + considerations because GLR semantic actions might be deferred. + (Actions): Mention look-ahead usage of yylval. + (Actions and Locations): Mention look-ahead usage of yylloc. + (Special Features for Use in Actions): Add YYEOF entry and mention it + in the yychar entry. + In the yychar entry, remove mention of the local yychar case (pure + parser) since this is irrelevant information when writing semantic + actions and since it's already discussed in `Table of Symbols' where + yychar is otherwise described as an external variable. + In the yychar entry, don't call it the `current' look-ahead since it + isn't when semantic actions are deferred. + In the yychar and yyclearin entries, add note about deferred semantic + actions. + Add yylloc and yylval entries discussing look-ahead usage. + (Look-Ahead Tokens): When discussing yychar, don't call it the + `current' look-ahead, and do mention yylval and yylloc. + (Error Recovery): Cross-reference `Action Features' when mentioning + yyclearin. + (Table of Symbols): In the yychar entry, don't call it the `current' + look-ahead. + In the yylloc and yylval entries, mention look-ahead usage. + +2006-01-08 Joel E. Denny + + * tests/glr-regression.at: Update copyright year to 2006. + +2006-01-06 Joel E. Denny + + * data/glr.c (yyGLRStateSet): Add yybool* yylookaheadStatuses member to + use during nondeterministic operation to track which stacks have + actually needed the current lookahead. + (yyinitStateSet, yyfreeStateSet, yyremoveDeletes, yysplitStack): + Allocate, deallocate, resize, and otherwise shuffle space for + yylookaheadStatuses in parallel with yystates member of yyGLRStateSet. + (yysplitStack, yyprocessOneStack, yyparse): Set lookahead status + appropriately during nondeterministic operation. + (yySemanticOption): Add int yyrawchar, YYSTYPE yyval, and YYLTYPE yyloc + members to store the current lookahead to be used by the deferred + user action. + (yyaddDeferredAction): Add size_t yyk parameter specifying the stack + from which the RHS is taken. Set the lookahead members of the new + yySemanticOption according to the lookahead status for stack yyk. + (yyglrShiftDefer, yyglrReduce): Pass yyk parameter on to + yyaddDeferredAction. + (yyresolveAction): Set yychar, yylval, and yylloc to the lookahead + members of yySemanticOption before invoking yyuserAction, and then set + them back to their current values afterward. + (yyparse): Set yychar = YYEMPTY where yytoken = YYEMPTY. + (yyreportAmbiguity): Add /*ARGSUSED*/ to pacify lint. + * tests/glr-regression.at: Remove `.' from the ends of recent test case + titles for consistency. + (Leaked merged semantic value if user action cuts parse): In order to + suppress lint warnings, use arguments in merge function, and assign + char value < 128 in main. + (Incorrect lookahead during deterministic GLR): New test case. + (Incorrect lookahead during nondeterministic GLR): New test case. + +2006-01-06 Joel E. Denny + + * data/c.m4 (b4_yy_symbol_print_generate): In yy_symbol_print, accept + !yyvaluep as signal that no semantic value is available to print. + * data/glr.c (yydestroyGLRState): If state is not resolved, don't try + to print a semantic value. + +2006-01-06 Joel E. Denny + + * tests/glr-regression.at: For consistency with my newer test cases, + don't thank myself. + +2006-01-05 Joel E. Denny + + * data/glr.c (yyresolveValue): When merging semantic options, if at + least one user action succeeds but a later one cuts the parse, then + destroy the semantic value before returning rather than leaking it. + (yyresolveStates): If a user action cuts the parse and thus + yyresolveValue fails, ignore the (unset) semantic value rather than + corrupting the yyGLRState, and empty the semantic options list since + the user actions should have called all necessary destructors. + Simplify code with YYCHK. + * tests/glr-regression.at (Corrupted semantic options if user action + cuts parse): New test case. + (Undesirable destructors if user action cuts parse): New test case. + Before applying any of this patch, this test case never actually failed + for me... but only because the corrupted semantic options usually + masked this bug. + (Leaked merged semantic value if user action cuts parse): New test + case. + +2006-01-05 Akim Demaille + + * src/reader.c, src/symlist.h, src/symlist.c: s/mid_rule/midrule/. + +2006-01-04 Paul Eggert + + * data/c.m4 (b4_c_modern): New macro, with a new provision for + _MSC_VER. Problem reported by Cenzato Marco. + (b4_c_function_def): Use it. + * data/yacc.c (YYMODERN_C): Remove. All uses replaced by + b4_c_modern. + (yystrlen, yystpcpy, yyparse): Use b4_c_function... macros rather + than rolling our own. + +2006-01-04 Akim Demaille + + Also warn about non-used mid-rule values. + * src/symlist.h, src/symlist.c (symbol_list): Add a mid_rule + member. + (symbol_list_new): Adjust. + * src/reader.c (symbol_typed_p): New. + (grammar_rule_check): Use it. + (grammar_midrule_action): Bind a mid-rule LHS to its rule. + Check its rule. + * tests/input.at (AT_CHECK_UNUSED_VALUES): New. + Use it. + * tests/actions.at (Exotic Dollars): Adjust. + +2006-01-04 Akim Demaille + + * src/reader.c (grammar_midrule_action): If $$ is set in a + mid-rule, move the `used' bit to its lhs. + * tests/input.at (Unused values): New. + * tests/actions.at (Exotic Dollars): Adjust: exp is not typed. + +2006-01-03 Paul Eggert + + * doc/bison.texinfo (Bison Options): Say more accurately what + --yacc does. + * src/parse-gram.y (rules_or_grammar_declaration): Don't complain + about declarations in the grammar when in Yacc mode, as POSIX does + not require a diagnostic when the grammar uses extensions. + + * src/reduce.c (reduce_grammar): Remove unnecessary cast to bool. + + Warn about dubious constructions like "%token T T". + Reported by twlevo. + * src/symtab.h (struct symbol.declared): New member. + * src/symtab.c (symbol_new): Initialize it to false. + (symbol_class_set): New arg DECLARING, specifying whether + this is a declaration that we want to warn about, if there + is more than one of them. All uses changed. + + * data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c: + Allow multiple %union directives, whose contents concatenate. + * src/parse-gram.y (grammar_declaration): Likewise. + Use muscle_code_grow, so that we don't need stype_line any more. + All uses changed. + + * src/muscle_tab.c (muscle_grow): Fix comment. + + * ChangeLog, data/c.m4, data/glr.c, data/glr.cc, data/location.cc: + * data/yacc.c, src/getargs.c, src/output.c, tests/cxx-type.at: + Update copyright year to 2006. + +2006-01-03 Akim Demaille + + Have glr.cc pass (some of) the calc.at tests. + * data/glr.cc (b4_parse_param_orig): New. + (b4_parse_param): Improve its definition, and bound it more + clearly in the skeleton. + (b4_epilogue): Append, instead of prepending, in order to keep + #line consistency. + Simplify the generation of auxiliary functions: locations and + purity are mandated. + (b4_global_tokens_and_yystype): Honor it. + * data/location.cc (c++.m4): Don't include it. + * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Define AT_GLR_CC_IF + and AT_SKEL_CC_IF. + * tests/calc.at (AT_CHECK_CALC): Rely on AT_SKEL_CC_IF instead of + AT_LALR1_CC_IF. + Be sure to initialize the first position's filename. + (AT_CHECK_CALC_LALR1_CC): Add %location and %defines, they are + mandated anyway. + (AT_CHECK_CALC_GLR_CC): New. + Use it to exercise glr.cc as a lalr1.cc drop-in replacement. + +2006-01-02 Akim Demaille + + * src/output.c (output_skeleton): Don't hard wire the inclusion of + c.m4. + * data/c++.m4, data/glr.c, data/yacc.c: Include c.m4. + * data/glr.cc: Do not include stack.hh. + +2006-01-02 Joel E. Denny + + * data/glr.c: Reformat whitespace with tabs. + (b4_lpure_formals): Remove this unused m4 macro. + * tests/cxx-type.at: Reformat whitespace with tabs. + (_AT_TEST_GLR_CXXTYPES): In union Node, rename node_info to nodeInfo + since it's a member. Rename type to isNterm for clarity. + +2005-12-29 Akim + + Let glr.cc catch up with symbol_value_print. + * data/glr.cc (b4_yysymprint_generate): Replace by... + (b4_yy_symbol_print_generate): this. + (yy_symbol_print, yy_symbol_value_print): Declare them. + +2005-12-28 Paul Eggert + + * src/location.h (boundary): Note that a line or column equal + to INT_MAX indicates an overflow. + * src/scan-gram.l: Include verify.h. Don't include get-errno.h. + (rule_length_overflow, increment_rule_length, add_column_width): + New functions. + ({id}, "\"", "'"): + ("}"): + Use increment_rule_length rather than incrementing it by hand. + (adjust_location, handle_syncline): Diagnose overflow. + (handle_action_dollar, handle_action_at): + Fix bug with monstrosities like $-2147483648. + Remove now-unnecessary checks. + (scan_integer): Verify assumptions and remove now-unnecessary checks. + (convert_ucn_to_byte): Verify assumptions. + (handle_syncline): New arg LOC. All callers changed. + Don't store through a value derived from char const * pointer. + + * src/reader.c (grammar_rule_check): Rewrite slightly to avoid + GCC warnings. + +2005-12-27 Paul Eggert + + * src/reader.c (grammar_midrule_action, grammar_symbol_append): + Remove unnecessary forward static decls. + +2005-12-27 Akim Demaille + + * src/reader.c (grammar_current_rule_check): Also check that $$ + is used. + Take the rule to check as argument, hence rename as... + (grammar_rule_check): this. + * src/reader.h, src/reader.c (grammar_rule_begin, grammar_rule_end): + Rename as... + (grammar_rule_begin, grammar_rule_end): these, for consistency. + (grammar_midrule_action, grammar_symbol_append): Now static. + * tests/torture.at (input): Don't rely on the default action + being always performed. + * tests/calc.at: "Set" $$ even when the action is "cut" with + YYERROR or other. + * tests/actions.at (Exotic Dollars): Instead of using unused + values, check that the warning is issued. + +2005-12-22 Paul Eggert + + * NEWS: Improve wording for unused-value warnings. + +2005-12-22 Akim Demaille + + * data/lalr1.cc, data/yacc.c, data/glr.c, data/c.m4 + (b4_yysymprint_generate): Rename as... + (b4_yy_symbol_print_generate): this. + Generate yy_symbol_print instead of yysymprint. + Generate also yy_symbol_value_print, and use it. + +2005-12-22 Akim Demaille + + * NEWS: Warn about unused values. + * src/symlist.h, src/symlist.c (symbol_list, symbol_list_new): Add + a `used' member. + (symbol_list_n_get, symbol_list_n_used_set): New. + (symbol_list_n_type_name_get): Use symbol_list_n_get. + * src/scan-gram.l (handle_action_dollar): Flag used symbols. + * src/reader.c (grammar_current_rule_check): Check that values are + used. + * src/symtab.c (symbol_print): Accept 0. + * tests/existing.at: Remove the type information. + Empty the actions. + Remove useless actions (beware of mid-rule actions: perl -000 + -pi -e 's/\s*\{\}(?=[\n\s]*[|;])//g'). + * tests/actions.at (Exotic Dollars): Use unused values. + * tests/calc.at: Likewise. + * tests/glr-regression.at (No users destructors if stack 0 deleted): + Likewise. + + * src/gram.c (rule_useful_p, rule_never_reduced_p): Use + rule_useful_p. + +2005-12-21 Paul Eggert + + Undo 2005-12-01 tentative license wording change. The wording is + still being reviewed by the lawyers, and we don't want to wait for + them before publishing a test release. For now, revert to the + previous wording. + * NEWS: Undo 2005-12-01 change. + * data/glr.c: Revert to previous license wording. + * data/glr.cc: Likewise. + * data/lalr1.cc: Likewise. + * data/location.cc: Likewise. + * data/yacc.c: Likewise. + + * NEWS: Reword %destructor vs YYABORT etc. + * data/glr.c: Use American spacing, for consistency. + * data/glr.cc: Likewise. + * data/lalr1.cc: Likewise. + * data/yacc.c: Likewise. + * data/yacc.c: Reformat comments slightly. + * doc/bison.texinfo: Replace "non-" with "non" when that makes sense, + for consistency. Fix some spelling errors and reword recently-included + text slightly. + * tests/cxx-type.at: Cast results of malloc, for C++. + +2005-12-21 Joel E. Denny + + * tests/cxx-type.at: Construct a tree, count the parents of shared + nodes, and free each node once and only once. Previously, the memory + for semantic values was leaked instead. + +2005-12-21 Joel E. Denny + + * data/glr.c (struct yyGLRStack): If pure, add yyval and yyloc members. + (yylval, yylloc): If pure, #define to yystackp->yyval and + yystackp->yyloc similar to yychar and yynerrs. + (yyparse): If pure, remove local yylval and yylloc. Add local + yystackp to accommodate pure definitions of yylval and yylloc. + (b4_lex_param, b4_lyyerror_args, b4_lpure_args): If pure, change + yylvalp and yyllocp to &yylval and &yylloc. + (nerrs, char, lval, lloc): If pure, add #define's for b4_prefix[] + namespace. Previously, nerrs and char were missing, but lval and lloc + weren't necessary. + (yyprocessOneStack, yyreportSyntaxError, yyrecoverSyntaxError): Remove + yylvalp and yyllocp parameters since, if pure, these are now always + accessible through yystackp. If not pure, they are still accessible + globally. + * data/glr.c, data/yacc.c (YYLLOC_DEFAULT): Change `if (N)' to + `if (YYID (N))' to pacify lint. + +2005-12-21 Akim Demaille + + YYACCEPT, YYERROR, and YYABORT, as user actions, should not + destroy the RHS symbols of a rule. + * data/yacc.c (yylen): Initialize to 0. + Keep its value to the number of items to possibly shift. + In particular, a regular successful parse that ends on YYFINAL by + a (internal) YYACCEPT must not have yylen != 0. + (yyerrorlab, yyreturn): Pop the RHS. + Reorder a bit to emphasize the `shifting' bits of code. + (YYPOPSTACK): Now accept a number of items to pop. + * data/lalr1.cc: Likewise. + * data/glr.c: Formatting changes. + Use goto instead of fall through. + * doc/bison.texinfo (Destructor Decl): Complete. + +2005-12-20 Juan Manuel Guerrero + + * Makefile.am: DJGPP specific files added to EXTRA_DIST. + * djgpp/Makefile.maint: Fix PACKAGE variable computation. + * djgpp/config.bat: Replace every occurence of the file name + scan-gram-c.c with c-scan-gram.c. The same for scan-skel-c.c with + c-scan-skel.c to conform with the 8.3 file name restriction on MSDOS. + * djgpp/config.sed: Replace every occurence of the file name + scan-gram-c.c with c-scan-gram.c. The same for scan-skel-c.c with + c-scan-skel.c to conform with the 8.3 file name restriction on MSDOS. + * djgpp/djunpack.bat: DJGPP specific file. + * djgpp/fnchange.lst: DJGPP specific file. + * djgpp/README.in: Add new information about how to unpack the bison + source on MSDOS and other systems which have 8.3 file name restrictions + using djunpack.bat and fnchange.lst. + +2005-12-12 Paul Eggert + + * bootstrap (build_cvs_prefix): Remove; unused. + (CVS_PREFIX): Adjust to yesterday's Savannah reorganization + when getting gnulib. + +2005-12-12 "Joel E. Denny" + + * data/glr.c: Reorder typedef declarations for structs to match order + of struct declarations. + Rename yystack everywhere to yystackp except in yyparse where it's not + a pointer. + (yyglrShift): Change parameter YYSTYPE yysval to YYSTYPE* yyvalp for + consistency. + (yyis_table_ninf): Change 0 to YYID (0) to pacify lint. + (yyreportSyntaxError): Add /*ARGSUSED*/ to pacify lint. + (yyparse): Change while (yytrue) to while ( YYID (yytrue)) to pacify + lint. + +2005-12-09 Paul Eggert + + * tests/sets.at (Accept): Fix typos in regular expression used to + sed out the final state number. + + Work around portability problem on Solaris 10: flex-generated + files include before , which messes up + because the latter defines __EXTENSIONS__. Address the problem + by creating two new little files that include first, + then include the flex-generated files. Rewrite everyone else + to include first, as well. + * lib/timevar.c: Always include "config.h". + * src/Makefile.am (bison_SOURCES): Replace scan-gram.l with + scan-gram-c.c, and scan-skel.l with scan-skel-c.c. + (EXTRA_bison_SOURCES): New macro. + * src/scan-gram-c.c, src/scan-skel-c.c: New files. + * src/system.h: Don't include config.h. + * src/LR0.c: Include first. + * src/assoc.c: Likewise. + * src/closure.c: Likewise. + * src/complain.c: Likewise. + * src/conflicts.c: Likewise. + * src/derives.c: Likewise. + * src/files.c: Likewise. + * src/getargs.c: Likewise. + * src/gram.c: Likewise. + * src/lalr.c: Likewise. + * src/location.c: Likewise. + * src/main.c: Likewise. + * src/muscle_tab.c: Likewise. + * src/nullable.c: Likewise. + * src/output.c: Likewise. + * src/parse-gram.y: Likewise. + * src/print.c: Likewise. + * src/print_graph.c: Likewise. + * src/reader.c: Likewise. + * src/reduce.c: Likewise. + * src/relation.c: Likewise. + * src/state.c: Likewise. + * src/symlist.c: Likewise. + * src/symtab.c: Likewise. + * src/tables.c: Likewise. + * src/uniqstr.c: Likewise. + * src/vcg.c: Likewise. + + * src/parse-gram.y: Fix minor problems uncovered by lint. + (current_lhs, current_lhs_location): Now static. + (current_assoc): Remove unused variable. + + Cleanups so that Bison-generated parsers have less lint. + * data/c.m4 (b4_yydestruct_generate, b4_yysymprint_generate): + Prepend /*ARGSUSED*/, for lint's sake. + * data/glr.c (YYUSE): Properly parenthesize, and use an alternate + definition if 'lint' is defined. + (YYID): New macro (or function, if lint). + All uses of /*CONSTCOND*/0 replaced by YYID(0). + * data/yacc.c: Likewise. + * data/glr.c (yyuserAction, yyuserMerge, yy_reduce_print): + (yyrecoverSyntaxError): Prepend /*ARGSUSED*/. + * data/glr.cc (YYLLOC_DEFAULT): Omit /*CONSTCOND*/ since this code + is C++ only. + * data/lalr1.cc (YYUSE): Just use a cast, since this code is C++ only. + * data/yacc.c (YYSTACK_FREE) [defined YYSTACK_ALLOC]: + Use YYID(0) rather than 0, for lint. + (yystrlen): Rewrite to avoid lint warning about ptrdiff_t overflow. + (yysyntax_error): Rewrite to avoid lint warnings about parenthesization. + +2005-12-07 Paul Eggert + + * tests/glr-regression.at + (Improper handling of embedded actions and dollar(-N) in GLR parsers): + Close memory leak reported by twlevo. + +2005-12-06 "Joel E. Denny" + + * data/glr.c (yyprocessOneStack, yyparse): Synchronize the shift for + all stacks. + (yyparse): Iterate another stack in order to call user destructors. + * tests/glr-regression.at (No users destructors if stack 0 deleted): + New test case. + (Duplicated user destructor for lookahead): This test now is expected + to succeed. + +2005-12-01 Paul Eggert + + * NEWS: Document the following change. + * data/yacc.c: Say "parser skeleton" rather than "file", since + it's no longer just a file. + * data/glr.c: Grant a special exception for C GLR parsers, that + reads like the already-existing exception for C LALR(1) parsers. + * data/glr.cc: Likewise. + * data/lalr1.cc: Likewise. + * data/location.cc: Likewise. + * data/yacc.c: Reword the "written by" statement to clarify that + it was the parser skeleton, not the entire output file. + * data/glr.c: Written by Paul Hilfinger. + * data/glr.cc: Written by Akim Demaille. + * data/lalr1.cc: Likewise. + +2005-11-18 Paul Eggert + + * data/yacc.c (yy_reduce_print, YY_REDUCE_PRINT): + Fix typos in previous change that broke 'make check'. + YY_REDUCE_PRINT cannot be a pseudo-varargs macro; that isn't + supported in C. + * tests/calc.at (_AT_CHECK_CALC,_AT_CHECK_CALC_ERROR): + Don't check NUM-STDERR-LINES, since the output format is fluctuating. + We can revert this once things settle down. + + * src/conflicts.c (conflicts_print): Don't print file name twice + when %expect fails because there were no conflicts. + * doc/bison.texinfo (Expect Decl): Tighten up wording in previous + change. + * tests/conflicts.at (%expect not enough, %expect too much): + (%expect with reduce conflicts): Adjust to new behavior. + +2005-11-18 Akim Demaille + + * src/conflicts.c (conflicts_print): Unsatisfied %expectation are + errors. + * NEWS: Document this. + * doc/bison.texinfo (Expect Decl): Likewise. + +2005-11-16 Akim Demaille + + Generalize the display of semantic values and locations in traces. + * data/glr.c (yy_reduce_print): Fix indices (again). + * data/c++.m4 (b4_rhs_value, b4_rhs_location): Don't expect + literal integers. + * data/lalr1.cc (yyreduce_print): Rename as... + (yy_reduce_print): this. + Display values and locations. + * data/yacc.c (yy_reduce_print): Likewise. + (YY_REDUCE_PRINT): Adjust to pass the required arguments. + (yysymprint): Move higher to be visible from yy_reduce_print). + (yyparse): Adjust. + * tests/calc.at: Adjust the expected length of the traces. + +2005-11-14 Akim Demaille + + * data/glr.c (yy_reduce_print): The loop was quite wrong: type are + from 1 to N, while values and location start at 0. + (b4_rhs_location, b4_rhs_value): Add parens around $1 and $2. + +2005-11-14 Akim Demaille + + * data/glr.c (yy_reduce_print): Fix the $ number. + +2005-11-14 Akim Demaille + + "Use" parse parameters. + * data/c.m4 (b4_parse_param_for, b4_parse_param_use): New. + * data/glr.c, data/glr.cc: Use them. + * data/glr.c (YYUSE): Have a C++ definition that supports + non-pointer types. + +2005-11-14 Akim Demaille + + * data/glr.c (yyexpandGLRStack): Declare only if defined. + +2005-11-14 Akim Demaille + + * data/glr.cc: New. + * data/m4sugar/m4sugar.m4 (m4_prepend): New. + +2005-11-12 Akim Demaille + + Let position and location be PODs. + * data/location.cc (position::initialize, location::initialize): New. + (position::position, location::location): Define only if + b4_location_constructors is defined. + * data/lalr1.cc (b4_location_constructors): Define it for backward + compatibility. + * doc/bison.texinfo (Initial Action Decl): Use initialize. + +2005-11-12 Akim Demaille + + * data/lalr1.cc: Move the body of the ctor and dtor into the + parser file (instead of the header). + Wrap the implementations in a "namespace yy". + +2005-11-12 Akim Demaille + + Have glr.c include its header file when created. + * data/glr.c (b4_shared_declarations): New. + Output them verbatim in the parser if !%defines, otherwise + output then in the header file, and include it instead. + +2005-11-11 Akim Demaille + + * data/glr.c: Comment changes. + +2005-11-11 Akim Demaille + + When yydebug, report semantic and location values for reductions. + * data/glr.c (yy_reduce_print): Report the semantic values and the + locations. + (YY_REDUCE_PRINT): Adjust. + (yyglrReduce): Use them. + (b4_rhs_value, b4_rhs_location): Remove m4_eval invocations. + * data/c.m4 (b4_yysymprint_generate): Specify the const arguments. + * tests/calc.at (_AT_CHECK_CALC_ERROR): Remove the reduction + traces. + +2005-11-10 Akim Demaille + + * data/glr.c (yynewGLRStackItem, YY_RESERVE_GLRSTACK): New. + (yyaddDeferredAction, yyglrShift, yyglrShiftDefer): Use them. + (yyexpandGLRStack, YYRELOC): Define only when YYSTACKEXPANDABLE. + +2005-11-09 Albert Chin-A-Young + + * m4/cxx.m4, examples/Makefile.am: Don't build + examples/calc++ if no C++ compiler is available. (trivial change) + +2005-11-09 Akim Demaille + + * src/scan-skel.l: Use a couple of asserts. + +2005-11-03 Akim Demaille + + In some (weird) cases, the final state number is incorrect. + Reported by Alexandre Duret-Lutz. + * src/LR0.c (state_list_append): Remove the computation of + final_state. + (save_reductions): Do it here. + (get_state): Alpha conversion. + (generate_states): Use a for loop. + * src/gram.h (item_number_is_rule_number) + (item_number_is_symbol_number): New. + * src/state.c: Use assert. + * src/system.h: Include assert.h. + * tests/sets.at (Accept): New. + +2005-10-30 Paul Hilfinger + + * data/glr.c (yyfill): Adjust comment. + (yyresolveAction): Initialize default location properly + for empty right-hand sides. + (yydoAction): Ditto. + Add comment explaining apparently dead code. + * tests/glr-regression.at + (Incorrectly initialized location for empty right-hand side in GLR): + New test. + +2005-10-30 Paul Eggert + + * bootstrap (cleanup_gnulib): New function. Use it to clean up + gnulib when interrupted. This fixes some race conditions and + works around some portability problems (one noted by Paul + Hilfinger). + +2005-10-22 Akim + + * Makefile.cfg: Adjust to config -> build-aux. + Reported by twledo. + +2005-10-21 Akim Demaille + + * data/c.m4 (b4_yydestruct_generate, b4_yysymprint_generate): Pass + the %parse-params. + * data/glr.c (YY_SYMBOL_PRINT, yydestroyGLRState): Adjust. + * data/yacc.c (b4_Pure_if): Rename as... + (b4_yacc_pure_if): this. + (YY_SYMBOL_PRINT, yyparse): Adjust. + * doc/bison.texinfo: Formatting changes. + +2005-10-21 Akim Demaille + + Finish the transition config -> build-aux. + * configure.ac, Makefile.am: Use build-aux. + * config/prev-version, config/announce-gen, config/Makefile.am: + Move to... + * build-aux/prev-version, build-aux/announce-gen, + * build-aux/Makefile.am: here. + +2005-10-14 Akim Demaille + + * examples/calc++/test: Use set -x only when VERBOSE. + +2005-10-13 Paul Eggert + + * NEWS: Bison now warns if it finds a stray `$' or `@' in an action. + * src/scan-gram.l ([$@]): Implement this. + +2005-10-13 Akim Demaille + + * src/scan-skel.l: Output the base name parts of the parser and + header file names. + * tests/output.at (AT_CHECK_OUTPUT): Support subdirectories, and + additional checks. + Use this to exercise C++ outputs in subdirs. + Reported by Oleg Smolsky. + +2005-10-12 Paul Eggert + + * data/c.m4 (b4_c_function_def): Look at __C99_FUNC__, not at + __STDC_VERSION__, as IBM cc 7.0 doesn't define the latter either. + Problem reported by John P. Hartmann. + * data/yacc.c (YYMODERN_C): Likewise. Don't define if the user has + already defined it. + +2005-10-12 Akim Demaille + + * src/parse-gram.y (version_check): Exit 63 to please missing + (stands for "version mismatch). + * tests/input.at, doc/bison.texinfo: Adjust. + +2005-10-10 Paul Eggert + + Work around portability problems with Visual Age C compiler + (xlc and xlC_r) reported by John P. Hartmann. + * data/location.cc (initial_column, initial_line): Remove. + All uses replaced by 0 and 1. + * src/scan-gram.l (gram_wrap): Redefine to avoid bug in flex 2.5.31 + that xlc complains about. + * src/scan-skel.l (skel_wrap): Likewise. + * data/c.m4 (b4_c_function_def): Look at __STDC_VERSION__ as well + as __STDC__. + * data/yacc.c (YYMODERN_C): New macro, which also looks at + __STDC_VERSION__. Use it everywhere instead of looking at + __STDC__ and __cplusplus. + +2005-10-10 Akim Demaille + + * examples/calc++/test: Be quiet unless VERBOSE. + +2005-10-05 Paul Eggert + + * data/c.m4 (yydestruct, yysymprint): + Use YYUSE instead of casting to void. + * data/glr.c (YYUSE): New macro. + (yyuserMerge, yyreportAmbiguity, yyreportSyntaxError): + Use it instead of rolling our own. + (YYLLOC_DEFAULT, YYCHK, YYDPRINTF, YY_SYMBOL_PRINT, YY_REDUCE_PRINT): + (YYCHK1): + Use /*CONSTCOND*/ to suppress lint warnings. + * data/lalr1.cc (YYLLOC_DEFAULT, YY_SYMBOL_PRINT, YY_REDUCE_PRINT): + (YY_STACK_PRINT): Use 'false' not '0'. + (YYUSE): New macro. + (yysymprint_, yydestruct_): Use it instead of rolling our own. + * data/yacc.c (YYUSE): New macro. + (YYCOPY, YYSTACK_RELOCATE, YYBACKUP, YYLLOC_DEFAULT): + (YYDPRINTF, YY_SYMBOL_PRINT, YY_STACK_PRINT, YY_REDUCE_PRINT): + (yyerrorlab): Use /*CONSTCOND*/ to suppress lint warnings. + + + * data/m4sugar/m4sugar.m4 (_m4_map): New macro. + (m4_map, m4_map_sep): Use it. Handle the empty list correctly. + +2005-10-04 Paul Eggert + + Undo the parts of the unlocked-I/O change that substituted + putc or puts for printf. This might hurt performance a bit, + but some people prefer the printf style. + * data/c.m4 (yysymprint): Prefer printf to puts and putc. + * data/glr.c (YYFPUTC, YYFPUTS, YYDPUTS): Remove. + All uses replaced by YYFPRINTF and YYDPRINTF. + * data/yacc.c: Likewise. + * lib/bitset.c (bitset_print): Likewise. + * lib/bitsetv.c (bitsetv_dump, debug-bitsetv): Prefer printf to + putc and puts. + * lib/lbitset.c (debug_lbitset): Likewise. + * src/closure.c (print_firsts, print_fderives): Likewise. + * src/gram.c (grammar_dump): Likewise. + * src/lalr.c (look_ahead_tokens_print): Likewise. + * src/output.c (escaped_output): Likewise. + (user_actions_output): Break apart two printfs. + * src/parse-gram.y (%printer): Prefer printf to putc and puts. + * src/reduce.c (reduce_print): Likewise. + * src/state.c (state_rule_look_ahead_tokens_print): Likewise. + * src/system.h: Include unlocked-io.h rathe than stdio.h. + + * data/glr.c (yyuserMerge, yyreportAmbiguity, yyreportSyntaxError): + Use assignments rather than casts-to-void to suppress + unused-variable warnings. This pacifies 'lint'. + * data/lalr1.cc (yysymprint_, yydestruct_): Use a call to suppress + unused-variable warnings. + +2005-10-03 Juan Manuel Guerrero + + * Makefile.am: DJGPP specific files added to EXTRA_DIST. + +2005-10-02 Paul Eggert + + Use unlocked I/O for a minor performance improvement on hosts like + GNU/Linux and Solaris that support unlocked I/O. The basic idea + is to use the gnlib unlocked-io module, and to prefer putc and + puts to printf when either will work (since the latter doesn't + come in an unlocked flavor). + * bootstrap (gnulib_modules): Add unlocked-io. + * data/c.m4 (yysymprint): Prefer puts and putc to printf. + * data/glr.c (YYFPUTC, YYFPUTS, YYDPUTS): New macros. + Prefer them to YYFPRINTF and YYDPRINTF if either will do, + and similarly for puts and putc and printf. + * data/yacc.c: Likewise. + * lib/bitset.c (bitset_print): Likewise. + * lib/bitset.h [USE_UNLOCKED_IO]: Include unlocked-io.h. + * lib/bitsetv.c (bitsetv_dump, debug-bitsetv): Prefer putc and puts + to printf. + * lib/lbitset.c (debug_lbitset): Likewise. + * src/closure.c (print_firsts, print_fderives): Likewise. + * src/gram.c (grammar_dump): Likewise. + * src/lalr.c (look_ahead_tokens_print): Likewise. + * src/output.c (escaped_output): Likewise. + (user_actions_output): Coalesce two printfs. + * src/parse-gram.y (%printer): Prefer putc and puts to printf. + * src/reduce.c (reduce_print): Likewise. + * src/state.c (state_rule_look_ahead_tokens_print): Likewise. + * src/system.h: Include unlocked-io.h rather than stdio.h. + + * data/lalr1.cc: Don't put an unmatched ' in a dnl comment, as + this confuses xgettext. + +2005-10-02 Akim Demaille + + * bootstrap (gnulib_modules): Add strverscmp. + * lib/.cvsignore: Add strverscmp.c, strverscmp.h. + * m4/.cvsignore: Add strverscmp.m4. + * src/parse-gram.y (%require): New token, new rule. + (version_check): New. + * src/scan-gram.l (%require): Adjust. + * tests/input.at (AT_REQUIRE): New. + Use it. + * doc/bison.texinfo (Require Decl): New. + (Calc++ Parser): Use %require. + +2005-10-02 Akim Demaille + + * data/location.cc: New. + +2005-10-02 Paul Eggert , + Akim Demaille + + Make sure -odir/foo.cc creates dir/location.hh etc. + * src/files.h (spec_outfile, parser_file_name, spec_name_prefix) + (spec_file_prefix, spec_verbose_file, spec_graph_file) + (spec_defines_file): Now const. + (dir_prefix): New. + (short_base_name): Remove. + * src/files.c: Adjust. + (dirname.h): Include. + (base_name): Don't prototype it. + (finput): Remove, duplicates gram_in. + (full_base_name, short_base_name): Replace by... + (all_but_ext, all_but_tab_ext): these. + (compute_base_names): Rename as... + (compute_file_name_parts): this. + Update to compute the new variables, including dir_prefix. + Adjust dependencies. + * src/output.c (prepare): Output them. + * src/reader.c: Adjust to use gram_in, not finput. + * src/scan-skel.l (@dir_prefix@): New. + +2005-10-02 Juan Manuel Guerrero + + * lib/subpipe.c: New function end_of_output_subpipe() added + to allow support for non-posix systems. This is a no-op function + for posix systems. + + * lib/subpipe.h: New function end_of_output_subpipe() added + to allow support for non-posix systems. This is a no-op function + for posix systems. + + * src/output.c (output_skeleton): Use end_of_output_subpipe() to + handle the lack of pipe/fork functionality on non-posix systems. + + * djgpp/Makefile.maint: DJGPP specific file. + + * djgpp/README.in: DJGPP specific file. + + * djgpp/config.bat: DJGPP specific configuration file. + + * djgpp/config.sed: DJGPP specific configuration file. + + * djgpp/config.site: DJGPP specific configuration file. + + * djgpp/config_h.sed: DJGPP specific configuration file. + + * djgpp/subpipe.c: DJGPP specific replacement file for lib/subpipe.c. + + * djgpp/subpipe.h: DJGPP specific replacement file for lib/subpipe.h. + +2005-10-02 Akim Demaille + + * data/location.cc: New, extract from... + * data/lalr1.cc: here. + (location.hh): Include it after the user prologue, in case the + filename type is defined by the user. + Forward declation location and position before the pre-prologue. + (yyresult_): Rename as... + (yyresult): this, it's a local variable, not an attribute. + * data/Makefile.am (dist_pkgdata_DATA): Adjust. + +2005-10-01 Akim Demaille + + * examples/extexi: Restore the #line generation. + +2005-09-30 Akim Demaille , + Alexandre Duret-Lutz + + Move the token type and YYSTYPE in the parser class. + * data/lalr1.cc (stack.hh, location.hh): Include earlier. + (parser::token): New, from the moved free definition of tokens. + (parser::semantic_value): Now a full definition instead of an + indirection to YYSTYPE. + (b4_post_prologue): No longer included in the header file, but + in the implementation file. + * doc/bison.texi (C+ Language Interface): Update. + * src/parse-gram.y: Support unary %define. + * tests/actions.at: Define global_tokens_and_yystype for backward + compatibility until we update the tests. + * tests/calc.at: Idem. + (first_line, first_column, last_line, last_column): Define for lalr1.cc + to simplify the code. + +2005-09-29 Paul Eggert + + Port to SunOS 4.1.4, which lacks strtoul and strerror. + Ah, the good old days! Problem reported by Peter Klein. + * bootstrap (gnulib_modules): Add strerror, strtoul. + * lib/.cvsignore: Add strerror.c, strtol.c, strtoul.c + * m4/.cvsignore: Add strerror.m4, strtol.m4, strtoul.m4. + +2005-09-29 Akim Demaille + + * data/c.m4 (b4_error_verbose_if): New. + * data/lalr1.cc: Use it. + (YYERROR_VERBOSE_IF): Remove. + (yyn_, yylen_, yystate_, yynerrs_, yyerrstatus_): Remove as + parser members, replaced by... + (yyn, yylen, yystate, yynerss, yyerrstatus): these parser::parse + local variables. + (yysyntax_error_): Takes the state number as argument. + (yyreduce_print_): Use the argument yyrule, not the former + attribute yyn_. + +2005-09-26 Paul Eggert + + * bootstrap (gnulib_modules): Add verify. + * lib/.cvsignore: Add verify.h. + * src/getargs.c: Use ARGMATCH_VERIFY rather than verify. + * src/system.h (verify): Remove. + Include verify.h instead. + * src/tables.c (tables_generate): Use new API for 'verify'. + +2005-09-21 Paul Eggert + + * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Do not use + local variables whose names begin with 'yy'. + * tests/calc.at (_AT_DATA_CALC_Y): Likewise. + Trivial changes from Joel E. Denny. + + * bootstrap (gnulib_modules): Remove alloca. Bison doesn't need + it itself. + * src/main.c (main) [C_ALLOCA]: Don't flush alloca'ed memory; we + don't use alloca any more. + + * data/yacc.c [YYSTACK_USE_ALLOCA && !defined __GNUC__ && ! defined + __BUILTIN_VA_ARG_INCR && ! defined _AIX && ! defined _MSC_VER && + defined _ALLOCA_H]: Don't include ; not needed in this case. + * tests/torture.at (Exploding the Stack Size with Alloca): Adjust + to match yacc.c, to test more hosts. + +2005-09-20 Paul Eggert + + * data/yacc.c (YYSIZE_T): Reindent to make it clearer. This + doesn't affect behavior. + (YYSTACK_ALLOC) [YYSTACK_USE_ALLOCA]: Improve support for + Solaris, AIX, MSC. + (_STDLIB_H): Renamed from YYINCLUDED_STDLIB_H. All uses changed. + This works a bit better with glibc, if user code has already included + stdlib.h. + * doc/bison.texinfo (Bison Parser): Document that users can't + arbitrarily use malloc and free for other purposes. Document + that and might be included. + (Table of Symbols): Under YYSTACK_USE_ALLOCA, Don't claim that the + user must declare alloca. + + * HACKING (release): Forwarn the Translation Project about + stable releses. + +2005-09-20 Akim Demaille + + * data/glr.c: Use b4_token_enums, not b4_token_enums_defines. + +2005-09-19 Paul Eggert + + * data/yacc.c (YYSIZE_MAXIMUM): New macro. + (YYSTACK_ALLOC_MAXIMUM): Use it. + (yysyntax_error): New function. + (yyparse) [YYERROR_VERBOSE]: Don't leak memory indefinitely if + multiple syntax errors are reported, and alloca is being used. + Instead, reallocate buffers twice as big each time, so that + we waste at most half the allocated memory. Start with a small + (128-byte) buffer that will suffice in most cases anyway. + Use yysyntax_error to do most of the work. + + * doc/bison.texinfo (Error Reporting, Table of Symbols): + yynerrs is the number of errors reported, not the number of + errors encountered. + + * tests/glr-regression.at (Duplicated user destructor for lookahead): + Mark it as expected to fail. + Cast result of malloc; problem reported by twlevo@xs4all.nl. + * tests/actions.at, tests/calc.at, tests/glr-regression.at: + Don't start user-code symbols with "yy", to avoid name space problems. + +2005-09-19 Akim Demaille + + Remove the traits, failed experiment. + It never proved useful, and anyway because of the current + definition, it was not possible to have several specialization of + this traits, making it useless. + * data/lalr1.cc (yy:traits): Remove. + Inline its definitions in the parser class. + +2005-09-19 Akim Demaille + + * tests/atlocal.in (LIBS): Pass INTLLIBS to address failures on at + least Mac OSX with a /usr/local install of gettext. + +2005-09-19 Akim Demaille + + * data/lalr1.cc (yyparse): Rename yylooka and yyilooka as yychar + and yytoken for similarity with the other skeletons. + +2005-09-19 Akim Demaille + + * NEWS, configure.ac: update version number to 2.1a. + +2005-09-16 Paul Eggert + + * NEWS: Version 2.1. + + * NEWS: Remove notice of yytname change, since it was never in an + official release. + * data/glr.c (yydestroyGLRState): Rename local var to avoid shadowing + diagnostic. + * src/output.c (prepare): Likewise. + * data/lalr1.cc (YYERROR_VERBOSE_IF): New macro. + (yysyntax_error_): Use it to avoid GCC warning when YYERROR_VERBOSE + is not defined. This is an awful hack, but it's enough for now. + All callers changed. + * tests/glr-regression-at (make_value): Args are const pointers now, + to avoid GCC warning. + (Duplicated user destructor for lookahead): New test. Currently + skipped. It fails on my host but I'm not sure it'll always fail. + +2005-09-16 Akim Demaille + + * src/symtab.h (struct symbol): Declare the printer and destructor + as const, to avoid accidental calls to free. + (symbol_destructor_set, symbol_printer_set): Adjust. + * src/symtab.c: Adjust. + +2005-09-16 Akim Demaille + + * data/c.m4 (b4_token_enums): New. + (b4_token_defines): Rename as... + (b4_token_enums_defines): this. + (b4_token_defines): New, output only the #defines. + * data/yacc.c, data/glr.c: Adjust. + * data/lalr1.cc: Use b4_token_enums instead of b4_token_enums_defines. + * data/c.m4 (b4_yydestruct_generate, b4_yysymprint_generate): Define + as default values. + +2005-09-16 Akim Demaille + + * data/lalr1.cc (yylex_): Remove, inline its code. + (yyreport_syntax_error_): Remove, replaced by... + (yysyntax_error_): this which returns a string and leaves to the + caller the call to the users' error function. + (yylooka_, yyilooka_, yylval, yylloc, yyerror_range_, yyval, yyloc): + Move from members of the parser object... + (yylooka, yyilooka, yylval, yylloc, yyerror_range, yyval, yyloc): + to local variables of the parse function. + +2005-09-16 Akim Demaille + + * doc/bison.texinfo (Calc++ Parser): Don't promote defining YYEOF + since it's in Bison's name space. + +2005-09-15 Paul Eggert + + * data/glr.c (yyresolveValue): Add default case to pacify + gcc -Wswitch-default. Problem reported by twlevo@xs4all.nl. + + * NEWS: Document when yyparse started to return 2. + * doc/bison.texinfo (Parser Function): Document when yyparse + returns 2. + + * data/lalr1.cc: Revert part of previous change, as it's incompatible. + (b4_filename_type): Renamed back from b4_file_name_type. All uses + changed. + (class position): file_name -> filename (reverting). All uses changed. + +2005-09-14 Paul Eggert + + * examples/calc++/Makefile.am ($(calc_sources_generated)): Don't + do anything if $@ exists. This reverts part of the 2005-07-07 + patch. + +2005-09-11 Paul Eggert + + * Makefile.am (EXTRA_DIST): Do not distribute REFERENCES; it + contains obsolete information and isn't worth distributing as a + separate file anyway. + * data/glr.c [defined YYSETJMP]: Don't include . + (YYJMP_BUF, YYSETJMP, YYLONGJMP) [!defined YYSETJMP]: New macros. + All uses of jmp_buf, setjmp, longjmp changed to use these instead. + (yyparse): Abort if user code uses longjmp to throw an unexpected + value. + +2005-09-09 Paul Eggert + + * data/c.m4 (b4_identification): Define YYBISON_VERSION. + Suggested by twlevo@xs4all.nl. + + * data/glr.c (YYCHK1): Do not assume YYE is in range. + This avoids a diagnostic from gcc -Wswitch-enum. + Problem reported by twlevo@xs4all.nl. + + * doc/bison.texinfo: Don't use "filename", as per GNU coding + standards. Use "file name" or "file" or "name", depending on + the context. + (Invocation): The output of "bison hack/foo.y" goes to foo.tab.c, + not to hack/foo.tab.c. + (Calc++ Top Level): 2nd arg of main is not const. + * data/glr.c: b4_filename -> b4_file_name. + * data/lalr1.cc: Likewise. Also, b4_filename_type -> b4_file_name_type. + All uses changed. + (class position): filename -> file_name. All uses changed. + * data/yacc.c: b4_filename -> b4_file_name. + * lib/bitset.h: filename -> file_name in local vars. + * lib/bitset_stats.c: Likewise. + * src/files.c: Likewise. + * src/scan-skel.l ("@output ".*\n): Likewise. + * src/files.c (file_name_split): Renamed from filename_split. + * src/muscle_tab.c (muscle_init): Output b4_file_name, not b4_filename. + +2005-09-08 Paul Eggert + + * lib/.cvsignore: Add pipe-safer.c, stdio--.h, unistd--.h, + to accommodate latest gnulib. + + * tests/glr-regression.at (Duplicate representation of merged trees): + Add casts to pacify g++. Problem reported by twlevo@xs4all.nl. + + * bootstrap: Add comment as to why the AM_LANGINFO_CODESET hack is + needed. + +2005-08-26 Paul Eggert + + * data/glr.c (yydestroyGLRState): Renamed from yydestroyStackItem. + All uses changed. Invoke user destructor after an error during a + split parse (trivial change from Joel E. Denny). + + * tests/glr-regression.at + (User destructor after an error during a split parse): New test case. + Problem reported by Joel E. Denny in: + http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00029.html + +2005-08-25 Paul Eggert + + * README-cvs: Give URLs for recommended tools. + Mention Gzip version problem, and bootstrapping issues. + Remove troubleshooting section, as it's somewhat obsolete. + + * bootstrap (no_cache): New var, to accommodate different wget + variants. Use it instead of '-C off'. Problem reported by + twlevo@xs4all.nl. + + * data/glr.c (yydestroyStackItem): New function. + (yyrecoverSyntaxError, yyreturn): Use it to improve quality of + debugging information. Problem reported by Joel E. Denny. + +2005-08-25 Akim Demaille + + * tests/local.at (AT_COMPILE_CXX): Pass $LINKS too. + +2005-08-24 Paul Eggert + + * data/glr.c (yyrecoverSyntaxError, yyreturn): + Don't invoke destructor on unresolved entries. + * tests/glr-regression.at + (User destructor for unresolved GLR semantic value): New test case. + Problem reported by Joel E. Denny in: + http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00016.html + +2005-08-21 Paul Eggert + + * lib/.cvsignore: Remove realloc.c, strncasecmp.c, xstrdup.c. + Add strnlen.c. + * m4/.cvsignore: Remove codeset.m4, gettext.m4, lib-ld.m4, + lib-prefix.m4, po.m4. + + * data/glr.c (yyreturn): Use "Cleanup:" rather than "Error:" + in yydestruct diagnostic, since it might not be an error. + Problem reported by Joel Denny near end of + . + * data/lalr1.cc (yyerturn): Likewise. + * data/yacc.c (yyreturn): Likewise. + * tests/calc.at (_AT_CHECK_CALC_ERROR): Adjust to the above change. + + * src/files.c: Remove obsolete FIXME comment. + + * data/glr.c (YY_SYMBOL_PRINT): Append a newline, for consistency + with the other templates, and to fix bogus run-on messages such + as the one reported at the end of + . + All callers changed to avoid the newline. + (yyprocessOneStack): Output two lines rather than one, to accommodate + the above change. This changes the debug output format slightly. + + * data/glr.c (yyresolveValue): Fix redundant parse tree problem + reported by Joel E. Denny in + + (trivial change). + * tests/glr-regression.at (Duplicate representation of merged trees): + New test, from Joel E. Denny in: + . + * THANKS: Add Joel E. Denny. + + * configure.ac (AC_INIT): Bump to 2.0c. + +2005-07-24 Paul Eggert + + * NEWS: Version 2.0b. + + * Makefile.am (SUBDIRS): Put examples before tests, so that + "make check" doesn't finish with "All 1 tests passed". + + * tests/regression.at (Token definitions): Don't rely on + AT_PARSER_CHECK for data that contains backslashes. It currently + uses 'echo', and 'echo' isn't portable if its argument contains + backslashes. Problem found on OpenBSD 3.4. Also, do not assume + that the byte '\0xff' is not printable in the C locale; it is, + under OpenBSD 3.4 (!). Luckily, '\0x80' through '\0x9e' are + not printable, so use '\0x81' to test. + + * data/glr.c (YYOPTIONAL_LOC): Define even if it's not a recent + version of GCC, since the macro is used with non-GCC compilers. + + Fix core dump reported by Pablo De Napoli in + . + * tests/regression.at (Invalid inputs with {}): New test. + * src/parse-gram.y (token_name): Translate type before using + it as an index. + + * data/glr.c (ATTRIBUTE_UNUSED): Remove, since it infringes on + the user's name space. All uses changed to __attribute__ + ((__unused__)). + (yyFail, yyMemoryExhausted, yyreportAmbiguity): + Add __attribute__ ((__noreturn__)). + + * etc/clcommit: Remove. We weren't using it, and it failed + "make maintainer-distcheck". + * Makefile.maint: Merge from coreutils. + (CVS_LIST, CVS_LIST_EXCEPT): New macros. + (syntax-check-rules): Change list of rules as described below. + (sc_cast_of_alloca_return_value, sc_dd_max_sym_length): + (sc_file_system, sc_obsolete_symbols, sc_prohibit_atoi_atof): + (sc_prohibit_jm_in_m4, sc_root_tests, sc_tight_scope): + (sc_trailing_space): New rules. + (sc_xalloc_h_in_src): Remove. + (sc_cast_of_argument_to_free, sc_cast_of_x_alloc_return_value): + (sc_space_tab, sc_error_exit_success, sc_changelog): + (sc_system_h_headers, sc_sun_os_names, sc_unmarked_diagnostics): + (makefile-check, po-check, author_mark_check): + (makefile_path_separator_check, copyright-check): + Use grep -n, to make it easier to find violations. + Use CVS_LIST and CVS_LIST_EXCEPT. + (header_regexp, h_re): Remove. + (dd_c): New macro. + (sc_dd_max_sym_length, .re-list, news-date-check): New rules. + (my-distcheck): Use more-modern GCC flags. + (signatures, %.asc): Remove. + (rel-files, announcement): Remove signatures. + Restore old updating code, even though we don't use it, so + that we're the same as coreutils. + (alpha, beta, major): Depend on news-date-check. + Make the upload commands. + + * data/c.m4, data/lalr1.cc, data/yacc.c: Normalize white space. + * lib/abitset.h, lib/bbitset.h, lib/bitset.h: Likewise. + * lib/bitset_stats.c, lib/ebitset.h, lib/lbitset.c: Likewise. + * lib/libitset.h, lib/timevar.c, lib/vbitset.h: Likewise. + * src/Makefile.am, src/gram.c, src/muscle_tab.h: Likewise. + * src/parse-gram.y, src/system.h, src/tables.c, src/vcg.c: Likewise. + * src/vcg_defaults.h, tests/cxx-type.at, tests/existing.at: Likewise. + * tests/sets.at: Likewise. + + * data/m4sugar/m4sugar.m4: Sync from Autoconf, except that + we comment out the Autoconf version number. + * doc/bison.texinfo (Calc++ Scanner): Don't use atoi, as + it's error-prone and "make maintainer-distcheck" rejects it. + + * lib/subpipe.c: Include without checking for HAVE_FCNTL_H. + Indent calls to "error" to pacify "make maintainer-distcheck", + when the calls are not intended to be translated. + * m4/subpipe.m4 (BISON_PREREQ_SUBPIPE): Don't check for fcntl.h. + + * src/Makefile.am (DEFS): Use +=, to pacify + "make maintainer-distcheck". + (bison_SOURCES): Add scan-skel.h. + (sc_tight_scope): New rule, from coreutils. + + * src/files.c (src_extension, header_extension): + Now static, not extern. + * src/getargs.c (short_options): Likewise. + * src/muscle_tab.c (muscle_table): Likewise. + * src/parse-gram.y (current_class, current_type, current_prec): + Likewise. + * src/reader.c (grammar_end, previous_rule_end): Likewise. + * src/getargs.h: Redo comments to pacify "make maintainer-distcheck". + * src/main.c (main): Cast bindtextdomain and textdomain calls to + void, to avoid warning when NLS is disabled. + * src/output.c: Include scan-skel.h. + (scan_skel): Remove decl, since scan-skel.h does this. + (output_skeleton): + Indent calls to "error" to pacify "make maintainer-distcheck". + * src/print_graph.c: Don't include , as system.h does this. + * src/reader.h (gram_end, gram_lineno): New decls to pacify + "make maintainer-distcheck". + * src/scan-skel.l (skel_lex, skel_get_lineno, skel_get_in): + (skel_get_out, skel_get_leng, skel_get_text, skel_set_lineno): + (skel_set_in, skel_set_out, skel_get_debug, skel_set_debug): + (skel_lex_destroy, scan_skel): Move these decls to... + * src/scan-skel.h: New file. + * src/uniqstr.c (uniqstr_assert): + Indent calls to "error" to pacify "make maintainer-distcheck". + + * tests/Makefile.am ($(srcdir)/package.m4): Use $(VAR), + not @VAR@. + + * tests/torture.at: Revamp to avoid misuse of atoi that + "make maintainer-distcheck" complained about. + + * examples/extexi (message): Don't print a message more than once, + and omit line-number decoration that makes Emacs compile think + that informative messages are worth worrying about. + +2005-07-22 Paul Eggert + + * configure.ac: Update version number. + + * Makefile.am (SUBDIRS): Add examples; somehow this got removed + accidentally. + * examples/calc++/calc++-parser.yy: Remove from CVS, as it's + autogenerated by the maintainer. + * examples/calc++/.cvsignore: Add *.yy. + + * lib/bitset.c (bitset_alloc): Don't cast xcalloc result. + * lib/bitset_stats.c (bitset_stats_init): Likewise. + * lib/bitsetv.c (bitsetv_alloc): Likewise. + + * po/POTFILES.in: Add lib/xalloc-die.c; remove lib/xmalloc.c. + + * src/relation.c (relation_transpose): Rewrite to avoid bogus complaint + from maintainer-distcheck about casting the argument of 'free'. + + * NEWS: Mention recent yytname changes. + * THANKS: Add Anthony Heading, twlevo@xs4all.nl. + + * bootstrap: For translations that have not yet been upgraded to + the new runtime-po domain, prime the pump by extracting the + relevant strings from the obsolete translations. This code can be + removed once the bison-runtime domain has been translated by each + team. + + * src/scan-gram.l (.): Don't double-quote token names, + now that token names are already quoted. + + Fix problem reported by Anthony Heading. + * data/glr.c (YYTOKEN_TABLE): New macro. + (yytname): Define if YYTOKEN_TABLE. + * data/yacc.c (YYTOKEN_TABLE, yytname): Likewise. + * data/lalr1.cc (YYTOKEN_TABLE, yytname_): Likewise. + (YYERROR_VERBOSE): Define the same way the other skeletons do. + * src/output.c (prepare_symbols): Output token_table_flag. + +2005-07-21 Paul Eggert + + * data/glr.c (yyinitGLRStack, yyreturn): Don't call malloc + again if the first call fails. + + * data/glr.c (yytnamerr): New function. + (yyreportSyntaxError): Use it to dequote most string literals. + * data/lalr1.c (yytname_): Renamed from yyname_, for compatibility + with other skeletons. All uses changed. + (yytnameerr_): New function. + (yyreport_syntax_error): Use it to dequote most string literals. + * data/yacc.c (yytnamerr): New function. + (yyerrlab): Use it to decode most string literals. + * doc/bison.texinfo (Decl Summary, Calling Convention): + Clarify quoting convention of yytname. + * src/output.c (prepare_symbols): Quote all names. This undoes + the 2005-04-17 change, which is now accomplished (mostly) via + changes in the parsers as described above. + * tests/regression.at (Token definitions, Web2c Actions): + Undo most 2005-04-17 change here, too. + +2005-07-20 Paul Eggert + + Fix more problems reported by twlevo@xs4all.nl. + * tests/cxx-type.at: Don't pipe output of ./types through sed to + remove trailing spaces. This loses the exit status of ./types, + and isn't needed since ./types shouldn't be emitting trailing + spaces. + * data/glr.c (yyreturn): Don't pop stack if yyinitStateSet failed, + as the stack isn't valid in that case. + + * src/scan-gram.l (gram_get_lineno, gram_get_in, gram_get_out): + (gram_get_leng, gram_get_text, gram_set_lineno, gram_set_in): + (gram_set_out, gram_get_debug, gram_set_debug, gram_lex_destroy): + Add declarations to pacify "gcc -Wmissing-prototypes" when flex 2.5.31 + is used. + * src/scan-skel.l (skel_get_lineno, skel_get_in, skel_get_out): + (skel_get_leng, skel_get_text, skel_set_lineno, skel_set_in): + (skel_set_out, skel_get_debug, skel_set_debug, skel_lex_destroy): + Likewise. + + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Work even with + overly-picky compilers that reject 'char *foo = "bar";'. + + * src/symtab.c (SYMBOL_ATTR_PRINT, symbol_print): Direct output + to FILE * parameter, not to stderr. This fixes a typo introduced + in the 2005-07-12 change. + + * lib/subpipe.c (create_subpipe): Rewrite slightly to avoid + warnings from GCC 4. + + * data/glr.c (yyexpandGLRStack, yyaddDeferredAction, yyexpandGLRStack): + (yyglrShiftDefer, yysplitStack): + Remove unused parameters b4_pure_formals. All uses changed. + (yyglrShift): Remove unused parameters b4_user_formals. + All uses changed. + (yyglrReduce): Removed unused parameter yylocp. All uses changed. + +2005-07-18 Paul Eggert + + Destructor cleanups and regularization among the three skeletons. + * NEWS: Document the behavior changes. + * data/glr.c (yyrecoverSyntaxError): Don't bother to pop the + stack before failing, as the cleanup code will do it for us now. + * data/lalr1.cc (yyerrlab): Likewise. + * data/glr.c (yyparse): Pop everything off the stack before + freeing it, so that destructors get called properly. + * data/lalr1.cc (yyreturn): Likewise. + * data/yacc.c (yyreturn): Pop and destroy the start symbol, too. + This is more consistent. + * doc/bison.texinfo (Destructor Decl): Mention more reasons + why destructors might be called. 1.875 -> 2.1. + (Destructor Decl, Decl Summary, Table of Symbols): + Some English-language cleanups for %destructor. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): + Add output line for destructor of start symbol. + * tests/calc.at (AT_CHECK_CALC): Add one to line counts, + because of that same extra output line. + + * NEWS: Document minor wording changes in diagnostics of + Bison-generated parsers. + * data/glr.c (yyMemoryExhausted): Renamed from yyStackOverflow. + Remove unused formals. All uses changed. + (yyreportAmbiguity): "ambiguity detected" -> "syntax is ambiguous". + (yyparse): Rename yyoverflowlab to yyexhaustedlab. + * data/yacc.c (yyparse): "parser stack overflow" -> "memory exhausted". + Rename yyoverflowab to yyexhaustedlab. + When memory exhaustion occurs during syntax-error reporting, + report it separately rather than in a single diagnostic; this + eases translation. + * doc/bison.texinfo (Memory Management): Renamed from Stack Overflow. + (Memory Exhausted): Renamed from Parser Stack Overflow. + Revamp wording slightly to prefer "memory exhaustion". + * tests/actions.at: "parser stack overflow" -> "memory exhausted". + + * data/c.m4 (b4_yysymprint_generate): Use YYFPRINTF, not fprintf. + + Add i18n support to the GLR skeleton. Partially fix the C++ + skeleton; a C++ expert needs to finish this. Remove debugging + msgids; there's little point to having them translated, since they + can be understood only by someone who can read the + (English-language) source code. + + Generate runtime-po/bison-runtime.pot automatically, so that we + don't have to worry about garbage getting in that file. We'll + make sure after the next official release that old msgids don't + get lost. See + . + + * runtime-po/Makefile.in.in, runtime-po/bison-runtime.pot: Remove. + Now auto-generated. + * PACKAGING: Don't claim that Gawk, GCC, Perl use this method yet. + Fix typos in explanations of the runtime file. + * bootstrap: Change gettext keyword from YYI18N to YY_. + Use standard Makefile.in.in in runtime-po, since we'll arrange + for backward-compatible bison-runtime.po files in a different way. + * data/glr.c (YY_): New macro, from yacc.c. + (yyuserAction, yyreportAmbiguity, yyreportSyntaxError, yyparse): + Translate messages intended for users. + (yyreportSyntaxError): Change "virtual memory" to "memory" to match + the wording in the other skeletons. We don't know that the memory + is virtual. + * data/lalr1.cc (YY_): Renamed from _. All uses changed. + Use same method that yacc.c uses. + Don't translate debugging messages. + (yy::yyreport_syntax_error): Put in a FIXME for the i18n stuff; + it doesn't work (yet), and requires C++ expertise to fix. + * data/yacc.c (YY_): Renamed from YY18N. All uses changed. + Move defn to a more logical place, to be consistent with other + skeletons. + Don't translate debugging messages. + Don't assume line numbers fit in unsigned int; use unsigned long fmts. + * doc/bison.texinfo: Mention . Change glibc cross reference + to gettext cross reference. Add indexing terms. Mention YYENABLE_NLS. + * runtime-po/POTFILES.in: Add data/glr.c, data/lalr1.cc. + + Fix yyerror / yylex test glitches noted by twlevo@xs4all.nl. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Have yyerror return + void, not int. + * tests/glr-regression.at (Badly Collapsed GLR States): + Likewise. + (Improper handling of embedded actions and dollar(-N) in GLR parsers): + yylex should return 0 at EOF rather than aborting. + + Improve tests for stack overflow in GLR parser. + Problem reported by twlevo@xs4all.nl. + * data/glr.c (struct yyGLRStack): Remove yyerrflag member. + All uses removed. + (yyStackOverflow): Just longjmp, but with value 2 so that caller + can handle the problem. + (YYCHK1): Use goto (a la yacc.c) rather than setting a flag. + (yyparse): New local variable yyresult to record the result. + Use result of setjmp to set it, rather than storing itinto + struct. + (yyDone): Remove label. + (yyacceptlab, yyabortlab, yyoverflowlab, yyreturn): New labels, + to mimic yacc.c. Do not discard lookahead if it's EOF (possible + if YYABORT is used). + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Exit with + yyparse status; put status > 1 into diagnostic. + Check that status==2 works. + * tests/calc.at, tests/cxx-type.at, tests/glr-regression.at: + Use exit status 3 for failure to open (which shouldn't happen). + +2005-07-17 Paul Eggert + + * tests/conflicts.at (%nonassoc and eof): Don't exit with status + 1 on syntax error; just let yyparse do its thing. + * tests/glr-regression.at (Badly Collapsed GLR States): Likewise. + * tests/torture.at (AT_DATA_STACK_TORTURE): Likewise. + (Exploding the Stack Size with Alloca): + (Exploding the Stack Size with Malloc): + Expect exit status 2, not 1, since the parser is supposed to blow + its stack. Problem reported by twlevo@xs4all.nl. + + * data/glr.c (yyparse): Don't assume that the initial calls + to YYMALLOC succeed; in that case, yyparse incorrectly returned 0. + Print a stack-overflow message and fail instead. + Initialize the line-number information before creating the stack, + so that the stack-overflow message can report line zero safely. + +2005-07-14 Paul Eggert + + Fix problems reported by twlevo@xs4all.nl. + * data/glr.c (YYSTACKEXPANDABLE): Don't define if already defined. + (yyuserMerge): Provide a default case if b4_mergers is empty. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Define YYSTACKEXPANDABLE. + * tests/glr-regression.at + (Improper handling of embedded actions and dollar(-N) in GLR parsers): + Add casts to pacify C++ compilers. + * tests/glr-regression.at (Improper merging of GLR delayed action + sets): Declare yylex before using it. + * tests/Makefile.am (maintainer-check-g++): Fix a stray + $(GXX) that escaped the renaming of GXX to CXX. Remove bogus + test for valgrind; valgrind is independent of g++. + (maintainer-check-posix): Add _POSIX2_VERSION=200112, to check + for compatibility with POSIX 1003.1-2001 (if running coreutils). + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Port to stricter C++. + Use a destructor, so that we can expand the stack. Change + YYSTYPE to char * so that we can free it. Cast result of malloc. + +2005-07-13 Paul Hilfinger + + * data/glr.c (yyuserAction): Fix uninitialized variable that caused + a valgrind failure. Problem reported by twlevo@xs4all.nl. + +2005-07-13 Paul Eggert + + * PACKAGING: New file, suggested by Bruno Haible and taken from + similar wording in gettext's PACKAGING file. + * NEWS: Mention PACKAGING. + * Makefile.am (EXTRA_DIST): Add PACKAGING. + +2005-07-12 Paul Eggert + + * NEWS: Document recent i18n improvements. + * bootstrap: Get runtime translations into runtime-po. + Create runtime-po files automatically, if possible. + * configure.ac: Invoke BISON_I18N, so that we eat our own dog food. + * data/yacc.c: Rewrite inclusion of so that ENABLE_NLS + does not infringe on the user's name space. + (YYENABLE_NLS): Renamed from ENABLE_BISON_NLS. + * doc/bison.texinfo (Internationalization): Revamp the English + and Texinfo syntax a bit, to try to make it clearer. + (Bison Options, Option Cross Key): Mention --print-localedir. + * m4/bison-i18n.m4 (BISON_I18N): Rename ENABLE_BISON_NLS to + YYENABLE_NLS. Quote a bit more. + * runtime-po/.cvsignore: New file. + * runtime-po/Makefile.in.in (mostlyclean): Remove *.old.pot. + * runtime-po/Rules-quot: Remove; now created by bootstrap. + * runtime-po/quot.sed: Likewise. + * runtime-po/boldquot.sed: Likewise. + * runtime-po/en@quot.header: Likewise. + * runtime-po/en@boldquot.header: Likewise. + * runtime-po/insert-header.sin: Likewise. + * runtime-po/remove-potcdate.sin: Likewise. + * runtime-po/Makevars: Likewise. + * runtime-po/LINGUAS: Likewise. + * runtime-po/de.po: Likewise; we will rely on the translation project + to maintain this, so "bootstrap" should get it. + * src/getarg.c (PRINT_LOCALEDIR_OPTION): Let the C compiler determine + its value. + * src/main.c (main): Bind the bison-runtime domain, too. + +2005-07-12 Bruno Haible + + * data/yacc.c: Include when NLS is enabled. + (YYI18N): Renamed from _. Use dgettext when NLS is enabled. + * po/POTFILES.in: Remove autogenerated file src/parse-gram.c. + * runtime-po: New directory. + * runtime-po/Makefile.in.in: New file, copied from po/, with modified + $(DOMAIN).pot-update rule, so that old messages are never dropped. + * runtime-po/Rules-quot: New file, copied from po/. + * runtime-po/quot.sed: Likewise. + * runtime-po/boldquot.sed: Likewise. + * runtime-po/en@quot.header: Likewise. + * runtime-po/en@boldquot.header: Likewise. + * runtime-po/insert-header.sin: Likewise. + * runtime-po/remove-potcdate.sin: Likewise. + * runtime-po/Makevars: New file. + * runtime-po/POTFILES.in: New file. + * runtime-po/LINGUAS: New file. + * runtime-po/bison-runtime.pot: New file. + * runtime-po/de.po: New file. + * m4/bison.m4: New file. + * Makefile.am (SUBDIRS): Add runtime-po. + (aclocaldir, aclocal_DATA): New variables. + * configure.ac: Add AC_CONFIG_FILES of runtime-po/Makefile.in. + Define aclocaldir. + * src/getargs.c (usage): Document --print-localedir option. + (PRINT_LOCALEDIR_OPTION): New enum item. + (long_options): Add --print-localedir option. + (getargs): Handle --print-localedir option. + * doc/bison.texinfo (Bison Parser): Remove paragraph about _(). + (Internationalization): New section. + +2005-07-12 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_print): Swap the arguments, + for consistency with the rest of the code. + * src/symlist.h, src/symlist.c (symbol_list_print): Ditto. + Add separators. + +2005-07-12 Akim Demaille + + * src/parse-gram.y: Use %printer instead of YYPRINT. + +2005-07-12 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_print): New. + * src/symlist.h, src/symlist.c (symbol_list_print): New. + * src/symlist.c (symbol_list_n_type_name_get): Report the culprit. + +2005-07-12 Akim Demaille + + * data/glr.c (b4_syncline): Fix (swap) the definitions of + b4_at_dollar and b4_dollar_dollar. + +2005-07-11 Paul Eggert + + * doc/bison.texinfo (Mystery Conflicts): Add reference to DeRemer + and Pennello's paper. + +2005-07-09 Paul Eggert + + * data/yacc.c (yyparse): Undo previous patch. Instead, + set yylsp[0] and yyvsp[0] only if the initial action + sets yylloc and yylval, respectively. + + * data/yacc.c (yyparse): In the initial action, set + yylsp[0] and yyvsp[0] rather than yylloc and yylval. + This avoids the use of undefined variables if the initial + action does not set yylloc and/or yylval. + +2005-07-07 Paul Eggert + + * examples/calc++/calc++-driver.cc, examples/calc++/calc++-driver.hh: + * examples/calc++/calc++-scanner.ll, examples/calc++/calc++.cc: + Remove from CVS. These files are automatically generated. + * examples/extexi: Clarify that this file is now part of Bison, + not GNU M4, and that it works with any POSIX-compatible Awk. + * examples/calc++/Makefile.am (run_extexi): Remove; not used. + ($(calc_extracted)): Renamed from $(calc_sources_extracted), + so that we also get calc++-parser.yy. Geneate it. + Use $(AWK), not gawk, since any conforming Awk will do. + Put comment before action, since older 'make' can't handle comment + in action. + $(BUILT_SOURCES): List all built sources, not just some of them. + $(MAINTAINERCLEANFILES): Remove *.stamp, and all built sources. + $($(srcdir)/calc++-parser.stamp): Work even if POSIXLY_CORRECT. + $($(calc_sources_generated)): Remove unnecessary test for existence + of target. (This had a shell syntax error anyway; a stray "x".) + (calc_extracted): List $(srcdir)/calc++-parser.yy, not + calc++-parser.yy. + * examples/.cvsignore, examples/calc++/.cvsignore: New files. + + * bootstrap (gnulib_modules): Add gettext, now that it's no longer + implied by the other modules. + +2005-07-06 Akim Demaille + + Bind examples/calc++ to the package. + * examples/calc++/Makefile: Remove, replaced by... + * examples/calc++/Makefile.am: ... this new file. + * examples/calc++/test: Remove input. + * examples/calc++/compile: Remove. + * examples/Makefile.am: New. + * configure.ac, Makefile.am: Adjust. + * doc/Makefile.am (clean-local): New, for more recent texi2dvis. + +2005-07-05 Paul Eggert + + * data/glr.c (yyFail): Drastically simplify; since the format argument + never had any % directives, we can simply pass it to yyerror. + (yyparse): Use "t a; a=b;" rather than "t a = b;" when a will + be modified later, as that is the usual style in glr.c. + Problems reported by Paul Hilfinger. + + Rewrite GLR parser to catch more buffer overrun, storage exhaustion, + and size overflow errors. + * data/glr.c: Include etc. after user prolog, not before, + in case the user prolog sets feature-test macros like _GNU_SOURCE. + (YYSIZEMAX): New macro. + (yystpcpy): New function, taken from yacc.c. + (struct yyGLRStack.yyspaceLeft): Now size_t, not int. + (yyinitGLRStack, yyfreeGLRstack): Remove unnecessary forward decls, + so that we don't have to maintain their signatures. + (yyFail): Check for buffer overflow, by using vsnprintf rather + than vsprintf. Allocate a bigger buffer if possible. + Report an error if buffer allocation fails. + (yyStackOverflow): New function. + (yyinitStateSet, yyinitGLRStack): Return a boolean indicating whether + the initialization was successful. It might fail if storage was + exhausted. + (yyexpandGLRStack): Add more checks for storage allocation failure. + Use yyStackOverflow to report failures. + (yymarkStackDeleted, yyglrShift, yyglrShiftDefer, yydoAction): + (yysplitStack, yyprocessOneStack, yyparse, yypstack): + Don't assume stack number fits in int. + (yysplitStack): Check for storage allocation failure. + (yysplitStack, yyprocessOneStack): Add pure_formals, so that we + can print diagnostics on storage allocation failure. All callers + changed. + (yyresolveValue): Use yybool for boolean. + (yyreportSyntaxError): Check for size-calculation overflow. + This code is taken from yacc.c. + (yyparse): Check for storage allocation errors when allocating + the initial stack. + +2005-07-05 Akim Demaille + + Extract calc++ from the documentation. + * doc/bison.texinfo (Calc++): Add the extraction marks. + * examples/extexi: New, from the aborted GNU Programming 2E. + Separate the different paragraph of a file with empty lines. + * examples/Makefile: Use it to extract the whole calc++ example. + +2005-06-24 Akim Demaille + + * doc/bison.texinfo (C++ Parser Interface): Use defcv to define + class typedefs. + +2005-06-22 Akim Demaille + + * doc/bison.texinfo (C++ Language Interface): First stab. + (C++ Parsers): Remove. + +2005-06-22 Akim Demaille + + * data/lalr1.cc (yylex_): Honor %lex-param. + +2005-06-22 Akim Demaille + + Start a set of simple examples. + * examples/calc++/Makefile, examples/calc++/calc++-driver.cc, + * examples/calc++/calc++-driver.hh, + * examples/calc++/calc++-parser.yy, + * examples/calc++/calc++-scanner.ll, examples/calc++/calc++.cc, + * examples/calc++/compile, examples/calc++/test: New. + +2005-06-09 Paul Eggert + + * data/yacc.c (malloc, free) [defined __cplusplus]: Wrap inside + extern "C" {}. This fixes a problem reported by Paul Hilfinger, + which stems from the 2005-05-27 patch. + +2005-06-06 Paul Hilfinger + + * data/glr.c: Modify treatment of unused parameters to permit use + of g++ (which doesn't allow __attribute__ ((unused)) for parameters). + +2005-05-30 Paul Eggert + + Fix infringement on user name space reported by Janos Zoltan Szabo. + * data/yacc.c (yyparse): strlen -> yystrlen. + +2005-05-30 Akim Demaille + + * data/lalr1.cc (_): New. + Translate the various messages. + +2005-05-27 Paul Eggert + + Fix infringement on user name space reported by Bruno Haible. + * data/yacc.c (YYSIZE_T): Define first, so that later decls can use it. + Prefer GCC's __SIZE_TYPE__ if available, so that we don't infringe on + the user's name space. + (alloca): Include to get it, if it's not built in. + (YYMALLOC, YYFREE): Define only if needed. + (malloc, free): Declare, but only if needed, as this infringes on + the user name space. + +2005-05-25 Paul Eggert + + Fix BeOS, FreeBSD, MacOS porting problems reported by Bruno Haible. + * lib/bitset.c (bitset_print): Don't assume size_t can be printed + with %d format. + * lib/ebitset.c (min, max): Undef before defining. + * lib/vbitset.c (min, max): Likewise. + * lib/subpipe.c (create_subpipe): Save local variables in case + vfork clobbers them. + +2005-05-24 Bruno Haible + + * tests/synclines.at (AT_SYNCLINES_COMPILE): Add support for the + error message syntax used by gcc-4.0. + +2005-05-23 Paul Eggert + + * README: Mention m4 1.4.3. Remove obsolete advice about + Sun Forte Developer 6 update 2, VMS, and MS-DOS. + + * bootstrap: Remove workaround for problem I encountered with + gettext 0.14.1; it seems to be fixed now. + +2005-05-22 Paul Eggert + + * NEWS: Version 2.0a. + + * src/files.c: Include "stdio-safer.h"; this fixes a typo in + the previous change. + + Various maintainer cleanups. + * .cvsignore: Add a.exe, a.out, b.out,, conf[0-9]*, confdefs*, + conftest*, for benefit of CVS commands run at the same time as + "configure". Add build-aux, since "bootstrap" now creates it and + its subfiles. + * Makefile.cfg (move_if_change): Remove. + * Makefile.maint: Remove the update stuff; we now use "bootstrap". + (ftp-gnu, www-gnu, move_if_change, local_updates, update): + (po_repo, do-po-update, po-update, wget_files, get-targets): + (config.guess-url_prefix, config.sub-url_prefix): + (ansi2knr.c-url_prefix, texinfo.tex-url_prefix): + (standards.texi-url_prefix, make-stds.texi-url_prefix, taget, url): + ($(get-targets), cvs-files, automake_repo, wget-update, cvs-update): + Remove. + * configure.ac (AC_CONFIG_AUX_DIR): Change from config to build-aux; + this is now the recommended name. + * config/.cvsignore: Remove config.guess, config.rpath, config.sub, + depcomp, install-sh, mdate-sh, missing, mkinstalldirs, texinfo.tex, + ylwrap. These files now go into build-aux. + * config/move-if-change: Remove. + * config/prev-version.txt: Bump from 1.75 to 2.0. + + * bootstrap: Add stdio-safer, unistd-safer modules. + Remove m4/glibc2.m4 (introduced by latest gnulib, but + we don't need it). + * lib/.cvsignore: Add dup-safer.c, fd-safer.c, + fopen-safer.c, stdio-safer.h, unistd-safer.h. + * lib/subpipe.c: Include "unistd-safer.h". + (create_subpipe): Make sure all the newly-created + file descriptors are > 2, so that diagnostics don't + get sent down them (which might cause Bison to hang, in theory). + * m4/.cvsignore: Add stdio-safer.m4, unistd-safer.m4. + * src/files.c (xfopen): Use fopen_safer, not fopen. + + * data/lalr1.cc (yy::]b4_parser_class_name[::parse): Port + yesterday's yacc.c fix. + +2005-05-21 Paul Eggert + + * data/glr.c, data/lalr1.cc: Update copyright date. + + Fix a destructor bug reported by Wolfgang Spraul in + . + * data/yacc.c (yyabortlab): Don't call destructor, and + don't set yychar to EMPTY. + (yyoverflowlab): Don't call destructor. + (yyreturn): Call destructor, if yychar is neither YYEOF nor YYEMPTY. + * tests/calc.at (AT_CHECK_CALC): Expect one fewer output lines, + since we no longer output the message "discarding lookahead token + end of input ()". + +2005-05-20 Paul Hilfinger + + * data/glr.c (YY_SYMBOL_PRINT): Don't print newline at end to + fix a small glitch in debugging output. + (yyprocessOneStack, yyrecoverSyntaxError, yyparse): Print newline + after YY_SYMBOL_PRINT where needed. + + (struct yyGLRState): Add some comments. + (struct yySemanticOption): Add some comments. + (union yyGLRStackItem): Add comment. + + (yymergeOptionSets): Correct this to properly perform the union, + avoiding infinite reported by Michael Rosien. + Update comment. + + * tests/glr-regression.at: Add test for GLR merging error reported + by M. Rosien. + +2005-05-13 Paul Eggert + + * COPYING, ChangeLog, GNUmakefile, HACKING, Makefile.am, + Makefile.cfg, Makefile.maint, NEWS, README, README-alpha, + README-cvs, TODO, bootstrap, configure.ac, data/Makefile.am, + data/README, data/c.m4, data/glr.c, data/lalr1.cc, data/yacc.c, + data/m4sugar/m4sugar.m4, doc/Makefile.am, doc/bison.texinfo, + doc/fdl.texi, doc/gpl.texi, doc/refcard.tex, lib/Makefile.am, + lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c, + lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h, + lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c, + lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c, + lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h, + lib/main.c, lib/subpipe.c, lib/subpipe.h, lib/timevar.c, + lib/timevar.def, lib/timevar.h, lib/vbitset.c, lib/vbitset.h, + lib/yyerror.c, m4/cxx.m4, m4/m4.m4, m4/subpipe.m4, m4/timevar.m4, + m4/warning.m4, src/LR0.c, src/LR0.h, src/Makefile.am, src/assoc.c, + src/assoc.h, src/closure.c, src/closure.h, src/complain.c, + src/complain.h, src/conflicts.c, src/conflicts.h, src/derives.c, + src/derives.h, src/files.c, src/files.h, src/getargs.c, + src/getargs.h, src/gram.c, src/gram.h, src/lalr.c, src/lalr.h, + src/location.c, src/location.h, src/main.c, src/muscle_tab.c, + src/muscle_tab.h, src/nullable.c, src/nullable.h, src/output.c, + src/output.h, src/parse-gram.c, src/parse-gram.h, + src/parse-gram.y, src/print.c, src/print.h, src/print_graph.c, + src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c, + src/reduce.h, src/relation.c, src/relation.h, src/scan-gram.l, + src/scan-skel.l, src/state.c, src/state.h, src/symlist.c, + src/symlist.h, src/symtab.c, src/symtab.h, src/system.h, + src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h, + src/vcg.c, src/vcg.h, src/vcg_defaults.h, tests/Makefile.am, + tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at, + tests/cxx-type.at, tests/existing.at, tests/glr-regression.at, + tests/headers.at, tests/input.at, tests/local.at, tests/output.at, + tests/reduce.at, tests/regression.at, tests/sets.at, + tests/synclines.at, tests/testsuite.at, tests/torture.at: + Update FSF postal mail address. + +2005-05-11 Paul Eggert + + * tests/local.at (AT_COMPILE_CXX): Treat LDFLAGS like AT_COMPILE does. + Problem reported by Ralf Menzel. + +2005-05-01 Paul Eggert + + * tests/actions.at: Test that stack overflow invokes destructors. + From Marcus Holland-Moritz. + * data/yacc.c (yyerrlab): Move the code that destroys the stack + from here.... + (yyreturn): to here. That way, destructors are called properly + even if the stack overflows, or the user calls YYACCEPT or + YYABORT. Stack-overflow problem reported by Marcus Holland-Moritz. + (yyoverflowlab): Destroy the lookahead. + +2005-04-24 Paul Eggert + + * data/yacc.c (YYSTACK_ALLOC_MAXIMUM): Add more-descriptive comment. + +2005-04-17 Paul Eggert + + * NEWS: Bison-generated C parsers no longer quote literal strings + associated with tokens. + * src/output.c (prepare_symbols): Don't escape strings, + since users don't want to see C escapes. + * tests/calc.at (AT_CHECK_CALC): Adjust to lack of quotes + in diagnostics. + * tests/input.at (Torturing the Scanner): Likewise. + * tests/regression.at (Token definitions, Web2c Actions): Likewise. + +2005-04-16 Paul Eggert + + * tests/torture.at (AT_INCREASE_DATA_SIZE): Skip the test if + the data size is known to be too small and we can't increase it. + This works around an HP-UX 11.00 glitch reported by Andrew Benham. + +2005-04-15 Paul Eggert + + * src/parse-gram.y: Include quotearg.h. + (string_as_id): Quote $1 before using it as a key, since the + lexer no longer quotes it for us. + (string_content): Don't strip quotes, since lexer no longer + quotes it for us. + * src/scan-gram.l: Include quotearg.h. + ("\""): Omit quote. + ("'"): Quote symbol before using it as + a key, since the rest of the lexer doesn't quote it. + * src/symtab.c (symbol_get): Don't quote symbol; caller does it now. + * tests/regression.at (Token definitions): Check for backslashes + in token strings. + + * data/yacc.c (YYSTACK_ALLOC_MAXIMUM): New macro. + (YYSIZE_T): Define to unsigned long int when using an older compiler. + (yyparse): Revamp code to generate long syntax error message, to + make it easier to translate, and to avoid problems with arithmetic + overflow. Change "virtual memory" to "memory" in diagnostic, since + we don't know whether the memory is virtual. + +2005-04-13 Paul Eggert + + * NEWS: Bison-generated C parsers now use the _ macro to + translate strings. + * data/yacc.c (_) [!defined _]: New macro. + All English strings wrapped inside this macro. + * doc/bison.texinfo (Bison Parser): Document _. + * po/POTFILES.in: Include src/parse-gram.c, since it now + includes translateable strings that parse-gram.y doesn't. + +2005-04-12 Paul Eggert + + * src/symtab.c (symbol_make_alias): Call symbol_type_set, + reverting the 2004-10-11 change to this function. + (symbol_check_alias_consistency): Don't call symbol_type_set + if the type name is already correct. + * tests/input.at (Typed symbol aliases): New test, from Tim Van Holder. + +2005-03-25 Paul Eggert + + * tests/regression.at (Token definitions): Don't use a token named + c, as that generates a "#define c ..." that runs afoul of buggy + stdlib.h that uses the identifier c as a member of struct + drand48_data. Problem reported by Horst Wente. + +2005-03-21 Paul Eggert + + * bootstrap: Change translation URL from + http://www2.iro.umontreal.ca/~gnutra/po/maint/bison/ to + http://www.iro.umontreal.ca/translation/maint/bison/ to avoid + redirection glitches. Problem reported by twlevo@xs4all.nl. + +2005-03-20 Paul Eggert + + * tests/local.at (AT_COMPILE, AT_COMPILE_CXX): Don't put options + after operands; POSIX says this isn't portable for the c99 command. + +2005-03-18 Paul Eggert + + * tests/glr-regression.at (glr-regr2a.y): Try to dump core + immediately if a data overrun has occurred; this may help us track + down what may be a spurious failure on MacOS. + +2005-03-17 Paul Eggert + + Respond to problems reported by twlevo@xs4all.nl. + + * bootstrap: Use "trap - 0" rather than the unportable "trap 0". + + * src/vcg.h: Comment fix. + * src/vcg_defaults.h: Parenthesize macro bodies to make them safe. + (G_CMAX): Change to -1 instead of INT_MAX. + + * data/yacc.c (yyparse): Omit spaces before #line. + +2005-03-15 Paul Eggert + + * src/tables.c (state_number_to_vector_number): Put it inside an + "#if 0", since it's not currently used. Problem reported by + Roland McGrath. + +2005-03-06 Paul Eggert + + * src/output.c (escaped_output): Renamed from + escaped_file_name_output, since we now use it for symbol tags as + well. All uses changed. + (symbol_destructors_output, symbol_printers_output): + Escape symbol tags too. + Problem reported by Matyas Forstner in + . + + * src/muscle_tab.c (muscle_code_grow): Don't quote numbers; it's + not needed. + * src/output.c (user_actions_output, token_definitions_output, + symbol_destructors_output, symbol_printers_output): Likewise. + * src/reader.c (prologue_augment): Likewise. + * src/scan-gram.l (handle_action_dollar, handle_action_at): Likewise. + + * src/vcg.c (output_edge): Don't quote linestyle arg. + Problem reported by twlevo@xs4all.nl. + +2005-02-28 Paul Eggert + + * doc/bison.texinfo (Semantic Tokens): Fix scoping problem in + example, reported by Derek M Jones. Also, make the example even + more outrageous, to better illustrate how bad the problem is. + +2005-02-24 Paul Eggert + + * doc/bison.texinfo (Mfcalc Symtab): Correct the prototype for + putsym. Typo reported by Sebastian Piping. + +2005-02-23 Paul Eggert + + * doc/bison.texinfo (Language and Grammar): some -> same + (Epilogue): int he -> in the + Typos reported by Sebastian Piping via Justin Pence. + +2005-02-07 Paul Eggert + + * tests/glr-regression.at (Improper handling of embedded actions + and dollar(-N) in GLR parsers): Renamed from "Improper handling of + embedded actions and $-N in GLR parsers", work around an Autoconf bug + with dollar signs in test names. + * tests/input.at (Invalid dollar-n): Renamed from "Invalid \$n", + for a similar reason. + +2005-01-28 Paul Eggert + + * src/vcg.c (output_graph): G_VIEW -> normal_view in case someone + wants to redefine G_VIEW. + +2005-01-27 Paul Eggert + + * src/vcg.c (get_view_str): Remove case for normal_view. + Problem reported by twlevo@xs4all.nl. + +2005-01-24 Paul Eggert + + * configure.ac (O0CFLAGS, O0CXXFLAGS): Fix quoting bug. + Problem reported by twlevo@xs4all.nl. + + * doc/bison.texinfo: Change @dircategory from "GNU programming + tools" to "Software development". Requested by Richard Stallman + via Karl Berry. + +2005-01-23 Paul Eggert + + * tests/c++.at (AT_CHECK_DOXYGEN): Don't use options after operands. + Problem reported by twlevo@xs4all.nl. + +2005-01-21 Paul Eggert + + * data/yacc.c (YYCOPY, yystpcpy, yyparse): Remove "register" + keyword; it's not needed with modern compilers, and it doesn't + affect correctness with older compilers. Suggested by + twlevo@xs4all.nl. + +2005-01-17 Paul Eggert + + * data/glr.c (yyuserAction): Add "default: break;" case to pacify + gcc -Wswitch-default. + * data/lalr1.cc (yy::]b4_parser_class_name[::parse): Likewise. + * data/yacc.c (yyparse): Likewise. + +2005-01-12 Paul Eggert + + * src/system.h (OUTPUT_EXT, TAB_EXT): Define only if not defined + already. Let config.h define any nonstandard values. + +2005-01-10 Paul Eggert + + * tests/calc.at (_AT_DATA_CALC_Y): Use alarm (100), not alarm (10), + for the benefit of slower hosts. Problem reported by + Nelson H. F. Beebe. + +2005-01-07 Paul Eggert + + * data/yacc.c (yyparse): Pacify non-GCC compilers about yyerrorlab + being defined and not used. + * data/lalr1.cc (yyparse): Likewise. + Use "if (false)" rather than "if (0)". + +2005-01-05 Paul Eggert + + * TODO: Mention that we should allow NUL bytes in tokens. + +2005-01-02 Paul Eggert + + * src/scan-skel.l (<>): Don't close standard output. + Problem reported by Hans Aberg. + +2005-01-01 Paul Eggert + + * src/getargs.c (version): Happy new year; update overall + program copyright date from 2004 to 2005. + + * src/scan-skel.l ("@output ".*\n): Don't close standard output. + Problem reported by Hans Aberg. + * tests/output.at (AT_CHECK_OUTPUT): New arg SHELLIO. + (Output file names.): Add a test for the case when standard output + is closed. + +2004-12-26 Paul Eggert + + * doc/bison.texinfo (@copying): Update FDL version number to 1.2, + to fix an oversight in the Bison 2.0 manual. + +2004-12-25 Paul Eggert + + * NEWS: Version 2.0. Reformat the existing news items since + 1.875, so that related items are grouped together. + * configure.ac (AC_INIT): Bump version to 2.0. + * src/parse-gram.c, src/parse-gram.h: Regenerate with 2.0. + + * tests/torture.at (Exploding the Stack Size with Alloca): Set + YYSTACK_USE_ALLOCA to 1 if __GNUC__ or alloca are defined; + otherwise, we're not testing alloca. Unfortunately there's no + simple way to consult HAVE_ALLOCA here. + + * data/lalr1.cc (yydestruct_): Pacify unused variable warning + for yymsg, too. + + * src/LR0.c (new_itemsets): Use memset rather than zeroing by + hand. This avoids a warning about comparing int to size_t when + GCC warnings are enabled. + +2004-12-22 Paul Eggert + + * NEWS: Bison-generated parsers no longer default to using the + alloca function (when available) to extend the parser stack, due + to widespread problems in unchecked stack-overflow detection. + * data/glr.c (YYMAXDEPTH): Remove undef when zero. It's the user's + responsibility to set it to a positive value. This lets the user + specify a value that is not a preprocessor constant. + * data/yacc.c (YYMAXDEPTH): Likewise. + (YYSTACK_ALLOC): Define only if YYSTACK_USE_ALLOCA is nonzero. + * doc/bison.texinfo (Stack Overflow): YYMAXDEPTH no longer needs + to be a compile-time constant. However, explain the constraints on it. + Also, explain the constraints on YYINITDEPTH. + (Table of Symbols): Explain that alloca is no longer the default. + Explain the user's responsibility if they define YYSTACK_USE_ALLOCA + to 1. + + * doc/bison.texinfo (Location Default Action): Mention that n must + be zero when k is zero. Suggested by Frank Heckenbach. + +2004-12-22 Akim Demaille + + * data/lalr1.cc (parser::token_number_type, parser::rhs_number_type) + (parser::state_type, parser::semantic_type, parser::location_type): + Private, not public. + (parser::parse): Return ints, not bool. + Returning a bool introduces a problem: 0 corresponds to false, and + it seems weird to return false on success. Returning true changes + the conventions for yyparse. + Alternatively we could return void and send an exception. + There is no clear consensus (yet?). + (state_stack, semantic_stack, location_stack): Rename as... + (state_stack_type, semantic_stack_type, location_stack_type): these. + Private, not public. + * tests/c++.at: New. + * tests/testsuite.at, tests/Makefile.am: Adjust. + +2004-12-21 Akim Demaille + + * data/lalr1.cc (parser::parse): Return a bool instead of an int. + +2004-12-21 Akim Demaille + + Don't impose std::string for filenames. + + * data/lalr1.cc (b4_filename_type): New. + (position::filename): Use it. + (parser.hh): Move the inclusion of stack.hh and location.hh below + the user code, so that needed headers for the filename type can be + included first. + Forward declare them before the user code. + * tests/Makefile.am (check-local, installcheck-local): Pass + TESTSUITEFLAGS to the TESTSUITE. + +2004-12-20 Akim Demaille + + Use more STL like names: my_class instead of MyClass. + + * data/lalr1.cc (LocationStack, LocationType, RhsNumberType) + (SemanticStack, SemanticType, StateStack, StateType) + (TokenNumberType, Stack, Slice, Traits, Parser::location) + (Parser::value): Rename as... + (location_stack, location_type, rhs_number_type, semantic_stack) + (semantic_type, state_stack, state_type, token_number_type, stack) + (slice, traits, parser::yylloc, parser::yylval): these. + + * tests/calc.at, tests/regression.at, tests/actions.at: Adjust. + +2004-12-19 Paul Eggert + + * data/glr.c (YYLLOC_DEFAULT): Use GNU spacing conventions. + * data/yacc.c (YYLLOC_DEFAULT): Likewise. + +2004-12-17 Paul Eggert + + Remove uses of 'short int' and 'unsigned short int'. This raises + some arbitrary limits. It uses more memory but nowadays that's + not much of an issue. + + This change does not affect the generated parsers; that's a different + task, as some users will want to conserve memory there. + + Ideally we should use size_t to represent all object counts, and + something like ptrdiff_t to represent signed differences of object + counts; but that will require more code-cleanup than I have the + time to do right now. + + * src/LR0.c (allocate_itemsets, new_itemsets, save_reductions): + Use size_t, not int or short int, to count objects. + * src/closure.c (nritemset, closure): Likewise. + * src/closure.h (nritemset, closure): Likewise. + * src/nullable.c (nullable_compute): Likewise. + * src/print.c (print_core): Likewise. + * src/print_graph.c (print_core): Likewise. + * src/state.c (state_compare, state_hash): Likewise. + * src/state.h (struct state): Likewise. + * src/tables.c (default_goto, goto_actions): Likewise. + + * src/gram.h (rule_number, rule): Use int, not short int. + * src/output.c (prepare_rules): Likewise. + * src/state.h (state_number, STATE_NUMBER_MAXIMUM, transitions, + errs, reductions): Likewise. + * src/symtab.h (symbol_number, SYMBOL_NUMBER_MAXIMUM, struct symbol): + Likewise. + * src/tables.c (vector_number, tally, action_number, + ACTION_NUMBER_MINIMUM): Likewise. + * src/output.c (muscle_insert_short_int_table): Remove. + +2004-12-17 Akim Demaille + + * data/lalr1.cc: Extensive Doxygenation. + (error_): Rename as... + (error): this, since it is visible to the user. + Adjust callers. + (Parser::message): Now an automatic variable from... + (Parser::yyreport_syntax_error_): here. + * tests/actions.at, tests/calc.at, tests/regression.at: Adjust to + Parser::error. + * tests/input.at: Escape $. + +2004-12-16 Paul Eggert + + * data/glr.c (b4_lhs_value, b4_rhs_value, b4_rhs-location): + Parenthesize rhs to avoid obscure problems with mistakes like + "foo$$bar = foo$1bar;". Problem reported by twlevo at xs4all. + * data/lalr1.cc (b4_lhs_value, b4_rhs_value, b4_lhs_location, + b4_rhs_location): Likewise. + * data/yacc.c (b4_lhs_value, b4_rhs_value, b4_lhs_location, + b4_rhs_location): Likewise. + +2004-12-16 Akim Demaille + + * data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c and + yacc.c: be sure to stay within yycheck_. + * tests/actions.at: Re-enable C++ tests. + +2004-12-16 Akim Demaille + + * src/print_graph.c (print_graph): Remove layoutalgorithm uses for + real. + +2004-12-16 Akim Demaille + + Use #define to handle the %name-prefix. + + * data/glr.c, data/yacc.c: Comment changes. + * data/lalr1.cc (yylex): Use #define to select the name of yylex, + so that one can refer to yylex in the parser file, and have it + renamed, as is the case with other skeletons. + +2004-12-16 Akim Demaille + + Move lalr1.cc internals into yy*. + + * data/lalr1.cc (semantic_stack_, location_stack_, state_stack_) + (semantic_stack_, location_stack_, pact_, pact_ninf_, defact_) + (pgoto_, defgoto_, table_, table_ninf_, check_, stos_, r1_, r2_) + (name_, rhs_, prhs_, rline_, token_number_, eof_, last_, nnts_) + (empty_, final_, terror_, errcode_, ntokens_) + (user_token_number_max_, undef_token_, n_, len_, state_, nerrs_) + (looka_, ilooka_, error_range_, nerrs_): + Rename as... + (yysemantic_stack_, yylocation_stack_, yystate_stack_) + (yysemantic_stack_, yylocation_stack_, yypact_, yypact_ninf_) + (yydefact_, yypgoto_, yydefgoto_, yytable_, yytable_ninf_) + (yycheck_, yystos_, yyr1_, yyr2_, yyname_, yyrhs_, yyprhs_) + (yyrline_, yytoken_number_, yyeof_, yylast_, yynnts_, yyempty_) + (yyfinal_, yyterror_, yyerrcode_, yyntokens_) + (yyuser_token_number_max_, yyundef_token_, yyn_, yylen_, yystate_) + (yynerrs_, yylooka_, yyilooka_, yyerror_range_, yynerrs_): + these. + +2004-12-15 Paul Eggert + + Fix some problems reported by twlevo at xs4all. + * src/symtab.c (symbol_new): Report an error if the input grammar + contains too many symbols. This is better than calling abort() later. + * src/vcg.h (enum layoutalgorithm): Remove. All uses removed. + (struct node, struct graph): + Rename member expand to stretch. All uses changed. + (struct graph): Remove member layoutalgorithm. All uses removed. + * src/vcg.c (get_layoutalgorithm_str): Remove. All uses removed. + * src/vcg_defaults.h (G_STRETCH): Renamed from G_EXPAND. + All uses changed. + (N_STRETCH): Rename from N_EXPAND. All uses changed. + +2004-12-15 Akim Demaille + + * data/lalr1.cc: Normalize /** \brief ... */ to ///. + Add more Doxygen comments. + (symprint_, stack_print_, reduce_print_, destruct_, pop) + (report_syntax_error_, translate_): Rename as... + (yysymprint_, yystack_print_, yyreduce_print_, yydestruct_) + (yypop_, yyreport_syntax_error_, yytranslate_): this. + +2004-12-15 Akim Demaille + + * data/lalr1.cc (lex_): Rename as... + (yylex_): this. + Move the trace here. + Take the %name-prefix into account. + Reported by Alexandre Duret-Lutz. + +2004-12-15 Akim Demaille + + Simplify the C++ parser constructor. + + * data/lalr1.cc (debug_): Rename as... + (yydebug_): so that the parser's internals are always in the yy* + pseudo namespace. + Adjust uses. + (b4_parse_param_decl): Remove the leading comma as it is now only + called as unique argument list. + (Parser::Parser): Remove the constructor accepting a location and + an initial debugging level. + Remove from the other ctor the argument for the debugging level. + (debug_level_type, debug_level, set_debug_level): New. + + * tests/actions.at, tests/calc.at, tests/regression.at: Adjust + constructor calls. + +2004-12-15 Akim Demaille + + Remove b4_root related material: failure experiment + (which goal was to allow to derive from a class). + + * data/lalr1.cc (b4_root, b4_param, b4_constructor): Remove + definitions and uses. + +2004-12-14 Paul Eggert + + * data/glr.c (struct yyGLRStack): yyerror_range now has 3 items, + not 2, since it's not portable to subtract 1 from the start of an + array. The new item 0 is never set or used. All uses changed. + + (yyrecoverSyntaxError): Use YYLLOC_DEFAULT instead of assuming + the default definition of YYLLOC_DEFAULT. Problem reported + by Frank Heckenbach. + +2004-12-12 Paul Eggert + + * data/glr.c (YYRHSLOC): Don't have two definitions, one for + the normal case and one for the error case. Just use the + first one uniformly. Problem reported by Frank Heckenbach. + (YYLLOC_DEFAULT): Use the conventions of yacc.c, so we can + use exactly the same macro in both places. + (yyerror_range): Now of type yyGLRStackItem, not YYLTYPE, + so that the normal-case YYRHSLOC works for the error case too. + All uses changed. + * data/yacc.c (YYRHSLOC): New macro, taken from glr.c. + (YYLLOC_DEFAULT): Use the same macro as glr.c. + * doc/bison.texinfo (Location Default Action): Don't claim that + we have an array of locations. Use the same macro for both glr + and lalr parsers. Mention YYRHSLOC. Mention what happens when + the index is 0. + +2004-12-10 Paul Eggert + + * HACKING: Update email addresses to send announcements to. + + * configure.ac (AC_INIT): Bump version to 1.875f. + +2004-12-10 Paul Eggert + + * NEWS: Version 1.875e. + * src/parse-gram.c, src/parse-gram.h: Regenerate with 1.875e. + + * src/scan-skel.l: Include "complain.h", for "fatal". + + * src/relation.h (relation_print, relation_digraph): + Relation sizes are of type relation_node, not size_t (this is + merely a doc fix, since the two types are equivalent). + (relation_transpose): Relation sizes are of type relation_node, + not int. + * src/relation.c: Likewise. + (top, infinity): Now of type relation_node, not int. + (traverse, relation_transpose): Use relation_node, not int. + + * data/glr.c (yyuserAction, yyrecoverSyntaxError): Mark args + with ATTRIBUTE_UNUSED if they're not used, to avoid GCC warning. + (yyparse): Remove unused local introduced in 2004-10-25 patch. + + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): New arg + specifying whether the test should be skipped. Use it tp + specify that the [%defines %skeleton "lalr1.cc"] tests currently + fail on some hosts, and should be skipped. + +2004-12-08 Paul Eggert + + * src/system.h (CALLOC, MALLOC, REALLOC): Remove. All callers + changed to use xcalloc, xnmalloc, xnrealloc, respectively, + unless otherwise specified below. + + * src/LR0.c (allocate_itemsets): Use xnmalloc, not xcalloc, + to allocate kernel_base, kernel_items, kernel_size, since + they needn't be initialized to 0. + (allocate_storgae): Likewise, for shiftset, redset, shift_symbol. + * src/closure.c (new_closure): Likewise, for itemset. + * src/derives.c (derives_compute): Likewise, for delts, derives, q. + * src/lalr.c (set_goto_map): Likewise, for temp_map. + (initialize_F): Likewise, for reads, edge, reads[i], includes[i]. + (build_relations): Likewise for edge, states1, includes. + * src/nullable.c (nullable_compute): Likewise, for squeue, relts. + * src/reader.c (packgram): Likewise, for ritem, rules. + * src/reduce.c (nonterminals_reduce): Likewise for nontermmap. + * src/relation.c (relation_digraph): Likewise for VERTICES. + (relation_transpose): Likewise for new_R, end_R. + * src/symtab.c (symbols_token_translations_init): Likewise for + token_translations. + * src/tables.c (save_row): Likewise for froms, tos, conflict_tos. + (token_actions): Likewise for yydefact, actrow, conflrow, + conflict_list. + (save_column): Likewise for froms[symno], tos[symno]. + (goto_actions): Likewise for state_count. + (pack_table): Likewise for base, pos, check. + (tables_generate): Likewise for width. + + * src/LR0.c (set_states): Don't reuse kernel_size and kernel_base + for initial core. Just have a separate core, so we needn't worry + about whether kernel_size and kernel_base are initialized. + + * src/LR0.c (shift_symbol, redset, shiftset, kernel_base, + kernel_size, kernel_items): Remove unnecessary initialization. + * src/conflicts.c (conflicts): Likewise. + * src/derives.c (derives): Likewise. + * src/muscle_tablc (muscle_insert): Likewise. + * src/relation.c (relation_digraph): Likewise. + * src/tables.c (froms, tos, conflict_tos, tally, width, actrow, order, + conflrow, conflict_table, conflict_list, table, check): + Likewise. + + * src/closure.c (new_closure): Arg is of type unsigned int, not int. + This is because all callers pass unsigned int. + * src/closure.h (new_closure): Likewise. + + * src/lalr.c (initialize_F): Initialize reads[i] in all cases. + (build_relations): Initialize includes[i] in all cases. + * src/reader.c (packgram): Always initialize rules[ruleno].prec + and rules[ruleno].precsym. Initialize members in order. + * src/relation.c (relation_transpose): Always initialize new_R[i] + and end_R[i]. + * src/table.c (conflict_row): Initialize 0 at end of conflict_list. + + * src/output.c (prepare_actions): Pass 0 instead of conflict_list[0]; + conflict_list[0] was always 0, but now it isn't initialized. + + * src/table.c (table_grow): When conflict_table grew, the grown + area wasn't cleared. Fix this. + + * lib/.cvsignore: Add strdup.c, strdup.h. + * m4/.cvsignore: Add strdup.m4. + +2004-12-07 Paul Eggert + + * src/lalr.h (GOTO_NUMBER_MAXIMUM): New macro. + * src/lalr.c (set_goto_map): Don't allow ngotos to equal + GOTO_NUMBER_MAXIMUM, since we occasionally compute + ngotos + 1 without checking for overflow. + (build_relations): Use END_NODE, not -1, to denote end of edges. + * src/lalr.c (set_goto_map, map_goto, initialize_F, add_loopback_edge, + build_relations): Use goto_number, not int, for goto numbers. + * src/tables.c (save_column, default_goto): Likewise. + +2004-11-23 Akim Demaille + + * data/lalr1.cc (YYSTYPE): Define it as is done for C, instead + of #defining from yystype. + Don't typedef yystype, C++ does not need it. + This lets it possible to forward declare it as union. + +2004-11-23 Paul Eggert + + * bootstrap (gnulib_modules): Add extensions. + Problem reported by Jim Meyering. + +2004-11-22 Paul Eggert + + * src/LR0.c, src/closure.c, src/derives.c, src/gram.c, + src/lalr.c, src/nullable.c, src/relation.c, src/scan-skel.l, + src/system.h, src/tables.c: XFREE -> free, to accommodate + recent change to gnulib xalloc.h. + Problem reported by Jim Meyering. + +2004-11-17 Akim Demaille + + * data/lalr1.cc (symprint_): Use cdebug_ to avoid warnings. + +2004-11-17 Akim Demaille , + Alexandre Duret-Lutz + + * data/lalr1.cc (Parser::yycdebug_): New, a pointer, to allow + changes. + (YYCDEBUG): Adjust. + Use it instead of cdebug_. + (Parser::debug_stream, Parser::set_debug_stream): New. + (Parser::symprint_): Define cdebug_ for temporary backward + compatibility. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Use + debug_stream (). + +2004-11-17 Akim Demaille + + * data/lalr1.cc (Parser:print_): Remove, use %printer instead. + * tests/regression.at (_AT_DATA_DANCER_Y): Adjust. + * tests/calc.at (_AT_DATA_CALC_Y): Ditto. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Likewise. + +2004-10-27 Paul Eggert + + * data/glr.c (yyloc_default): Remove; not used. + Problem reported by Frank Heckenbach. + +2004-10-25 Akim Demaille + + * data/glr.c (YYRHSLOC): Move its definition next to its uses. + Introduce another definition to address simple location arrays. + (yyGLRStack): New member: yyerror_range. + (yyrecoverSyntaxError, yyparse): Update it. + (yyrecoverSyntaxError): Use it when shifting the error token to + have an accurate range, equivalent to the one computed by both + yacc.c and lalr1.cc. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Change its yylex so + that column numbers start at column 0, as per GNU Coding + Standards, the others tests, and the doc. + (_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_AMBIG_GLR_OUTPUT_WITH_LOC): + Adjust to the above change (first column is 0). + And adjust the location of the "", now covering the whole + line. + +2004-10-22 Akim Demaille + and Paul Eggert + + Remove some arbitrary limits on goto numbers and relations. + * src/lalr.c (goto_map, ngotos, from_state, to_state): Omit + initial values, since they're never used. + (set_goto_map): ngotos is now unsigned, so test for overflow + by seeing whether it wraps around to zero. + * src/lalr.h (goto_number): Now size_t, not short int. + (GOTO_NUMBER_MAXIMUM): Remove. + * src/relation.c (relation_print, traverse, relation_transpose): + Check for END_NODE rather than looking at sign. + * src/relation.h (END_NODE): New macro. + (relation_node): Now size_t, not short int. + +2004-10-22 Paul Eggert + + * doc/bison.texinfo (Language and Grammar): In example, "int" is a + keyword, not an identifier. Problem reported by Baron Schwartz in + . + +2004-10-11 Akim Demaille + + * src/symtab.c (symbol_check_alias_consistency): Also check + type names, destructors, and printers. + Reported by Alexandre Duret-Lutz. + Recode the handling of associativity and precedence in terms + of symbol_precedence_set. + Accept no redeclaration at all, not even equal to the previous + value. + (redeclaration): New. + Use it to factor redeclaration complaints. + (symbol_make_alias): Don't set the type of the alias, let + symbol_check_alias_consistency do it as for other features. + * src/symtab.h (symbol): Add new member prec_location, and + type_location. + * src/symtab.c (symbol_precedence_set, symbol_type_set): Set them. + * tests/input.at (Incompatible Aliases): New. + +2004-10-09 Paul Eggert + + .cvsignore fixes to accommodate gnulib changes, + and the practice of naming build directories "_build". + * .cvsignore: Add "_*". Sort. + * lib/.cvsignore: Add getopt_.h, xalloc-die.c. + * m4/.cvsignore: Add "*_gl.m4". + +2004-10-06 Akim Demaille + + * src/parse-gram.y (add_param): Fix the truncation of trailing + spaces. + +2004-10-05 Akim Demaille + + In Bison 1.875's yacc.c, YYLLOC_DEFAULT was called regardless + whether the reducion was empty or not. This leaves room to + improve the use of YYLLOC_DEFAULT in such a case. + lalr1.cc is still experimental, so changing this is acceptable. + And finally, there are probably not many users who changed the + handling of locations in GLR, so changing is admissible too. + + * data/glr.c, data/lalr1.cc, data/yacc.c (YYLLOC_DEFAULT): On an + empty reduction, set @$ to an empty location ending the previously + stacked symbol. + Adjust uses to make sure the code is triggered on empty + reductions. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust the + expected output: empty reductions have empty locations. + +2004-09-29 Akim Demaille + + * data/lalr1.cc: Move towards a more standard C++ coding style + for templates: Class < T > -> Class. + +2004-09-29 Akim Demaille + + * data/lalr1.cc: Reinstall the former ctor, for sake of + compatibility, but warn it will be removed. + Move towards a more standard C++ coding style (i.e., type *var -> + type* var). + +2004-09-27 Paul Eggert + + * src/parse-gram.y (add_param): Rewrite to avoid strchr, + since it's less likely to work if NULs are involved in the future. + +2004-09-27 Akim Demaille + + * data/yacc.c (YY_LOCATION_PRINT): Fix its default declaration. + +2004-09-27 Akim Demaille + + * data/lalr1.cc (b4_parse_param_decl_1): New. + (b4_parse_param_decl): Use it to have different names between attribute + and argument names. + (b4_cc_constructor_call): Likewise. + +2004-09-24 Akim Demaille + + * src/parse-gram.y (add_param): Strip the leading and trailing + blanks from a formal argument declaration. + (YY_LOCATION_PRINT): New. + +2004-09-24 Akim Demaille + + * data/c.m4 (b4_yysymprint_generate): Move the YYINPUT invocation + after the location. + +2004-09-24 Akim Demaille + + * doc/bison.texinfo (Table of Symbols): Sort. + +2004-09-21 Akim Demaille + + * data/yacc.c, data/glr.c (b4_at_dollar, b4_dollar_dollar): Remove + the useless parentheses. + Suggested by Paul Eggert. + +2004-09-20 Akim Demaille + + Let the initial-action act on the look-ahead, and use it for the + "initial push" (corresponding to an hypothetical beginning-of-file). + And let lalr1.cc honor %initial-action. + + * doc/bison.texinfo (Initial Action Decl): Clarify, and add an + example. + * data/lalr1.cc (Parser::initlocation_): Remove, bad experiment. + (Parser::Parser): Remove the ctor that used to initialize it. + (Parser::parse): Like in the other skeletons, issue the "starting + parse" message before any action. + Honor %initial-action. + Initialize the stacks with the lookahead. + * data/yacc.c: Let $$ and @$ in %initial-action designate the + look-ahead. + Push them in the stacks. + * tests/actions.at, tests/calc.at: Adjust the C++ ctor invocations. + +2004-09-20 Akim Demaille + + * doc/bison.texinfo (Initial Action Decl): New. + +2004-09-20 Akim Demaille + + * data/yacc.c (YY_LOCATION_PRINT): Use YYLTYPE_IS_TRIVIAL as a + clearer criterion to define it. + (parse): Initialize the initial location when YYLTYPE_IS_TRIVIAL. + When reducing on an empty RHS, use the latest stacked location as + location. + yylloc is not always available. + * data/glr.c: Likewise. + Also, honor initial-actions. + +2004-09-20 Akim Demaille + + * data/yacc.c (YY_LOCATION_PRINT): New. + Define when we know YYLTYPE's structure, i.e., when the default + YYLLOC_DEFAULT is used. + * data/c.m4 (b4_yysymprint_generate): Use it. + * data/lalr1.cc (YYLLOC_DEFAULT): Stop relying on the initial + value of the result. + (error_start_): Replace with... + (error_range_): this location array. + This allows to replace code relying on the implementation of + locations by portable code. + * data/yacc.c (yylerrsp): Replace with... + (yyerror_range): this. + Every time a token is popped, update yyerror_range[0], to have an + accurate location for the error token. + * data/glr.c (YY_LOCATION_PRINT): New. + (yyprocessOneStack): Fix an invocation of YY_SYMBOL_PRINT: + deference a pointer. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): No longer + report the location in %printers. + + * src/scan-skel.l: Instead of abort, report error messages to ease + understanding skeleton scanning failures. + +2004-09-16 Akim Demaille + + * data/lalr1.cc (Stack::Iterator, Stack::ConstIterator): Rename as... + (iterator, const_iterator): these, to be more in the C++ spirit. + Also, return reverse iterators so that when displaying the stack + we display its bottom first. + (Parser::stack_print_, Parser::reduce_print_): Match the messages + from yacc.c. + We should probably use vector here though. + +2004-09-16 Akim Demaille + + Have more complete shift traces. + + * data/yacc.c, data/lalr1.c, data/glr.c: Use YY_SYMBOL_PRINT + to report Shifts instead of ad hoc YYDPRINTF invocations, + including for the error token. + * data/lalr1.cc (symprint_): Output the location. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): In C++, don't + output the location within the %printer. + Activate GLR tests, at least to make sure they compile properly. + They still don't pass though. + * tests/calc.at: Adjust expect verbose output, since now "Entering + state..." is on a different line than the "Shifting" message. + +2004-09-08 Akim Demaille + + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Move the + Bison directive from the Bison file to the invocation of this + macro, so that these directives are passed to + AT_BISON_OPTION_PUSHDEFS to get correct help macros. + Use these helping macros (e.g., AT_LOC, AT_VAL and so forth). + Move the AT_SETUP/AT_CLEANUP outside, to report as test title + the extra Bison directives instead of the whole series. + Change the grammar so that there are recoverable errors, and + unrecoverable errors. Now we can have the parser give up before + consuming the whole input. As a result we now can observe that + the lookahead is freed when needed. + Change the parser source to parse argv[1] instead of a hard coded + string. + Simplify yylex, and give a value and location to EOF. + Simplify some invocations of AT_CHECK_PRINTER_AND_DESTRUCTOR that + passed directives already coded in the file. + Add some tests to check the location of "error". + For some tests, the C++ parser is correct, and not yacc.c. + For other tests, they provide different, but unsatisfying, values, + so keep the C++ value so that at least one parser is "correct" + according to the test suite. + (Actions after errors): Remove, this is subsumed by the + AT_CHECK_PRINTER_AND_DESTRUCTOR series. + +2004-09-06 Akim Demaille + + * data/lalr1.cc: Adjust the indentation of the labels. + (Parser::pop): New. + Use it. + +2004-09-06 Akim Demaille + + * data/yacc.cc, data/glr.cc (yydestruct): Accept an additional + argument, an informative message. + Call YY_SYMBOL_PRINT. + Adjust all callers: integrate the associated YY_SYMBOL_PRINT. + * data/lalr1.cc (destruct_): Likewise. + In addition, no longer depend on b4_yysymprint_generate and + b4_yydestruct_generate to generate these functions, do it "by + hand". + +2004-09-03 Akim Demaille + + * data/glr.c, data/lalr1.cc, data/yacc.c: When YYABORT was + invoked, yydestruct the lookahead. + * tests/calc.at (Calculator $1): Update the expected lengths of + traces: there is an added line for the discarded lookahead. + * doc/bison.texinfo (Destructor Decl): Some rewording. + Define "discarded" symbols. + +2004-09-02 Akim Demaille + + * data/lalr1.cc (translate_, destruct_): No reason to be static. + +2004-09-02 Akim Demaille + + * data/glr.c, yacc.c (YYDSYMPRINT): Remove, not used. + (YYDSYMPRINTF): Rename as... + (YY_SYMBOL_PRINT): this. + * data/lalr1.cc (YY_SYMBOL_PRINT): New, modeled after the previous + two. + Use it instead of direct symprint_ calls. + (yybackup): Tweak the "Now at end of input" case to match yacc.c's + one. + +2004-09-02 Akim Demaille + + * data/lalr1.cc (b4_yysymprint_generate): New. + (symprint_): New member function, defined when YYDEBUG. + Use it consistently instead of token/nterm debugging output by + hand. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust + %printer calls to use cdebug_ when using lalr1.cc. + +2004-08-30 Florian Krohm + + * data/glr.c: Guard the declarations of yypstack and yypdumpstack + with #ifdef YYDEBUG. + +2004-08-26 Akim Demaille + + * doc/bison.texinfo (Implementing Loops): Rename as... + (Implementing Gotos/Loops): this. + +2004-08-13 Paul Eggert + + Adjust to latest gnulib. + * bootstrap (gnulib_modules): Add xalloc-die. + Set LC_ALL=C so that file names sort consistently. + Prefer the gnulib copies of gettext.m4, glibc21.m4, + inttypes_h.m4, lib-ld.m4, lib-prefix.m4, po.m4, stdint_h.m4, + uintmax_t.m4, ulonglong.m4. + (intl_files_to_remove): Add gettext.m4, lib-ld.m4, lib-prefix.m4, + po.m4 since we are now using _gl.m4 instead. + +2004-08-10 Florian Krohm + + * src/scan-action.l: Remove. Scanning of semantic actions is + handled in scan-gram.l. + +2004-08-07 Florian Krohm + + * src/scan-gram.l (handle_syncline): Use uniqstr_new not xstrdup. + + * src/location.h (struct): The file member is a uniqstr. + (equal_boundaries): Use UNIQSTR_EQ for comparison. + +2004-07-22 Paul Eggert + + Fix bug with non-%union parsers that have printers or destructors, + which led to a Bison core dump. Reported by Peter Fales in + . + + * data/c.m4 (b4_symbol_actions): Don't assume %union was used. + * data/lalr1.cc (yystype) [defined YYSTYPE]: Define to YYSTYPE, + not to our own type. + * src/output.c (symbol_destructors_output, symbol_printers_output): + Don't assume %union. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR, + AT_CHECK_PRINTER_AND_DESTRUCTOR): New argument + UNION-FLAG. All callers changed. + (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Don't assume %union. + Use type char, not unsigned int, when declaring an array of char; + this lets us remove a cast. + (Printers and Destructors): Add non-%union test cases. + +2004-06-21 Paul Eggert + + * doc/bison.texinfo: Minor editorial changes, mostly to the new + GLR writeups. E.g., avoid frenchspacing and the future tense, + change "lookahead" to "look-ahead", and change "wrt" to "with + respect to". + +2004-06-21 Paul Hilfinger + + * doc/bison.texinfo (Merging GLR Parses, Compiler Requirements): + New sections, split off from the GLR Parsers section. Put the new + Simple GLR Parser near the start of the GLR section, for clarity. + Rewrite connective text. + +2004-06-21 Frank Heckenbach + + * doc/bison.texinfo (Simple GLR Parsers): New section. + +2004-06-21 Paul Eggert + + * NEWS, TODO, doc/bison.texinfo: + Use "look-ahead" instead of "lookahead", to be consistent. + * REFERENCES: Fix incorrect reference to DeRemer and Pennello, + while we're fixing "look-ahead". + * src/conflicts.c (shift_set): Renamed from shiftset. + (look_ahead_set): Renamed from lookaheadset. + * src/print.c: Likewise. + * src/getargs.c (report_args): Add "look-ahead" as the new canonical + name for "lookahead". + (report_types, usage): Likewise. + * src/getargs.h (report_look_ahead_tokens): Renamed from + report_lookaheads. + * src/lalr.c (compute_look_ahead_tokens): Renamed from + compute_lookaheads. + (state_look_ahead_tokens_count): Renamed from state_lookaheads_count. + (look_ahead_tokens_print): Renamed from lookaheads_print. + * src/state.c (state_rule_look_ahead_tokens_print): Renamed from + state_rule_lookaheads_print. + * src/state.h: Likewise. + (reductions.look_ahead_tokens): Renamed from lookaheads. + * tests/torture.at (AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR): Renamed from + AT_DATA_LOOKAHEADS_GRAMMAR. + +2004-06-03 Paul Eggert + + * README: Update location of patched M4 distribution. + +2004-05-30 Albert Chin-A-Young + + Don't assume the C++ compiler takes the same arguments as the C compiler + (trivial change). + * configure.ac (O0CXXFLAGS): New var. + * tests/atlocal.in (CXXFLAGS): Use it. + +2004-05-29 Paul Eggert + + Fix some "make check" problems with C++ reported by + Albert Chin-A-Young for Tru64 C++ in this thread: + http://lists.gnu.org/archive/html/bug-bison/2004-05/msg00049.html + + * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Check for std::cerr. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): + Output to a .cc file for C++, not to a .c file. + * tests/calc.at (AT_CHECK_CALC): Likewise. + * tests/regression.at (AT_CHECK_DANCER): Likewise. + * tests/local.at (AT_COMPILE_CXX): Default to OUTPUT.cc, not OUTPUT.c. + +2004-05-28 Albert Chin-A-Young + + * tests/calc.at, tests/actions.at: Workaround for SGI + C++ compiler. (trivial change) + +2004-05-27 Paul Eggert + + Spent a few hours checking out which prerequisite versions the + current sources actually require. I went all the way back to + Gettext 0.10.40, Automake 1.4, and Autoconf 2.57 and investigated + a seemingly endless set of combinations of versions more recent + than that. The bottom line is that the current sources require + fairly recent versions of the build tools, and it'll be some work + to change this. + * configure.ac (AC_PREREQ): Increase from 2.58 to 2.59. + (AM_INIT_AUTOMAKE): Increase from 1.7 to 1.8. + (AM_GNU_GETTEXT_VERSION): Increase from 0.11.5 to 0.12. + Add comments explaining why those particular versions are + currently needed. + + * src/parse-gram.y (lloc_default): Rewrite to avoid compiler bug + in SGI MIPSpro 7.4.1m. Problem reported by Albert Chin-A-Young in + . + + * configure.ac (AC_PREREQ): Bump to 2.58, since 2.57 doesn't work + (it fails with a Autoconf-without-aclocal-m4 diagnostic). + +2004-05-26 Paul Eggert + + * configure.ac (AM_GNU_GETTEXT_VERSION): Lower it from 0.14.1 to + 0.11.5. Suggested by Bruno Haible. + * bootstrap: Remove gettext version checking. + + * doc/bison.texinfo (Decl Summary): Also mention that %union + can depend on prerequisite types. Problem reported by Tim + Van Holder. + +2004-05-25 Paul Eggert + + * README: Mention GNU m4 1.4 bugs and Akim's patched version. + * README-alpha: Don't tell people not to package this. + + * bootstrap: Don't assume $(...) works; use `...` instead. + Problem reported by Paul Hilfinger. Also, diagnose non-GNU + gettext better. + + * doc/bison.texinfo (Decl Summary, Bison Options): Clarify what's + put into the -d output file, and mention what to do if YYSTYPE is + defined as a macro. + +2004-05-24 Paul Eggert + + Undo change made earlier today: it caused autopoint to not bring + in ABOUT-NLS. Ouch. Instead, substitute our own diagnostic for + autopoint's. + + * bootstrap: Check that gettext version matches what's in + configure.ac. Warn users to ignore robots.txt ERROR 404. + * bootstrap: Undo today's earlier change (logged below). + * configure.ac (AM_GNU_GETTEXT_VERSION): Likewise. + + The gettext version checking is causing more trouble than it's + curing; remove it. Problem reported by Paul Hilfinger. + + * bootstrap: Issue a warning that one can expect a message + 'AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION'. + * configure.ac (AM_GNU_GETTEXT_VERSION): Remove. + +2004-05-23 Paul Eggert + + Ensure that the C++ compiler used for testing actually works on a + simple test program; if not, skip the C++-related tests. Problem + reported by Vin Shelton in: + http://lists.gnu.org/archive/html/bug-bison/2004-05/msg00026.html + + * m4/cxx.m4: New file. + * configure.ac (BISON_TEST_FOR_WORKING_CXX_COMPILER): Add. + * tests/atlocal.in (BISON_CXX_WORKS): Add. + * tests/local.at (AT_COMPILE_CXX): Use it. + +2004-05-21 Paul Eggert + + * data/glr.c (yylloc): Output this macro even if locations are not + being generated, as the GLR parser needs it even in that case. + Problem reported by Troy A. Johnson + . + + * configure.ac (AC_INIT): Update to 1.875e. + +2004-05-21 Paul Eggert + + * NEWS: Version 1.875d. + * configure.ac (AC_INIT): Likewise. + * src/parse-gram.c, src/parse-gram.h: Regenerate with 1.875d. + + * configure.ac (--enable-gcc-warnings): Do not enable -Wshadow, + -Wmissing-prototypes, or -Wstrict-prototypes for C++. The current + lalr1.cc runs afoul of the first, and the last two are no longer + supported by GCC 3.4.0. + * README: Mention GNU m4 1.4 or later; mention m4 patches. + * HACKING: Use ./bootstrap, not "make update" to import foreign files. + +2004-05-06 Paul Eggert + + * src/muscle_tab.c (hash_muscle): Accept and return size_t, not + unsigned int, for compatibility with latest gnulib hash module. + * src/state.c (state_hash, state_hasher): Likewise. + * src/symtab.c (hash_symbol, hash_symbol_hasher): Likewise. + * src/uniqstr.c (hash_uniqstr): Likewise. + +2004-05-03 Paul Eggert + + * NEWS: Unescaped newlines are no longer allowed in char & strings. + + * src/scan-gram.l (): Reject unescaped newlines in + character and string literals. + (unexpected_end): New function. + (unexpected_eof): Use it. + (unexpected_newline): New function. + (): Coalesce duplicate + actions. + + * NEWS: Document %expect-rr. + + * bootstrap (--gnulib-srcdir=*, --cvs-user=*): + Fix typo by replacing $1 with $option. + Remove more 'intl'-related files. + Don't DEFUN AM_INTL_SUBDIR twice. + + * lib/.cvsignore: Add strndup.h. Remove memchr.c, memcmp.c, + memrchr.c, strcasecmp.c, strchr.c, strrchr.c, strspn.c, strtol.c, + strtoul.c. + * m4/.cvsignore: Add exitfail.m4, extensions.m4, gnulib.m4, + hard-locale.m4, mbstate_t.m4, strerror_r.m4, strndup.m4, + xstrndup.m4. Remove glibc21.m4, intdiv0.m4, inttypes-pri.m4, + inttypes.m4, inttypes_h.m4, isc-posix.m4, lcmessage.m4, + stdint_h.m4, uintmax_t.m4, ulonglong.m4. + * src/.cvsignore: Add *.output. + + * src/parse-gram.y: Put copyright notice inside %{ %} so it + gets copied to the output file. + +2004-04-28 Paul Eggert + + Get files from the gnulib and po repositories, instead of relying + on them being in our CVS. Upgrade to latest versions of gnulib + and Automake. + + * Makefile.am (SUBDIRS): Remove m4; Automake now does m4. + * bootstrap: Bootstrap from gnulib and po repositories. + Much of this code was stolen from GNU diff and GNU tar's bootstrap. + * README-cvs: Document these changes. Remove version numbers from + mentions of build tools, since they change so often. Mention Flex. + + * configure.ac (AC_CONFIG_MACRO_DIR): Add, with m4 as arg. + (gl_USE_SYSTEM_EXTENSIONS): Add. + (AC_GNU_SOURCE, AC_AIX, AC_MINIX): + Remove; no longer needed, as gl_USE_SYSTEM_EXTENSIONS + does this for us. + (AC_ISC_POSIX): Remove; we no longer support this + ancient OS, as it gets in the way of latest Autoconf & gnulib. + (AC_HEADER_STDC): Remove: we now assume C89 or better. + (AC_CHECK_HEADERS_ONCE): Use instead of AC_CHECK_HEADERS. + Do not check for C89 headers, except for locale.h which is used + by the Yacc library and must port to K&R hosts. + (AC_CHECK_FUNCS_ONCE): Use instead of AC_CHECK_FUNCS. + Do not check for C89 functions, except for setlocale which is + used by the Yacc library. + (AC_CHECK_DECLS, AC_REPLACE_FUNCS): Remove; no longer needed. + (gl_DIRNAME, gl_ERROR, gl_FUNC_ALLOCA, gl_FUNC_MEMCHR, + gl_FUNC_MEMRCHR, gl_FUNC_STPCPY, gl_FUNC_STRNLEN, gl_FUNC_STRTOL, + gl_GETOPT, gl_HASH, gl_MBSWIDTH, gl_OBSTACK, gl_QUOTE, + gl_QUOTEARG, gl_XALLOC, jm_FUNC_GLIBC_UNLOCKED_IO, jm_FUNC_MALLOC, + AM_GNU_GETTEXT): Remove; now done by: + (GNULIB_AUTOCONF_SNIPPET): Add. "bootstrap" builds this for us. + (AC_CONFIG_FILES): Remove m4/Makefile, as Automake now does this + for us. + + * lib/Makefile.am: Include gnulib.mk, built for us by "bootstrap". + (BUILT_SOURCES, EXTRA_DIST, MOSTLYCLEANFILES): + Define to empty, as gnulib.mk will do the rest for us. + ($(libbison_a_OBJECTS), stdbool.h): Remove, as gnulib.mk does this + for us. + (libbison_a_SOURCES): Define to $(lib_SOURCES) now. + (lib_SOURCES): New symbol, containing only the non-gnulib libs. + + * src/files.c: Include gnulib's xstrndup.h. + + * src/system.h (MALLOC): Use xnmalloc, for better overflow checking. + (REALLOC): Use xnrealloc, for likewise. + (xstrndup, stpcpy): Remove decls, as gnulib does this for us now. + (strnlen, memrchr): Remove decls; functions no longer used. + Include . + + * config/depcomp, config/install-sh, lib/alloca.c, lib/argmatch.c, + lib/argmatch.h, lib/basename.c, lib/dirname.c, lib/dirname.h, + lib/error.c, lib/error.h, lib/getopt.c, lib/getopt.h, + lib/getopt1.c, lib/gettext.h, lib/hash.c, lib/hash.h, + lib/malloc.c, lib/mbswidth.c, lib/mbswidth.h, lib/memchr.c, + lib/memcmp.c, lib/memrchr.c, lib/obstack.c, lib/obstack.h, + lib/quote.c, lib/quote.h, lib/quotearg.c, lib/quotearg.h, + lib/realloc.c, lib/stdbool_.h, lib/stpcpy.c, lib/strcasecmp.c, + lib/strchr.c, lib/strncasecmp.c, lib/strnlen.c, lib/strrchr.c, + lib/strspn.c, lib/strtol.c, lib/strtoul.c, lib/unlocked-io.h, + lib/xalloc.h, lib/xmalloc.c, lib/xstrdup.c, lib/xstrndup.c, + m4/Makefile.am, m4/alloca.m4, m4/dirname.m4, m4/dos.m4, + m4/error.m4, m4/getopt.m4, m4/hash.m4, m4/malloc.m4, + m4/mbrtowc.m4, m4/mbswidth.m4, m4/memchr.m4, m4/memcmp.m4, + m4/memrchr.m4, m4/obstack.m4, m4/onceonly.m4, m4/prereq.m4, + m4/quote.m4, m4/quotearg.m4, m4/realloc.m4, m4/stdbool.m4, + m4/stpcpy.m4, m4/strnlen.m4, m4/strtol.m4, m4/strtoul.m4, + m4/unlocked-io.m4, m4/xalloc.m4, po/LINGUAS, po/Makefile.in.in, + po/Makevars, po/da.po, po/de.po, po/es.po, po/et.po, po/fr.po, + po/hr.po, po/id.po, po/it.po, po/ja.po, po/ms.po, po/nl.po, + po/pt_BR.po, po/ro.po, po/ru.po, po/sv.po, po/tr.po: + Remove, as these files are now generated automatically + by bootstrap or automake. + + * po/ChangeLog: Remove: all but one entry was a duplicate + of this file, and I moved that 2000-11-02 entry here. + + * config/.cvsignore: Add Makefile, depcomp, install-sh. + * lib/.cvsignore: Add alloca.c, alloca.h, alloca_.h, argmatch.c, + argmatch.h, basename.c, dirname.c, dirname.h, error.c, error.h, + exit.h, exitfail.c, exitfail.h, getopt.c, getopt.h, getopt1.c, + getopt_int.h, gettext.h, gnulib.mk, hard-locale.c, hard-locale.h, + hash.c, hash.h, malloc.c, mbswidth.c, mbswidth.h, memchr.c, + memcmp.c, memrchr.c, obstack.c, obstack.h, quote.c, quote.h, + quotearg.c, quotearg.h, realloc.c, stdbool_.h, stpcpy.c, stpcpy.h, + strcasecmp.c, strchr.c, stripslash.c, strncasecmp.c, strndup.c, + strnlen.c, strrchr.c, strspn.c, strtol.c, strtoul.c, + unlocked-io.h, xalloc.h, xmalloc.c, xstrdup.c, xstrndup.c, + xstrndup.h. + * m4/.cvsignore: Remove Makefile, Makefile.in. Add alloca.m4, + dirname.m4, dos.m4, error.m4, getopt.m4, hash.m4, mbrtowc.m4, + mbswidth.m4, obstack.m4, onceonly.m4, quote.m4, quotearg.m4, + stdbool.m4, stpcpy.m4, strnlen.m4, unlocked-io.m4, xalloc.m4. + * po/.cvsignore: Add *.po, LINGUAS, Makefile.in.in, Makevars. + * src/.cvsignore: Remove *_.c. + + + * Makefile.maint (GZIP_ENV): Don't use --rsyncable if gzip doesn't + support it. (The latest stable gzip doesn't.) + +2004-04-27 Paul Eggert + + * data/lalr1.cc (Parser::stos_) [! YYDEBUG]: Define even in this + case, as stos_ is now used by destructors due to the 2004-02-09 + change. + + Remove more K&R C support. + * lib/libiberty.y (PARAMS): Remove. All uses removed. + * lib/subpipe.c (errno): Remove decl. + Include unconditionally. + (EXIT_FAILURE): Remove macro. + * src/complain.c (vfprintf, strerror): Remove. + * src/system.h: Include limits.h, stdlib.h, string.h, locale.h + unconditionally. + (EXIT_FAILURE, EXIT_SUCCESS, setlocale): Remove defns. + Use latest Autoconf recommendations for including inttypes.h, stdint.h. + (strchr, strspn, memchr): Remove decls. + * tests/calc.at (_AT_DATA_CALC_Y): Include stdlib.h, string.h + unconditionally. Do not declare perror. + * tests/conflicts.at (%nonassoc and eof): Include stdlib.h + unconditionally. + + * src/complain.c (_): Remove useless defn, as system.h defines this. + + * lib/bitset.h (__INT_TO_PTR): Remove; workaround no longer needed + with latest obstack.h. + * lib/ebitset.c (ebitset_elt_alloc): Don't bother to cast args + to procedure types, as obstack.h now does that for us. + * lib/lbitset.c (lbitset_elt_alloc): Likewise. + + * lib/subpipe.h [HAVE_SYS_TYPES_H]: Include , + so that this include file can stand alone. + * lib/subpipe.c: Do not include , as subpipe.h + does this now. Include subpipe.h first after config.h, to + test whether it can stand alone. + + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Don't + declare yyerror when using lalr.cc, as GCC 3.4.0 warns about the + unused declaration. + + * tests/synclines.at (%union synch line): Put a dummy member in + the union, because empty unions aren't allowed in C. Caught + by GCC 3.4.0. + +2004-04-13 Jim Meyering + + * src/conflicts.c (conflicts_print): Correct format string typo: + use `%%' to produce literal `%'. (trivial change) + +2004-03-30 Paul Eggert + + * src/getargs.c (version): Update copyright year to 2004. + + * data/c.m4 (b4_int_type): Use 'short int' rather than + 'short', and similarly for 'long', 'unsigned', etc. + * data/glr.c (YYTRANSLATE, yyconfl, yySymbol, yyItemNum, + yygetLRActions, yyprocessOneStack, yyrecoverSyntaxError, + yy_yypstack, yydumpstack): Likewise. + * data/lalr1.cc (user_token_number_max_, user_token_number_max_, + translate_, seq_, [], pop, Slice, range_, operator+, operator+=): + Likewise. + * data/yacc.c (b4_int_type, yyss, YYSTACK_BYTES, yysigned_char, + yy_stack_print, yyparse): Likewise. + * doc/bison.texinfo (Prologue, Multiple Types): Likewise. + * lib/bbitset.h (bitset_word, BITSET_WORD_BITS): Likewise. + * lib/bitset.c (bitset_print): Likewise. + * lib/bitset_stats.c (bitste_log_histogram_print): Likewise. + * lib/bitsetv-print.c (bitsetv_matrix_dump): Likewise. + * lib/bitsetv.c (bitsetv_dump): Likewise. + * lib/ebitset.c (EBITSET_ELT_BITS, ebitset_elt_alloc): Likewise. + * lib/lbitset.c (LBITSET_ELT_BITS, lbitset_elt_alloc, debug_lbitset): + Likewise. + * src/LR0.c (allocate_itemsets): Likewise. + * src/gram.h (rule_number, rule): Likewise. + * src/lalr.h (goto_number): Likewise. + * src/nullable.c (nullable_compute): Likewise. + * src/output.c (prepare_rules): Likewise. + * src/relation.c (relation_print, relation_digraph): Likewise. + * src/relation.h (relation_node): Likewise. + * src/state.h (state_number, transitions, errs, reductions, + struct state): Likewise. + * src/symtab.h (symbol_number, struct symbol): Likewise. + * src/tables.c (vector_number, tally, action_number, + default_goto, goto_actions): Likewise. + * tests/existing.at (GNU Cim Grammar): Likewise. + * tests/regression.at (Web2c Actions): Likewise. + + * src/output.c (muscle_insert_short_int_table): Renamed from + muscle_insert_short_table. All uses changed. + +2004-03-25 Paul Hilfinger + + * src/parse-gram.y: Define PERCENT_EXPECT_RR. + (declaration): Replace expected_conflicts with expected_sr_conflicts. + Add %expect-rr rule. + + * src/scan-gram.l: Recognize %expect-rr. + + * src/conflicts.h (expected_sr_conflicts): Rename from + expected_conflicts. + (expected_rr_conflicts): Declare. + + * src/conflicts.c (expected_sr_conflicts): Rename from + expected_conflicts. + (expected_rr_conflicts): Define. + (conflicts_print): Check r/r conflicts against expected_rr_conflicts + for GLR parsers. + Use expected_sr_conflicts in place of expected_conflicts. + Warn if expected_rr_conflicts used in non-GLR parser. + + * doc/bison.texinfo: Add documentation for %expect-rr. + +2004-03-08 Paul Eggert + + Add support for hex token numbers. Suggested by Odd Arild Olsen in + . + + * NEWS: Document hexadecimal tokens, no NUL bytes, %destructor + in lalr1.cc. + * doc/bison.texinfo (Token Decl): Add hexadecimal token numbers. + * src/scan-gram.l (scan_integer): New function. + ({int}): Use it. + (0[xX][0-9abcdefABCDEF]+): New pattern, to support hex numbers. + (, \\x[0-9abcdefABCDEF]+, + handle_action_dollar, handle_action_at, convert_ucn_to_byte): + Say "long int", not "long", for uniformity with GNU style. + +2004-02-25 Paul Eggert + + * tests/local.at (AT_COMPILE, AT_COMPILE_CXX): Ignore stdout from + compilers. This fixes a problem with Intel's C++ compiler being + chatty, reported by Guido Trentalancia in + . + +2004-02-09 Alexandre Duret-Lutz + + Support %destructor and merge error locations in lalr1.cc. + + * data/lalr1.cc (b4_cxx_destruct_def): New macro. + (Parser::stos_): Define unconditionally. + (Parser::destruct_): New method. Generate its body with + b4_yydestruct_generate. + (Parser::error_start_): New attribute. + (Parser::parse) : Call destruct_ on erroneous + token which are discarded. + (Parser::parse) : Update + error_start_ when erroneous token are discarded. + (Parser::parse) : Compute the location of the error + token so that it covers all the discarded tokens. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust so + it can be called with `%skeleton "lalr1.cc"', and do that. + +2004-02-02 Paul Eggert + + * src/Makefile.am (AM_CPPFLAGS): New macro. It mentions + $(top_srcdir)/lib and ../lib. This fixes a bug reported + by Paul Hilfinger; the old INCLUDES value didn't mention ../lib. + There's no need to mention top_builddir since Automake does that + for us. + (INCLUDES): Remove, as Automake says it's obsolescent. + Contents migrated into AM_CPPFLAGS as described above. + * lib/Makefile.am (INCLUDES): Remove; obsolescent. + +2004-01-14 Paul Hilfinger + + * data/glr.c (yytokenName): Bullet-proof against YYEMPTY token. + (yyreportSyntaxError): Handle case where lookahead token is + YYEMPTY. + +2004-01-13 Paul Hilfinger + + * data/glr.c: Put casts on uses of YYREALLOC and YYMALLOC so that + resulting parsers are compilable with C++. + +2003-12-23 Paul Eggert + + * config/depcomp, config/install-sh: Sync with Automake 1.8. + * src/output.c (output_skeleton): Rename local var. + * tests/input.at (Torturing the Scanner): Don't use \x0 or \0 in + Bison tokens, as this runs afoul of the 2003-10-07 change that + disallowed NUL bytes in character constants or string literals. + + * tests/local.at: Require Autoconf 2.59's Autotest. + * tests/testsuite.at: Don't include local.at, since we now assume + Autoconf 2.59 or later. Autoconf 2.59 had some problems with + including it. + * tests/Makefile.am ($(TESTSUITE)): Remove warning about ignoring + multiple inclusion warnings. + +2003-12-02 Akim Demaille + + * doc/bison.texinfo (How Can I Reset the Parser): More about start + conditions. + From Bruno Haible. + +2003-11-18 Alexandre Duret-Lutz + + * doc/bison.texinfo (Bison Options): Escape `@' in `$@'. + +2003-10-07 Paul Eggert + + * tests/Makefile.am (clean-local): Don't run 'testsuite --clean' + if testsuite doesn't exist. + + * doc/bison.texinfo (Symbols): NUL bytes are not allowed in string + literals, unfortunately. + * src/scan-gram.l (): + Complain about NUL bytes in character constants or string literals. + +2003-10-05 Paul Eggert + + * NEWS: Don't document %no-default-prec, as it's still + too experimental. + * doc/bison.texinfo: Document %no-default-prec only if + the defaultprec flag is set. Normally it's not. + +2003-10-04 Paul Eggert + + * data/glr.c (b4_rhs_value, b4_rhs_location): Yield a + non-modifiable lvalue, instead of a modifiable one. + * doc/bison.texinfo (Actions): Document that $$ can + be assigned to. Do not claim that $$ and $N are + array element references: user code should not rely on this. + +2003-10-01 Paul Eggert + + * src/parse-gram.h (PERCENT_NO_DEFAULT_PREC): New token. + (grammar_declaration): Use it. + * src/scan-gram.l: New token %no-default-prec. + * tests/conflicts.at: Revamp tests to use %no-default-prec. + * NEWS, doc/bison.texinfo: Document the above. + +2003-10-01 Akim Demaille + + VCG no longer supports long_straight_phase. + + * src/vcg.c, src/vcg.h: Remove the handling of long_straight_phase. + * src/print_graph.c (print_graph): Adjust. + +2003-09-30 Frank Heckenbach + and Paul Eggert + + * doc/bison.texinfo (Decl Summary, Contextual Precedence, + Table of Symbols): Document %default-prec. + * src/parse-gram.y (PERCENT_DEFAULT_PREC): New token. + (grammar_declaration): Set default_prec on %default-prec. + * src/scan-gram.l (%default-prec): New token. + * src/reader.h (default_prec): New flag. + * src/reader.c: Likewise. + (packgram): Handle it. + * tests/conflicts.at (%default-prec without %prec, + %default-prec with %prec, %default-prec 1): New tests. + +2003-09-30 Paul Eggert + + * tests/testsuite.at: Include local.at, not input.at, fixing + a typo in the 2003-08-25 patch. + +2003-08-27 Akim Demaille + + * data/lalr1.cc (yyparse) [__GNUC__]: "Use" yyerrorlab to pacify + GCC warnings. + +2003-08-26 Akim Demaille + + * config/announce-gen (print_changelog_deltas): Neutralize "<#" as + "<\#" to avoid magic from Gnus when posting parts of this script. + +2003-08-26 Akim Demaille + + * data/lalr1.cc (Parser::report_syntax_error_): New, extracted from + (Parser::parse): here. + Adjust: nerrs and errstatus is now replaced by... + (Parser::nerrs_, Parser::errstatus_): New. + +2003-08-25 Akim Demaille + + * config/announce-gen, Makefile.cfg: New. + * Makefile.am: Adjust. + * GNUmakefile, Makefile.maint: Update from CVS Autoconf, but + keeping local WGET and WGETFLAGS modifications from Paul Eggert. + +2003-08-25 Akim Demaille + + When reducing initial empty rules, Bison parser read an initial + location that is not defined. This results in garbage, and that + affects Bison's own parser. Therefore we need (i) to extend Bison + to support a means to initialize this location, and (ii) to use + this CVS Bison to fix CVS Bison's parser. + + * src/reader.h, reader.c (epilogue_augment): Remove, replace + with... + * src/muscle_tab.h, src/muscle_tab.c (muscle_code_grow): this. + * src/parse-gram.y: Adjust. + (%initial-action): New. + (%error-verbose): Since we require CVS Bison, there is no reason + not to use it. + * src/scan-gram.l: Adjust. + * src/Makefile.am (YACC): New, to make sure we use our own parser. + * data/yacc.c (yyparse): Use b4_initial_action. + +2003-08-25 Akim Demaille + + * doc/bison.texinfo: Don't promote stdout for error messages. + +2003-08-25 Akim Demaille + + * data/lalr1.cc (Parser::reduce_print_): Remove unused yyi. + From Alexandre Duret-Lutz. + +2003-08-25 Akim Demaille + + Version 1.875c. + +2003-08-25 Akim Demaille + + * data/lalr1.cc (Parser::stack_print_, YY_STACK_PRINT): New. + Use them. + +2003-08-25 Akim Demaille + + * data/lalr1.cc (Parser::reduce_print_): New. + Use it. + +2003-08-25 Akim Demaille + + Have lalr1.cc catch with Paul Eggert's patch to fix the infinite + error recovery loops. This patch is based on + . + Also, augment the similarity between lalr1.cc and yacc.c. + Note: the locations of error recovery rules are not correct yet. + + * data/lalr1.cc: Comment changes to augment the similarity between + lalr1.cc and yacc.c. + (YYERROR): Goto to yyerrorlab, not yyerrlab1. + (yyerrlab1): Remove, but where it used to be (now the bottom part of + yyerrlab), when hitting EOF, pop the whole stack here instead of + merely falling thru the default error handling mechanism. + (yyerrorlab): New label, with the old contents of YYERROR, + plus the following change: pop the stack of rhs corresponding + to the production that invoked YYERROR. That is how Yacc + behaves (required by POSIX). + * tests/calc.at (AT_CHECK_CALC_LALR1_CC): No longer expected to + fail. + +2003-08-25 Akim Demaille + + Tune local.at so that people can "autom4te -l autotest calc.at -o + calc" for instance, to extract a sub test suite. + + * tests/testsuite.at: Move the initialization, Autotest version + requirement, and AT_TESTED invocation into... + * tests/local.at: here. + * tests/testsuite.at: Include it for compatibility with Autoconf + 2.57. + * tests/Makefile.am ($(TESTSUITE)): Report that the warning should + be ignore. + +2003-08-04 Paul Eggert + + Rework code slightly to avoid gcc -Wtraditional warnings. + * data/glr.c (yyuserMerge): Return void, not YYSTYPE. + The returned value is now stored in *YY0. All callers changed. + * src/output.c (merge_output): Adjust to the above change. + +2003-07-26 Paul Eggert + + * data/glr.c (YYASSERT): New macro. + (yyfillin, yydoAction, yyglrReduce, yysplitStack, + yyresolveStates, yyprocessOneStack): + Use `YYASSERT (FOO);' rather than `if (! (FOO)) abort ();'. + Derived from a suggestion by Frank Heckenbach. + +2003-07-25 Paul Eggert + + * data/glr.c (yyglrReduce): Don't use C89 string concatenation, + for portability to K&R C (after ansi2knr, presumably). See + + by Frank Heckenbach, though I have omitted the structure-initialization + part of his glr-knr.diff patch since I recall that the Portable + C Compiler didn't require that change. + + Let the user specify how to allocate and free memory. + Derived from a suggestion by Frank Heckenbach in + . + * data/glr.c (YYFREE, YYMALLOC, YYREALLOC): New macros. + All uses of free, malloc, realloc changed to use these macros, + and unnecessary casts removed. + * data/yacc.c (YYFREE, YYMALLOC): Likewise. + +2003-07-06 Matthias Mann + + * data/lalr1.cc (operator<<(std::ostream&, const Position&)): + use s.empty() rather than s == "" to test for empty string; see + + (trivial change) + +2003-06-25 Akim Demaille + + * config/depcomp, config/install-sh: Update from masters. + +2003-06-20 Paul Eggert + + * data/glr.c (YYLLOC_DEFAULT): Parenthesize arguments as needed, + and return properly parenthesized result. + * data/lalar1.cc (YYLLOC_DEFAULT): Likewise. + * data/yacc.c (YYLLOC_DEFAULT): Likewise. + Remove unnecessary parentheses from uses. + * doc/bison.texinfo (Location Default Action): Describe the + conventions for parentheses. + +2003-06-19 Paul Eggert + + * data/glr.c (yyremoveDeletes, yy_reduce_print, yyglrReduce, + yyreportTree): Do not assume that size_t is the same width as int, + when printing sizes. Print sizes using an unsigned format. + Problem reported by Frank Heckenbach in + . + + Port to Forte Developer 7 C compiler. + * data/glr.c (struct YYLTYPE): If locations are not being used, + declare a single dummy member, as empty structs do not conform + to the C standard. + (YYERROR, YYBACKUP): Do not use "do { ...; return foo; } while (0)"; + the Forte Developer 7 C compiler complains that end-of-loop + code is not reached. + +2003-06-17 Paul Eggert + + * lib/libiberty.h (PARAMS): Spell argument as Args, not as X, to + avoid warnings from picky compilers about redefinition of PARAMS. + +2003-06-17 Paul Eggert + + Version 1.875b. + + * NEWS: Document 1.875b. + + * lib/bbitset.h: Do not include config.h; that's the includer's job. + Do not include ; shouldn't be needed on a C89 host. + * lib/bitset.h (bitset_compatible_p): Indent as per GNU standard. + Don't use 'index' in comments, as it's a builtin fn on some hosts. + * lib/bitset_stats.c: Include gettext.h unconditionally, as + per recent gettext manual's suggestion. + * lib/ebitset.c (ebitset_resize, ebitset_unused_clear): + Use prototypes, not old-style definitions. + * lib/lbitset.c (lbitset_unused_clear): Likewise. + * lib/vbitset.c (vbitset_resize, vbitset_ones, vbitset_zero, + vbitset_empty_p, vbitset_copy1, vbitset_not, vbitset_equal_p, + vbitset_subset_p, vbitset_disjoint_p, vbitset_and, vbitset_and_cmp, + vbitset_andn, vbitset_andn_cmp, vbitset_or, vbitset_or_cmp, + vbitset_xor, vbitset_xor_cmp, vbitset_and_or, vbitset_and_or_cmp, + vbitset_andn_or, vbitset_andn_or_cmp, vbitset_or_and, + vbitset_or_and_cmp, vbitset_copy): Likewise. + + * lib/libiberty.h: Do not include config.h; that's the includer's job. + Do not include . + (PARAMS): Define unconditionally for C89. + (ATTRIBUTE_NORETURN): Remove. + (ATTRIBUTE_UNUSED): Define unconditionally. + + Upgrade to 2003-06-08 libbitset, submitted by Michael Hayes in: + + * lib/Makefile.am (bitsets_sources): Add vbitset.c, vbitset.h. + * lib/vbitset.c, lib/vbitset.h: New files. + * lib/abitset.c, lib/bbitset.h, lib/bitset.c, lib/bitset.h, + lib/bitset_stats.c, lib/ebitset.c, lib/lbitset.c: Import + from libbitset. + + * doc/bison.texinfo (How Can I Reset the Parser): Renamed from + `How Can I Reset @code{yyparse}', since texinfo does not allow + arbitrary @ in node names. + + * m4/Makefile.am (EXTRA_DIST): Add the following files, which + shouldn't be needed according to the gettext 0.12.1 documentation + but which seem to be needed anyway: codeset.m4 glibc21.m4 + intdiv0.m4 inttypes-pri.m4 inttypes.m4 inttypes_h.m4 isc-posix.m4 + lcmessage.m4 nls.m4 po.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4. + * po/Makefile.in.in: Upgrade to gettext 0.12.1 version. + + * lib/.cvsignore: Add stdbool.h. + * m4/.cvsignore: Add nls.m4, po.m4. + + Upgrade to CVS gnulib. + * stdbool_.h: File renamed from stdbool.h.in. + * configure.ac (AM_STDBOOL_H): Invoke this instead of + AC_HEADER_STDBOOL. + (AM_GNU_GETTEXT): Put brackets around args, as latest manual suggests. + (AM_GNU_GETTEXT_VERSION): Update to 0.12.1. + * lib/Makefile.am (EXTRA_DIST): Add stdbool_.h. + (MOSTLYCLEANFILES): New var. + ($(libbison_a_OBJECTS)): Depend on $(STDBOOL_H). + (stdbool.h): New rule. + * lib/dirname.c, lib/dirname.h, lib/hash.c, lib/hash.h, + lib/malloc.c, lib/obstack.h, lib/quote.c, lib/realloc.c, + lib/strcasecmp.c, lib/xalloc.h, m4/alloca.m4, m4/onceonly.m4, + m4/quote.m4: Upgrade to today's gnulib. + + * tests/calc.at (AT_CHECK_CALC): New option EXPECTED-TO-FAIL. + (AT_CHECK_CALC_LALR1_CC): Use it, since the C++ LALR parser fails + the tests right now. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Ensure yylex and + yyerror are declared before use; C99 requires this. + +2003-06-09 Paul Hilfinger + + * data/glr.c (YYERROR): Update definition to reset yyerrState to 0 + first. + (yyrecoverSyntaxError): Correct the logic for setting and testing + yyerrState. + Correct comment on handling EOF. + Allow states with only a default reduction, rather than failing + (I can't quite reconstruct why these were not allowed before). + + Fixes to avoid problem that $-N rules in GLR parsers can cause + buffer overruns, corrupting state. + + * src/output.c (prepare_rules): Output max_left_semantic_context + definition. + * src/reader.h (max_left_semantic_context): New variable declaration. + * src/scan-gram.l (max_left_semantic_context): Define. + (handle_action_dollar): Update max_left_semantic_context. + * data/glr.c (YYMAXLEFT): New definition. + (yydoAction): Increase size of yyrhsVals by YYMAXLEFT. + (yyresolveAction): Ditto. + + Fixes to problems with location handling in GLR parsers reported by + Frank Heckenbach (2003/06/05). + + * data/glr.c (YYLTYPE): Make trivial if locations not used. + (YYRHSLOC): Add parentheses, and define only if locations used. + (YYLLOC_DEFAULT): Add parentheses, and give trivial definition if + locations not used. + (yyuserAction): Use YYLLOC_DEFAULT to set *yylocp. + (yydoAction): Remove redundant initialization of *yyvalp and *yylocp. + + * tests/cxx-type.at: Exercise location information; update tests + to differentiate output with and without locations. + Remove forward declarations of yylex and yyerror---caused errors + because default YYLTYPE not yet defined. + Change semantic actions to compute strings, rather than printing + them directly (to test proper passing of semantics values). Change + output to prefix notation and update test data and expected results. + (yylex): Track locations. + (stmtMerge): Return value rather than printing, and include arguments + in value. + +2003-06-03 Paul Eggert + + Avoid warnings generated by GCC 2.95.4 when Bison is + configured with --enable-gcc-warnings. + * data/lalr1.cc (yy::]b4_parser_class_name[::parse, + yy::]b4_parser_class_name[::translate_, + yy::Stack::operator[] (unsigned), + yy::Stack::operator[] (unsigned) const, + yy::Slice::operator[] (unsigned), + yy::Slice::operator[] (unsigned) const): + Rename local vars to avoid warnings. + * tests/glr-regression.at (Improper handling of embedded actions + and $-N in GLR parsers): Remove unused local variable from yylex. + * tests/regression.at (_AT_DATA_DANCER_Y): Declare yylex to take + (void) as arg when not pure, since we now assume C89 when building + Bison. Pacify GCC by using parameter. + +2003-06-02 Paul Eggert + + * data/lalr1.cc (yy::Position::lines, yy::Position::columns, + yy::Location::lines, yy::Location::columns): Rename arguments + to avoid shadowing; this removes a warning generated by GCC 3.3. + +2003-06-01 Paul Eggert + + Don't pass C-only warning optins (e.g., -Wmissing-declarations) + to g++, as GCC 3.3 complains if you do it. + * configure.ac (WARNING_CXXFLAGS): New subst. Set it to + everything that WARNING_CFLAGS has, except omit warnings + not suitable for C++. + (AC_PROG_CXX): Use this instead of AC_CHECK_PROGS([CXX], [g++]). + * tests/atlocal.in (CXXFLAGS): New var. + * tests/local.at (AT_COMPILE_CXX): Use it instead of CFLAGS. + + Fix a GLR parser bug I reported in February; see + . + The problem was that GLR parsers did not conform to the C standard, + because actions like { $1 = $2 + $3; } expanded to expressions + that invoked YYFILL in separate subexpressions, and YYFILL assigned + to a local variable. The C standard says that expressions + like (var = f ()) + (var = f ()) have undefined behavior. + Another problem was that GCC sometimes issues warnings that + yyfill and its parameters are unused. + + * data/glr.c (yyfillin): Renamed from the old yyfill. Mark + as possibly unused. + (yyfill): New function. + (YYFILL): Use it. + (yyuserAction): Change type of yynormal to bool, so that it matches + the new yyfill signature. Mark it as possibly unused. + + + Follow up on a bug I reported in February, where a Bison-generated + parser can loop. Provide a test case and a fix for yacc.c. I + don't have a fix for lalr1.cc or for glr.c, unfortunately. + The original bug report is in: + + + * data/yacc.c (YYERROR): Now just 'goto yyerrorlab', since the + macro's size was becoming unwieldy. + (yyerrlab): Do not discard an empty lookahead symbol, as this + might destroy garbage. + (yyerrorlab): New label, with the old contents of YYERROR, + plus the following change: pop the stack of rhs corresponding + to the production that invoked YYERROR. That is how Yacc + behaves, and POSIX requires this behavior. + (yyerrlab1): Use YYPOPSTACK instead of its definiens. + * tests/calc.at (_AT_DATA_CALC_Y): Include unistd.h if available. + Define 'alarm' to do nothing if unistd.h is not available. + Add a new rule "exp: '-' error;" to test the above change to + data/yacc.c. Use 'alarm' to abort any test taking longer than + 10 seconds, as it's probably looping. + (AT_CHECK_CALC): Test recovery from error in new grammar rule. + Also, the new yacc.c generates two fewer diagnostics for an + existing test. + +2003-05-24 Paul Eggert + + * data/glr.c (YYSTACKEXPANDABLE): Do not evaluate + YYSTYPE_IS_TRIVIAL or YYSTYPE_IS_TRIVIAL unless they are defined. + This fixes a problem reported by John Bowman when the Compaq/HP + Alpha cxx compiler happy (e.g. using cxx -D__USE_STD_IOSTREAM + -ansi -Wall -gall). + * data/yacc.c (union yyalloc): Likewise. + (YYCOPY): Do not evaluate __GNUC__ unless it is defined. + + Switch from 'int' to 'bool' where that makes sense. + + * lib/abitset.c (abitset_test, abitset_empty_p, abitset_equal_p, + abitset_subset_p, abitset_disjoint_p, abitset_and_cmp, + abitset_andn_cmp, abitset_or_cmp, abitset_xor_cmp, abitset_and_or, + abitset_and_or_cmp, abitset_andn_or_cmp, abitset_or_and_cmp): + Return or accept bool, not int. All callers changed. + * lib/bbitset.h: (bitset_toggle_, bitset_copy_, bitset_and_or_cmp_, + bitset_andn_or_cmp_, bitset_or_and_cmp_): Likewise. + * lib/bitset.c (bitset_only_set_p, bitset_print, bitset_toggle_, + bitset_copy_, bitset_op4_cmp, bitset_and_or_cmp_, bitset_andn_or_cmp_, + bitset_or_and_cmp_): Likewise. + * lib/bitset.h (bitset_test, bitset_only_set_p): Likewise. + * lib/bitset_stats.c (bitset_stats_print, bitset_stats_toggle, + bitset_stats_test, bitset_stats_empty_p, bitset_stats_disjoint_p, + bitset_stats_equal_p, bitset_stats_subset_p, bitset_stats_and_cmp, + bitset_stats_andn_cmp, bitset_stats_or_cmp, bitset_stats_xor_cmp, + bitset_stats_and_or_cmp, bitset_stats_andn_or_cmp, + bitset_stats_or_and_cmp): Likewise. + * lib/ebitset.c (ebitset_elt_zero_p, ebitset_equal_p, ebitset_copy_cmp, + ebitset_test, ebitset_empty_p, ebitset_subset_p, ebitset_disjoint_p, + ebitset_op3_cmp, ebitset_and_cmp, ebitset_andn_cmp, ebitset_or_cmp, + ebitset_xor_cmp): Likewise. + * lib/lbitset.c (lbitset_elt_zero_p, lbitset_equal_p, lbitset_copy_cmp, + lbitset_test, lbitset_empty_p, lbitset_subset_p, lbitset_disjoint_p, + lbitset_op3_cmp, lbitset_and_cmp, lbitset_andn_cmp, lbitset_or_cmp, + lbitset_xor_cmp): Likewise. + * lib/bbitset.h: Include . + (struct bitset_vtable): The following members now return bool, not + int: toggle, test, empty_p, disjoint_p, equal_p, subset_p, + and_cmp, andn_cmp, or_cmp, xor_cmp, and_or_cmp, andn_or_cmp, + or_and_cmp). + * src/conflicts.c (count_rr_conflicts): Likewise. + * lib/bitset_stats.h (bitset_stats_enabled): Now bool, not int. + All uses changed. + * lib/ebitset.c (ebitset_obstack_init): Likewise. + * lib/lbitset.c (lbitset_obstack_init): Likewise. + * src/getargs.c (debug_flag, defines_flag, locations_flag, + no_lines_flag, no_parser_flag, token_table_flag, yacc_flag, + graph_flag): Likewise. + * src/getargs.h (debug_flag, defines_flag, locations_flag, + no_lines_flag, no_parser_flag, token_table_flag, yacc_flag, + graph_flag): Likewise. + * src/output.c (error_verbose): Likewise. + * src/output.h (error_verbose): Likewise. + * src/reader.c (start_flag, typed): Likewise. + * src/reader.h (typed): Likewise. + * src/getargs.c (LOCATIONS_OPTION): New constant. + (long_options, getargs): Use it. + * src/lalr.c (build_relations): Use bool, not int. + * src/nullable.c (nullable_compute): Likewise. + * src/print.c (print_reductions): Likewise. + * src/tables.c (action_row, pack_vector): Likewise. + * src/muscle_tab.h (MUSCLE_INSERT_BOOL): New macro. + * src/output.c (prepare): Use it. + * src/output.c (token_definitions_output, + symbol_destructors_output, symbol_destructors_output): Use string, + not boolean integer, to keep track of whether to output separator. + * src/print_graph.c (print_core): Likewise. + * src/state.c (state_rule_lookaheads_print): Likewise. + + * config/install-sh: Sync from automake 1.7.5. + +2003-05-14 Paul Eggert + + * src/parse-gram.y (rules_or_grammar_declaration): Require a + semicolon after a grammar declaration, in the interest of possible + future changes to the Bison input language. + Do not allow a stray semicolon at the start of the grammar. + (rhses.1): Allow one or more semicolons after any rule, including + just before "|" as required by POSIX. + * tests/input.at (Torturing the Scanner): Add tests for ";|" in a + grammar. + +2003-05-14 Alexandre Duret-Lutz + + %parse-param support for lalr1.cc. + + * data/lalr1.cc (b4_parse_param_decl, b4_parse_param_cons, + b4_cc_constructor_calls, b4_cc_constructor_call, + b4_parse_param_vars, b4_cc_var_decls, b4_cc_var_decl): New m4 + definitions. + (yy::b4_parser_class_name::b4_parser_class_name): Take extra + parse-param arguments. + (yy::b4_parser_class_name): Declare instance variables to + hold parse-param arguments. + * tests/calc.at: s/value/semantic_value/ because value clashes + with a member of yy::b4_parser_class_name. Adjust C++ code + to handle %parse-param. Enable %parse-param test in C++. + +2003-05-12 Paul Eggert + + * doc/bison.texinfo (How Can I Reset @code{yyparse}): Reword the + English a bit. Fix fclose typo. Change "const char" to "char + const", and use ANSI C rather than K&R for "main". Suggest + YY_FLUSH_BUFFER over yyrestart (as that is what Flex recommends) + and suggest yy_switch_to_buffer. + +2003-05-05 Paul Eggert + + * lib/bitset.h (__INT_TO_PTR): Define to a value that presumes + C89. This avoids a diagnostic on compilers that define __STDC__ + to 0, fixing a problem with Tru64 cc reported by Martin Mokrejs in + . + +2003-05-03 Paul Eggert + + * lib/bitset.h (BITSET_FOR_EACH, BITSET_FOR_EACH_REVERSE): + Do not overrun array bounds. + This should fix a bug reported today by Olatunji Oluwabukunmi in + . + +2003-04-29 Akim Demaille + + * src/gram.h, src/gram.c (pure_parser, glr_parser): Move to... + * src/getargs.c, src/getargs.h: here, as bool, not int. + (nondeterministic_parser): New. + * src/parse-gram.y, src/scan-gram.l: Support + %nondeterministic-parser. + * src/output.c (prepare): Use nondeterministic_parser instead + of glr_parser where appropriate. + * src/tables.c (conflict_row, action_row, save_row) + (token_actions, token_actions, pack_vector): Ditto. + +2003-04-29 Akim Demaille + + * doc/bison.texinfo (C++ Parsers, Implementing Loops): New. + +2003-04-29 Akim Demaille + + * tests/calc.at: Also test yacc.c and glr.c (but not lalr1.cc yet) + with %pure-parser and %locations to exercise the patch from Yakov + Markovitch below. + +2003-04-28 Tim Van Holder + + * data/yacc.c: (b4_lex_param): Corrected for the case where + %lex-param is provided and %pure-parser isn't. + +2003-04-27 Paul Eggert + + Avoid gcc -Wundef warnings reported by Gerald Pfeifer in + . + * data/yacc.c (YYSTACK_ALLOC): Don't evaluate YYSTACK_USE_ALLOCA + if it is not defined. + (YYMAXDEPTH): Don't evaluate YYMAXDEPTH if it is not defined. + +2003-04-26 Paul Eggert + + * data/lalr1.cc (yy::Parser::pact_ninf_, yy::Parser::table_ninf_): + Declare to be of type suitable for the ninf value itself, not of + type suitable for the corresponding table, since the latter might + be unsigned but the ninf value might be negative. This fixes a + bug reported by Alexandre Duret-Lutz in + . + + * configure.ac (AC_FUNC_ERROR_AT_LINE): Remove, since gl_ERROR + invokes it. We shouldn't invoke it twice because it will attempt + to put error.o in the archive twice. This fixes a glitch reported + by Martin Mokrejs in + . + +2003-04-21 Paul Eggert + + * m4/error.m4: Update from Bruno Haible's 2003-04-14 patch + to gnulib. + +2003-04-21 Yakov Markovitch + + * data/glr.c (yyexpandGLRStack) [!YYSTACKEXPANDABLE]: + Fix obvious typo that results in uncompilable GLR parsers + when both %pure-parser and %locations are used. (trivial change) + +2003-04-17 Paul Eggert + + * src/scan-gram.l: Add %option nounput, since we no longer use unput. + (unexpected_eof): Renamed from unexpected_end_of_file, for brevity. + Do not insert the expected token via unput, as this runs afoul + of a POSIX-compatibility bug in flex 2.5.31. + All uses changed to BEGIN the parent state, + since we no longer insert the expected token via unput. + * tests/regression.at (Invalid inputs): Remove cascaded diagnostic + that is no longer emitted after the above change. + + * src/conflicts.c (set_conflicts): Resolve all conflicts, not just + the first one. This change is from Paul Hilfinger, and it fixes + regression reported by Werner Lemberg in + . + + (resolve_sr_conflict): Don't invoke state_errs_set + unless one or more tokens have been explicitly made errors. + Otherwise, the above change causes Bison to abort. + + * tests/existing.at (GNU pic Grammar): New test case, taken from + Lemberg's email. + +2003-03-31 Akim Demaille + + * doc/Makefile.am (AM_MAKEINFOFLAGS): Don't split the info file. + +2003-03-31 Akim Demaille + + * src/output.c (prepare_symbols): Avoid trailing spaces in the + output. + +2003-03-31 Akim Demaille + + * doc/bison.texinfo (Strings are Destroyed): s/losses/loses/. + From Paul Hilfinger. + +2003-03-29 Akim Demaille + + * m4/error.m4: Do not put under dynamic conditions some code which + expansion is under static control. + +2003-03-29 Akim Demaille + + * doc/bison.texinfo (How Can I Reset @code{yyparse}): New. + +2003-03-29 Akim Demaille + + * doc/bison.texinfo (Strings are Destroyed): New. + +2003-03-13 Paul Eggert + + * .cvsignore: Add configure.lineno. + * src/.cvsignore: Add yacc. + * tests/.cvsignore: Add testsuite.log. + * doc/fdl.texi: Sync with latest FSF version. + +2003-03-12 Paul Eggert + + * scan-gram.l (YY_USER_INIT): Initialize code_start, too. + (<>, <>): Set *loc to the scanner + cursor, instead of leaving it undefined. This fixes a bug + reported by Tim Van Holder in + . + * tests/input.at (Torturing the Scanner): Test the scanner on + an empty input file, which was Tim Van Holder's test case. + + * m4/timevar.m4 (BISON_PREREQ_TIMEVAR): When checking whether + can be included, include sys/time.h and + sys/times.h first, if available. This works around the SunOS + 4.1.4 porting bug reported by Bruce Becker in + . + + * m4/subpipe.m4 (BISON_PREREQ_SUBPIPE): Don't + AC_CHECK_HEADERS([sys/wait.h]), as this interferes with + AC_HEADER_SYS_WAIT. + + Merge changes from gnulib. This was prompted because the CVS + snapshot didn't build on Solaris 7 due to strnlen problems. + + These changes need to be merged back into gnulib: + * lib/hash.c: Include unconditionally. + * m4/onceonly.m4 (m4_quote): New macro. + (AC_CHECK_HEADERS_ONCE, AC_CHECK_FUNCS_ONCE, AC_CHECK_DECLS_ONCE): + Quote AC_FOREACH variable-expansions properly. + The 2003-01-03 obstack.h change also needs merging. + {end of changes requiring merging} + + * lib/stdbool.h.in, m4/alloca.m4, m4/dirname.m4, m4/dos.m4, + m4/getopt.m4, m4/hash.m4, m4/malloc.m4, m4/memchr.m4, + m4/memrchr.m4, m4/obstack.m4, m4/onceonly.m4, m4/quote.m4, + m4/quotearg.m4, m4/realloc.m4, m4/stpcpy.m4, m4/strnlen.m4, + m4/strtol.m4, m4/strtoul.m4, m4/unlocked-io.m4, m4/xalloc.m4: + New files, imported from gnulib. + * m4/Makefile.am (EXTRA_DIST): Add the new m4/*.m4 files mentioned + above. + + * lib/mbswidth.c, m4/error.m4, m4/mbrtowc.m4, m4/mbswidth.m4, + m4/memcmp.m4, m4/prereq.m4, m4/stdbool.m4: Update to current + gnulib sources. + + * configure.ac (gl_DIRNAME, gl_GETOPT, gl_HASH, gl_QUOTE, gl_XALLOC): + Add. + (gl_ERROR): New, replacing jm_PREREQ_ERROR. + (gl_FUNC_ALLOCA): New, replacing AC_FUNC_ALLOCA. + (gl_FUNC_STPCPY): New, replacing AC_REPLACE_FUNCS(stpcpy). + (gl_FUNC_STRNLEN): New, replacing AC_FUNC_STRNLEN. + (gl_MBSWIDTH): New, replacing jm_PREREQ_MBSWIDTH. + (gl_OBSTACK): New, replacing AC_FUNC_OBSTACK. + (gl_QUOTEARG): New, replacing jm_PREREQ_QUOTEARG. + (jm_FUNC_GLIBC_UNLOCKED_IO, gl_FUNC_STPCPY, gl_FUNC_STRTOL): New. + (jm_FUNC_MALLOC): New, replacing AC_FUNC_MALLOC. + (jm_FUNC_REALLOC): New, replacing AC_FUNC_REALLOC. + (jm_PREREQ_ARGMATCH): Remove. + (AC_REPLACE_FUNCS): Remove memchr, memrchr, stpcpy, strtol, strtoul. + * lib/Makefile.am (libbison_a_SOURCES): Add argmatch.c, argmatch.h. + + * src/system.h: Include unconditionally. + + * lib/bbitset.h: Include unconditionally. We have been + assuming at least C89 in the bitset code for some time now. + +2003-03-03 Akim Demaille + + * ro.po: New. + +2003-03-02 Akim Demaille + + * doc/bison.texinfo (Table of Symbols): Reactivate the + documentation for %lex-param, and %parse-param. + +2003-03-02 Akim Demaille + + * data/yacc.c, data/glr.c, data/lal1.cc: Use similar code to + generate verbose error messages. + Use the number of tokens as an upper bound in yytname, as it + cannot be a non terminal. + +2003-03-02 Akim Demaille + + * tests/regression.at (_AT_DATA_DANCER_Y): Fix the expected error + message. + +2003-03-02 Akim Demaille + + * tests/regression.at (_AT_DATA_DANCER_Y, AT_CHECK_DANCER): New. + Use them to exercise yycheck overrun. + Based on Andrew Suffield's grammar. + +2003-03-02 Akim Demaille + + Create tests/local.at for Bison generic testing macros. + + * tests/calc.at (AT_CHECK_PUSHDEFS, AT_CHECK_POPDEFS): Move to... + * tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS): + This new file. + * tests/calc.at (AT_CHECK_CALC): Adjust. + * tests/testsuite.at (AT_DATA_GRAMMAR_PROLOGUE, AT_DATA_GRAMMAR) + (AT_COMPILE, AT_COMPILE_CXX, AT_PARSER_CHECK): Move to... + * tests/local.at: here. + (AT_COMPILE_CXX): Tags the tests using it as c++. + Ignore the test if CXX is not functional. + +2003-03-01 Paul Eggert + + * src/scan-gram.l (code_start): Initialize it to scanner_cursor, + not loc->end, since loc->end might contain garbage and this leads + to undefined behavior on some platforms. + (id_loc, token_start): Use (IF_LINTed) initial values that do not + depend on *loc, so that the reader doesn't give the the false + impression that *loc is initialized. + ("%%"): Do not bother setting code_start, since its value + does not survive the return. + +2003-03-01 Akim Demaille + + * src/scan-gram.l (code_start): Always initialize it when entering + into yylex, as SC_EPILOGUE is activated *before* the corresponding + yylex invocation. An alternative would be making it static, but + then it starts with the second %%'s beginning, instead of its end. + +2003-02-28 Paul Eggert + + * lib/mbswidth.c: Include before "mbswidth.h", to work + around a UnixWare 7.1.1 porting bug reported by John Hughes in + . + +2003-02-26 Paul Eggert + + * README: Mention compiler bug in Sun Forte Developer 6 update 2. + Remove Sequent/Pyramid discussion (nobody uses them any more). + Merge VMS and MS-DOS discussion; these ports may well be dead + but let's keep mentioning them for now. Put <> around email + addresses. Add copyright notice. + +2003-02-24 Paul Eggert + + * data/glr.c (yy_reduce_print): yylineno -> yylno, + to avoid collision with flex use of yylineno. + Problem reported by Bruce Lilly in + . + * data/lalr1.cc (yy::]b4_parser_class_name[::parse): Likewise. + * data/yacc.c (yy_reduce_print): Likewise. + + * config/depcomp: Sync with Automake 1.7.3. + +2003-02-21 Akim Demaille + + * data/lalr1.cc: Use temporary variables instead of casts to + change integer types. + Suggested by Paul Eggert. + +2003-02-21 Akim Demaille + + * doc/bison.texinfo: Use "location" consistently to refer to @n, + to avoid confusions with lalr1.cc's notion of Position. + Suggested by Paul Eggert. + +2003-02-20 Akim Demaille + + * data/lalr1.cc (position.hh): Make sure "columns" never pushes + before initial_columns. + (location.hh): Use consistent variable names when defining the + operator<<. + Use "last" so that we subtract from Positions, not from unsigned. + +2003-02-20 Akim Demaille + + * data/lalr1.cc (position.hh): New subfile, including the extended + and Doxygen'ed documentation of class Position. + (location.hh): Use it. + Document a` la Doxygen. + With the help of Benoit Perrot. + +2003-02-20 Akim Demaille + + * tests/calc.at (AT_CHECK_PUSHDEFS, AT_CHECK_POPDEFS): Define + AT_YACC_IF. + Redefine AT_YYERROR_SEES_LOC_IF using it. + (_AT_DATA_CALC_Y): Don't declare yyerror when lalr1.cc, as it is + not defined. + Don't use the location in yy::Parser::error_ and + yy::Parser::print_ when not %locations. + Activate more lalr1.cc tests. + +2003-02-19 Akim Demaille + + * data/lalr1.cc: When displaying a line number, be sure to make it + an int. + +2003-02-19 Akim Demaille + + * data/lalr1.cc (b4_stack_depth_init, yy::Parser::initdepth_): + Remove, useless. + (YYABORT, YYACCEPT, YYERROR): New. + * tests/calc.at: Renable the lalr1.cc test. + +2003-02-19 Akim Demaille + + * tests/calc.at (AT_CHECK_CALC): Check different scenarios of + error recovery, mixing with/without pops and discarding of the + lookahead. + Exercise YYERROR. + Disable the lalr1.cc tests as currently it doesn't support YYERROR. + +2003-02-17 Paul Eggert + + * tests/atlocal.in (LDFLAGS, LIBS): New vars. + * tests/testsuite.at (AT_COMPILE): Use them. + This fixes the testsuite problem reported by Robert Lentz in + . + +2003-02-12 Paul Eggert + + * data/yacc.c (yyerrlab) [YYERROR_VERBOSE]: + Avoid subscript error in yycheck. Bug reported by Andrew Suffield in + . + * data/glr.c (yyreportSyntaxError) [YYERROR_VERBOSE]: Likewise. + Check for malloc failure, for consistency with yacc.c. + (yytname_size): Remove, for consistency with yacc.c. + + The bug still remains in data/lalr1.cc, as I didn't have time + to fix it there. + +2003-02-06 Akim Demaille + + * configure.ac (GXX): Rename as... + (CXX): this, to keep the original Autoconf semantics. + Require 2.57. + * data/lalr1.cc: Fix b4_copyright invocations. + If YYDEBUG is not defined, don't depend upon name_ being defined. + (location.hh): Include string and iostream. + (Position::filename): New member. + (Position::Position ()): New. + (operator<< (Position)): New. + (operator- (Position, int)): New. + (Location::first, Location::last): Rename as... + (Location::begin, Location::end): these, to mock the conventional + iterator names. + (operator<< (Location)): New. + * tests/atlocal.in (CXX): New. + * tests/testsuite.at (AT_COMPILE_CXX): New. + * tests/calc.at (_AT_DATA_CALC_Y): Adjust yyerror to report the + locations in a more synthetic way. + (AT_CHECK_PUSHDEFS): AT_YYERROR_SEES_LOC_IF is positive if + lalr1.cc is used. + Adjust the C locations to match those from Emacs: first column is + column 0. + Change all the expected results. + Conform to the GCS: simplify the locations when applicable. + (LOC, VAL, YYLLOC_FORMAL, YYLLOC_ARG, USE_YYLLOC, LEX_FORMALS) + (LEX_ARGS, USE_LEX_ARGS, LEX_PRE_FORMALS, LEX_PRE_ARGS): Replace + these CPP macros with the m4 macros new defined by... + (AT_CHECK_PUSHDEFS): this, i.e.: + (AT_LALR1_CC_IF, AT_PURE_LEX_IF, AT_LOC, AT_VAL, AT_LEX_FORMALS) + (AT_LEX_ARGS, AT_USE_LEX_ARGS, AT_LEX_PRE_FORMALS, AT_LEX_PRE_ARGS) + New macros. + (AT_CHECK_POPDEFS): Undefine them. + (AT_CHECK_CALC_LALR1_CC): New. + Use it for the first lalr1.cc test. + +2003-02-04 Akim Demaille + + * data/lalr1.cc (YYLLOC_DEFAULT): Fix its definition: be based on + Location as is defined. + +2003-02-04 Akim Demaille + + * data/lalr1.cc: If YYDEBUG is not defined, don't depend upon + name_ being defined. + +2003-02-03 Paul Eggert + + * src/gram.h (start_symbol): Remove unused decl. + + Use more-consistent naming conventions for local vars. + + * src/derives.c (derives_compute): Change type of local var from + int to rule_number. + * src/gram.c (grammar_rules_partial_print): Likewise. + * src/print.c (print_core): Likewise. + * src/reduce.c (reduce_grammar_tables): Likewise. + + * src/gram.c (grammar_dump): Change name of item_number * + local var from r to rp. + * src/nullable.c (nullable_compute): Likewise. + + * src/gram.h (ISTOKEN, ISVAR): Use i, not s, for int var. + + * src/gram.h (symbol_number_as_item_number): Use sym, not s, + for symbol or symbol_number var. + * src/reader.c (grammar_start_symbol_set): Likewise. + * src/reader.h (grammar_start_symbol_set, grammar_symbol_append): + Likewise. + * src/state.c (transitions_to): Likewise. + * src/state.h: Likewise. + * src/tables.c (symbol_number_to_vector_number): Likewise. + + * src/muscle_tab.h (MUSCLE_OBSTACK_SGROW): Use p, not s, for + char * var. + + * src/parse-gram.y (lloc_default): Use loc, not r, for YYLTYPE + var. + + * src/scan-gram.l (no_cr_read): Use bytes_read, not s, for size + var. + + * src/system.h (xstrndup, strchr, strspn, strnlen, memchr, memrchr): + Use str, not s, for char * var. Use ch, not c, for character var. + Use size for size var. + + * src/uniqstr.c (uniqstr_new, uniqstr_assert): Use str, not s, for + char * var. + (uniqstr_print, uniqst_print_processor): Use ustr, not s, for + uniqstr var. + * src/uniqstr.h: Likewise. + + * src/vcg.c (get_color_str, get_textmode_str, get_shape_str, + get_layoutalgorithm_str, get_decision_str, get_orientation_str, + get_node_alignment_str, get_arrow_mode_str, get_crossing_type_str, + get_view_str, get_linestyle_str, get_arrowstyle_str): Rename + param to have same name as that of enum, so that we don't use + "s" to stand for a non-state. + +2003-02-02 Akim Demaille + + * src/scan-skel.l: Scan more than one inert character per yylex + invocation. + +2003-02-01 Paul Eggert + + Version 1.875a. + + * po/LINGUAS: Add ms. + +2003-01-30 Akim Demaille + + * doc/Makefile.am (CLEANFILES): Add bison.fns for distcheck. + +2003-01-29 Paul Hilfinger + + * tests/cxx-type.at: Correct apparent typo in Bison input: $$ instead + of $1. + + Changes in response to error report by S. Eken: GLR mode does not + handle negative $ indices or $ indices in embedded rules correctly. + See . + + * data/glr.c (b4_rhs_value): Change to use YYFILL macro. + (b4_rhs_location): Ditto. + (yyfill): New function to copy from stack tree into array + incrementally. + (yyuserAction): Modify to allow incremental move of semantic values + to rhs array when in GLR mode. + Define YYFILL to use in user-defined actions to fill semantic array + as needed. + Remove dummy use of yystack, as there is now a guaranteed use. + (yydoAction): Modify to allow incremental move of semantic values + to rhs array when in GLR mode. + (yyresolveAction): Ditto. + (yyglrShiftDefer): Update comment. + (yyresolveStates): Use X == NULL for pointers, not !X. + (yyglrReduce): Ditto. + (yydoAction): Ditto + + * tests/glr-regr1.at: Rename to ... + * tests/glr-regression.at: Add new regression test for the problems + described above (adapted from S. Eken). + Update copyright notice. + * tests/testsuite.at: Rename glr-regr1.at to glr-regression.at. + * tests/Makefile.am: Ditto. + +2003-01-28 Paul Eggert + + * data/lalr1.cc: Do not use @output_header_name@ unless + b4_defines_flag is set. This fixes two bugs reported by + Tim Van Holder in + + and . + +2003-01-21 Paul Eggert + + * data/yacc.c (YYERROR): Move code from yyerrlab1 to here, so that + we don't need to worry about yyerrlab1 being reported as an + "unused label" by non-GCC C compilers. The downside is that if + locations are used then a couple of statements are duplicated each + time YYERROR is invoked, but the upside is that the warnings + should vanish. + (yyerrlab1): Move code to YERROR. + (yyerrlab2): Remove. Change uses back to yyerrlab1. + This reverts some of the 2002-12-27 change. + +2003-01-17 Paul Eggert + + * src/output.c (symbol_printers_output): Fix typo that led + to core dump. Problem reported by Antonio Rus in + . + +2003-01-13 Akim Demaille , + Quoc Peyrot , + Robert Anisko + + * data/lalr1.cc (parse::yyerrlab1): When popping the stack, stop + when the stacks contain one element, as the loop would otherwise + free the last state, and then use the top state (the one we just + popped). This means that the initial elements will not be freed + explicitly, as is the case in yacc.c; it is not a problem, as + these elements have fake values. + +2003-01-11 Paul Eggert + + * NEWS: %expect-violations are now just warnings, reverting + to Bison 1.30 and 1.75 behavior. This fixes the GCC 3.2 + bootstrapping problem reported by Matthias Klose; see + . + * src/conflicts.c (conflicts_print): Likewise. + * tests/conflicts.at (%expect not enough, %expect too much, + %expect with reduce conflicts): Likewise. + * doc/bison.texinfo (Expect Decl): Document this. Also mention + that the warning is enabled if the number of conflicts changes + (not necessarily increases). + + * src/getargs.c (version): Update copyright year. + +2003-01-09 Akim Demaille + + * src/Makefile.am, lib/Makefile.am: Use $(VAR) instead of @VAR@. + +2003-01-08 Paul Eggert + + * Makefile.maint (WGETFLAGS): + New macro, containing "-C off" to disable proxy caches. + All uses of $(WGET) changed to $(WGET) $(WGETFLAGS). + (rel-check): Use $(WGET) instead of wget. + +2003-01-06 Paul Eggert + + * doc/bison.texinfo (Generalized LR Parsing): Add a reference to + the GLR paper of Scott, Johnstone and Hussain. + +2003-01-04 Paul Eggert + + * configure.ac (AC_ARG_ENABLE): Add --disable-yacc. + (YACC_SCRIPT, YACC_LIBRARY): New vars to AC_SUBST. + * lib/Makefile.am (lib_LIBRARIES): liby.a -> @YACC_LIBRARY@. + (EXTRA_LIBRARIES): New var, for liby.a. + * src/Makefile.am (bin_SCRIPTS): yacc -> @YACC_SCRIPT@. + (EXTRA_SCRIPTS): New var, for yacc. + + * data/yacc.c (yyerrlab1): Omit attribute if __cplusplus is defined, + since GNU C++ (as of 3.2.1) does not allow attributes on labels. + Problem reported by Nelson H. F. Beebe. + +2003-01-03 Paul Eggert + + * lib/obstack.h (__INT_TO_PTR) [__STDC__]: Cast result to + (void *) to avoid diagnostic with native c89 on SGI IRIX 6.5 + when compiling Bison 1.875's `bitset bset = obstack_alloc + (bobstack, bytes);'. Problem reported by Nelson H. F. Beebe. + + * src/scan-skel.l (QPUTS): Omit redundant `;' from macro definition. + ([^@\n]): Renamed from [^@\n]+ so that the token buffer does not + grow to a huge size with typical invocation. + + * lib/hash.c (_Bool, bool, false, true, __bool_true_false_are_defined): + Use the pattern recommended by Autoconf 2.57, except also protect + against double-definition. + * src/system.h: Likewise. + Portability issues reported by Nelson H. F. Beebe. + + * data/glr.c (yybool): Renamed from bool, to avoid collisions in C. + All uses changed. Provide a definition in both C and C++. + (yytrue, yyfalse): Define even if defined (__cplusplus). + + * lib/bitset_stats.c (bitset_stats_list): Remove unused var. + Reported by Nelson H. F. Beebe. + + * src/scan-skel.l ("@oline@"): Output lineno+1, not lineno. + +2003-01-02 Paul Eggert + + * data/yacc.c (yyerrlab1): Append `;' after attribute, to + pacify the buggy "smart preprocessor" in MacOS 10.2.3. + Bug reported by Nelson H. F. Beebe. + +2003-01-01 Paul Eggert + + * Version 1.875. + +2002-12-30 Paul Eggert + + * src/scan-gram.l (","): + Moved here from... + (","): Here. This causes stray "," to be treated + more uniformly. + + * src/scan-gram.l ("}"): Output ";" before the + last brace in braced code when not in Yacc mode, for compatibility + with Bison 1.35. This resurrects the 2001-12-15 patch to + src/reader.c. + + * src/reader.h (YYDECL): Use YYSTYPE, not its deprecated alias + yystype. This follows up the 2002-12-24 YYSTYPE bug fix. + +2002-12-28 Paul Eggert + + * src/symtab.c (symbol_make_alias): Set type of SYMVAL to be + that of SYM's type. This fixes Debian bug 168069, reported by + Thomas Olsson. + +2002-12-28 Paul Eggert + + Version 1.75f. + + Switch back to the Yacc style of conflict reports, undoing some + of the 2002-07-30 change. + * doc/bison.texinfo (Understanding): Use Yacc style for + conflict reports. Also, use new way of locating rules. + * src/conflicts.c (conflict_report): + Renamed from conflict_report_yacc, removing the old + 'conflict_report'. Translate the entire conflict report at once, + so that we don't assume that "," has the same interpretation in + all languages. + (conflicts_output): Use Yacc-style conflict report for each state, + instead of our more-complicated style. + (conflicts_print): Use Yacc-style conflict report, except print + the input file name when not emulating Yacc. + * tests/conflicts.at (Unresolved SR Conflicts, Defaulted + Conflicted Reduction, %expect not enough, %expect too much, + %expect with reduce conflicts): Switch to Yacc-style conflict reports. + * tests/existing.at (GNU Cim Grammar): Likewise. + * tests/glr-regr1.at (Badly Collapsed GLR States): Likewise. + + * src/complain.c (warn_at, warn, complain_at, complain, fatal_at, + fatal): Don't invoke fflush; it's not needed and it might even be + harmful for stdout, as stdout might not be open. + * src/reduce.c (reduce_print): Likewise. + +2002-12-27 Paul Eggert + + Fix a bug where error locations were not being recorded correctly. + This problem was originally reported by Paul Hilfinger in + . + + * data/yacc.c (yyparse): New local var yylerrsp, to record the + top of the location stack's error locations. + (yyerrlab): Set it. When discarding a token, push its location + onto yylerrsp so that we don't lose track of the error's end. + (yyerrlab1): Now is only the target of YYERROR, so that we can + properly record the location of the action that failed. For GCC + 2.93 and later, insert an __attribute__ ((__unused__)) to avoid + GCC warning about yyerrlab1 being unused if YYERROR is unused. + (yyerrlab2): New label, which yyerrlab now falls through to. + Compute the error's location by applying YYLLOC_DEFAULT to + the locations of all the symbols that went into the error. + * doc/bison.texinfo (Location Default Action): Mention that + YYLLOC_DEFAULT is also invoked for syntax errors. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): + Error locations include the locations of all the tokens that were + discarded, not just the last token. + +2002-12-26 Paul Eggert + + * src/files.c: Include quote.h. + (compute_output_file_names): Warn if we detect conflicting + outputs to the same file. This should catch the misunderstanding + exemplified by Debian Bug 165349, reported by Bruce Stephens.. + + * src/conflicts.c (conflicts_print): If the user specifies + "%expect N", report an error if there are any reduce/reduce + conflicts. This is what the manual says should happen. + This fixes Debian bug 130890, reported by Anthony DeRobertis. + * tests/conflicts.at (%expect with reduce conflicts): New test. + + Don't use m4_include on relative file names, as it doesn't work as + desired if there happens to be a file with that name under ".". + + * m4sugar/version.m4: Remove; it was included but it wasn't used. + * data/Makefile.am (dist_m4sugar_DATA): Remove m4sugar/version.m4. + * data/m4sugar/m4sugar.m4: Don't include m4sugar/version.m4. + * data/glr.c, data/lalr1.cc, data/yacc.c: Don't include c.m4. + * src/output.c (output_skeleton): Use full path names when + specifying a file to include; don't rely on include path, as + it's unreliable when the working file contains a file with + that name. + +2002-12-25 Paul Eggert + + Remove obsolete references to bison.simple and bison.hairy. + Problem mentioned by Aubin Mahe in + . + * data/glr.c: Comment fix. + * doc/bison.1: Remove references. Also, mention "yacc". + + * src/getargs.c (getargs) [MSDOS]: Don't assume optarg != NULL + with -g option. + + * src/parse-gram.y (declaration): Use enum "report_states" rather + than its numeric value 1. + + * src/scan-skel.l ("@output ".*\n): Close any old yyout before + opening a new one. This fixes Debian bug 165349, reported by + Bruce Stephens. + +2002-12-24 Paul Eggert + + Version 1.75e. + + * Makefile.maint (cvs-update): Don't assume that the shell + supports $(...), as Solaris sh doesn't. + + * src/parse-gram.y (lloc_default): Remove test for empty + nonterminals at the end, since it didn't change the result. + +2002-12-24 Paul Eggert + + If the user does not define YYSTYPE as a macro, Bison now declares it + using typedef instead of defining it as a macro. POSIX requires this. + For consistency, YYLTYPE is also declared instead of defined. + + %union directives can now have a tag before the `{', e.g., the + directive `%union foo {...}' now generates the C code + `typedef union foo { ... } YYSTYPE;'; this is for Yacc compatibility. + The default union tag is `YYSTYPE', for compatibility with Solaris 9 + Yacc. For consistency, YYLTYPE's struct tag is now `YYLTYPE' + instead of `yyltype'. + + `yystype' and `yyltype' are now obsolescent macros instead of being + typedefs or tags; they are no longer documented and will be + withdrawn in a future release. + + * data/glr.c (b4_location_type): Remove. + (YYSTYPE): Renamed from yystype. + (YYSTYPE_IS_DECLARED): New macro, used to prevent double-typedef. + (struct YYLTYPE): Renamed from struct yyltype. + (YYLTYPE): Renamed from yyltype. + (yyltype, yystype): New (and obsolescent) macros, + for backward compatibility. + * data/yacc.c: Likewise. + + * data/yacc.c (YYSTYPE): Declare as union YYSTYPE if the user + does not specify a union tag. This is for compatibility with + Solaris 9 yacc. + + * src/parse-gram.y (add_param): 2nd arg is now char * not char + const *, since it is now modified by stripping surrounding { }. + (current_braced_code): Remove. + (PERCENT_DESTRUCTOR, PERCENT_PRINTER, PERCENT_UNION, + PERCENT_LEX_PARAM, PERCENT_PARSE_PARAM): Change names to include + trailing " {...}". Now of type . + (grammar_declaration): Adjust to bundled tokens. + (code_content): Remove; stripping is now done by add_param. + (print_token_value): Print contents of bundled tokens. + (token_name): New function. + + * src/reader.h (braced_code, current_braced_code): Remove. + (token_name): New decl. + + * src/scan-gram.l (handle_dollar, handle_at): Now takes int + token_type, not braced_code code_kind. All uses changed. + (SC_PRE_CODE): New state, for scanning after a keyword that + has (or usually has) an immediately-following braced code. + (token_type): New local var, to keep track of which token type + to return when scanning braced code. + ("%destructor", "%lex-param", + "%parse-param", "%printer", + "%union"): Set token type and BEGIN SC_PRE_CODE + instead of returning a token type immediately. + ("{"): Set token type. + ("}"): Use it. + (handle_action_dollar, handle_action_at): Now returns bool + indicating success. Fail if ! current_rule; this prevents a core dump. + (handle_symbol_code_dollar, handle_symbol_code_at): + Remove; merge body into caller. + (handle_dollar, handle_at): Complain in invalid contexts. + + * NEWS, doc/bison.texinfo: Document the above. + * NEWS: Fix years and program names in copyright notice. + +2002-12-17 Paul Eggert + + * NEWS, doc/bison.texinfo (Parser Function, Pure Calling, Error + Reporting, Table of Symbols): Omit mentions of %lex-param and + %parse-param from the documentation for now. + +2002-12-15 Paul Eggert + + Undo most of the 2002-11-12 yychar -> yytoken patch, as it broke + GCC 3.2.1 (which depends on yychar == YYEMPTY when there is no + lookahead symbol, and which sets yychar in parser actions) and it + disagreed with the Bison documentation. Bug + reported by Andrew Walrond. + + * data/yacc.c (YYTRANSLATE): Don't check for negative argument, + as the caller now does that. + (yyclearin, YYBACKUP, yyparse): Use yychar, not yytoken. + (YYEMPTY): Parenthesize right hand side, since others use it. + (yyparse): Don't assume that our generated code is the only code + that sets yychar. + +2002-12-13 Paul Eggert + + Version 1.75d. + + POSIX requires a "yacc" command. + * src/Makefile.am (bin_SCRIPTS): New macro, for yacc. + (MOSTLYCLEANFILES): Add yacc. + (yacc): New rule. + * doc/bison.texinfo (Invocation, Bison Options): Mention yacc + as an alias for bison y. + + * po/LINGUAS: Add da. + + * src/getargs.c (__GNU_LIBRARY__) [lint]: Define to work around + problem with latest . + (HACK_FOR___GNU_LIBRARY___PROTOTYPE): New macro. + + * doc/fdl.texi: Upgrade to 1.2. + * lib/alloca.c, lib/error.c, lib/getopt.c, lib/getopt.h + lib/getopt1.c, lib/gettext.h, lib/memrchr.c, lib/obstack.c, + lib/obstack.h, lib/strnlen.c, lib/unlocked-io.h: Sync with + gnulib. + * config/install-sh: Sync with autotools. + + Fix a bad interaction with flex 2.5.23 reported by Bruce Lilly in + . + * data/yacc.c (YYLTYPE, struct yyltype): Do not define unless + locations are requested. + (union yyalloc): Do not depend on YYLTYPE_IS_TRIVIAL unless + locations are requested. + +2002-12-12 Paul Eggert + + Remove unportable casts and storage allocation tricks. + While we're at it, remove almost all casts, since they + usually aren't needed and are a sign of trouble. + + * configure.ac (AC_CHECK_TYPES): Check for uintptr_t. + + * src/derives.c (derives_compute): Do not subtract NTOKENS from + the pointer DSET returned by malloc; this isn't portable. + Instead, always use DSET[i - NTOKENS] rather than DSET[i]. + Similarly for DERIVES. + * src/lalr.c (set_goto_map): Likewise, for GOTO_MAP and TEMP_MAP. + * src/nullable.c (nullable_compute): Likewise, for RSETS and NULLABLE. + * src/reduce.c (reduce_grammar_tables): Likewise, for nontermmap + + * src/derives.c (derives_compute): Do not bother invoking + int_of_rule_number, since rule numbers are integers. + + * src/files.c (concat2, tr, compute_base_name): Use xmalloc (N) + rather than XMALLOC (char, N). + + * src/files.c (filename_split): Rewrite to avoid cast. + + * src/gram.h (symbol_number_as_item_number, + item_number_as_symbol_number, rule_number_as_item_number, + item_number_as_rule_number): + Now inline functions rather than macros, to avoid casts. + * src/state.h (state_number_as_int): Likewise. + * src/tables.c (state_number_to_vector_number, + symbol_number_to_vector_number): Likewise. + + * src/gram.h (int_of_rule_number): Remove; no longer used. + + * src/lalr.c (add_lookback_edge): Use malloc rather than calloc, + since the resulting storage is always stored into. + + * src/main.c (alloca) [C_ALLOCA]: Add decl here, the only place + where it's needed. + + * src/muscle_tab.c (muscle_m4_output): + Now inline. Return bool, not int. + * src/state.c (state_compare): Likewise. + * src/symtab.c (symbol_check_defined, + symbol_check_alias_consistency, symbol_pack, symbol_translation, + hash_compare_symbol, hash_symbol): + Likewise. + * src/uniqstr.c (uniqstr_print): Likewise. + * src/muscle_tab.c (muscle_m4_output_processor): + New function, to avoid casts. + * src/state.c (state_comparator, stage_hasher): Likewise. + * src/symtab.c (symbol_check_defined_processor, + symbol_check_alias_consistency_processor, symbol_pack_processor, + symbol_translation_processor, hash_symbol_comparator, + hash_symbol_hasher): Likewise. + * src/uniqstr.c (uniqstr_print_processor): Likewise. + * src/muscle_tab.c (muscles_m4_output): + Use new functions instead of casting old functions unportably. + * src/state.c (state_hash_new): Likewise. + * src/symtab.c (symbols_new, symbols_do, symbols_check_defined, + symbols_token_translations_init): + Likewise. + * src/uniqstr.c (uniqstrs_new, hash_initialize, uniqstrs_do): Likewise. + + * src/output.c (GENERATE_MUSCLE_INSERT_TABLE): Use long local + var instead of casting to long, to avoid casts. + (prepare_states): Use MALLOC rather than alloca, so that we don't + have to worry about alloca. + * src/state.c (state_hash_lookup): Likewise. + + * src/scan-gram.l ("'"): Use unsigned char + local var instead of casting to unsigned char, to avoid casts. + + * src/state.c (TRANSITIONS_ALLOC, ERRS_ALLOC, REDUCTIONS_ALLOC, + STATE_ALLOC): Remove. + (transitions_new, errs_new, reductions_new, state_new): Use malloc + rather than calloc, and use offsetof to avoid allocating slightly + too much storage. + (state_new): Initialize all members. + + * src/state.c (state_hash): Use unsigned accumulator, not signed. + + * src/symtab.c (symbol_free): Remove; unused. + (symbol_get): Remove cast in lhs of assignment. + (symbols_do): Now static. Accept generic arguments, not + hashing-related ones. + + * src/symtab.h: (NUMBER_UNDEFINED): Remove unnecessary cast. + (symbol_processor): Remove. + (symbols_do): Remove decl; now static. + + * src/system.h (alloca): Remove; decl no longer needed. + (): Include, for offsetof. + (, ): Include if available. + (uintptr_t): New type, if system lacks it. + (CALLOC, MALLOC, REALLOC): New macros. + All uses of XCALLOC, XMALLOC, and XREALLOC changed to use these + new macros. + + * src/tables.c (table_size): Now int, to pacify GCC. + (table_grow, table_ninf_remap): Use signed table size. + (save_row): Don't bother initializing locals when not needed. + (default_goto, goto_actions, pack_vector): Remove unnecessary casts. + * src/uniqstr.c (hash_compare_uniqstr): Likewise. + + * src/vcg.h: Correct misspellings. + + * src/vcg_defaults.h (G_CMAX): Now INT_MAX. + + + * src/getargs.c (getargs): Don't assume EOF == -1. + +2002-12-09 Paul Eggert + + Change identifier spellings to avoid collisions with names + that are reserved by POSIX. + + Don't use names ending in _t, since POSIX reserves them. + For consistency, remove _e and _s endings -- they're weren't + needed to remove ambiguity. All uses changed. + * src/uniqstr.h (uniqstr): Renamed from uniqstr_t, which in + turn was just renamed from struniq_t. + * src/uniqstr.c (uniqstr_processor): Renamed from struniq_processor, + which in turn was just renamed from struniq_processor_t. + (hash_compare_uniqstr): Renamed from hash_compare_struniq, which + in turn was renamed from hash_compare_struniq_t. + * src/LR0.c (struct state_list): Renamed from struct state_list_s. + (state_list): Renamed from state_list_t. + * src/assoc.h (assoc): Renamed from assoc_t. + * src/conflicts.c (enum conflict_resolution): Renamed from + enum conflict_resolution_e. + * src/derives.c (struct rule_list): Renamed from struct rule_list_s. + (rule_list): Renamed from rule_list_t. + * src/getargs.h (enum trace): Renamed from enum trace_e. + (enum report): Renamed from enum report_e. + * src/gram.h (item_number): Renamed from item_number_t. + (rule_number): Renamed from rule_number_t. + (struct rule_s): Remove the "rule_s" part; not used. + (rule): Renamed from rule_t. + (rule_filter): Renamed from rule_filter_t. + * src/lalr.c (struct goto_list): Renamed from struct goto_list_s. + (goto_list): Renamed from goto_list_t. + * src/lalr.h (goto_number): Renamed from goto_number_t. + * src/location.h (location): Renamed from location_t. + * src/muscle_tab.c (muscle_entry): Renamed from muscle_entry_t, + and moved here from: + * src/muscle_tab.h (muscle_entry_t): here. + * src/nullable.c (struct rule_list): Renamed from struct rule_list_s. + (rule_list): Renamed from rule_list_t. + * src/print_graph.c (static_graph): Renamed from graph. + * src/reader.h (braced_code): Renamed from braced_code_t. + Remove brace_code_e tag. + * src/relation.h (relation_node): Renamed from relation_node_t. + (relation_nodes): Renamed from relation_nodes_t. + (relation): Renamed from relation_t. + * src/state.h (state_number): Renamed from state_number_t. + (struct state): Renamed from struct state_s. + (state): Renamed from state_t. + (transitions): Renamed from transitions_t. Unused (and + misspelled) transtion_s tag removed. + (errs): Renamed from errs_t. Unused errs_s tag removed. + (reductions): Renamed from reductions_t. Unused tag + reductions_s removed. + * src/symlist.h (symbol_list): Renamed from symbol_list_t. + (struct symbol_list): Renamed from struct symbol_list_s. + * src/symtab.h (symbol_number): Renamed from symbol_number_t. + (struct symbol): Renamed from struct symbol_s. + (symbol): Renamed from symbol_t. + * src/tables.c (vector_number): Renamed from vector_number_t. + (action_number): Renamed from action_t. + * src/tables.h (base_number): Renamed from base_t. + * src/vcg.h (enum color): Renamed from enum color_e. + (enum textmode): Renamed from enum textmode_e. + (enum shape): Renamed from enum shape_e. + (struct colorentry): Renamed from struct colorentry_s. + (struct classname): Renamed from struct classname_s. + (struct infoname): Renamed from struct infoname_s. + (enum layoutalgorithm): Renamed from enum layoutalgorithm_e. + (enum decision): Renamed from enum decision_e. + (enum orientation): Renamed from enum orientation_e. + (enum alignment): Renamed from enum alignment_e. + (enum arrow_mode): Renamed from enum arrow_mode_e. + (enum crossing_type): Renamed from enum crossing_type_e. + (enum view): Renamed from enum view_e. + (struct node): Renamed from struct node_s. + (node): Renamed from node_t. + (enum linestyle): Renamed from enum linestyle_e. + (enum arrowstyle): Renamed from enum arrowstyle_e. + (struct edge): Renamed from struct edge. + (edge): Renamed from edge_t. + (struct graph): Renamed from struct graph_s. + (graph): Renamed from graph_t. + * tests/calc.at (_AT_DATA_CALC_Y, Simple LALR Calculator): + Rename value_t -> value. + * tests/input.at (Torturing the Scanner): Rename value_t -> value, + value_t_as_yystype -> value_as_yystype. + + Don't include in the mainstream code, since it + reserves E[A-Z0-9]* and we want to use symbols like 'EQUALS'. + * lib/get-errno.c, lib/get-errno.h: New files. + * lib/Makefile.am (libbison_a_SOURCES): Add get-errno.h, + get-errno.c. + * src/files.c (xfopen, xfclose): Use get_errno instead of errno. + * src/output.c (output_skeleton): Likewise. + * src/scan-gram.l ({int}): Use set_errno and get_errno + instead of errno. + (\\x[0-9abcdefABCDEF]+): + Likewise. + (handle_action_dollar, handle_action_at): Likewise. + * src/system.h: Do not include . + (TAB_EXT): Renamed from EXT_TAB. + (OUTPUT_EXT): Renamed from EXT_OUTPUT. + + Avoid str[a-z]*, since reserves that name space. + Change all instances of "struniq" in names to "uniqstr", and + likewise for "STRUNIQ" and "UNIQSTR". + * src/uniqstr.c: Renamed from src/struniq.c. + * src/uniqstr.h: Renamed from src/struniq.h. + * src/Makefile.am (bison_SOURCES): Adjust to these renamings. + * src/files.c (strsuffix): Remove; unused. + (concat2): Renamed from stringappend. Now static. + * src/files.h (strsuffix, stringappend): Remove; unused. + * src/parse-gram.y (): Renamed from . + (): Renamed from . + * src/scan-gram.l (obstack_for_string): Renamed from string_obstack. + * src/vcg.h (struct node_s.expand): Renamed from struct node_s.stretch. + (struct graph_s.expand): Renamed from struct graph_s.stretch. + * src/vcg_defaults.h (G_EXPAND): Renamed from G_STRETCH. + (G_LONG_STRAIGHT_PHASE): Renamed from G_STRAIGHT_PHASE. + (N_EXPAND): Renamed from N_STRETCH. + + Avoid *_MAX and *_MIN, since reserves that name space. + * data/yacc.c (YYSTACK_GAP_MAXIMUM): Renamed from YYSTACK_GAP_MAX. + * src/gram.h (ITEM_NUMBER_MAX, ITEM_NUMBER_MIN, RULE_NUMBER_MAX): + Remove; unused. + * src/lalr.h (GOTO_NUMBER_MAXIMUM): Renamed from GOTO_NUMBER_MAX. + * src/state.h (STATE_NUMBER_MAXIMUM): Renamed from STATE_NUMBER_MAX. + * src/symtab.h (SYMBOL_NUMBER_MAXIMUM): Renamed from SYMBOL_NUMBER_MAX. + * src/tables.c (VECTOR_NUMBER_MAX, VECTOR_NUMBER_MIN): Remove; unused. + (BASE_MAXIMUM): Renamed from BASE_MAX. + (BASE_MINIMUM): Renamed from BASE_MIN. + (ACTION_MAX): Remove; unused. + (ACTION_NUMBER_MINIMUM): Renamed from ACTION_MIN. + Unnecessary casts removed from above defines. + + + Fix misspelling in names. + * src/vcg.h (enum_alignment_e): Renamed from enum_alignement_e. + * src/vcg_defaults.h (G_NODE_ALIGNMENT): Renamed from + G_NODE_ALIGNEMENT. + + + * lib/timevar.c (timevar_report): Renamed from time_report, + for consistency with other names. + * lib/timevar.h (timevar_report): New decl. + * src/system.h (time_report): Remove; decl is now in lib/timevar.h. + + + Sort include-file uses. + + Reorder all include files under src to be in the order "system.h". + then the ../lib include files in angle brackets (alphabetized), + then the . include files in double-quotes (alphabetized). Fix + dependency breakages encountered in this process, as follows: + * src/closure.h, src/derives.h, src/state.h: Include "gram.h". + * src/complain.c: Don't include stdlib.h, string.h _LIBC stuff. + * src/state.h: Include "symtab.h". + +2002-12-08 Paul Eggert + + * data/glr.c, data/lalr1.cc, data/yacc.c: Do not use __file__, + since this causes problems when __file__ contains character + sequences like "@" that are treated specially by src/scan-skel.l. + Instead, just use the file's basename. This fixes the bug + reported by Martin Mokrejs in + . + +2002-12-06 Paul Eggert + + Add support for rules that do not have trailing semicolons, as + POSIX requires. Improve the quality of locations in Bison + diagnostics. + + * src/location.c: Include . + (empty_location): Now const. + (location_print): New function. Follow the recommendation of the + GNU Coding Standards for locations that span file boundaries. + * src/location.h: Do not include ; no longer needed. + (boundary): New type. + (location_t): Use it. This allows locations to span file boundaries. + All member uses changed: file -> start.file or end.file (as needed), + first_line -> start.line, first_column -> start.column, + last_line -> end.line, last_column -> end.column. + (equal_boundaries): New function. + (LOCATION_RESET, LOCATION_STEP): Remove. + (LOCATION_PRINT): Remove. All callers changed to use location_print. + (empty_location): Now const. + (location_print): New decl. + * src/parse-gram.y (lloc_default): New function, which handles + empty locations more accurately. + (YYLLOC_DEFAULT): Use it. + (%token COLON): Remove. + (%token ID_COLON): New token. + (rules): Use it. + (declarations, rules): Remove trailing semicolon. + (declaration, rules_or_grammar_declaration): + Allow empty (";") declaration. + (symbol_def): Remove empty actions; no longer needed. + (rules_or_grammar_declaration): Remove trailing semicolon. + (semi_colon.opt): Remove. + * src/reader.h: Include location.h. + (scanner_cursor): New decl. + * src/reduce.c (nonterminals_reduce): Use warn_at rather than + rolling our own. + * src/scan-gram.l (YY_USER_INIT): Initialize scanner_cursor instead + of *loc. + (STEP): Remove. No longer needed, now that adjust_location does + the work. All uses removed. + (scanner_cursor): New var. + (adjust_location): Renamed from extend_location. It now sets + *loc and adjusts the scanner cursor. All uses changed. + Don't bother testing for CR. + (handle_syncline): Remove location arg; now updates scanner cursor. + All callers changed. + (unexpected_end_of_file): Now accepts start boundary of token or + comment, not location. All callers changed. Update scanner cursor, + not the location. + (SC_AFTER_IDENTIFIER): New state. + (context_state): Renamed from c_context. All uses changed. + (id_loc, code_start, token_start): New local vars. + (): New initial context. Move all + processing of Yacc white space and equivalents here. + ({id}): Save id_loc. Begin state SC_AFTER_IDENTIFIER + instead of returning ID immediately, since we need to search for + a subsequent colon. + ("'", "\""): Save token_start. + ("%{", "{", "%%"): Save code_start. + (): New state, looking for a colon. + (, , ): + BEGIN context_state at end, not INITIAL. + ("\"", "'", + "}", "%}", <>): + Return correct token start. + (): Save start boundary when + the start of a character, string or multiline comment is found. + * tests/conflicts.at (S/R in initial, Defaulted Conflicted + Reduction): Adjust reported locations to match the more-precise + results now expected. + * tests/input.at (Invalid $n, Invalid @n, Type Clashes): Likewise. + * tests/reduce.at (Useless Rules, Reduced Automaton, + Underivable Rules): Likewise. + * tests/regression.at (Invalid inputs): No longer `expecting ";" + or "|"' now that so many other tokens are allowed by the new grammar. + + * src/complain.h (current_file): Remove duplicate decl; + current_file is now owned by files.h. + * src/complain.c, src/scan-gram.l: Include files.h. + +2002-12-06 Paul Eggert + + * data/glr.c (yy_reduce_print): Don't assume that yyrline[yyrule] + promotes to int; it might be unsigned int. + * data/yacc.c (yy_reduce_print): Likewise. + + * doc/bison.texinfo (Table of Symbols): YYERROR_VERBOSE should + be #defined in the prologue, not in the Bison declarations. + This fixes Debian Bug 102878, reported by Shaul Karl. + +2002-12-02 Paul Eggert + + * configure.ac (AC_REPLACE_FUNCS): Add strtoul. + * lib/strtoul.c: New file, from gnulib. + This fixes a porting bug reported by Peter Klein in + . + +2002-11-30 Paul Eggert + + * src/scan-gram.l (no_cr_read, extend_location): Move to epilogue, + and put only a forward declaration in the prologue. This is for + consistency with the other scanner helper functions. + + Type clashes now generate warnings, not errors, since it + appears that POSIX may allow some grammars with type clashes. + * src/reader.c (grammar_current_rule_check): Warn about + type clashes instead of complaining. + * tests/input.at (Type Clashes): Expect warnings, not complaints. + + Add Yacc library, since POSIX requires it. + * doc/bison.texinfo (Yacc Library): New node. Regenerate top menu. + * lib/Makefile.am (lib_LIBRARIES, liby_a_SOURCES): New macros. + * lib/main.c, lib/yyerror.c: New files. + + gram_error can be static; it need not be extern. + * src/reader.h (gram_error): Remove decl. + * src/parse-gram.y (gram_error): Now static. Add static decl. + (print_token_value): Omit parameter names from forward decl, + for consistency. + +2002-11-29 Paul Eggert + + * doc/bison.texinfo: Emphasize that yylex and yyerror must + be declared before being used. E.g., one should typically + declare them in the prologue. Use GNU coding style in examples. + Put "const" consistently after the type it modifies. Mention + that C99 supports "inline". Mention that yyerror traditionally + returns "int". + + %parse-param and %lex-param now take just one argument, the + declaration; the argument name is deduced from the declaration. + + * doc/bison.texinfo (Parser Function, Pure Calling, Error + Reporting, Table of Symbols): Document this. + * src/parse-gram.y (add_param): New function. + (COMMA): Remove. + (declaration): Implement new rule for %parse-param and %lex-param. + * src/scan-gram.l: "," now elicits a warning, rather than being + a token; this is more compatible with byacc. + * tests/calc.at (Simple LALR Calculator): Adopt new convention. + +2002-11-27 Paul Eggert + + Rename identifiers to avoid real and potential collisions. + + * data/c.m4 (b4_yysymprint_generate): yyout -> yyoutput, + to avoid collision with lex macro described by Bruce Lilly in + . + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Likewise. + * doc/bison.texinfo (Prologue, Tracing): yyprint -> print_token_value. + * src/parse-gram.y (print_token_value): Renamed from yyprint. + All uses changed. + (YYPARSE_PARAM, YYLEX_PARAM, yycontrol): Remove. All uses changed. + The name "yycontrol" violates the name space rules, and this stuff + wasn't being used anyway. + (input): Remove action; this stuff wasn't being used. + (gram_error): Rename local variable yylloc -> loc. + * src/reader.h (struct gram_control_s, gram_control_t): Remove. + (YY_DECL): Don't use "yy" at start of local variables. + All uses changed, e.g., yylloc -> loc. + * src/scan-gram.l (STEP): Renamed from YY_STEP. All uses changed. + (STRING_GROW): Renamed from YY_OBS_GROW. All uses changed. + (STRING_FINISH): Renamed from YY_OBS_FINISH. All uses changed. + (STRING_FREE): Renamed from YY_OBS_FREE. All uses changed. + + * src/parse-gram.y (gram_error): loc is now const *. + * src/reader.h (gram_error): Likewise. + +2002-11-24 Paul Eggert + + Version 1.75c. + + * tests/actions.at (Actions after errors): Use an output format + more similar to that of the Printers and Destructors test. + Test the position of the ';' token too. + (Printers and Destructors): Likewise. + (Printers and Destructors: %glr-parser): Remove for now, to avoid + unnecessarily alarming people when the test fails. + + * data/yacc.c (yyerrlab1): Move this label down, so that the + parser does not discard the lookahead token if the user code + invokes YYERROR. This change is required for POSIX conformance. + + * lib/error.c: Sync with gnulib. + +2002-11-22 Paul Eggert + + * lib/quotearg.c, lib/quotearg.h: Sync with gnulib. + * lib/mbswidth.c, lib/mbswidth.h: Likewise. + * lib/xmalloc.c: Likewise. + +2002-11-20 Paul Eggert + + * lib/argmatch.c, lib/argmatch.h: Sync with gnulib. + +2002-11-20 Paul Eggert + + Avoid use of , as the GNU Coding Standards hint that one + should use `if (! x) abort ();' rather than `assert (x);', and + anyway it's one less thing to worry about configuring. + + * data/glr.c, lib/hash.c, src/system.h: Do not include . + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Likewise, + and replace all instances of assert with abort. + * tests/calc.at (_AT_DATA_CALC_Y): Likewise. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Likewise. + + * data/glr.c (yydoAction, yyglrReduce, yysplitStack, yyresolveStates, + yyresolveAction, yyprocessOneStack): Use abort rather than assert. + * lib/hash.c (hash_lookup, hash_get_first, hash_get_next, + hash_find_entry, hash_rehash, hash_insert): Likewise. + * src/conflicts.c (resolve_sr_conflict): Likewise. + * src/lalr.c (set_goto_map, map_goto): Likewise. + * src/nullable.c (nullable_compute): Likewise. + * src/output.c (prepare_rules, token_definitions_output): Likewise. + * src/reader.c (packgram, reader): Likewise. + * src/state.c (state_new, state_free, state_transitions_set, + state_reduction_find): Likewise. + * src/symtab.c (symbol_user_token_number_set, symbol_make_alias, + symbol_pack): Likewise. + * src/tables.c (conflict_row, pack_vector): Likewise. + * src/vcg.c (get_color_str, get_textmode_str, get_shape_str, + get_layoutalgorithm_str, get_decision_str, get_orientation_str, + get_node_alignement_str, get_arrow_mode_str, get_crossing_type_str, + get_view_str, get_linestyle_str, get_arrowstyle_str): Likewise. + + * lib/argmatch.h (ARRAY_CARDINALITY): Do not bother to #undef. + (ARGMATCH_CONSTRAINT): New macro. + (ARGMATCH_ASSERT): Use it. + + * src/system.h (verify): New macro. + * src/getargs.c (trace_argmatch, report_argmatch): Use verify + rather than assert. + * src/tables.c (tables_generate): Likewise. + + * src/struniq.c (struniq_assert): Now returns void, and aborts + if the assertion is false. + (struniq_assert_p): Remove. + * src/struniq.h: Likewise. + +2002-11-18 Paul Eggert + + * data/glr.c (yygetLRActions): Replace `yyindex' with + `yytable[yyindex]' to fix typo introduced in my 2002-11-09 patch. + This fixes the regression with Sun ONE Studio 7 cc that I reported in + . + +2002-11-18 Akim Demaille + + * doc/bison.texinfo (Tracing): `yyprint' shouldn't prepend a + space. + From Tim Van Holder. + +2002-11-17 Paul Eggert + + Pacify Sun ONE Studio 7 lint. Also, rename "ParseError" + to "SyntaxError" for consistency with my 2002-11-15 change. + + * data/glr.c (YYDPRINTF, YYDSYMPRINT, YYDSYMPRINTF) [!YYDEBUG]: Do + not define to {}, since this breaks the common use of `YYDPRINTF + ((...));' if a single statement is desired (e.g. before `else'). + Work around GCC warnings by surrounding corresponding calls with + {} if needed. + (yyhasResolvedValue): Remove unused function. + (yymergeOptionSets, yyresolvStack): Use `continue;' for empty + loop body. + (yyreportSyntaxError): Renamed from yyreportParseError. + (yyrecoverSyntaxError): Renamed from yyrecoverParseError. + All uses changed. + * tests/calc.at (_AT_DATA_CALC_Y): Make vars static instead of + extern when possible. Remove unused initializations. + +2002-11-16 Akim Demaille + + Augment the similarity between GLR and LALR traces. + + * data/yacc.c (yy_stack_print, YY_STACK_PRINT, yy_reduce_print) + (YY_REDUCE_PRINT): New. + (yyparse): Use them. + * data/glr.c (yy_reduce_print): Use YYFPRINTF, no need for + YYDPRINT here. + (yyglrReduce, yyrecoverParseError, yyparse): Don't report the + state reached after the reduction/recovery, since... + (yyparse, yyprocessOneStack): Report the state we are entering in. + +2002-11-16 Akim Demaille + + * src/getargs.h, src/getargs.c (trace_e, trace_args, trace_types): + Add support for --trace=skeleton. + * src/scan-skel.l: %option debug. + Scan strings of non-@ or \n instead of character by character. + (scan_skel): Handle trace_skeleton. + (QPUTS): New. + (@output_parser_name@, @output_header_name@): ``Restore'' their + support (used to be M4 macros). + * data/yacc.c: Quote larger chunks, a la glr.c. + * data/lalr1.cc: Likewise. + The header guards are no longer available, so use some other + string than `YYLSP_NEEDED'. + +2002-11-16 Akim Demaille + + Make the ``Printers and Destructors'' test more verbose, taking + `yacc.c''s behavior as (possibly wrong) reference. + + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Use printf + instead of fprint on stdout. + Set and report the last_line of the symbols. + Consistently display values and locations. + +2002-11-16 Paul Eggert + + * data/yacc.c: Avoid over-quoting of __line__ and __file__. + +2002-11-15 Paul Eggert + + * tests/actions.at (Actions after errors): New test case. + + * data/glr.c, data/lalr1.cc, data/yacc.cc, doc/bison.texinfo, + src/conflicts.c, src/parse-gram.y, src/tables.c, src/tables.h, + tests/action.at, tests/calc.at, tests/conflicts.at, + tests/cxx-type.at, tests/regression.at: + "parse error" -> "syntax error" for POSIX compatibility. + "parsing stack overflow..." -> "parser stack overflow" so + that code matches Bison documentation. + +2002-11-15 Akim Demaille + + * src/parse-gram.y (declaration): Have %parse-param and %lex-param + take two BRACED_CODE, not two string_content. + Free the scanner's obstack when we are done. + (code_content): New. + * tests/calc.at: Adjust. + * doc/bison.texinfo: Adjust. + Also, make sure to include the `,' for these declarations. + +2002-11-15 Tim Van Holder + + * m4/prereq.m4: Removed the commented jm_PREREQ_HASH + definition; avoids potential autoreconf problems. + +2002-11-15 Akim Demaille + + Always check the value returned by yyparse. + + * tests/calc.at (_AT_DATA_CALC_Y): Have `main' exit with the value + returned by yyparse. + (_AT_CHECK_CALC_ERROR): Take the expected exit value as argument. + Adjust calls. + * tests/glr-regr1.at (glr-regr1.y): Have `main' exit with the value + returned by yyparse. + +2002-11-14 Paul Hilfinger + + * data/glr.c (yyFail): Always set yyerrflag. Corrects regression + on input.at test. + +2002-11-14 Paul Eggert + + * src/output.c (output_skeleton): Call xfopen instead of + duplicating xfopen's body. + + Fix bugs reported by Nelson H. F. Beebe in + . + + * tests/headers.at (AT_TEST_CPP_GUARD_H): Don't assume that + "$CC -E foo.h" is allowed, as this doesn't work with the Portland + Group compiler. Instead, use "$CC -E bar.c". Include the .h + file twice in the grammar, as an extra check. + + * tests/input.at (Torturing the Scanner): Surround the + backslash-newline tests with "#if 0", to make it less likely that + we'll run into compiler bugs. Bring back solitary \ inside + comment, but add a closing comment to work around HP C bug. Don't + test backslash-newline in C character constant. + +2002-11-14 Akim Demaille + + * tests/synclines.at (AT_SYNCLINES_COMPILE): Ignore the exit + status of the compiler. + Calling `exit 1' is no longer needed. + Reported by Nelson H. F. Beebe. + +2002-11-14 Akim Demaille + + * tests/atlocal.in (CPPFLAGS): We have config.h. + * tests/testsuite.at (AT_DATA_GRAMMAR_PROLOGUE, AT_DATA_GRAMMAR): + New. + * tests/actions.at, tests/calc.at, tests/conflicts.at, + * tests/cxx-type.at, tests/glr-regr1.at, tests/headers.at, + * tests/regression.at, tests/torture.at: Use them for all the + grammars that are to be compiled. + * tests/cxx-type.at (_AT_TEST_GLR_CALC): Rename as... + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): this. + * doc/bison.texinfo (GLR Parsers): Document `inline'. + +2002-11-14 Akim Demaille + + * doc/bison.texinfo: Various formatting changes (alignments in + samples, additional @group/@end group, GCS in samples. + Use @deffn instead of simple @table to define the directives, + macros, variables etc. + +2002-11-13 Paul Eggert + + Fix some bugs reported by Albert Chin-A-Young in + . + + * tests/input.at (Torturing the Scanner): Don't invoke "cc a.c b.c + -o c"; the HP C compiler chatters during compilation. + Instead, invoke "cc -c a.c -o a.o; cc -c b.c -o b.o; cc a.o b.o -o c". + * tests/headers.at (export YYLTYPE): Likewise. + + * tests/input.at (Torturing the Scanner): Remove lines containing + solitary backslashes, as they tickle a bug in the HP C compiler. + + * tests/glr-regr1.at (Badly Collapsed GLR States): Avoid // + comments, since they're not portable. Use GNU coding style. + +2002-11-13 Akim Demaille + + * data/yacc.c: Leave bigger chunks of quoted text. + (YYDSYMPRINTF): New. + Use it to report symbol activities. + * data/glr.c (YYDSYMPRINTF): New. + Use it. + +2002-11-12 Paul Eggert + + Version 1.75b. + + * data/glr.c (yydoAction): Return YYRESULTTAG, not int. + (yyglrReduce): Return yyok, not 0. + This should avoid the enumerated-type warnings reported + by Nelson H. F. Beebe in + . + + * lib/bbitset.h (BITSET_INLINE): Remove. + * lib/bitset.h [! BITSET_INLINE]: Remove. + (bitset_set, bitset_reset, bitset_test): Rename local vars + to avoid shadowing warnings by GCC. + + * data/glr.c (inline): Remove #define. It's the user's + responsibility to #define it away, just like 'const'. + This fixes one of the bugs reported by Nelson H. F. Beebe in + . + + * Makefile.maint (po-check): Scan .l and .y files instead of the + .c and the .h files that they generate. This fixes the bug + reported by Tim Van Holder in: + + Look for N_ as well as for _. Try to avoid matching #define for + N_ and _. + * po/POTFILES.in: Remove src/parse-gram.c, src/scan-gram.c, + src/system.h. Add src/parse-gram.y, src/scan-gram.l. + * src/scan-gram.l: Revamp regular expressions so that " and ' + do not confuse xgettext. + + * src/struniq.h (struniq_new): Do not declare the return type + to be 'const'; this violates the C standard. + * src/struniq.c (struniq_new): Likewise. + +2002-11-12 Albert Chin-A-Young + + * src/Makefile.am (LDADD): Link $(LIBINTL) last to avoid the + duplicate definition of optind on Tru64 UNIX 4.0D with the Compaq + linker. + +2002-11-12 Akim Demaille + + * Makefile.maint: Sync with Autoconf: + (local_updates): New. + +2002-11-12 Akim Demaille + + * po/POTFILES.in (src/lalr.c, src/state.c): Remove + +2002-11-12 Akim Demaille + + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Display the + locations. + +2002-11-12 Akim Demaille + + * data/c.m4 (b4_yysymprint_generate): Pass *yyvaluep to YYPRINT, + not yyvalue. + +2002-11-12 Akim Demaille + + * tests/actions.at (AT_CHECK_PRINTER_AND_DESTRUCTOR): New. + Use it to test the GLR parser. + +2002-11-12 Akim Demaille + + * tests/regression.at (input.y): s/YYEOF/MYEOF/, as the skeleton + defines it. + * data/glr.c (yystos): New. + (b4_yysymprint_generate, b4_yydestruct_generate): Invoke. + (YYDSYMPRINT): New. + (yyval): Don't define it, it is handled via M4. + (yyrecoverParseError): Free verbosely the discarded symbols. + * data/yacc.c (yysymprint): Remove, rather... + (b4_yysymprint_generate): invoke. + * data/c.m4 (b4_yysymprint_generate): New. + Accept pointers as arguments, as opposed to the version from + yacc.c. + (b4_yydestruct_generate): Likewise. + * tests/cations.at (Printers and Destructors): Use Bison directives + instead of CPP macros. + Don't rely on internal details. + +2002-11-12 Akim Demaille + + * data/c.m4 (b4_yydestruct_generate, b4_symbol_actions): New. + * data/yacc.c: Rename yychar1 as yytoken, as in glr.c. + Don't work on yychar (i.e., do set it to YYEMPTY, don't match + it against YYEMPTY and so forth), work on yytoken (i.e., set + it to YYEMPTY etc.). + (yydestruct): Replace with a b4_yydestruct_generate invocation. + (b4_symbol_actions): Remove. + * data/glr.c (YYTRANSLATE): As for yacc.c, if negative, it stands + for 0, end-of-input. + +2002-11-12 Akim Demaille + + * doc/bison.texinfo (Destructor Decl): New. + +2002-11-12 Akim Demaille + + * src/tables.c (tables_generate): Use free for pointers that + cannot be NULL, not XFREE. + (pack_vector): Use assert, not fatal, for bound violations. + * src/state.c (state_new): Likewise. + * src/reader.c (reader): Likewise. + * src/lalr.c (set_goto_map): Likewise. + * src/location.h (LOCATION_PRINT): If first_line is 0, just issue + the file name. + +2002-11-12 Akim Demaille + + * src/scan-gram.l, src/reader.h (scanner_last_string_free): + Restore. + * src/scan-gram.l (last_string): Is global to the file, not to + yylex. + * src/parse-gram.y (input): Don't append the epilogue here, + (epilogue.opt): do it here, and free the scanner's obstack. + * src/reader.c (epilogue_set): Rename as... + (epilogue_augment): this. + * data/c.m4 (b4_epilogue): Defaults to empty. + +2002-11-12 Akim Demaille + + * src/getargs.c (long_options): Remove duplicates. + * src/vmsgetargs.c, src/build.com, src/bison.cld, src/vmshlp.mar: + Remove. + * doc/bison.rnh: Remove. + * doc/bison.texinfo (VMS Invocation): Remove. + +2002-11-12 Akim Demaille + + * src/struniq.h, src/struniq.c (struniq_t): Is const. + (STRUNIQ_EQ, struniq_assert, struniq_assert_p): New. + + Use struniq for symbols. + + * src/symtab.h (symbol_t): The tag member is a struniq. + (symbol_type_set): Adjust. + * src/symtab.c (symbol_new): Takes a struniq. + (symbol_free): Don't free the tag member. + (hash_compare_symbol_t, hash_symbol_t): Rename as... + (hash_compare_symbol, hash_symbol): these. + Use the fact that tags as struniqs. + (symbol_get): Use struniq_new. + * src/symlist.h, src/symlist.c (symbol_list_n_type_name_get): + Returns a strniq. + * src/reader.h (merger_list, grammar_currentmerge_set): The name + and type members are struniqs. + * src/reader.c (get_merge_function) + (grammar_current_rule_merge_set): Adjust. + (TYPE, current_type): Are struniq. + + Use struniq for file names. + + * src/files.h, src/files.c (infile): Split into... + (grammar_file, current_file): these. + * src/scan-gram.c (YY_USER_INIT, handle_syncline): Adjust. + * src/reduce.c (reduce_print): Likewise. + * src/getargs.c (getargs): Likewise. + * src/complain.h, src/complain.c: Likewise. + * src/main.c (main): Call struniqs_new early enough to use it for + file names. + Don't free the input file name. + +2002-11-12 Akim Demaille + + * src/symtab.c (symbol_free): Remove dead deactivated code: + type_name are properly removed. + Don't use XFREE to free items that cannot be NULL. + * src/struniq.h, src/struniq.c: New. + * src/main.c (main): Initialize/free struniqs. + * src/parse-gram.y (%union): Add astruniq member. + (yyprint): Adjust. + * src/scan-gram.l (<{tag}>): Return a struniq. + Free the obstack bit that used to store it. + * src/symtab.h (symbol_t): The 'type_name' member is a struniq. + +2002-11-11 Paul Eggert + + Revamp to fix many (but not all) of the C- and M4-related quoting + problems. Among other things, this fixes the Bison bug reported + by Jan Hubicka when processing the Bash grammar; see: + + + Use new @ escapes consistently. Represent brackets with @{ and @} + rather than @<:@ and @:>@, since this works a bit better with dumb + editors like vi. Represent @ with @@, since @ is now consistently + an escape. Use @oline@ and @ofile@ rather than __oline__ and + __ofile__, to avoid unexpected expansions. Similarly, use @output + rather than #output. + + * data/c.m4 (b4_copyright): Omit file name from comment, since + the file name could contain "*/". + (b4_synclines_flag): Don't quote the 2nd argument; it should already + be quoted. All uses changed. + + * data/glr.c: Use new @ escapes consistently. + (b4_input_suffix, b4_output_parser_suffix, b4_output_parser_name, + b4_output_header_suffix, b4_output_header_name, b4_header_guard): + Remove, since they couldn't handle arbitrary characters in file + names. + * data/lalr1.cc: Likewise. + * data/yacc.c: Likewise. + + * src/files.c (output_infix): Remove; all uses removed. + * src/files.h: Likewise. + + * data/glr.c: Remove use of "#ifdef b4_header_guard", since it + mishandled funny characters in file names, and anyway it isn't + needed any more. + * data/yacc.c: Likewise. + * data/lalr1.cc: Use YYSLP_NEEDED instead of b4_header_guard. + + * data/glr.c (YYSTYPE_IS_TRIVIAL): Define when the .h file would. + * data/yacc.c: Likewise. + + * src/muscle_tab.c: Include quotearg.h, since we need to quote C + strings now. + (muscle_init): Quote filename as a C string. + * src/muscle_tab.h (MUSCLE_GROW_STRING_PAIR): Remove; unused. + (MUSCLE_OBSTACK_SGROW, MUSCLE_INSERT_C_STRING): New macros. + * src/output.c (escaped_file_name_output): New function. + (prepare_symbols): Quote tokens for M4. + (prepare): Don't insert output_infix, output_prefix, + output_parser_name, output_header_name; this is now down by scan-skel. + Insert skeleton as a C string. + + * src/output.c (user_actions_output, symbol_destructors_output, + symbol_printers_output): Quote filenames for C and M4. + * src/reader.c (prologue_augment, epilogue_set): Likewise. + + * src/scan-gram.l (): Don't worry about any backslash + escapes other than \\ and \'; this simplifies the code. + (): Likewise, for \\ and \". + (): Escape $ and @, too. + Use new escapes @{ and @} for [ and ]. + + * src/scan-skel.l (yylineno, yyoutname): Remove static vars, replacing + them with auto vars. + Switch to new escape scheme, where @ is the escape character uniformly. + Abort if a stray escape character is found. Avoid unbounded input + buffer when parsing non-escaped text. + + * tests/input.at (Torturing the Scanner): Add tests that @oline@, + __oline__, #output, $@, and @{ do not have unintended meanings. + +2002-11-09 Paul Eggert + + Fix the test failure due to GCC warnings described in + . + * data/glr.c (yyis_pact_ninf, yyis_table_ninf): New macros, which + evaluate to 0 if it's impossible for NINF to be in the respective + table. + (yygetLRActions, yyrecoverParseError): Use them. + + * src/scan-gram.l (unexpected_end_of_file): Fix bug: columns were + counted in the token inserted at end of file. Now takes + location_t *, not location_t, so that the location can be + adjusted. All uses changed. + + * tests/regression.at (Invalid inputs): Adjust wording in + diagnostic to match the new behavior. + + * tests/torture.at (AT_DATA_TRIANGULAR_GRAMMAR, + AT_DATA_HORIZONTAL_GRAMMAR, AT_DATA_LOOKAHEADS_GRAMMAR, + AT_DATA_STACK_TORTURE): Replace `assert (x);' with `if (! (x)) + abort ();'. This reduces the runtime of the "Many lookaheads" + test from 27.6 to 2.7 minutes on a 440 MHz Ultrasparc III running + GCC 3.2. + +2002-11-07 Paul Eggert + + * src/parse-gram.y (CHARACTER): Remove unused token. + All uses removed. + + * src/scan-gram.l: Remove stack option. We no longer use the + stack, since the stack was never deeper than 1; instead, use the + new auto var c_context to record the stacked value. + + Remove nounput option. At an unexpected end of file, we now unput + the minimal input necessary to end cleanly; this simplifies the + code. + + Avoid unbounded token sizes where this is easy. + + (unexpected_end_of_file): New function. + Use it to systematize the error message on unexpected EOF. + (last-string): Now auto, not static. + (YY_OBS_FREE): Remove unnecessary do while (0) wrapper. + (scanner_last_string_free): Remove; not used. + (percent_percent_count): Move decl to just before use. + (SC_ESCAPED_CHARACTER): Return ID at unexpected end of file, + not the (never otherwised-used) CHARACTER. + +2002-11-07 Akim Demaille + + Let yyerror always receive the msg as last argument, so that + yyerror can be variadic. + + * data/yacc.c (b4_yyerror_args): New. + Use it when calling yyerror. + * data/glr.c (b4_yyerror_args, b4_lyyerror_args): New. + Use it when calling yyerror. + * doc/bison.texinfo (Error Reporting): Adjust. + * tests/calc.at (_AT_DATA_CALC_Y): Adjust. + * tests/cxx-type.at (_AT_TEST_GLR_CALC): Adjust. + +2002-11-06 Akim Demaille + + #line should have quoted strings. + Ideally, this should be done by m4_quotearg. + + * src/scan-skel.l: Include quotearg.h. + Quote __ofile__. + * src/output.c (symbol_printers_output) + (symbol_destructors_output): Quote the file name. + +2002-11-06 Akim Demaille + + * tests/regression.at (Invalid inputs): Adjust to the recent + messages. + +2002-11-06 Akim Demaille + + Restore --no-lines. + Reported by Jim Kent. + + * data/c.m4 (b4_syncline): New. + * data/glr.c, data/yacc.c, data/lalr1.cc: Use it. + * src/reader.c (prologue_augment, epilogue_set): Use b4_syncline. + * src/output.c (user_actions_output): Likewise. + (prepare): Define 'b4_synclines_flag'. + * src/muscle_tab.c (muscle_init): Don't define b4_linef. + +2002-11-06 Akim Demaille + + * src/main.c (main): Free `infile'. + * src/scan-gram.l (handle_syncline): New. + Recognize `#line'. + * src/output.c (user_actions_output, symbol_destructors_output) + (symbol_printers_output): Use the location's file name, not + infile. + * src/reader.c (prologue_augment, epilogue_set): Likewise. + +2002-11-05 Paul Hilfinger + + * src/tables.c (matching_state): Don't allow states to match if + either has GLR conflict entries. + +2002-11-05 Paul Eggert + + * src/scan-gram.l: Use more accurate diagnostics, e.g. + "integer out of range" rather than "invalid value". + * tests/input.at (Invalid $n, Invalid @n): Change expected wording + accordingly. + + Scan <% and %> digraphs in C code as POSIX 1003.1-2001 requires. + Also, remove one static variable in the scanner. + + * src/scan-gram.l (braces_level): Now auto, not static. + Initialize to zero if the compiler is being picky. + (INITIAL): Clear braces_level instead of incrementing it. + (SC_BRACED_CODE): Treat <% and %> as { and } when inside C code, + as POSIX 1003.1-2001 requires. + * src/system.h (IF_LINT): New macro, taken from coreutils. + * configure.ac: Define "lint" if --enable-gcc-warnings. + +2002-11-05 Akim Demaille + + * src/scan-gram.l: When it starts with `%', complain about the + whole directive, not just that `invalid character: %'. + +2002-11-04 Akim Demaille + + * Makefile.maint: Update from Autoconf. + (update, cvs-update, po-update, do-po-update): New. + +2002-11-04 Akim Demaille + + * tests/glr-regr1.at (Badly Collapsed GLR States): Prototype yylex + and yyerror. + Have yyerror `use' its arguments. + * tests/calc.at (AT_CHECK_PUSHDEFS): AT_YYERROR_SEES_LOC_IF + returns true when location & yacc & pure & parse-param. + (_AT_DATA_CALC_Y): Let yyerror ``use'' its arguments. + +2002-11-04 Akim Demaille + + * src/location.h (LOCATION_PRINT): Use quotearg slot 3 to avoid + clashes. + * src/scan-gram.l: Use [\'] instead of ['] to pacify + font-lock-mode. + Use complain_at. + Use quote, not quote_n since LOCATION_PRINT no longer uses the + slot 0. + +2002-11-03 Paul Eggert + + * src/reader.c (get_merge_function, grammar_current_rule_check): + Use consistent diagnostics for reporting type name clashes. + Quote the types with <>, for consistency with Yacc. + * tests/input.at (Type Clashes): Adjust to diagnostic changes. + +2002-11-03 Akim Demaille + + * data/c.m4 (b4_identification, b4_user_args, b4_parse_param): + New. + * data/yacc.m4 (b4_pure_args, b4_Pure_args): New. + (b4_parse_param): Remove. + Use b4_identification. + Propagate b4_pure_args where needed to pass them to yyerror. + * data/glr.m4 (b4_parse_param): Remove. + (b4_user_formals, b4_pure_args, b4_pure_formals, b4_lpure_args) + (b4_lpure_formals): New. + Use b4_identification. + (YY_USER_FORMALS, YY_USER_ARGS): Remove, replaced by + b4_user_formals and b4_user_args. + (yyexpandGLRStack, yyFail, yyaddDeferredAction, yyglrShiftDefer) + (yyreportAmbiguity): When using a pure parser, also need + the location, and the parse-params. + Adjust callers. + (yyuserAction, yyglrShift, yyreportParseError, yyrecoverParseError): + When using a pure parser, also need the parse-params. + Adjust callers. + * tests/calc.at: Test pure (%pure-parser) and absolutely pure + (%pure-parser + %parse-param) LALR and GLR parsers. + (AT_CHECK_PUSHDEFS, AT_CHECK_POPDEFS): New, define AT_PARAM_IF, + AT_LOCATION_IF, AT_PURE_IF, AT_GLR_IF, AAT_PURE_AND_LOC_IF, + AT_GLR_OR_PARAM_IF, AT_YYERROR_ARG_LOC_IF, AT_YYERROR_SEES_LOC_IF. + (_AT_DATA_CALC_Y): Equip for purity of yyerror. + (_AT_CHECK_CALC_ERROR): Use AT_YYERROR_SEES_LOC_IF. + * tests/cxx-type.at (_AT_TEST_GLR_CALC): Equip for yyerror purity. + * doc/bison.texinfo: Untabify the whole file. + (Parser Function): Document %parse-param, deprecate YYPARSE_PARAM. + (Pure Calling): Document %lex-param, deprecate YYLEX_PARAM. + (Error Reporting): Adjust to these new directives. + Document %error-verbose, deprecate YYERROR_VERBOSE. + +2002-11-03 Akim Demaille + + * tests/calc.at: Change all the AT_CHECK_CALC_LALR and + AT_CHECK_CALC_GLR invocations to use % directives, instead of + command line options. + * tests/cxx-type.at: Formatting changes. + +2002-11-03 Paul Eggert + + * src/scan-gram.l: Revamp to fix POSIX incompatibilities, + to count columns correctly, and to check for invalid inputs. + + Use mbsnwidth to count columns correctly. Account for tabs, too. + Include mbswidth.h. + (YY_USER_ACTION): Invoke extend_location rather than LOCATION_COLUMNS. + (extend_location): New function. + (YY_LINES): Remove. + + Handle CRLF in C code rather than in Lex code. + (YY_INPUT): New macro. + (no_cr_read): New function. + + Scan UCNs, even though we don't fully handle them yet. + (convert_ucn_to_byte): New function. + + Handle backslash-newline correctly in C code. + (SC_LINE_COMMENT, SC_YACC_COMMENT): New states. + (eols, blanks): Remove. YY_USER_ACTION now counts newlines etc.; + all uses changed. + (tag, splice): New EREs. Do not allow NUL or newline in tags. + Use {splice} wherever C allows backslash-newline. + YY_STEP after space, newline, vertical-tab. + ("/*"): BEGIN SC_YACC_COMMENT, not yy_push_state (SC_COMMENT). + + (letter, id): Don't assume ASCII; e.g., spell out a-z. + + ({int}, handle_action_dollar, handle_action_at): Check for integer + overflow. + + (YY_STEP): Omit trailing semicolon, so that it's more like C. + + (): Allow \0 and \00 + as well as \000. Check for UCHAR_MAX, not 255. + Allow \x with an arbitrary positive number of digits, as in C. + Check for overflow here. + Allow \? and UCNs, for compatibility with C. + + (handle_symbol_code_dollar): Use quote_n slot 1 to avoid collision + with quote slot used by complain_at. + + * tests/input.at: Add tests for backslash-newline, m4 quotes + in symbols, long literals, and funny escapes in strings. + + * configure.ac (jm_PREREQ_MBSWIDTH): Add. + * lib/Makefile.am (libbison_a_SOURCES): Add mbswidth.h, mbswidth.c. + * lib/mbswidth.h, lib/mbswidth.c: New files, from GNU gettext. + * m4/Makefile.am (EXTRA_DIST): Add mbswidth.m4. + * m4/mbswidth.m4: New file, from GNU coreutils. + + * doc/bison.texinfo (Grammar Outline): Document // comments. + (Symbols): Document that trigraphs have no special meaning in Bison, + nor is backslash-newline allowed. + (Actions): Document that trigraphs have no special meaning. + + * src/location.h (LOCATION_COLUMNS, LOCATION_LINES): Remove; + no longer used. + +2002-11-02 Paul Eggert + + * src/reader.c: Don't include quote.h; not needed. + (get_merge_function): Reword warning to be consistent with + type clash diagnostic in grammar_current_rule_check. + + * lib/quotearg.c (quotearg_buffer_restyled): Fix off-by-two + bug in trigraph handling. + + * src/output.c (prepare_symbols): When printing token names, + escape "[" as "@<:@" and likewise for "]". + + * src/system.h (errno): Remove declaration, as we are now + assuming C89 or better, and C89 guarantees errno. + +2002-10-30 Paul Eggert + + * lib/bitset_stats.c (bitset_stats_read, bitset_stats_write): + Check for close failures. + * src/files.h (xfclose): Return void, not int, since it always + returned zero. + * src/files.c (xfclose): Likewise. Report I/O error if ferror + indicates one. + * src/output.c (output_skeleton): Use xfclose rather than fclose + and ferror. xfclose now checks ferror. + + * data/glr.c (YYLEFTMOST_STATE): Remove. + (yyreportTree): Use a stack-based leftmost state. This avoids + our continuing battles with bogus warnings about initializers. + +2002-10-30 Akim Demaille + + * src/system.h: Don't use #ifdef/#ifndef on HAVE_ values, only + #if. + +2002-10-29 Paul Hilfinger + + * tests/glr-regr1.at: New test for reported regressions. + * tests/testsuite.at: Add glr-regr1.at test. + * tests/Makefile.am: Add glr-regr1.at test. + +2002-10-24 Paul Eggert + + Version 1.75a. + + * tests/calc.at (_AT_DATA_CALC_Y): Remove unused strcat declaration. + * tests/cxx-type.at (_AT_TEST_GLR_CALC): Include stdlib.h, since + we use malloc. Don't assume 'A' through 'Z' are contiguous. + Don't assume strdup exists; POSIX says its an XSI extension. + Check for buffer overflow on input. + +2002-10-24 Akim Demaille + + * src/output.c (output_skeleton): Don't disable M4sugar comments + too soon: it results in comments being expanded. + * data/yacc.c, data/glr.c, data/lalr1.cc: Do it right before the + first output. + +2002-10-24 Akim Demaille + + * data/yacc.c (m4_int_type): New. + * data/c.m4 (m4_int_type): Don't use yysigned_char, but `signed + char' as only yacc.c wants K&R portability. + * data/glr.c (yysigned_char): Remove. + * data/lalr1.cc: Rename the trailing b4_name as b4_parser_class_name. + Reported by Quoc Peyrot. + +2002-10-23 Paul Eggert + + * src/main.c (main): With --trace=time, report times even if a + non-fatal error occurs. Formerly, the times were reported in some + such cases but not in others. + * src/reader.c (reader): Just return if a complaint has been issued, + instead of exiting, so that 'main' can report times. + +2002-10-22 Akim Demaille + + * src/system.h: Include sys/types. + Reported by Bert Deknuydt. + +2002-10-23 Paul Eggert + + * configure.ac (AC_PROG_LEX): Use instead of AM_PROG_LEX. + Suggested by Art Haas. + +2002-10-22 Paul Eggert + + * src/complain.c (exit) [! (STDC_HEADERS || _LIBC)]: Remove exit + decl; not needed any more. + * src/main.c (main): Use return to exit, undoing yesterday's change. + The last OS that we could find where this wouldn't work is + SunOS 3.5, and that's too old to worry about now. + + * data/glr.c (struct yyltype): Define members even when not + doing locations. This is more consistent with yacc.c, and it + works around the following bug reports: + http://lists.gnu.org/archive/html/bug-bison/2002-10/msg00106.html + http://lists.gnu.org/archive/html/bug-bison/2002-10/msg00111.html + + * doc/bison.texinfo: Minor spelling and typographical fixes. Use + @acronym consistently. Standardize on "Yacc" instead of "YACC", + "Algol" instead of "ALGOL". Give a bit more history about BNF. + +2002-10-22 Akim Demaille + + * data/README: New. + +2002-10-21 Paul Eggert + + Be consistent about 'bool'; the old code used an enum in one + module and an int in another, and this violates the C standard. + * m4/stdbool.m4: New file, from coreutils 4.5.3. + * configure.ac (AC_HEADER_STDBOOL): Add. + * m4/Makefile.am (EXTRA_DIST): Add stdbool.m4. + * src/muscle_tab.c (hash_compare_muscles): (a ? FALSE : TRUE) -> (! a) + * src/symtab.c (hash_compare_symbol_t): Likewise. + * src/system.h (bool, false, true): Use a definition consistent + with ../lib/hash.c. All uses changed. + + * src/complain.c (warning_issued): Renamed from warn_message_count, + so that we needn't worry about integer overflow (!). + Now of type bool. All uses changed. + (complaint_issued): Renamed from complain_message_count; likewise. + + * src/main.c (main): Use exit to exit with failure. + + * src/complain.c (fatal_at, fatal): Use EXIT_FAILURE and EXIT_SUCCESS + rather than 1 and 0. + * src/main.c (main): Likewise. + * src/getargs.c (getargs): Likewise. + * src/reader.c (reader): Likewise. + + * src/getarg.c (getargs): Remove duplicate code for + "Try `bison --help'". + + * src/files.c (xfopen, xfclose): Use EXIT_FAILURE rather than 2. + What was that "2" for? + + * src/complain.h (fatal, fatal_at): Add __attribute__((__noreturn__)). + * src/getargs.c (usage): Likewise. + + * src/getargs.c (getargs): When there are too few operands, report + the last one. When there are too many, report the first extra + one. This is how diffutils does it. + +2002-10-20 Paul Eggert + + Remove K&R vestiges. + * configure.ac (AC_C_CONST, AM_C_PROTOTYPES): Remove. + * src/complain.c (VA_START): Remove. Assume prototypes. + (vfprintf) [! (HAVE_VPRINTF || defined vfprintf)]: New macro. + (private_strerror, warn_at, warn, complain_at, complain, fatal_at, + fatal): Assume prototypes. + * src/complain.h: Assume prototypes. + * src/system.h (PARAMS): Remove. + Include unconditionally, since it's guaranteeed even + for a freestanding C89 compiler. + (SHRT_MIN, SHRT_MAX): Remove, since C89 guarantees them. + * src/vmsgetargs.c (getargs, cli_present, cli_get_value): Prototype. + +2002-10-20 Akim Demaille + + * src/muscle_tab.c (muscle_grow): Remove trailing debugging code. + * data/glr.c (YY_USER_FORMALS, YY_USER_ARGS): New. + (yyuserAction, yydoAction, yyglrReduce, yyresolveValue) + (yyresolveStates, yyresolveAction, yyresolveStack) + (yyprocessOneStack): Use them. + (yy_reduce_print): New. + * tests/calc.at (_AT_DATA_CALC_Y): Exercise %parse-param. + +2002-10-20 Akim Demaille + + * data/c.m4 (b4_c_ansi_args): Recognize functions with no + arguments and output `void'. + (b4_c_function): Rename as... + (b4_c_function_def): this. + (b4_c_function_decl, b4_c_ansi_function_def) + (b4_c_ansi_function_decl): New. + Change the interpretation of the arguments: before `int, foo', now + `int foo, foo'. + * data/yacc.c (yyparse): Prototype and define thanks to these. + Adjust b4_c_function_def uses. + * data/glr.c (yyparse): Likewise, but ANSI only. + +2002-10-20 Akim Demaille + + * src/output.c (prepare): Move the definition of `tokens_number', + `nterms_number', `undef_token_number', `user_token_number_max' + to... + (prepare_tokens): Here. + (prepare_tokens): Rename as... + (prepare_symbols): this. + (prepare): Move the definition of `rules_number' to... + (prepare_rules): here. + (prepare): Move the definition of `last', `final_state_number', + `states_number' to... + (prepare_states): here. + * data/yacc.c, data/lalr1.cc, data/glr.c: Normalize `>' into `<'. + +2002-10-20 Akim Demaille + + * src/tables.h, src/tables.c, src/output.c: Comment changes. + +2002-10-20 Akim Demaille + + * data/yacc.c, data/yacc.c (b4_location_if, b4_pure_if): Move to... + * data/c.m4: here. + +2002-10-20 Akim Demaille + + * src/output.c (prepare): Use MUSCLE_INSERT_STRING. + * src/muscle_tab.c (muscle_pair_list_grow): Rename `val as + `pair'. + (muscle_init): Move the `b4_ltype', `b4_maxdepth', `b4_initdepth', + `name' to... + * data/glr.c, data/lalr1.cc, data/yacc.c (b4_location_type) + (b4_stack_depth_init, b4_stack_depth_max, b4_parser_class_name): + These. + +2002-10-19 Paul Eggert + + Do not create a temporary file, as that involves security and + cleanup headaches. Instead, use a pair of pipes. + Derived from a suggestion by Florian Krohm. + * lib/subpipe.c, lib/subpipe.h, m4/subpipe.m4: New files. + * lib/mkstemp.c, lib/readpipe.c, lib/tempname.c, m4/mkstemp.m4: Remove. + * configure.ac (UTILS_FUNC_MKSTEMP, jm_PREREQ_TEMPNAME): Remove. + (BISON_PREREQ_SUBPIPE): Add. + * lib/Makefile.am (libbison_a_SOURCES): Remove readpipe.c. + Add subpipe.h, subpipe.c. + * m4/Makefile.am (EXTRA_DIST): Remove mkstemp.m4. Add subpipe.m4. + * po/POTFILES.in: Add lib/subpipe.c. + * src/output.c: Include "subpipe.h". + (m4_invoke): Remove decl. + (scan_skel): New decl. + (output_skeleton): Use pipe rather than temporary file for m4 input. + Check that m4sugar.m4 is readable, to avoid deadlock. + Check for pipe I/O error. + * src/scan-skel.l (readpipe): Remove decl. + (scan_skel): New function, to be used in place of m4_invoke. + Read from stream rather than file. + + * lib/timevar.c (TICKS_TO_MSEC, CLOCKS_TO_MSEC): Do not cast to + float, as this generates a warning on Solaris 8 + GCC 3.2 with + --enable-gcc-warnings. Instead, divide into 1.0 rather than 1; + this generates a more-accurate value anyway. + + * lib/timevar.c (timervar_accumulate): Rename locals to + avoid confusion with similarly-named more-global. + * src/muscle_tab.c (muscle_pair_list_grow): Likewise. + + * src/output.c (prepare): Use xstrdup to convert char const * + to char *, to avoid GCC warning. + +2002-10-19 Akim Demaille + + * tests/calc.at (_AT_DATA_CALC_Y): Define VAL, LOC, LEX_FORMALS, + LEX_PRE_FORMALS, LEX_ARGS, LEX_PRE_ARGS, USE_LEX_ARGS. + Use them to have `calc.y' ready for %pure-parser. + * data/yacc.c (YYLEX): Pass a yylex return type to + b4_c_function_call. + +2002-10-19 Akim Demaille + + Prototype support of %lex-param and %parse-param. + + * src/parse-gram.y: Add the definition of the %lex-param and + %parse-param tokens, plus their rules. + Drop the `_' version of %glr-parser. + Add the "," token. + * src/scan-gram.l (INITIAL): Scan them. + * src/muscle_tab.c: Comment changes. + (muscle_insert, muscle_find): Rename `pair' as `probe'. + * src/muscle_tab.h (MUSCLE_INSERT_PREFIX): Remove unused. + (muscle_entry_s): The `value' member is no longer const. + Adjust all dependencies. + * src/muscle_tab.c (muscle_init): Adjust: use + MUSCLE_INSERT_STRING. + Initialize the obstack earlier. + * src/muscle_tab.h, src/muscle_tab.c (muscle_grow) + (muscle_pair_list_grow): New. + * data/c.m4 (b4_c_function_call, b4_c_args): New. + * data/yacc.c (YYLEX): Use b4_c_function_call to honor %lex-param. + * tests/calc.at: Use %locations, not --locations. + (AT_CHECK_CALC_GLR): Use %glr-parser, not %glr_parser. + +2002-10-19 Akim Demaille + + * src/getargs.c (usage): Take status as argument and exit + accordingly. + Report the traditional `Try ... --help' message when status != 0. + (usage, version): Don't take a FILE * as arg, it is pointless. + (getargs): When there is an incorrect number of arguments, make it + an error, and report it GNUlically thanks to `usage ()'. + +2002-10-18 Paul Eggert + + * data/glr.c (yyreportParseError): Don't assume that sprintf + yields the length of the printed string, as this is not true + on SunOS 4.1.4. Reported by Peter Klein. + + * tests/calc.at (_AT_DATA_CALC_Y): #undef memcmp and realloc. + * tests/conflicts.at (%nonassoc and eof): Likewise. + Fixes SunOS 4.1.4 test failure reported by Peter Klein. + +2002-10-17 Akim Demaille + + * src/getargs.h (trace_e): Add trace_scan, and trace_parse. + * src/getargs.c (trace_types, trace_args): Adjust. + * src/reader.c (grammar_current_rule_prec_set) + (grammar_current_rule_dprec_set, grammar_current_rule_merge_set): + Standardize error messages. + And s/@prec/%prec/! + (reader): Use trace_flag to enable scanner/parser debugging, + instead of an adhoc scheme. + * src/scan-gram.l: Remove trailing debugging code. + +2002-10-16 Paul Eggert + + * src/muscle_tab.h (MUSCLE_TAB_H_): Was misspelled as + MUSCLE_TAB_H. + + * NEWS: Officially drop support for building Bison with K&R C, + since it didn't work anyway and it's not worth worrying about. + * Makefile.maint (wget_files): Remove ansi2knr.c. + (ansi2knr.c-url_prefix): Remove. + * lib/.cvsignore: Remove ansi2knr, ansi2knr.*. + * lib/Makefile.am (AUTOMAKE_OPTIONS): Remove. + * src/Makefile.am (AUTOMAKE_OPTIONS): Remove. + +2002-10-15 Paul Eggert + + Stop using the "enum_" trick for K&R-style function definitions; + it confused me, and I was the author! Instead, assume that people + who want to use K&R C compilers (when using these modules in GCC, + perhaps?) will run ansi2knr. + + * lib/bbitset.h: (enum_bitset_ops, enum_bitset_type): Remove. + All uses of "enum_" changed to "enum ". + * lib/ebitset.c (enum_ebitset_find_mode): Likewise. + * lib/lbitset.c (enum_lbitset_find_mode): Likewise. + + * lib/abitset.c (abitset_and, abitset_and_cmp, abitset_and_or, + abitset_and_or_cmp, abitset_andn, abitset_andn_cmp, + abitset_andn_or, abitset_andn_or_cmp, abitset_bytes, abitset_copy, + abitset_copy1, abitset_disjoint_p, abitset_empty_p, + abitset_equal_p, abitset_init, abitset_list, abitset_list_reverse, + abitset_not, abitset_ones, abitset_or, abitset_or_and, + abitset_or_and_cmp, abitset_or_cmp, abitset_reset, abitset_set, + abitset_size, abitset_small_list, abitset_subset_p, abitset_test, + abitset_unused_clear, abitset_xor, abitset_xor_cmp, abitset_zero): + Use function prototypes; this removes the need for declaring + static functions simply to provide their prototypes. + * lib/bitset.c (bitset_alloc, bitset_and_or_, bitset_and_or_cmp_, + bitset_andn_or_, bitset_andn_or_cmp_, bitset_bytes, bitset_copy_, + bitset_count_, bitset_create, bitset_dump, bitset_first, + bitset_free, bitset_init, bitset_last, bitset_next, + bitset_obstack_alloc, bitset_obstack_free, bitset_only_set_p, + bitset_op4_cmp, bitset_or_and_, bitset_or_and_cmp_, bitset_prev, + bitset_print, bitset_release_memory, bitset_toggle_, + bitset_type_choose, bitset_type_get, bitset_type_name_get, + debug_bitset): Likewise. + * lib/bitset.h (bitset_set, bitset_reset, bitset_test): Likewise. + * lib/bitset_stats.c (bitset_log_histogram_print, + bitset_percent_histogram_print, bitset_stats_and, + bitset_stats_and_cmp, bitset_stats_and_or, + bitset_stats_and_or_cmp, bitset_stats_andn, bitset_stats_andn_cmp, + bitset_stats_andn_or, bitset_stats_andn_or_cmp, bitset_stats_copy, + bitset_stats_count, bitset_stats_disable, bitset_stats_disjoint_p, + bitset_stats_dump, bitset_stats_empty_p, bitset_stats_enable, + bitset_stats_equal_p, bitset_stats_free, bitset_stats_init, + bitset_stats_list, bitset_stats_list_reverse, bitset_stats_not, + bitset_stats_ones, bitset_stats_or, bitset_stats_or_and, + bitset_stats_or_and_cmp, bitset_stats_or_cmp, bitset_stats_print, + bitset_stats_print_1, bitset_stats_read, bitset_stats_reset, + bitset_stats_set, bitset_stats_size, bitset_stats_subset_p, + bitset_stats_test, bitset_stats_toggle, bitset_stats_type_get, + bitset_stats_write, bitset_stats_xor, bitset_stats_xor_cmp, + bitset_stats_zero): Likewise. + * lib/bitsetv.c (bitsetv_alloc, bitsetv_create, bitsetv_free, + bitsetv_zero, bitsetv_ones, bitsetv_transitive_closure, + bitsetv_dump, debug_bitsetv): Likewise. + * lib/ebitset.c (ebitset_and, ebitset_and_cmp, ebitset_andn, + ebitset_andn_cmp, ebitset_bytes, ebitset_copy, ebitset_copy_, + ebitset_copy_cmp, ebitset_disjoint_p, ebitset_elt_add, + ebitset_elt_alloc, ebitset_elt_calloc, ebitset_elt_find, + ebitset_elt_free, ebitset_elt_last, ebitset_elt_remove, + ebitset_elt_zero_p, ebitset_elts_grow, ebitset_empty_p, + ebitset_equal_p, ebitset_free, ebitset_init, ebitset_list, + ebitset_list_reverse, ebitset_not, ebitset_ones, ebitset_op3_cmp, + ebitset_or, ebitset_or_cmp, ebitset_release_memory, ebitset_reset, + ebitset_set, ebitset_size, ebitset_subset_p, ebitset_test, + ebitset_weed, ebitset_xor, ebitset_xor_cmp, ebitset_zero): + Likewise. + * lib/lbitset.c (debug_lbitset, lbitset_and, lbitset_and_cmp, + lbitset_andn, lbitset_andn_cmp, lbitset_bytes, lbitset_copy, + lbitset_copy_cmp, lbitset_disjoint_p, lbitset_elt_alloc, + lbitset_elt_calloc, lbitset_elt_find, lbitset_elt_free, + lbitset_elt_link, lbitset_elt_unlink, lbitset_elt_zero_p, + lbitset_empty_p, lbitset_equal_p, lbitset_free, lbitset_init, + lbitset_list, lbitset_list_reverse, lbitset_not, lbitset_ones, + lbitset_op3_cmp, lbitset_or, lbitset_or_cmp, lbitset_prune, + lbitset_release_memory, lbitset_reset, lbitset_set, lbitset_size, + lbitset_subset_p, lbitset_test, lbitset_weed, lbitset_xor, + lbitset_xor_cmp, lbitset_zero): Likewise. + +2002-10-14 Akim Demaille + + Version 1.75. + +2002-10-14 Akim Demaille + + * tests/Makefile.am (maintainer-check-posix): New. + +2002-10-14 Akim Demaille + + * data/glr.c [YYDEBUG] (YYLEFTMOST_STATE): Initialize the yyloc + member. + +2002-10-14 Akim Demaille + + * src/tables.c (table_ninf_remap): base -> tab. + Reported by Matt Rosing. + +2002-10-14 Paul Eggert + + * tests/action.at, tests/calc.at, tests/conflicts.at, + tests/cxx-type.at, tests/headers.at, tests/input.at, + tests/regression.at, tests/synclines.at, tests/torture.at: + Say "bison -o foo.c foo.y", not "bison foo.y -o foo.c", + so that the tests still work even if POSIXLY_CORRECT is set. + * doc/bison.texinfo (Rpcalc Compile, Invocation): Likewise. + + * data/c.m4 (b4_int_type): Use yysigned_char instead of signed char, + for portability to K&R hosts. Fix typo: signed char is guaranteed + only to 127, not to 128. + * data/glr.c (yysigned_char): New type. + * data/yacc.c (yysigned_char): Likewise. + * tests/regression.at (Web2c Actions): signed char -> yysigned_char. + +2002-10-13 Paul Eggert + + * data/yacc.c (yyparse): Rewrite to avoid "comparison is always + true due to limited range of data type" warning from GCC. + + * data/c.m4 (b4_token_defines): Protect against double-inclusion + by wrapping enum yytokentype's definition inside #ifndef + YYTOKENTYPE. This undoes a bug I introduced on 2002-10-12. + +2002-10-13 Akim Demaille + + * data/glr.c (yyglrShiftDefer, yyaddDeferredAction, yydoAction): + Un yy- yyrhs to avoid the name clash with the global YYRHS. + +2002-10-13 Akim Demaille + + * Makefile.maint: Update from Autoconf 2.54. + * m4/strerror_r.m4 (AC_FUNC_STRERROR_R): Remove, shipped with 2.54. + +2002-10-13 Akim Demaille + + * src/print.c (print_state): Separate the list of solved conflicts + from the other items. + * tests/conflicts.at (Resolved SR Conflicts): Adjust. + +2002-10-13 Akim Demaille + + Let nondeterministic skeletons be usable with deterministic + tables. + + With the patch, GAWK compiled by GCC without -O2 passes its test + suite using a GLR parser driven by LALR tables. It fails with -O2 + because `struct stat' gives two different answers on my machine: + 88 (definition of an auto var) and later 96 (memset on this var). + Hence the stack is badly corrumpted. The headers inclusion is to + blame: if I move the awk.h inclusion before GLR's system header + inclusion, the two struct stat have the same size. + + * src/tables.c (pack_table): Always create conflict_table. + (token_actions): Always create conflict_list. + * data/glr.c (YYFLAG): Remove, unused. + +2002-10-13 Akim Demaille + + * configure.ac (AC_GNU_SOURCE): Use it instead of hand written code. + (O0FLAGS): New. + (VALGRIND, GXX): New. + * tests/atlocal.in (CFLAGS): Use O0FLAGS. + * tests/bison.in: Run $PREBISON a pre-command. + * tests/Makefile.am (maintainer-check, maintainer-check-valgrind) + (maintainer-check-g++): New. + * Makefile.am (maintainer-check): New. + +2002-10-13 Akim Demaille + + * data/glr.c: Formatting changes. + Tweak some trace messages to match yacc.c's. + +2002-10-13 Akim Demaille + + GLR parsers sometimes raise parse errors instead of performing the + default reduction. + Reported by Charles-Henry de Boysson. + + * tests/calc.at (_AT_CHECK_CALC, _AT_CHECK_CALC_ERROR): Don't + check the length of the traces when %glr. + (_AT_CHECK_CALC_ERROR): Also skip `^Stack' lines, coming from + GLR's traces. + (AT_CHECK_CALC_LALR, AT_CHECK_CALC_GLR): New. + Test GLR parsers. + * data/glr.c (YYLEFTMOST_STATE): Fix its value. + (yyltype): Remove the yy prefix from the member names. + (yytable): Complete its comment. + (yygetLRActions): Map error action number from YYTABLE from + YYTABLE_NINF to 0. + (yyisErrorAction): No longer compare YYACTION to YYPACT_NINF + (which was a bug: it should have been YYTABEL_NINF, and yet it was + not satisfying as we could compare an YYACTION computed from + YYDEFACT to YYTABLE_NINF although they are unrelated): 0 is the + only value for error actions. + (yyreportParseError): In verbose parse error messages, don't issue + `error' in the list of expected tokens. + * data/yacc.c (yyparse) : Rewrite the decoding of the + next action to perform to match glr.c's decoding. + (yytable): Complete its comment. + +2002-10-13 Paul Eggert + + Fix problem reported by Henrik Grubbstroem in + : + "nonterm: { $$ = 123; } { $$ = $1; };" was wrongly rejected, + because the Bison parser reads the second action before reducing + the first one. + * src/scan-gram.l (rule_length): New static var. + Use it to keep track of the rule length in the scanner, since + we can't expect the parser to be in lock-step sync with the scanner. + (handle_action_dollar, handle_action_at): Use this var. + * tests/actions.at (Exotic Dollars): Test for the problem. + +2002-10-12 Paul Eggert + + * lib/timevar.c [! IN_GCC && HAVE_SYS_TIME_H]: Include . + * m4/timevar.m4 (BISON_PREREQ_TIMEVAR): Check for . + Include when checking for clock_t and struct tms. + Use same include order as source. + This is for the SunOS 4.1.4 porting bug reported by Peter Klein in + . + + * lib/timevar.c: Update copyright date and clarify comments. + (get_time) [IN_GCC]: Keep the GCC version for reference. + + * lib/timevar.c, lib/timevar.h, lib/timevar.def: Import + GCC version as of today, then merge Bison's changes. + Change "GCC" to "Bison" in copyright notice. timevar.def's + author is Akim, so change that too. + + * src/reader.c (grammar_current_rule_check): + Don't worry about the default action if $$ is untyped. + Prevents bogus warnings reported by Jim Gifford in + . + + * data/c.m4 (b4_token_enum): Do not define YYTOKENTYPE. + * data/glr.c, data/lalr1.cc, data/yacc.c: + Output token definitions before the first part of user declarations. + Fixes compatibility problem reported by Jim Gifford for kbd in + . + +2002-10-11 Paul Eggert + + * data/yacc.c (yyreport_parse_error): Remove, putting its body into... + (yyparse): here. This undoes some of the 2002-07-25 change. + Compatibility problem reported by Ralf S. Engelschall with + OSSP cfg . + +2002-10-11 Akim Demaille + + * tests/regression.at Characters Escapes): New. + * src/scan-gram.l (SC_ESCAPED_CHARACTER): Accept \' in strings and + characters. + Reported by Jan Nieuwenhuizen. + +2002-10-11 Akim Demaille + + * po/id.po: New. + +2002-10-10 Paul Eggert + + Portability fixes for bitsets; this also avoids several GCC + warnings. + + * lib/abitset.c: Include , for offsetof. + * lib/lbitset.c: Likewise. + + * lib/abitset.c (abitset_bytes): Return a size that is aligned + properly for vectors of objects. Do not assume that adding a + header size to a multiple of a word size yields a value that is + properly aligned for the whole union. + * lib/bitsetv.c (bitsetv_alloc): Likewise. + + * lib/bitset_stats.c (bitset_stats_bytes): Adjust to new, + unique names for structures. + * lib/ebitset.c (ebitset_bytes): Likewise. + * lib/lbitset.c (lbitset_bytes): Likewise. + + * lib/abitset.c (abitset_ones, abitset_zero, abitset_empty_p, + abitset_copy1, abitset_not, abitset_equal_p, abitset_subset_p, + abitset_disjoint_p, abitset_and, abitset_and_cmp, abitset_andn, + abitset_andn_cmp, abitset_or, abitset_or_cmp, abitset_xor, + abitset_xor_cmp, abitset_and_or, abitset_and_or_cmp, + abitset_andn_or, abitset_andn_or_cmp, abitset_or_and, + abitset_or_and_cmp, abitset_copy): Supply prototype decls, + to improve the type-checking that GCC can do. + * lib/bitset.c (bitset_op4_cmp): Likewise. + * lib/bitset_stats.c (bitset_stats_count, + bitset_stats_empty_p, bitset_stats_ones, bitset_stats_zero, + bitset_stats_copy, bitset_stats_disjoint_p, + bitset_stats_equal_p, bitset_stats_not, bitset_stats_subset_p, + bitset_stats_and, bitset_stats_and_cmp, bitset_stats_andn, + bitset_stats_andn_cmp, bitset_stats_or, bitset_stats_or_cmp, + bitset_stats_xor, bitset_stats_xor_cmp, bitset_stats_and_or, + bitset_stats_and_or_cmp, bitset_stats_andn_or, + bitset_stats_andn_or_cmp, bitset_stats_or_and, + bitset_stats_or_and_cmp): Likewise. + * lib/lbitset.c (lbitset_and, lbitset_and_cmp, lbitset_andn, + lbitset_andn_cmp, lbitset_or, lbitset_or_cmp, lbitset_xor, + lbitset_xor_cmp, lbitset_empty_p, lbitset_ones, lbitset_not, + lbitset_subset_p, lbitset_disjoint_p, debug_lbitset): Likewise. + + * lib/abitset.h: Include bitset.h, not bbitset.h. + * lib/ebitset.h: Likewise. + * lib/lbitset.h: Likewise. + + * lib/bbitset.h: (enum_bitset_ops, enum_bitset_type): New types. + All instances of parameters of type enum bitset_opts are now of + type enum_bitset_opts, to conform to the C Standard, and similarly + for enum_bitset_type. + * lib/ebitset.c (enum_ebitset_find_mode): Likewise. + * lib/lbitset.c (enum_lbitset_find_mode): Likewise. + + Do not use "struct bitset_struct" to mean different things in + different modules. Not only is this confusing, it violates + the C Standard, which requires that structure types in different + modules must be compatible if one is to be passed to the other. + * lib/bbitset.h (bitset): Now points to a union, not to a struct. + All instances of "struct bitset_struct *" replaced with "bitset". + * lib/bitset.h (struct bitset_struct): Remove, replacing with.... + (union bitset_union, struct abitset_struct, struct ebitset_struct, + struct lbitset_struct, struct bitset_stats_struct): New types. + All uses of struct bitset_struct changed to union bitset_union, + etc. + * lib/abitset.c (struct abitset_struct, abitset, + struct bitset_struct): Remove. + * lib/bitset_stats.c (struct bitset_stats_struct, bitset_stats, + struct bitset_struct): Remove. + * lib/ebitset.c (struct ebitset_struct, ebitset, struct + bitset_struct): Remove. + * lib/lbitset.c (struct lbitset_struct, lbitset, bitset_struct): + Likewise. + + Do not call a function of type T using a call that assumes the + function is of a different type U. Standard C requires that a + function must be called with a type that is compatible with its + definition. + * lib/bbitset.h (bitset_and_or_, bitset_andn_or_, bitset_or_and_): + New decls. + * lib/bitset.c (bitset_and_or_, bitset_andn_or_, bitset_or_and_): + New functions. + * lib/ebitset.c (PFV): Remove. + * lib/lbitset.c (PFV): Likewise. + * lib/ebitset.c (ebitset_and, ebitset_andn, ebitset_or, + ebitset_xor, ebitset_copy, ebitset_ones, ebitset_empty_p): New + decls. + (ebitset_and, ebitset_andn, ebitset_or, ebitset_xor): New functions. + (ebitset_vtable): Use them. + * lib/lbitset.c (lbitset_and, lbitset_andn, lbitset_or, + lbitset_xor): New functions. + (lbitset_vtable): Use them. + + * lib/bitset.h (bitset_next, bitset_prev, bitset_only_set_p): + Declare. + + * lib/bitsetv.c (bitsetv_alloc): Add a cast to (void *) to avoid a + GCC warning. + * lib/lbitset.c (LBITSET_CURRENT1): Likewise. + Use offsetof, for simplicity. + +2002-10-06 Paul Eggert + + * lib/bitset.h (bitset_reset): Do not assume that bitset_word is + the same width as int. This reapplies a hunk of the 2002-08-12 patch + , + which was inadvertently undone by the 2002-09-30 patch. + * lib/lbitset.c (debug_lbitset): Do not assume that bitset_word is + the same width as int. + +2002-10-04 Paul Eggert + + Version 1.50. + + * configure.ac (AC_INIT), NEWS: Increment version number. + + * doc/bison.texinfo: Minor spelling, grammar, and white space + fixes. + (Symbols): Mention that any negative value returned from yylex + signifies end-of-input. Warn about negative chars. Mention + the portable Standard C character set. + + The GNU coding standard says CFLAGS and YFLAGS are reserved + for the installer to set. + * lib/Makefile.am (AM_CFLAGS): Renamed from CFLAGS. + * src/Makefile.am (AM_CFLAGS): Likewise. + (AM_YFLAGS): Renamed from YFLAGS. + + Fix some MAX and MIN problems. + * src/gram.h (ITEM_NUMBER_MIN): MIN_MAX -> INT_MIN. + * src/lalr.h (GOTO_NUMBER_MAX): INT_MAX -> SHRT_MAX. + * src/symtab.h (SYMBOL_NUMBER_MAX): New macro. + * src/reader.c (reader): Use it. + + * tests/regression.at (Braces parsing): Use grep, not fgrep, as + POSIX 1003.1-2001 has removed fgrep. + +2002-10-04 Michael Hayes + + * lib/bbitset.h (BITSET_WINDEX_MAX): Redefine so that it cannot be + interpreted as signed. + * lib/ebitset.c (ebitset_list): Fix bug. + +2002-10-01 Paul Eggert + + More fixes for 64-bit hosts and large bitsets. + + * lib/abitset.c (struct abitset_struct.n_bits, abitset_small_list, + abitset_size, abitset_list, abitset_list_reverse, abitset_list): + Use bitset_bindex, not int or unsigned int or size_t, to count bits. + * lib/bbitset.h (struct bitset_vtable.size, struct bitset_vtable.count, + struct bitset_vtable.list, struct bitset_vtable.list_reverse, + bitset_count_, bitset_next, bitset_prev, bitset_first, bitset_last, + bitset_count_): Likewise. + * lib/bitset.h (bitset_iterator.num, bitset_iterator.i, + bitset_first, bitset_last): Likewise. + * lib/bitset_stats.c (bitset_stats_size, bitset_stats_list, + bitset_stats_list_reverse, bitset_stats_size, + bitset_stats_count, bitset_stats_list, bitset_stat_list_reverse): + Likewise. + * lib/bitsetv-print.c (bitsetv_matrix_dump): Likewise. + * lib/bitsetv.c (bitsetv_alloc, bitsetv_create, bitsetv_free, + bitsetv_zero, bitsetv_ones, bitsetv_transitive_closure, + bitsetv_reflexive_transitive_closure): Likewise. + * lib/bitsetv.h (bitsetv_alloc, bitsetv_create): Likewise. + * lib/ebitset.c (ebitset_size, ebitset_list, ebitset_list_reverse): + Likewise. + * lib/lbitset.c (lbitset_size, lbitset_list, lbitset_list_merge): + Likewise. + + * lib/abitset.c (abitset_ones, abitset_zero, abitset_bytes): + Use size_t, not unsigned int, to count bytes. + * lib/abitset.h (abitset_bytes): Likewise. + * lib/bitset.c (bitset_bytes, bitset_alloc, bitset_obstack_alloc): + Likewise. + * lib/bitset.h (bitset_bytes): Likewise. + * lib/bitset_stats.c (bitset_stats_bytes, bitset_stats_init): Likewise. + * lib/bitset_stats.h (bitset_stats_bytes): Likewise. + * lib/bitsetv.c (bitsetv_alloc): Likewise. + * lib/ebitset.c (ebitset_bytes): Likewise. + * lib/ebitset.h (ebitset_bytes): Likewise. + * lib/lbitset.c (lbitset_bytes): Likewise. + * lib/lbitset.h (lbitset_bytes): Likewise. + + * lib/abitset.c (abitset_empty_p, abitset_not, abitset_equal_p, + abitset_subset_p, abitset_disjoint_p, abitset_and, + abitset_and_cmp, abitset_andn, abitset_andn_cmp, abitset_or, + abitset_or_cmp, abitset_xor, abitset_xor_cmp, abitset_and_or, + abitset_and_or_cmp, abitset_andn_or, abitset_andn_or_cmp, + abitset_or_and, abitset_or_and_cmp): + Use bitset_windex instead of unsigned int. + * lib/bitsetv.c (bitsetv_dump, debug_bitsetv): Likewise. + * lib/ebitset.c (struct ebitset_struct.size, ebitset_elts_grow, + ebitset_elt_add, ebitset_elt_remove, ebitset_weed, + ebitset_elt_find, ebitset_list_reverse, ebitset_list, ebitset_init): + Likewise. + * lib/lbitset.c (lbitset_ones, lbitset_not): Likewise. + + * lib/bitset.c (bitset_print): + Use proper printf formats for widths of integer types. + * lib/bitset_stats.c (bitset_percent_histogram_print, + bitset_log_histogram_print, bitset_stats_print_1): Likewise. + * lib/bitsetv-print.c (bitsetv_matrix_dump): Likewise. + * lib/bitsetv.c (bitsetv_dump, debug_bitsetv): Likewise. + * lib/lbitset.c (lbitset_bytes): Likewise. + + * lib/bbitset.h (BITSET_BINDEX_MAX, BITSET_WINDEX_MAX, + BITSET_SIZE_MAX): New macros. + (BITSET_INDEX_MAX): Remove. It wasn't right, since it assumed that + sizeof (bitset_word) == sizeof (bitset_windex). All uses changed + to BITSET_WINDEX_MAX. + + * lib/bitset.c (bitset_next, bitset_prev, bitset_first, + bitset_last): Return BITSET_BINDEX_MAX (not -1) for no value, + since we now return the bitset_bindex type (not int). + + * lib/bitsetv.c (bitsetv_alloc): Check for arithmetic overflow + when computing sizes. + * lib/ebitset.c (ebitset_elts_grow): Likewise. + + * lib/lbitset.c (lbitset_elt_find): Simplify windex calculation + and avoid cast to unsigned. + +2002-09-30 Akim Demaille + + * lib/abitset.c, lib/bbitset.h, lib/bitset.c, lib/bitset.h, + * lib/bitset_stats.c, lib/bitsetv.c, lib/ebitset.c, lib/lbitset.c: + Updates from Michael Hayes. + +2002-09-30 Art Haas + + * configure.ac: Update AC_OUTPUT and AM_CONFIG_HEADER + invocations. + * tests/cxx-type.at (declarator): Don't rely on NDEBUG being not + defined. + +2002-09-27 Akim Demaille + + Version 1.49c. + +2002-09-27 Akim Demaille + + * configure.ac (AM_INIT_AUTOMAKE): We _need_ 1.7. + (Because of AC_LIBSOURCE). + +2002-09-27 Akim Demaille + + Playing with Autoscan. + + * configure.ac: Remove the old LIBOBJ tweaks. + (AC_REPLACE_FUNCS): Add strrchr and strtol. + * lib/strrchr.c: New. + * lib/strtol.c: New, from the Coreutils 4.5.1. + +2002-09-27 Akim Demaille + + Playing with Autoscan. + + * m4/prereq.m4 (jm_PREREQ_ARGMATCH, jm_FUNC_ARGMATCH): New. + * lib/Makefile.am (libbison_a_SOURCES): No longer include + argmatch.c and argmatch.h, since they are AC_LIBSOURCE'd. + * lib/strcasecmp.c, lib/strncasecmp.c, lib/memcmp.c: New, from the + Coreutils 4.5.1. + +2002-09-24 Akim Demaille + + * doc/bison.texinfo (Stack Overflow): xref to Recursion. + (Frequently Asked Questions, Parser Stack Overflow): New. + +2002-09-13 Akim Demaille + + Playing with autoscan. + + * src/reader.c (get_merge_function): Use xstrdup, not strdup. + * src/files.c (skeleton_find): Remove, unused. + * m4/memcmp.m4: New, from the Coreutils 4.5.1. + * m4/prereq.m4 (jm_PREREQ_QUOTEARG): Run jm_FUNC_MEMCMP. + +2002-09-13 Akim Demaille + + * configure.ac (AM_INIT_AUTOMAKE): Require Automake 1.6.3. + * Makefile.am (AUTOMAKE_OPTIONS): Don't. + +2002-09-13 Akim Demaille + + * configure.ac: Require 2.54. + s/jm_FUNC_MALLOC/AC_FUNC_MALLOC/. + s/jm_FUNC_REALLOC/AC_FUNC_REALLOC/. + * m4/c-bs-a.m4, m4/malloc.m4, m4/mbstate_t.m4, m4/realloc.m4: + Remove, provided by Autoconf macros. + +2002-09-12 Akim Demaille + + * m4/prereq.m4: Update, from Coreutils 4.5.1. + +2002-09-12 Akim Demaille + + * m4/prereq.m4: Update, from Fileutils 4.1.5. + * configure.ac (jm_PREREQ_TEMPNAME): Invoke it. + Reported by Martin Mokrejs. + +2002-09-10 Akim Demaille + + * src/parse-gram.y: Associate a human readable string to each + token type. + * tests/regression.at (Invalid inputs): Adjust. + +2002-09-10 Gary V. Vaughan + + * tests/Makefile.am ($(srcdir)/package.m4): Bison now ships + with an Autoconf-2.5x style configure.ac. + +2002-09-06 Paul Eggert + + * doc/bison.texinfo (Conditions): Make explicit that the GPL + exception applies only to yacc.c. This is a modification of a + patch originally suggested by Akim Demaille. + +2002-09-06 Akim Demaille + + * data/c.m4 (b4_copyright): Move the GPL exception comment from + here to... + * data/yacc.c: here. + + * data/lalr1.cc (struct yyltype): Don't define it, since we use + LocationType. + (b4_ltype): Default to yy::Location from location.hh. + +2002-09-04 Jim Meyering + + * data/yacc.c: Guard the declaration of yytoknum also with + `#ifdef YYPRINT', so it is declared only when used. + +2002-09-04 Akim Demaille + + * configure.in: Rename as... + * configure.ac: this. + Bump to 1.49c. + +2002-09-04 Akim Demaille + + * src/assoc.c, src/closure.c, src/gram.c, src/injections.c, + * src/lalr.c, src/LR0.c, src/relation.c, src/tables.c: Don't + translate maintainer only messages. + +2002-08-12 Paul Eggert + + Version 1.49b. + + * Makefile.am (SUBDIRS): Remove intl. + (DISTCLEANFILES): Remove. + * NEWS: Mention that GNU M4 is now required. Clarify what is + meant by "larger grammars". Mention the pt_BR translation. + * configure.in (AC_CHECK_DECLS): Add getenv, getopt. + (AM_GNU_GETTEXT_VERSION): New macro, replacing GETTEXT_VERSION var. + Bump version from 0.11.2 to 0.11.5. + (BISON_PREREQ_STAGE): Remove. + (AM_GNU_GETTEXT): Use external gettext. + (AC_OUTPUT): Remove intl/Makefile. + + * config/depcomp, config/install-sh: Sync with Automake 1.6.3. + + * data/glr.c: Include string.h, for strlen. + (yyreportParseError): Use size_t for yysize. + (yy_yypstack): No longer nested inside yypstates, as nested + functions are not portable. Do not assume size_t is the + same width as int. + (yypstates): Do not assume that ptrdiff_t is the same width + as int, and similarly for yyposn and YYINDEX. + + * data/yacc.c: Fix comment about `$$ = $1': it can copy garbage. + + * lib/Makefile.am (INCLUDES): Do not include from the intl + directory, which has been removed. + * src/Makefile.am (INCLUDES): Likewise. + + * lib/Makefile.am (libbison_a_SOURCES): Add unlocked-io.h. + (bitsets_sources, additional_bitsets_sources, timevars_sources): + New vars. + + * lib/Makefile.am (libbison_a_SOURCES): Avoid +=, a GNU make extension. + * tests/Makefile.am (EXTRA_DIST): Likewise. + + * lib/abitset.c (abitset_reverse_list, ebitset_reverse_list): + Do not assume that bitset_windex is the same width as unsigned. + + * lib/abitset.c (abitset_unused_clear): Do not assume that + bitset_word is the same width as int. + * lib/bbitset.h (BITSET_INDEX_MAX, BITSET_MSB): Likewise. + * lib/bitset.h (bitset_set, bitset_reset): Likewise. + * lib/bitset_stats.c (bitset_stats_set, bitset_stats_reset): Likewise. + * lib/ebitset.c (ebitset_set, ebitset_reset): Likewise. + * lib/lbitset.c (lbitset_set, lbitset_reset): Likewise. + + * lib/abitset.c (abitset_op1): Use -1, not ~0, as memset arg (for + portability to one's complement hosts!). + * lib/ebitset.c (ebitset_op1): Likewise. + * lib/lbitset.c (lbitset_op1): Likewise. + + * lib/argmatch.c, lib/quotearg.c, quotearg.h: Sync with GNU tar. + * lib/argmatch.h, lib/basename.c, lib/dirname.c, lib/dirname.h, + lib/hash.c, lib/hash.h, lib/strnlen.c, lib/xmalloc.c: + Sync with fileutils. + * lib/error.c, lib/getopt.c, lib/getopt.h, lib/getopt1.c, + lib/gettext.h: Sync with diffutils. + + * lib/memrchr.c, lib/mkstemp.c, lib/strchr.c, lib/strnlen.c, + lib/strspn.c, lib/tempname.c: Use GPL, not LGPL. + + * lib/obstack.c, lib/obstack.h: Sync with fileutils, except use + PROTOTYPES to check for prototypes, and "defined __STDC__" to + check for void *. + + * lib/bbitset.h (BITSET_WORD_BITS): Now of type unsigned, not + size_t; the old version tried to do this but casted improperly. + (bitset_bindex, bitset_windex): Now size_t, not unsigned long. + (bitset_test): Now returns int, not unsigned long. + + * lib/bitset_stats.c: Include "gettext.h". + (_): New macro. + (bitset_stats_set, bitset_stats_reset, bitset_stats_test): Don't + name locals "index", as it generates unnecessary warnings on some + hosts that have an "index" function. + + * lib/bitset_stats.c (bitset_stats_print_1, bitset_stats_print, + bitset_stats_read, bitset_stats_write): Wrap strings in _() if + they need translation. + * src/LR0.c (state_list_append, new_itemsets, get_state, + append_states, generate_states): Likewise. + * src/assoc.c (assoc_to_string): Likewise. + * src/closure.c (print_closure, set_firsts, closure): Likewise. + * src/gram.c (grammar_dump): Likewise. + * src/injections.c (injections_compute): Likewise. + * src/lalr.c (lookaheads_print): Likewise. + * src/relation.c (relation_transpose): Likewise. + * src/scan-gram.l: Likewise. + * src/tables.c (table_grow, pack_vector): Likewise. + + * m4/Makefile.am (EXTRA_DIST): Remove codeset.m4, + glibc21.m4, isc-posix.m4 lcmessage.m4, stage.m4. + * m4/malloc.m4, m4/realloc.m4: Sync with diffutils. + * m4/mbstate_t.m4: Sync with fileutils. + * m4/prereq.m4 (jm_PREREQ_QUOTEARG): AC_MBSTATE_T -> AC_TYPE_MBSTATE_T. + + * po/LINGUAS: Add pt_BR. + * po/POTFILES.in: Add src/assoc.c, src/closure.c, src/gram.c, + src/main.c, src/relation.c, src/state.c, lib/bitset_stats.c, + lib/timevar.c. + Use src/parse-gram.y instead of src/parse-gram.c, as the gettext + manual recommends. + Similarly, use src/scan-gram.l instead of src/scan-gram.c. + + * src/complain.c (strerror_r): Remove decl; not needed. + (strerror): Use same pattern as ../lib/error.c. + + * src/files.c, src/files.h (compute_header_macro): Remove; unused. + + * src/gram.c (grammar_dump): Do not assume ptrdiff_t fits in int. + + * src/main.c (main): Cast result of bindtextdomain and textdomain + to void, to avoid a GCC warning when --disable-nls is in effect. + + * src/scan-gram.l: Use strings rather than escapes when possible, + to minimize the number of warnings from xgettext. + (handle_action_dollar, handle_action_at): Don't use isdigit, + as it mishandles negative chars and it may not work as expected + outside the C locale. + + * src/symtab.c (symbol_get): Don't cast LHS of an assignment; + this is a GCC extension and is not portable to other compilers. + + * src/system.h (alloca): Use same pattern as ../lib/error.c. + Do not include ; no longer needed. + Do not include ; no longer needed (and generates + warnings on OpenBSD 3.0). + + * tests/cxx-type.at (yylex): Do not pass signed char to isupper; + it's not portable. + + * tests/regression.at: Do not use 'cc -c input.c -o input'; + Sun C rejects this. Instead, use 'cc -c input.c -o input.o'. + + * tests/synclines.at (AC_SYNCLINES_COMPILE): Accept any nonzero + exit status as failure, not just exit status 1. Sun C exits + with status 2 sometimes. + + * tests/torture.at (AT_INCREASE_DATA_SIZE): New macro. + Use it for the two large tests. + +2002-08-02 Akim Demaille + + * src/conflicts.c (conflicts_output): Don't output rules never + reduced here, since anyway that computation doesn't work. + * src/gram.h, src/gram.h (rule_filter_t, rule_useful_p) + (rule_useless_p, rule_never_reduced_p): New. + (grammar_rules_partial_print): Use a filter instead of a range. + Display the title only if needed. + (grammar_rules_print): Adjust. + (grammar_rules_never_reduced_report): New. + * src/tables.c (action_row): Move the computation of rules never + reduced to... + (token_actions): here. + * src/main.c (main): Make the parser before making the report, so + that rules never reduced are computed. + Call grammar_rules_never_reduced_report. + * src/print.c (print_results): Report rules never reduced. + * tests/conflicts.at, tests/reduce.at: Adjust. + +2002-08-01 Akim Demaille + + Instead of attaching lookaheads and duplicating the rules being + reduced by a state, attach the lookaheads to the reductions. + + * src/state.h (state_t): Remove the `lookaheads', + `lookaheads_rule' member. + (reductions_t): Add a `lookaheads' member. + Use a regular array for the `rules'. + * src/state.c (reductions_new): Initialize the lookaheads member + to 0. + (state_rule_lookaheads_print): Adjust. + * src/state.h, src/state.c (state_reductions_find): New. + * src/conflicts.c (resolve_sr_conflict, set_conflicts) + (count_rr_conflicts): Adjust. + * src/lalr.c (LArule): Remove. + (add_lookback_edge): Adjust. + (state_lookaheads_count): New. + (states_lookaheads_initialize): Merge into... + (initialize_LA): this. + (lalr_free): Adjust. + * src/main.c (main): Don't free nullable and derives too early: it + is used by --verbose. + * src/print.c, src/print_graph.c, src/tables.c: Adjust. + +2002-08-01 Akim Demaille + + * src/derives.h, src/derives.c (derives): A `rule_t***' instead of + `rule_number_t**'. + (set_derives, free_derives): Rename as... + (derives_compute, derives_free): this. + Adjust all dependencies. + * src/nullable.c (set_nullable, free_nullable): Rename as... + (nullable_compute, nullable_free): these. + (rule_list_t): Store rule_t *, not rule_number_t. + * src/state.c (state_rule_lookaheads_print): Directly compare rule + pointers, instead of their numbers. + * src/main.c (main): Call nullable_free, and derives_free earlier, + as they were lo longer used. + +2002-08-01 Akim Demaille + + * lib/timevar.c (get_time): Include children time. + * src/lalr.h (LA, LArule): Don't export them: used with the + state_t. + * src/lalr.c (LA, LArule): Static. + * src/lalr.h, src/lalr.c (lalr_free): New. + * src/main.c (main): Call it. + * src/tables.c (pack_vector): Check whether loc is >= to the + table_size, not >. + (pack_tables): Don't free froms, tos, conflict_tos, and pos... + (tables_generate): do it, since that's also it which allocates + them. + Don't free LA and LArule, main does. + +2002-07-31 Akim Demaille + + Separate parser tables computation and output. + + * src/output.c (nvectors, base_t, base, base_ninf, conflict_table) + (conflict_list, conflict_list_cnt, table, check, table_ninf) + (yydefgoto, yydefact, high): Move to... + * src/tables.h, src/tables.c: here. + * src/output.c (vector_number_t, VECTOR_NUMBER_MAX) + (VECTOR_NUMBER_MIN, state_number_to_vector_number) + (symbol_number_to_vector_number, nvectors, BASE_MAX, BASE_MIN) + (froms, tos, conflict_tos, tally, width, action_t, ACTION_MAX) + (ACTION_MIN, actrow, order, nentries, pos, conflrow) + (conflict_list_free, table_size, lowzero, table_grow, conflict_row) + (action_row, save_row, token_actions, save_column, default_goto) + (goto_actions, sort_actions, matching_state, pack_vector) + (table_ninf_remap, pack_table, prepare_actions): Move to... + * src/tables.c: here. + * src/tables.h, src/tables.c(tables_generate, tables_free): New. + * src/output.c (token_actions, output_base, output_conflicts) + (output_check): Merge into... + (prepare_actions): this. + (actions_output): Rename as... + (user_actions_output): this. + * src/main.c (main): Call tables_generate and tables_free. + +2002-07-31 Akim Demaille + + Steal GCC's --time-report support. + + * lib/timevar.c, lib/timevar.h, lib/timevar.def: New, + stolen/adjusted from GCC. + * m4/stage.m4: Remove time related checks. + * m4/timevar.m4: New. + * configure.in: Adjust. + * src/system.h: Adjust to using timevar.h. + * src/getargs.h, src/getargs.c: Support trace_time for + --trace=time. + * src/main.c (stage): Remove. + (main): Replace `stage' invocations with timevar calls. + * src/output.c: Insert pertinent timevar calls. + +2002-07-31 Akim Demaille + + Let --trace have arguments. + + * src/getargs.h (enum trace_e): New. + * src/getargs.c (trace_args, trace_types, trace_argmatch): New. + (long_options, short_options): --trace/-T takes an optional + argument. + Change all the uses of trace_flag to reflect the new flags. + * tests/sets.at (Firsts, Nullable, Broken Closure): Use --trace=sets. + + Strengthen `stage' portability. + + * m4/stage.m4 (BISON_PREREQ_STAGE): New. + * configure.in: Use it. + Don't check for malloc.h and sys/times.h. + * src/system.h: Include them when appropriate. + * src/main.c (stage): Compile only when mallinfo, struct mallinfo, + times and struct tms are available. + +2002-07-30 Akim Demaille + + In verbose parse error message, don't report `error' as an + expected token. + * tests/actions.at (Printers and Destructors): Adjust. + * tests/calc.at (Calculator $1): Adjust. + * data/yacc.c, data/glr.c, data/lalr1.c: When making the verbose + error message, do not report the parser accepts the error token in + that state. + +2002-07-30 Akim Demaille + + Normalize conflict related messages. + + * src/complain.h, src/complain.c (warn, complain): New. + * src/conflicts.c (conflicts_print): Use them. + (conflict_report_yacc): New, extracted from... + (conflicts_print): here. + * tests/conflicts.at, tests/existing.at: Adjust. + +2002-07-30 Akim Demaille + + Report rules which are never reduced by the parser: those hidden + by conflicts. + + * src/LR0.c (save_reductions): Don't make the final state too + different: save its reduction (accept) instead of having a state + without any action (no shift or goto, no reduce). + Note: the final state is now a ``regular'' state, i.e., the + parsers now contain `reduce 0' as default reduction. + Nevertheless, since they decide to `accept' when yystate = + final_state, they still will not reduce rule 0. + * src/print.c (print_actions, print_reduction): Adjust. + * src/output.c (action_row): Track reduced rules. + (token_actions): Report rules never reduced. + * tests/conflicts.at, tests/regression.at: Adjust. + +2002-07-30 Akim Demaille + + `stage' was accidently included in a previous patch. + Initiate its autoconfiscation. + + * configure.in: Look for malloc.h and sys/times.h. + * src/main.c (stage): Adjust. + Report only when trace_flag. + +2002-07-29 Akim Demaille + + * src/state.h, src/state.c (transitions_t): Holds state_t*'s, not + state_number_t. + (errs_t): symbol_t*, not symbol_number_t. + (reductions_t): rule_t*, not rule_number_t. + (FOR_EACH_SHIFT): New. + * src/LR0.c, src/conflicts.c, src/lalr.c, src/output.c + * src/print.c, src/print_graph.c: Adjust. + +2002-07-29 Akim Demaille + + Use $accept and $end, as BYacc and BTYacc do, instead of $axiom and $. + + * src/symtab.h, src/symtab.c (eoftoken, axiom): Rename as... + (endtoken, accept): these. + * src/reader.c (reader): Set endtoken's default tag to "$end". + Set undeftoken's tag to "$undefined" instead of "$undefined.". + * doc/bison.texinfo (Table of Symbols): Mention $accept and $end. + Adjust. + +2002-07-29 Akim Demaille + + * src/reduce.c (reduce_grammar): When the language is empty, + complain about the start symbol, not the axiom. + Use its location. + * tests/reduce.at (Empty Language): New. + +2002-07-26 Akim Demaille + + * src/reader.h, src/reader.c (gram_error): ... can't get + yycontrol without making too strong assumptions on the parser + itself. + * src/output.c (prepare_tokens): Use the real 0th value of + token_translations instead of `0'. + * src/parse-gram.y (yyerror): Don't rely on yycontrol being + visible here. + * data/yacc.c (yyreport_parse_error): Rename yylocation as yylloc + for the time being: %locations ought to provide it to yyerror. + +2002-07-25 Akim Demaille + + * src/output.c (prepare_tokens): Go up to ntokens, not ntokens + 1. + * doc/bison.texinfo (Decl Summary): s/$illegal/$undefined./. + * tests/regression.at (Web2c Actions): Adjust. + +2002-07-25 Akim Demaille + + Stop storing rules from 1 to nrules + 1. + + * src/LR0.c, src/closure.c, src/derives.c, src/gram.c, src/lalr.c + * src/nullable.c, src/output.c, src/print.c, src/reader.c + * src/reduce.c: Allocate and free from &rules[0], not &rules[1]. + Iterate from 0 to nrules. + Use rule_number_as_item_number and item_number_as_rule_number. + Adjust to `derive' now containing possibly 0. + * src/gram.h (rule_number_as_item_number, item_number_as_rule_number): + Handle the `- 1' part in rule numbers from/to item numbers. + * src/conflicts.c (log_resolution): Fix the message which reversed + shift and reduce. + * src/output.c (action_row): Initialize default_rule to -1. + (token_actions): Adjust. + * tests/sets.at (Nullable, Firsts): Fix the previously bogus + expected output. + * tests/conflicts.at (Resolved SR Conflicts): Likewise. + +2002-07-25 Akim Demaille + + * data/c.m4 (b4_c_function, b4_c_ansi_args, b4_c_ansi_arg) + (b4_c_knr_arg_names, b4_c_knr_arg_name, b4_c_knr_arg_decls) + (b4_c_knr_arg_decl): New. + * data/yacc.c: Use it to define yysymprint, yydestruct, and + yyreport_parse_error. + +2002-07-25 Akim Demaille + + * data/yacc.c (yyreport_parse_error): New, extracted from... + (yyparse): here. + (yydestruct, yysymprint): Move above yyparse. + Be K&R compliant. + +2002-07-25 Akim Demaille + + * data/c.m4 (b4_ints_in, b4_int_type, b4_int_type_for): New, + replace... + (b4_sint_type, b4_uint_type): these. + * data/yacc.c, data/glr.c, data/lalr1.cc: Use b4_int_type_for. + * tests/regression.at (Web2c Actions): Adjust. + +2002-07-25 Akim Demaille + + * src/gram.h (TIEM_NUMBER_MAX): New. + (item_number_of_rule_number, rule_number_of_item_number): Rename + as... + (rule_number_as_item_number, item_number_as_rule_number): these. + Adjust dependencies. + * src/output.c (vector_number_t, VECTOR_NUMBER_MAX) + (VECTOR_NUMBER_MIN, state_number_to_vector_number) + (symbol_number_to_vector_number): New. + (order): Of vector_number_t* type. + (base_t, BASE_MAX, BASE_MIN): New. + (froms, tos, width, pos, check): Of base_t type. + (action_number_t, ACTION_MIN, ACTION_MAX): New. + (actrow): Of action_number_t type. + (conflrow): Of unsigned int type. + (table_ninf, base_ninf): New. + (GENERATE_MUSCLE_INSERT_TABLE): Also output the `*_min' value. + (muscle_insert_int_table, muscle_insert_base_table) + (muscle_insert_rule_number_table): New. + (prepare_tokens): Output `toknum' as int_table. + (action_row): Returns a rule_number_t. + Use ACTION_MIN, not SHRT_MIN. + (token_actions): yydefact is rule_number_t*. + (table_ninf_remap): New. + (pack_table): Use it for `base' and `table'. + * data/yacc.c, data/glr.c, data/lalr1.cc (YYFLAG): Remove, + replaced with... + (YYPACT_NINF, YYTABLE_NINF): these. + (yypact, yytable): Compute their types instead of hard-coded + `short'. + * tests/regression.at (Web2c Actions): Adjust. + +2002-07-19 Akim Demaille + + * src/scan-gram.l (id): Can start with an underscore. + +2002-07-16 Akim Demaille + + * src/assoc.c, src/asssoc.h (assoc_t, assoc_to_string): New. + Adjust all former `associativity' dependencies. + * src/symtab.c (symbol_new): Default associativity is `undef', not + `right'. + (symbol_check_alias_consistence): Adjust. + +2002-07-09 Akim Demaille + + * doc/bison.texinfo: Properly set the ``header'' part. + Use @dircategory ``GNU programming tools'' as per Texinfo's + documentation. + Use @copying. + +2002-07-09 Akim Demaille + + * lib/quotearg.h: Protect against multiple inclusions. + * src/location.h (location_t): Add a `file' member. + (LOCATION_RESET, LOCATION_PRINT): Adjust. + * src/complain.c (warn_at, complain_at, fatal_at): Drop + `error_one_per_line' support. + +2002-07-09 Akim Demaille + + * src/complain.h, src/complain.c (warn, complain): Remove, unused. + * src/reader.c (lineno): Remove. + Adjust all dependencies. + (get_merge_function): Take a location and use complain_at. + * src/symtab.h, src/symtab.c (symbol_make_alias): Likewise. + * tests/regression.at (Invalid inputs, Mixing %token styles): + Adjust. + +2002-07-09 Akim Demaille + + * src/parse-gram.y (rules_or_grammar_declaration): Add an error + recovery rule, and forbid extensions when --yacc. + (gram_error): Use complain_at. + * src/reader.c (reader): Exit if there were parse errors. + +2002-07-09 Akim Demaille + + * tests/synclines.at (AT_SYNCLINES_COMPILE): New. + (AT_TEST_SYNCLINE): Adjust to unusual GCC outputs. + Reported by R Blake . + +2002-07-09 Akim Demaille + + * data/yacc.c: Output the copyright notive in the header. + +2002-07-03 Akim Demaille + + * src/output.c (froms, tos): Are state_number_t. + (save_column): sp, sp1, and sp2 are state_number_t. + (prepare): Rename `final' as `final_state_number', `nnts' as + `nterms_number', `nrules' as `rules_number', `nstates' as + `states_number', and `ntokens' as `tokens_number'. Remove `nsym', + unused. + * data/yacc.c, data/glr.c, data/lalr1.cc: Adjust. + * data/lalr1.cc (nsym_): Remove, unused. + +2002-07-03 Akim Demaille + + * src/lalr.h, src/lalr.c (goto_number_t): New. + * src/lalr.c (goto_list_t): New. + Propagate them. + * src/nullable.c (rule_list_t): New. + Propagate. + * src/types.h: Remove. + +2002-07-03 Akim Demaille + + * src/closure.c (print_fderives): Use rule_rhs_print. + * src/derives.c (print_derives): Use rule_rhs_print. + (rule_list_t): New, replaces `shorts'. + (set_derives): Add comments. + * tests/sets.at (Nullable, Firsts): Adjust. + +2002-07-03 Akim Demaille + + * src/output.c (prepare_actions): Free `tally' and `width'. + (prepare_actions): Allocate and free `order'. + * src/symtab.c (symbols_free): Free `symbols'. + * src/scan-gram.l (scanner_free): Clear Flex's scanners memory. + * src/output.c (m4_invoke): Move to... + * src/scan-skel.l: here. + (<>): Close yyout, and free its name. + +2002-07-03 Akim Demaille + + Fix some memory leaks, and fix a bug: state 0 was examined twice. + + * src/LR0.c (new_state): Merge into... + (state_list_append): this. + (new_states): Merge into... + (generate_states): here. + (set_states): Don't ensure a proper `errs' state member here, do it... + * src/conflicts.c (conflicts_solve): here. + * src/state.h, src/state.c: Comment changes. + (state_t): Rename member `shifts' as `transitions'. + Adjust all dependencies. + (errs_new): For consistency, also take the values as argument. + (errs_dup): Remove. + (state_errs_set): New. + (state_reductions_set, state_transitions_set): Assert that no + previous value was assigned. + (state_free): New. + (states_free): Use it. + * src/conflicts.c (resolve_sr_conflict): Don't use an `errs_t' as + temporary storage: use `errs' and `nerrs' as elsewhere. + (set_conflicts): Allocate and free this `errs'. + +2002-07-02 Akim Demaille + + * lib/libiberty.h: New. + * lib: Update the bitset implementation from upstream. + * src/closure.c, src/lalr.c, src/output.c, src/print_graph.c, + * src/state.c: Use BITSET_FOR_EACH, not BITSET_EXECUTE. + * src/main.c: Adjust bitset stats calls. + +2002-07-01 Paul Eggert + + * src/scan-gram.l (): Convert to unsigned + char, so that negative chars don't collide with $. + +2002-06-30 Akim Demaille + + Have the GLR tests be `warning' checked, and fix the warnings. + + * data/glr.c (YYFPRINTF): Always define it, not only when YYDEBUG + (yyuserAction, yyreportAmbiguity): `Use' all the arguments. + (yyremoveDeletes): `yyi' and `yyj' are size_t. + Use YYFPRINTF when under if (YYDEBUG) to avoid empty `if' bodies. + (yyaddDeferredAction): static. + (yyglrReduce): yyi, yyk, amd yyposn are size_t. + (yyreportParseError): yyprefix is const. + yytokenp is used only when verbose. + (yy__GNUC__): Replace with __GNUC__. + (yypdumpstack): yyi is size_t. + (yypreference): Un-yy local variables and arguments, to avoid + clashes with `yyr1'. Anyway, we are not in the user name space. + (yytname_size): be an int, as is compared with ints. + * tests/testsuite.at (AT_COMPILE, AT_PARSER_CHECK): New. + Use them. + * tests/cxx-gram.at: Use quotation to protect $1. + Use AT_COMPILE to enable warnings hunts. + Prototype yylex and yyerror. + `Use' argc. + Include `string.h', not `strings.h'. + Produce and prototype stmtMerge only when used. + yylex takes a location. + +2002-06-30 Akim Demaille + + We spend a lot of time in quotearg, in particular when --verbose. + + * src/symtab.c (symbol_get): Store a quoted version of the key. + (symbol_tag_get, symbol_tag_get_n, symbol_tag_print): Remove. + Adjust all callers. + +2002-06-30 Akim Demaille + + * src/state.h (reductions_t): Rename member `nreds' as num. + (errs_t): Rename members `nerrs' and `errs' as `num' and `symbols'. + * src/state.c (ERRS_ALLOC, REDUCTIONS_ALLOC): Use the correct types. + +2002-06-30 Akim Demaille + + * src/state.h, src/state.c (shift_t, SHIFT_SYMBOL, SHIFT_IS_SHIFT) + (SHIFT_IS_GOTO, SHIFT_IS_ERROR, SHIFT_DISABLE, SHIFT_IS_DISABLED) + (shifts_to): Rename as... + (transition_t, TRANSITION_SYMBOL, TRANSITION_IS_TRANSITION) + (TRANSITION_IS_GOTO, TRANSITION_IS_ERROR, TRANSITION_DISABLE) + (TRANSITION_IS_DISABLED, transitions_to): these. + +2002-06-30 Akim Demaille + + * src/print.c (print_shifts, print_gotos): Merge into... + (print_transitions): this. + (print_transitions, print_errs, print_reductions): Align the + lookaheads columns. + (print_core, print_transitions, print_errs, print_state, + print_grammar): Output empty lines separator before, not after. + (state_default_rule_compute): Rename as... + (state_default_rule): this. + * tests/conflicts.at (Defaulted Conflicted Reduction), + (Unresolved SR Conflicts, Resolved SR Conflicts): Adjust. + * tests/regression.at (Rule Line Numbers, Web2c Report): Adjust. + +2002-06-30 Akim Demaille + + Display items as we display rules. + + * src/gram.h, src/gram.c (rule_lhs_print): New. + * src/gram.c (grammar_rules_partial_print): Use it. + * src/print.c (print_core): Likewise. + * tests/conflicts.at (Defaulted Conflicted Reduction), + (Unresolved SR Conflicts): Adjust. + (Unresolved SR Conflicts): Adjust and rename as... + (Resolved SR Conflicts): this, as was meant. + * tests/regression.at (Web2c Report): Adjust. + +2002-06-30 Akim Demaille + + * src/print.c (state_default_rule_compute): New, extracted from... + (print_reductions): here. + Pessimize, but clarify the code. + * tests/conflicts.at (Defaulted Conflicted Reduction): New. + +2002-06-30 Akim Demaille + + * src/output.c (action_row): Let default_rule be always a rule + number. + +2002-06-30 Akim Demaille + + * src/closure.c (print_firsts, print_fderives, closure): + Use BITSET_EXECUTE. + * src/lalr.c (lookaheads_print): Likewise. + * src/state.c (state_rule_lookaheads_print): Likewise. + * src/print_graph.c (print_core): Likewise. + * src/print.c (print_reductions): Likewise. + * src/output.c (action_row): Likewise. + Use SHIFT_IS_DISABLED, SHIFT_IS_SHIFT and SHIFT_SYMBOL. + +2002-06-30 Akim Demaille + + * src/print_graph.c: Use report_flag. + +2002-06-30 Akim Demaille + + * src/lalr.c (traverse, digraph, matrix_print, transpose): Move + to... + * src/relation.h, src/relation.c (traverse, relation_digraph) + (relation_print, relation_transpose): New. + +2002-06-30 Akim Demaille + + * src/state.h, src/state.c (shifts_to): New. + * src/lalr.c (build_relations): Use it. + +2002-06-30 Akim Demaille + + * src/gram.h (rule_number_t, RULE_NUMBER_MAX, int_of_rule_number) + (item_number_of_rule_number, rule_number_of_item_number): New. + * src/LR0.c, src/closure.c, src/derives.c, src/derives.h, + * src/gram.c, src/lalr.c, src/nullable.c, src/output.c, src/print.c, + * src/print_graph.c, src/reader.c, src/reduce.c, src/reduce.h: + Propagate their use. + Much remains to be done, in particular wrt `shorts' from types.h. + +2002-06-30 Akim Demaille + + * src/symtab.c (symbol_new): Initialize the `printer' member. + +2002-06-30 Akim Demaille + + * src/LR0.c (save_reductions): Remove, replaced by... + * src/state.h, src/state.c (state_reductions_set): New. + (reductions, errs): Rename as... + (reductions_t, errs_t): these. + Adjust all dependencies. + +2002-06-30 Akim Demaille + + * src/LR0.c (state_list_t, state_list_append): New. + (first_state, last_state): Now symbol_list_t. + (this_state): Remove. + (new_itemsets, append_states, save_reductions): Take a state_t as + argument. + (set_states, generate_states): Adjust. + (save_shifts): Remove, replaced by... + * src/state.h, src/state.c (state_shifts_set): New. + (shifts): Rename as... + (shifts_t): this. + Adjust all dependencies. + * src/state.h (state_t): Remove the `next' member. + +2002-06-30 Akim Demaille + + * src/vcg.c (quote): Use slot 2, since we often pass symbol tag + escaped in slot 0. + +2002-06-30 Akim Demaille + + Use hash.h for the state hash table. + + * src/LR0.c (STATE_HASH_SIZE, state_hash): Remove. + (allocate_storage): Use state_hash_new. + (free_storage): Use state_hash_free. + (new_state, get_state): Adjust. + * src/lalr.h, src/lalr.c (states): Move to... + * src/states.h (state_t): Remove the `link' member, no longer + used. + * src/states.h, src/states.c: here. + (state_hash_new, state_hash_free, state_hash_lookup) + (state_hash_insert, states_free): New. + * src/states.c (state_table, state_compare, state_hash): New. + * src/output.c (output_actions): Do not free states now, since we + still need to know the final_state number in `prepare', called + afterwards. Do it... + * src/main.c (main): here: call states_free after `output'. + +2002-06-30 Akim Demaille + + * src/state.h, src/state.c (state_new): New, extracted from... + * src/LR0.c (new_state): here. + * src/state.h (STATE_ALLOC): Move to... + * src/state.c: here. + * src/LR0.h, src/LR0.c (nstates, final_state): Move to... + * src/state.h, src/state.c: here. + +2002-06-30 Akim Demaille + + * src/reader.c (gensym): Rename as... + * src/symtab.h, src/symtab.c (dummy_symbol_get): this. + (getsym): Rename as... + (symbol_get): this. + +2002-06-30 Akim Demaille + + * src/state.h (state_number_t, STATE_NUMBER_MAX): New. + * src/LR0.c, src/LR0.h, src/conflicts.c, src/lalr.c, src/lalr.h, + * src/output.c, src/print.c, src/print_graph.c: Propagate. + * src/LR0.h, src/LR0.h (final_state): Is a state_t*. + +2002-06-30 Akim Demaille + + Make the test suite pass with warnings checked. + + * tests/actions.at (Printers and Destructors): Improve. + Avoid unsigned vs. signed issues. + * tests/calc.at: Don't exercise the scanner here, do it... + * tests/input.at (Torturing the Scanner): here. + +2002-06-28 Paul Hilfinger + + * data/glr.c: Correct typo in Emacs-mode directive. Slightly + reorganize first lines parallel to yacc.c. + +2002-06-28 Akim Demaille + + * data/c.m4 (b4_copyright, b4_sint_type, b4_uint_type, b4_token_define) + (b4_token_enum, b4_token_defines): New, factored from... + * data/lalr1.cc, data/yacc.c, glr.c: here. + +2002-06-28 Akim Demaille + + * data/yacc.c (yydestruct, yysymprint): Pacify GCC warnings for + unused variables. + * src/output.c (merger_output): static. + +2002-06-28 Akim Demaille + + * src/reader.h: s/grammer_current_rule_merge_set/grammar_.../. + * src/conflicts.c (conflicts_total_count): `i' is unsigned, to + pacify GCC. + * src/output.c (save_row): Initialize all the variables to pacify GCC. + +2002-06-27 Paul Hilfinger + + Accumulated changelog for new GLR parsing features. + + * src/conflicts.c (count_total_conflicts): Change name to + conflicts_total_count. + * src/conflicts.h: Ditto. + * src/output.c (token_actions): Use the new name. + (output_conflicts): Change conflp => conflict_list_heads, and + confl => conflict_list for better readability. + * data/glr.c: Use the new names. + * NEWS: Add self to GLR announcement. + + * src/reader.c (free_merger_functions): Cleanup: XFREE->free. + + * doc/bison.texinfo (GLR Parsers): Make corrections suggested by + Akim Demaille. + + * data/bison.glr: Change name to glr.c + * data/glr.c: Renamed from bison.glr. + * data/Makefile.am: Add glr.c + + * src/getargs.c: + + * src/symlist.h: Add dprec and merger fields to symbol_list_s. + * src/symlist.c (symbol_list_new): Initialize dprec and merger fields. + + Originally 2002-06-16 Paul Hilfinger + + * data/bison.glr: Be sure to restore the + current #line when returning to the skeleton contents after having + exposed the input file's #line. + + Originally 2002-06-13 Paul Hilfinger + + * data/bison.glr: Bring up to date with changes to bison.simple. + + Originally 2002-06-03 Paul Hilfinger + + * data/bison.glr: Correct definitions that use b4_prefix. + Various reformatting. + (GLRStack): Make yychar (in YYPURE case) and yytokenp as part of stack. + (yyreportParseError, yyrecoverParseError, yyprocessOneStack): remove + yytokenp argument; now part of stack. + (yychar): Define to behave as documented. + (yyclearin): Ditto. + + Originally 2002-05-14 Paul Hilfinger + + * src/reader.h: Add declaration for free_merger_functions. + + * src/reader.c (merge_functions): New variable. + (get_merge_function): New function. + (free_merger_functions): New function. + (readgram): Check for %prec that is not followed by a symbol. + Handle %dprec and %merge declarations. + (packgram): Initialize dprec and merger fields in rules array. + + * src/output.c (conflict_tos, conflrow, conflict_table, conflict_list, + conflict_list_cnt, conflict_list_free): New variables. + (table_grow): Also grow conflict_table. + (prepare_rules): Output dprec and merger tables. + (conflict_row): New function. + (action_row): Output conflict lists for GLR parser. Don't use + default reduction in conflicted states for GLR parser so that there + are spaces for the conflict lists. + (save_row): Also save conflict information. + (token_actions): Allocate conflict list. + (merger_output): New function. + (pack_vector): Pack conflict table, too. + (output_conflicts): New function to output yyconflp and yyconfl. + (output_check): Allocate conflict_tos. + (output_actions): Output conflict tables, also. + (output_skeleton): Output b4_mergers definition. + (prepare): Output b4_max_rhs_length definition. + Use 'bison.glr' as default skeleton for GLR parsers. + + * src/gram.c (glr_parser): New flag. + (grammar_free): Call free_merger_functions. + + * src/conflicts.c (count_rr_conflicts): Augment to optionally count + all pairs of conflicting reductions, rather than just all tokens + causing conflicts. Needed to size conflict tables. + (conflicts_output): Modify call to count_rr_conflicts for new + interface. + (conflicts_print): Ditto. + (count_total_conflicts): New function. + + * src/reader.h (merger_list): New type. + (merge_functions): New variable. + + * src/lex.h (tok_dprec, tok_merge): New token types. + + * src/gram.h (rule_s): Add dprec and merger fields. + (glr_parser): New flag. + + * src/conflicts.h (count_total_conflicts): New function. + + * src/options.c (option_table): Add %dprec, %merge, and %glr-parser. + + * doc/bison.texinfo (Generalized LR Parsing): New section. + (GLR Parsers): New section. + (Language and Grammar): Mention GLR parsing. + (Table of Symbols): Add %dprec, %glr-parser, %merge, GLR + Correct typo ("tge" -> "the"). + + * data/bison.glr: New skeleton for GLR parsing. + + * tests/cxx-gram.at: New tests for GLR parsing. + + * tests/testsuite.at: Include cxx-gram.at. + + * tests/Makefile.am: Add cxx-gram.at. + + * src/parse-gram.y: + + * src/scan-gram.l: Add %dprec, %glr-parser, %merge. + + * src/parse-gram.y: Grammar for %dprec, %merge, %glr-parser. + +2002-06-27 Akim Demaille + + * src/options.h, src/options.c: Remove. + * src/getargs.c (short_options, long_options): New. + +2002-06-27 Akim Demaille + + * data/bison.simple, data/bison.c++: Rename as... + * data/yacc.c, data/lalr1.cc: these. + * doc/bison.texinfo (Environment Variables): Remove. + +2002-06-25 Raja R Harinath + + * src/getargs.c (report_argmatch): Initialize strtok(). + +2002-06-20 Akim Demaille + + * data/bison.simple (b4_symbol_actions): New, replaces... + (b4_symbol_destructor, b4_symbol_printer): these. + (yysymprint): Be sure to call YYPRINT only for tokens, and using + user token numbers. + +2002-06-20 Akim Demaille + + * data/bison.simple (yydestructor): Rename as... + (yydestruct): this. + +2002-06-20 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_type_set) + (symbol_destructor_set, symbol_precedence_set): The location is + the last argument. + Adjust all callers. + +2002-06-20 Akim Demaille + + * src/parse-gram.y (YYPRINT, yyprint): Don't mess with the parser + internals. + * src/reader.h, src/reader.c (grammar_current_rule_prec_set): + Takes a location. + * src/symtab.h, src/symtab.c (symbol_class_set) + (symbol_user_token_number_set): Likewise. + Adjust all callers. + Promote complain_at. + * tests/input.at (Type Clashes): Adjust. + +2002-06-20 Akim Demaille + + * data/bison.simple (YYLEX): Fix the declaration when + %pure-parser. + +2002-06-20 Akim Demaille + + * data/bison.simple (yysymprint): Don't print the token number, + just its name. + * tests/actions.at (Destructors): Rename as... + (Printers and Destructors): this. + Also exercise %printer. + +2002-06-20 Akim Demaille + + * data/bison.simple (YYDSYMPRINT): New. + Use it to remove many of the #if YYDEBUG/if (yydebug). + +2002-06-20 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_t): printer and + printer_location are new members. + (symbol_printer_set): New. + * src/parse-gram.y (PERCENT_PRINTER): New token. + Handle its associated rule. + * src/scan-gram.l: Adjust. + (handle_destructor_at, handle_destructor_dollar): Rename as... + (handle_symbol_code_at, handle_symbol_code_dollar): these. + * src/output.c (symbol_printers_output): New. + (output_skeleton): Call it. + * data/bison.simple (yysymprint): New. Cannot be named yyprint + since there are already many grammar files with a user `yyprint'. + Replace the calls to YYPRINT to calls to yysymprint. + * tests/calc.at: Adjust. + * tests/torture.at (AT_DATA_STACK_TORTURE): Remove YYPRINT: it was + taking advantage of parser very internal details (stack size!). + +2002-06-20 Akim Demaille + + * src/scan-gram.l: Complete the scanner with the missing patterns + to pacify Flex. + Use `quote' and `symbol_tag_get' where appropriate. + +2002-06-19 Akim Demaille + + * tests/actions.at (Destructors): Augment to test locations. + * data/bison.simple (yydestructor): Pass it the current location + if locations are enabled. + Prototype only when __STDC__ or C++. + Change the argument names to move into the yy name space: there is + user code here. + +2002-06-19 Akim Demaille + + * data/bison.simple (b4_pure_if): New. + Use it instead of #ifdef YYPURE. + +2002-06-19 Akim Demaille + + * data/bison.simple (b4_location_if): New. + Use it instead of #ifdef YYLSP_NEEDED. + +2002-06-19 Akim Demaille + + Prepare @$ in %destructor, but currently don't bind it in the + skeleton, as %location use is not cleaned up yet. + + * src/scan-gram.l (handle_dollar, handle_destructor_at) + (handle_action_at): New. + (handle_at, handle_action_dollar, handle_destructor_dollar): Take + a braced_code_t and a location as additional arguments. + (handle_destructor_dollar): Instead of requiring `b4_eval', just + unquote one when outputting `b4_dollar_dollar'. + Adjust callers. + * data/bison.simple (b4_eval): Remove. + (b4_symbol_destructor): Adjust. + * tests/input.at (Invalid @n): Adjust. + +2002-06-19 Zack Weinberg + + * doc/bison.texinfo: Document ability to have multiple + prologue sections. + +2002-06-18 Akim Demaille + + * src/files.c (compute_base_names): When computing the output file + names from the input file name, strip the directory part. + +2002-06-18 Akim Demaille + + * data/bison.simple.new: Comment changes. + Reported by Andreas Schwab. + +2002-06-18 Matt Kraai + + * data/bison.simple (yyoverflowlab): #ifndef yyoverflow, so that + there are no `label `yyoverflowlab' defined but not used' warnings + when yyoverflow is defined. + +2002-06-18 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_t): destructor_location is a + new member. + (symbol_destructor_set): Adjust. + * src/output.c (symbol_destructors_output): Output the destructor + locations. + Output the symbol name. + * data/bison.simple (b4_symbol_destructor): Adjust. + +2002-06-18 Cris Bailiff + and Akim Demaille + + * data/bison.simple.new (yyerrlab1): Be sure to pop and destroy + what's left on the stack when the error recovery hits EOF. + * tests/actions.at (Destructors): Complete to exercise this case. + +2002-06-17 Akim Demaille + + * data/m4sugar/m4sugar.m4 (m4_map): Recognize when the list of + arguments is really empty, not only equal to `[]'. + * src/symtab.h, src/symtab.c (symbol_t): `destructor' is a new + member. + (symbol_destructor_set): New. + * src/output.c (symbol_destructors_output): New. + * src/reader.h (brace_code_t, current_braced_code): New. + * src/scan-gram.l (BRACED_CODE): Use it to branch on... + (handle_dollar): Rename as... + (handle_action_dollar): this. + (handle_destructor_dollar): New. + * src/parse-gram.y (PERCENT_DESTRUCTOR): New. + (grammar_declaration): Use it. + * data/bison.simple (yystos): Is always defined. + (yydestructor): New. + * tests/actions.at (Destructors): New. + * tests/calc.at (_AT_CHECK_CALC_ERROR): Don't rely on egrep. + +2002-06-17 Akim Demaille + + * src/symlist.h, src/symlist.c (symbol_list_length): New. + * src/scan-gram.l (handle_dollar, handle_at): Compute the + rule_length only when needed. + * src/output.c (actions_output, token_definitions_output): Output + the full M4 block. + * src/symtab.c: Don't access directly to the symbol tag, use + symbol_tag_get. + * src/parse-gram.y: Use symbol_list_free. + +2002-06-17 Akim Demaille + + * src/reader.h, src/reader.c (symbol_list, symbol_list_new) + (symbol_list_prepend, get_type_name): Move to... + * src/symlist.h, src/symlist.c (symbol_list_t, symbol_list_new) + (symbol_list_prepend, symbol_list_n_type_name_get): here. + Adjust all callers. + (symbol_list_free): New. + * src/scan-gram.l (handle_dollar): Takes a location. + * tests/input.at (Invalid $n): Adjust. + +2002-06-17 Akim Demaille + + * src/reader.h, src/reader.c (symbol_list_new): Export it. + (symbol_list_prepend): New. + * src/parse-gram.y (%union): `list' is a new member. + (symbols.1): New, replaces... + (terms_to_prec.1, nterms_to_type.1): these. + * src/symtab.h, src/symtab.c (symbol_type_set, symbol_precedence_set) + Take a location as additional argument. + Adjust all callers. + +2002-06-15 Akim Demaille + + * src/parse-gram.y: Move %token in the declaration section so that + we don't depend upon CVS Bison. + +2002-06-15 Akim Demaille + + * src/state.h, src/state.c (state_rule_lookaheads_print): New. + * src/print.c (print_core): Use it. + +2002-06-15 Akim Demaille + + * src/conflicts.c (log_resolution): Accept the rule involved in + the sr conflicts instead of the lookahead number that points to + that rule. + (flush_reduce): Accept the current lookahead vector as argument, + instead of the index in LA. + (resolve_sr_conflict): Accept the current number of lookahead + bitset to consider for the STATE, instead of the index in LA. + (set_conflicts): Adjust. + * src/lalr.c, src/lalr.h, src/state.h: Comment changes. + +2002-06-15 Akim Demaille + + * src/state.h (state_t): Replace the `lookaheadsp' member, a + short, with `lookaheads' (bitsetv), `lookaheads_rule' (rule_t**). + Adjust all dependencies. + * src/lalr.c (initialize_lookaheads): Split into... + (states_lookaheads_count, states_lookaheads_initialize): these. + (lalr): Adjust. + +2002-06-15 Akim Demaille + + * src/gram.h, src/gram.c (grammar_rules_partial_print): New, eved + out of... + (grammar_rules_print): here. + * src/reduce.c (reduce_output): Use it. + * tests/reduce.at (Useless Rules, Reduced Automaton) + (Underivable Rules): Adjust. + +2002-06-15 Akim Demaille + + Copy BYacc's nice way to report the grammar. + + * src/gram.h, src/gram.c (grammar_rhs_print, grammar_rules_print): + New. + Don't print the rules' location, it is confusing and useless. + (rule_print): Use grammar_rhs_print. + * src/print.c (print_grammar): Use grammar_rules_print. + +2002-06-15 Akim Demaille + + Complete and rationalize `useless thing' warnings. + + * src/symtab.h, src/symtab.c (symbol_tag_get, symbol_tag_get_n) + (symbol_tag_print): New. + Use them everywhere in place of accessing directly the tag member. + * src/gram.h, src/gram.c (rule_print): New. + Use it where a rule used to be printed `by hand'. + * src/reduce.c (nonterminals_reduce): Report the use nonterminals. + (reduce_grammar_tables): Report the useless rules. + (reduce_print): Useless things are a warning, not an error. + Report it as such. + * tests/reduce.at (Useless Nonterminals, Useless Rules): + (Reduced Automaton, Underivable Rules): Adjust. + * tests/regression.at (Web2c Report, Web2c Report): Adjust. + * tests/conflicts.at (Unresolved SR Conflicts) + (Solved SR Conflicts): Adjust. + +2002-06-15 Akim Demaille + + Let symbols have a location. + + * src/symtab.h, src/symtab.c (symbol_t): Location is a new member. + (getsym): Adjust. + Adjust all callers. + * src/complain.h, src/complain.c (complain_at, fatal_at, warn_at): + Use location_t, not int. + * src/symtab.c (symbol_check_defined): Take advantage of the + location. + * tests/regression.at (Invalid inputs): Adjust. + +2002-06-15 Akim Demaille + + * src/parse-gram.y (YYLLOC_DEFAULT, current_lhs_location): New. + (input): Don't try to initialize yylloc here, do it in the + scanner. + * src/scan-gram.l (YY_USER_INIT): Initialize yylloc. + * src/gram.h (rule_t): Change line and action_line into location + and action_location, of location_t type. + Adjust all dependencies. + * src/location.h, src/location.c (empty_location): New. + * src/reader.h, src/reader.c (grammar_start_symbol_set) + (grammar_symbol_append, grammar_rule_begin, grammar_rule_end) + (grammar_current_rule_symbol_append) + (grammar_current_rule_action_append): Expect a location as argument. + * src/reader.c (grammar_midrule_action): Adjust to attach an + action's location as dummy symbol location. + * src/symtab.h, src/symtab.c (startsymbol_location): New. + * tests/regression.at (Web2c Report, Rule Line Numbers): Adjust + the line numbers. + +2002-06-14 Akim Demaille + + Grammar declarations may be found in the grammar section. + + * src/parse-gram.y (rules_or_grammar_declaration): New. + (declarations): Each declaration may end with a semicolon, not + just... + (grammar_declaration): `"%union"'. + (grammar): Branch to rules_or_grammar_declaration. + +2002-06-14 Akim Demaille + + * src/main.c (main): Invoke scanner_free. + +2002-06-14 Akim Demaille + + * src/output.c (m4_invoke): Extracted from... + (output_skeleton): here. + Free tempfile. + +2002-06-14 Akim Demaille + + * src/parse-gram.y (directives, directive, gram) + (grammar_directives, precedence_directives, precedence_directive): + Rename as... + (declarations, declaration, grammar, grammar_declaration) + (precedence_declaration, precedence_declarator): these. + (symbol_declaration): New. + +2002-06-14 Akim Demaille + + * src/files.c (action_obstack): Remove, unused. + (output_obstack): Remove it, and all its dependencies, as it is no + longer needed. + * src/reader.c (epilogue_set): Build the epilogue in the + muscle_obstack. + * src/output.h, src/output.c (muscle_obstack): Move to... + * src/muscle_tab.h, src/muscle_tab.h: here. + (muscle_init): Initialize muscle_obstack. + (muscle_free): New. + * src/main.c (main): Call it. + +2002-06-14 Akim Demaille + + * src/location.h: New, extracted from... + * src/reader.h: here. + * src/Makefile.am (noinst_HEADERS): Merge into + (bison_SOURCES): this. + Add location.h. + * src/parse-gram.y: Use location_t instead of Bison's. + * src/reader.h, src/reader.c (prologue_augment, epilogue_set): + Use location_t instead of ints. + +2002-06-14 Akim Demaille + + * data/bison.simple, data/bison.c++: Be sure to restore the + current #line when returning to the skeleton contents after having + exposed the input file's #line. + +2002-06-12 Akim Demaille + + * src/scan-gram.l (SC_BRACED_CODE): Don't use `<.*>', it is too + eager. + * tests/actions.at (Exotic Dollars): New. + +2002-06-12 Akim Demaille + + * src/scan-gram.l (SC_PROLOGUE): Don't eat characters amongst + ['"/] too eagerly. + * tests/input.at (Torturing the Scanner): New. + +2002-06-11 Akim Demaille + + * src/scan-gram.l (YY_OBS_INIT): Remove, replace with... + [SC_COMMENT,SC_STRING,SC_CHARACTER,SC_BRACED_CODE,SC_PROLOGUE] + [SC_EPILOGUE]: Output the quadrigraphs only when not in a comment. + * src/reader.h, src/scan-gram.l (scanner_initialize): this. + * src/reader.c (reader): Use it. + +2002-06-11 Akim Demaille + + * src/scan-gram.l (YY_OBS_FINISH): Don't set yylval. + Adjust all callers. + (scanner_last_string_free): New. + +2002-06-11 Akim Demaille + + * src/scan-gram.l (YY_INIT, YY_GROW, YY_FINISH): Rename as... + (YY_OBS_INIT, YY_OBS_GROW, YY_OBS_FINISH): these. + (last_string, YY_OBS_FREE): New. + Use them when returning an ID. + +2002-06-11 Akim Demaille + + Have Bison grammars parsed by a Bison grammar. + + * src/reader.c, src/reader.h (prologue_augment): New. + * src/reader.c (copy_definition): Remove. + + * src/reader.h, src/reader.c (gram_start_symbol_set, prologue_augment) + (grammar_symbol_append, grammar_rule_begin, grammar_midrule_action) + (grammar_current_rule_prec_set, grammar_current_rule_check) + (grammar_current_rule_symbol_append) + (grammar_current_rule_action_append): Export. + * src/parse-gram.y (symbol_list_new, symbol_list_symbol_append_ + (symbol_list_action_append): Remove. + Hook the routines from reader. + * src/scan-gram.l: In INITIAL, characters and strings are tokens. + * src/system.h (ATTRIBUTE_NORETURN, ATTRIBUTE_UNUSED): Now. + + * src/reader.c (read_declarations): Remove, unused. + + * src/parse-gram.y: Handle the epilogue. + * src/reader.h, src/reader.c (gram_start_symbol_set): Rename as... + (grammar_start_symbol_set): this. + * src/scan-gram.l: Be sure to ``use'' yycontrol to keep GCC quiet. + * src/reader.c (readgram): Remove, unused. + (reader): Adjust to insert eoftoken and axiom where appropriate. + + * src/reader.c (copy_dollar): Replace with... + * src/scan-gram.h (handle_dollar): this. + * src/parse-gram.y: Remove `%thong'. + + * src/reader.c (copy_at): Replace with... + * src/scan-gram.h (handle_at): this. + + * src/complain.h, src/complain.c (warn_at, complain_at, fatal_at): + New. + + * src/scan-gram.l (YY_LINES): Keep lineno synchronized for the + time being. + + * src/reader.h, src/reader.c (grammar_rule_end): New. + + * src/parse.y (current_type, current_class): New. + Implement `%nterm', `%token' support. + Merge `%term' into `%token'. + (string_as_id): New. + * src/symtab.h, src/symtab.c (symbol_make_alias): Don't pass the + type name. + + * src/parse-gram.y: Be sure to handle properly the beginning of + rules. + + * src/parse-gram.y: Handle %type. + * src/reader.c (grammar_rule_end): Call grammar_current_rule_check. + + * src/parse-gram.y: More directives support. + * src/options.c: No longer handle source directives. + + * src/parse-gram.y: Fix %output. + + * src/parse-gram.y: Handle %union. + Use the prologue locations. + * src/reader.c (parse_union_decl): Remove. + + * src/reader.h, src/reader.c (epilogue_set): New. + * src/parse-gram.y: Use it. + + * data/bison.simple, data/bison.c++: b4_stype is now either not + defined, then default to int, or to the contents of %union, + without `union' itself. + Adjust. + * src/muscle_tab.c (muscle_init): Don't predefine `stype'. + + * src/output.c (actions_output): Don't output braces, as they are + already handled by the scanner. + + * src/scan-gram.l (SC_CHARACTER): Set the user_token_number of + characters to themselves. + + * tests/reduce.at (Reduced Automaton): End the grammars with %% so + that the epilogue has a proper #line. + + * src/parse-gram.y: Handle precedence/associativity. + + * src/symtab.c (symbol_precedence_set): Requires the symbol to be + a terminal. + * src/scan-gram.l (SC_BRACED_CODE): Catch strings and characters. + * tests/calc.at: Do not use `%token "foo"' as it makes not sense + at all to define terminals that cannot be emitted. + + * src/scan-gram.l: Escape M4 characters. + + * src/scan-gram.l: Working properly with escapes in user + strings/characters. + + * tests/torture.at (AT_DATA_TRIANGULAR_GRAMMAR) + (AT_DATA_HORIZONTAL_GRAMMAR): Respect the `%token ID NUM STRING' + grammar. + Use more modest sizes, as for the time being the parser does not + release memory, and therefore the process swallows a huge amount + of memory. + + * tests/torture.at (AT_DATA_LOOKAHEADS_GRAMMAR): Adjust to the + stricter %token grammar. + + * src/symtab.h (associativity): Add `undef_assoc'. + (symbol_precedence_set): Do nothing when passed an undef_assoc. + * src/symtab.c (symbol_check_alias_consistence): Adjust. + + * tests/regression.at (Invalid %directive): Remove, as it is now + meaningless. + (Invalid inputs): Adjust to the new error messages. + (Token definitions): The new grammar doesn't allow too many + eccentricities. + + * src/lex.h, src/lex.c: Remove. + * src/reader.c (lastprec, skip_to_char, read_signed_integer) + (copy_character, copy_string2, copy_string, copy_identifier) + (copy_comment, parse_token_decl, parse_type_decl, parse_assoc_decl) + (parse_muscle_decl, parse_dquoted_param, parse_skel_decl) + (parse_action): Remove. + * po/POTFILES.in: Adjust. + +2002-06-11 Akim Demaille + + * src/reader.c (parse_action): Don't store directly into the + rule's action member: return the action as a string. + Don't require `rule_length' as an argument: compute it. + (grammar_current_rule_symbol_append) + (grammar_current_rule_action_append): New, eved out from + (readgram): here. + Remove `action_flag', `rulelength', unused now. + +2002-06-11 Akim Demaille + + * src/reader.c (grammar_current_rule_prec_set). + (grammar_current_rule_check): New, eved out from... + (readgram): here. + Remove `xaction', `first_rhs': useless. + * tests/input.at (Type clashes): New. + * tests/existing.at (GNU Cim Grammar): Adjust. + +2002-06-11 Akim Demaille + + * src/reader.c (grammar_midrule_action): New, Eved out from + (readgram): here. + +2002-06-11 Akim Demaille + + * src/reader.c (grammar_rule_begin, previous_rule, current_rule): + New. + (readgram): Use them as replacement of inlined code, crule and + crule1. + +2002-06-11 Akim Demaille + + * src/reader.c (grammar_end, grammar_symbol_append): New. + (readgram): Use them. + Make the use of `p' as local as possible. + +2002-06-10 Akim Demaille + + GCJ's parser requires the tokens to be defined before the prologue. + + * data/bison.simple: Output the token definition before the user's + prologue. + * tests/regression.at (Braces parsing, Duplicate string) + (Mixing %token styles): Check the output from bison. + (Early token definitions): New. + +2002-06-10 Akim Demaille + + * src/symtab.c (symbol_user_token_number_set): Don't complain when + assigning twice the same user number to a token, so that we can + use it in... + * src/lex.c (lex): here. + Also use `symbol_class_set' instead of hand written code. + * src/reader.c (parse_assoc_decl): Likewise. + +2002-06-10 Akim Demaille + + * src/symtab.c, src/symtab.c (symbol_class_set) + (symbol_user_token_number_set): New. + * src/reader.c (parse_token_decl): Use them. + Use a switch instead of ifs. + Use a single argument. + +2002-06-10 Akim Demaille + + Remove `%thong' support as it is undocumented, unused, duplicates + `%token's job, and creates useless e-mail traffic with people who + want to know what it is, why it is undocumented, unused, and + duplicates `%token's job. + + * src/reader.c (parse_thong_decl): Remove. + * src/options.c (option_table): Remove "thong". + * src/lex.h (tok_thong): Remove. + +2002-06-10 Akim Demaille + + * src/symtab.c, src/symtab.c (symbol_type_set) + (symbol_precedence_set): New. + * src/reader.c (parse_type_decl, parse_assoc_decl): Use them. + (value_components_used): Remove, unused. + +2002-06-09 Akim Demaille + + Move symbols handling code out of the reader. + + * src/reader.h, src/reader.c (errtoken, undeftoken, eoftoken) + (axiom): Move to... + * src/symtab.h, src/symtab.c: here. + + * src/gram.c (start_symbol): Remove: use startsymbol->number. + * src/reader.c (startval): Rename as... + * src/symtab.h, src/symtab.c (startsymbol): this. + * src/reader.c: Adjust. + + * src/reader.c (symbol_check_defined, symbol_make_alias) + (symbol_check_alias_consistence, symbol_pack, symbol_translation) + (token_translations_init) + Move to... + * src/symtab.c: here. + * src/reader.c (packsymbols): Move to... + * src/symtab.h, src/symtab.c (symbols_pack): here. + * src/symtab.h, src/symtab.c (symbol_make_alias): Takes SYMVAL as + argument. + +2002-06-03 Akim Demaille + + * src/muscle_tab.c (muscle_insert, muscle_find): Declarations, + then statements. + +2002-06-03 Akim Demaille + + * src/muscle_tab.c (muscle_find, muscle_insert): Don't initialize + structs with non literals. + * src/scan-skel.l: never-interactive. + * src/conflicts.c (enum conflict_resolution_e): No trailing + comma. + * src/getargs.c (usage): Split long literal strings. + Reported by Hans Aberg. + +2002-05-28 Akim Demaille + + * data/bison.c++: Use C++ ostreams. + (cdebug_): New member. + +2002-05-28 Akim Demaille + + * src/output.c (output_skeleton): Be sure to allocate enough room + for `/' _and_ for `\0' in full_skeleton. + +2002-05-28 Akim Demaille + + * data/bison.c++: Catch up with bison.simple: + 2002-05-24 Paul Hilfinger + and Paul Eggert : `error' handing. + 2002-05-26 Akim Demaille : stos_, token_number_, + and popping traces. + +2002-05-27 Paul Hilfinger + + * src/output.c (output_skeleton): Put an explicit path in front of + the skeleton file name, rather than relying on the -I directory, + to partially alleviate effects of having a skeleton file lying around + in the current directory. + +2002-05-27 Paul Hilfinger + + * src/conflicts.c (log_resolution): Correct typo: + obstack_printf should be obstack_fgrow1. + +2002-05-26 Akim Demaille + + * src/state.h (state_t): `solved_conflicts' is a new member. + * src/LR0.c (new_state): Set it to 0. + * src/conflicts.h, src/conflicts.c (print_conflicts) + (free_conflicts, solve_conflicts): Rename as... + (conflicts_print, conflicts_free, conflicts_solve): these. + Adjust callers. + * src/conflicts.c (enum conflict_resolution_e) + (solved_conflicts_obstack): New, used by... + (log_resolution): this. + Adjust to attach the conflict resolution to each state. + Complete the description with the precedence/associativity + information. + (resolve_sr_conflict): Adjust. + * src/print.c (print_state): Output its solved_conflicts. + * tests/conflicts.at (Unresolved SR Conflicts) + (Solved SR Conflicts): Exercise --report=all. + +2002-05-26 Akim Demaille + + * src/LR0.c, src/derives.c, src/gram.c, src/gram.h, src/lalr.c, + * src/nullable.c, src/output.c, src/print.c, src/print_graph.c, + * src/reader.c, src/reduce.c, src/state.h, src/symtab.h + (token_number_t, item_number_as_token_number) + (token_number_as_item_number, muscle_insert_token_number_table): + Rename as... + (symbol_number_t, item_number_as_symbol_number) + (symbol_number_as_item_number, muscle_insert_symbol_number_table): + these, since it is more appropriate. + +2002-05-26 Akim Demaille + + * tests/calc.at (AT_CHECK_CALC): Adjust: there are now additional + `Error:' lines. + * data/bison.simple (yystos) [YYDEBUG]: New. + (yyparse) [YYDEBUG]: Display the symbols which are popped during + error recovery. + * tests/regression.at (Web2c Actions): Adjust: yystos is output now. + +2002-05-25 Akim Demaille + + * doc/bison.texinfo (Debugging): Split into... + (Tracing): this new section, its former contents, and... + (Understanding): this new section. + * src/getargs.h, src/getargs.c (verbose_flag): Remove, replaced + by... + (report_flag): this. + Adjust all dependencies. + (report_args, report_types, report_argmatch): New. + (usage, getargs): Report/support -r, --report. + * src/options.h + (struct option_table_struct): Rename as.., + (struct option_table_s): this. + Rename the `set_flag' member to `flag' to match with getopt_long's + struct. + * src/options.c (option_table): Split verbose into an entry for + %verbose, and another for --verbose. + Support --report/-r, so remove -r from the obsolete --raw. + * src/print.c: Attach full item sets and lookaheads reports to + report_flag instead of trace_flag. + * lib/argmatch.h, lib/argmatch.c: New, from Fileutils 4.1. + +2002-05-24 Paul Hilfinger + and Paul Eggert + + * data/bison.simple (yyparse): Correct error handling to conform to + POSIX and yacc. Specifically, after syntax error is discovered, + do not reduce further before shifting the error token. + Clean up the code a bit by removing the labels yyerrdefault, + yyerrhandle, yyerrpop. + * NEWS: Document the above. + +2002-05-20 Paul Hilfinger + + * data/bison.simple (yyr1): Don't use yy_token_number_type as element + type; it isn't always big enough, since it doesn't necessarily + include non-terminals. + (yytranslate): Expand definition of yy_token_number_type, so that + the latter can be removed. + (yy_token_number_type): Remove, only one use. + * data/bison.c++ (r1_): Parallel change to yyr1 in bison.simple--- + don't use TokenNumberType as element type. + + * tests/regression.at: Modify expected output to agree with change + to yyr1 and yytranslate. + +2002-05-13 Florian Krohm + + * src/reader.c (parse_action): Use copy_character instead of + obstack_1grow. + +2002-05-13 Akim Demaille + + * tests/regression.at (Token definitions): Prototype yylex and + yyerror. + +2002-05-12 Paul Hilfinger + + * src/scan-skel.l: Correct off-by-one error in handling of __oline__. + * data/bison.simple (b4_sint_type, b4_uint_type): Correct to reflect + 32-bit arithmetic. + * data/bison.c++ (b4_sint_type, b4_uint_type): Ditto. + +2002-05-07 Akim Demaille + + * tests/synclines.at: Be sure to prototype yylex and yyerror to + avoid GCC warnings. + +2002-05-07 Akim Demaille + + Kill GCC warnings. + + * src/reduce.c (nonterminals_reduce): Don't loop over RITEM: loop + over the RHS of each rule. + * src/gram.h, src/gram.c (nritems): Is `unsigned int', not int. + * src/state.h (state_t): Member `nitems' is unsigned short. + * src/LR0.c (get_state): Adjust. + * src/reader.c (packgram): Likewise. + * src/output.c (GENERATE_MUSCLE_INSERT_TABLE): `max' is of type + `Type'. + (muscle_insert_int_table): Remove, unused. + (prepare_rules): Remove `max'. + +2002-05-06 Akim Demaille + + * src/closure.c (print_firsts): Display of the symbol tags. + (bitmatrix_print): Move to... + * lib/bitsetv-print.h, lib/bitsetv-print.c (bitsetv_matrix_dump): + here. + * tests/sets.at (Nullable, Broken Closure, Firsts): Adjust. + +2002-05-06 Akim Demaille + + * src/muscle_tab.c (muscle_m4_output): Must return TRUE for + hash_do_for_each. + +2002-05-06 Akim Demaille + + * src/LR0.c (new_state, get_state): Instead of using the global + `kernel_size' and `kernel_base', have two new arguments: + `core_size' and `core'. + Adjust callers. + +2002-05-06 Akim Demaille + + * src/reader.c (packgram): No longer end `ritem' with a 0 + sentinel: it is not used. + +2002-05-05 Akim Demaille + + New experimental feature: display the lookaheads in the report and + graph. + + * src/print (print_core): When --trace-flag, display the rules + lookaheads. + * src/print_graph.c (print_core): Likewise. + Swap the arguments. + Adjust caller. + +2002-05-05 Akim Demaille + + * tests/torture.at (Many lookaheads): New test. + +2002-05-05 Akim Demaille + + * src/output.c (GENERATE_OUTPUT_TABLE): Replace with... + (GENERATE_MUSCLE_INSERT_TABLE): this. + (output_int_table, output_unsigned_int_table, output_short_table) + (output_token_number_table, output_item_number_table): Replace with... + (muscle_insert_int_table, muscle_insert_unsigned_int_table) + (muscle_insert_short_table, muscle_insert_token_number_table) + (muscle_insert_item_number_table): these. + Adjust all callers. + (prepare_tokens): Don't free `translations', since... + * src/reader.h, src/reader.c (grammar_free): do it. + Move to... + * src/gram.h, src/gram.c (grammar_free): here. + * data/bison.simple, data/bison.c++: b4_token_number_max is now + b4_translate_max. + +2002-05-05 Akim Demaille + + * src/output.c (output_unsigned_int_table): New. + (prepare_rules): `i' is unsigned. + `prhs', `rline', `r2' are unsigned int. + Rename muscle `rhs_number_max' as `rhs_max'. + Output muscles `prhs_max', `rline_max', and `r2_max'. + Free rline and r1. + * data/bison.simple, data/bison.c++: Adjust to use these muscles + to compute types instead of constant types. + * tests/regression.at (Web2c Actions): Adjust. + +2002-05-04 Akim Demaille + + * src/symtab.h (SALIAS, SUNDEF): Rename as... + (USER_NUMBER_ALIAS, USER_NUMBER_UNDEFINED): these. + Adjust dependencies. + * src/output.c (token_definitions_output): Be sure not to output a + `#define 'a'' when fed with `%token 'a' "a"'. + * tests/regression.at (Token definitions): New. + +2002-05-03 Paul Eggert + + * data/bison.simple (b4_token_defines): Also define YYTOKENTYPE + for K&R C. + +2002-05-03 gettextize + + * Makefile.am (SUBDIRS): Remove intl. + (EXTRA_DIST): Add config/config.rpath. + +2002-05-03 Akim Demaille + + * data/bison.simple (m4_if): Don't output empty enums. + And actually, output valid enum definitions :(. + +2002-05-03 Akim Demaille + + * configure.bat: Remove, completely obsolete. + * Makefile.am (EXTRA_DIST): Adjust. + Don't distribute config.rpath... + * config/Makefile.am (EXTRA_DIST): Do it. + +2002-05-03 Akim Demaille + + * configure.in (GETTEXT_VERSION): New. + Suggested by Bruno Haible for the forthcoming Gettext 0.10.3. + +2002-05-03 Akim Demaille + + * data/bison.simple (b4_token_enum): New. + (b4_token_defines): Use it to output tokens both as #define and + enums. + Suggested by Paul Eggert. + * src/output.c (token_definitions_output): Don't output spurious + white spaces. + +2002-05-03 Akim Demaille + + * data/m4sugar/m4sugar.m4: Update from CVS Autoconf. + +2002-05-02 Robert Anisko + + * data/bison.c++: Adapt expansion of $s and @s to the C++ parser. + Update the stack class, give a try to deque as the default container. + +2002-05-02 Akim Demaille + + * data/bison.simple (yyparse): Do not implement @$ = @1. + (YYLLOC_DEFAULT): Adjust to do it. + * doc/bison.texinfo (Location Default Action): Fix. + +2002-05-02 Akim Demaille + + * src/reader.c (parse_braces): Merge into... + (parse_action): this. + +2002-05-02 Akim Demaille + + * configure.in (ALL_LINGUAS): Remove. + * po/LINGUAS, hr.po: New. + +2002-05-02 Akim Demaille + + Remove the so called hairy (semantic) parsers. + + * src/system.h (EXT_GUARD_C, EXT_STYPE_H): Remove. + * src/gram.h, src/gram.c (semantic_parser): Remove. + (rule_t): Remove the guard and guard_line members. + * src/lex.h (token_t): remove tok_guard. + * src/options.c (option_table): Remove %guard and %semantic_parser + support. + * src/output.c, src/output.h (guards_output): Remove. + (prepare): Adjust. + (token_definitions_output): Don't output the `T' + tokens (???). + (output_skeleton): Don't output the guards. + * src/files.c, src/files.c (attrsfile): Remove. + * src/reader.c (symbol_list): Remove the guard and guard_line + members. + Adjust dependencies. + (parse_guard): Remove. + * data/bison.hairy: Remove. + * doc/bison.texinfo (Environment Variables): Remove occurrences of + BISON_HAIRY. + +2002-05-02 Akim Demaille + + * src/reader.c (copy_at, copy_dollarm parse_braces, parse_action) + (parse_guard): Rename the formal argument `stack_offset' as + `rule_length', which is more readable. + Adjust callers. + (copy_at, copy_dollar): Instead of outputting the hard coded + values of $$, $n and so forth, output invocation to b4_lhs_value, + b4_lhs_location, b4_rhs_value, and b4_rhs_location. + Note: this patch partially drops `semantic-parser' support: it + always does `rule_length - n', where semantic parsers ought to + always use `-n'. + * data/bison.simple, data/bison.c++ (b4_lhs_value) + (b4_lhs_location, b4_rhs_value, and b4_rhs_location: New. + +2002-05-02 Akim Demaille + + * configure.in (AC_INIT): Bump to 1.49b. + (AM_INIT_AUTOMAKE): Short invocation. + +2002-05-02 Akim Demaille + + Version 1.49a. + +2002-05-01 Akim Demaille + + * src/skeleton.h: Remove. + +2002-05-01 Akim Demaille + + * src/skeleton.h: Fix the #endif. + Reported by Magnus Fromreide. + +2002-04-26 Paul Eggert + + * data/bison.simple (YYSTYPE_IS_TRIVIAL, YYLTYPE_IS_TRIVIAL): + Define if we define YYSTYPE and YYLTYPE, respectively. + (YYCOPY): Fix [] quoting problem in the non-GCC case. + +2002-04-25 Robert Anisko + + * src/scan-skel.l: Postprocess quadrigraphs. + + * src/reader.c (copy_character): New function, used to output + single characters while replacing `[' and `]' with quadrigraphs, to + avoid troubles with M4 quotes. + (copy_comment): Output characters with copy_character. + (read_additionnal_code): Likewise. + (copy_string2): Likewise. + (copy_definition): Likewise. + + * tests/calc.at: Exercise M4 quoting. + +2002-04-25 Akim Demaille + + * tests/sets.at (AT_EXTRACT_SETS): Sed portability issue: no space + between `!' and the command. + Reported by Paul Eggert. + +2002-04-24 Robert Anisko + + * tests/calc.at: Exercise prologue splitting. + + * data/bison.simple, data/bison.c++: Use `b4_pre_prologue' and + `b4_post_prologue' instead of `b4_prologue'. + + * src/output.c (prepare): Add the `pre_prologue' and `post_prologue' + muscles. + (output): Free pre_prologue_obstack and post_prologue_obstack. + * src/files.h, src/files.c (attrs_obstack): Remove. + (pre_prologue_obstack, post_prologue_obstack): New. + * src/reader.c (copy_definition): Add a parameter to specify the + obstack to fill, instead of using attrs_obstack unconditionally. + (read_declarations): Pass pre_prologue_obstack to copy_definition if + `%union' has not yet been seen, pass post_prologue_obstack otherwise. + +2002-04-23 Paul Eggert + + * data/bison.simple: Remove unnecessary commentary and white + space differences from 1_29-branch. + Depend on YYERROR_VERBOSE, not defined (YYERROR_VERBOSE). + + (union yyalloc, YYSTACK_GAP_MAX, YYSTACK_BYTES, YYCOPY, + YYSTACK_RELOCATE): Do not define if yyoverflow is defined, or + if this is a C++ parser and YYSTYPE or YYLTYPE has nontrivial + constructors or destructors. + + (yyparse) [! defined YYSTACK_RELOCATE]: Do not relocate the stack. + +2002-04-23 Akim Demaille + + * tests/sets.at (AT_EXTRACT_SETS): Don't use 8 char long sed labels. + * tests/synclines.at (AT_TEST_SYNCLINE): Be robust to GCC's + location with columns. + * tests/conflicts.at (%nonassoc and eof): Don't use `error.h'. + All reported by Paul Eggert. + +2002-04-22 Akim Demaille + + * src/reduce.c (dump_grammar): Move to... + * src/gram.h, src/gram.c (grammar_dump): here. + Be sure to separate long item numbers. + Don't read the members of a rule's prec if its nil. + +2002-04-22 Akim Demaille + + * src/output.c (table_size, table_grow): New. + (MAXTABLE): Remove, replace uses with table_size. + (pack_vector): Instead of dying when the table is too big, grow it. + +2002-04-22 Akim Demaille + + * data/bison.simple (yyr1): Its type is that of a token number. + * data/bison.c++ (r1_): Likewise. + * tests/regression.at (Web2c Actions): Adjust. + +2002-04-22 Akim Demaille + + * src/reader.c (token_translations_init): 256 is now the default + value for the error token, i.e., it will be assigned another + number if the user assigned 256 to one of her tokens. + (reader): Don't force 256 to error. + * doc/bison.texinfo (Symbols): Adjust. + * tests/torture.at (AT_DATA_HORIZONTAL_GRAMMAR) + (AT_DATA_TRIANGULAR_GRAMMAR): Number the tokens as 1, 2, 3 + etc. instead of 10, 20, 30 (which was used to `jump' over error + (256) and undefined (2)). + +2002-04-22 Akim Demaille + + Propagate more token_number_t. + + * src/gram.h (token_number_as_item_number) + (item_number_as_token_number): New. + * src/output.c (GENERATE_OUTPUT_TABLE): New. + Use it to create output_item_number_table and + output_token_number_table. + * src/LR0.c, src/derives.c, src/gram.c, src/gram.h, src/lalr.c, + * src/lex.c, src/nullable.c, src/output.c, src/print.c, + * src/print_graph.c, src/reader.c, src/reduce.c, src/state.h, + * src/symtab.c, src/symtab.h: Use token_number_t instead of shorts. + +2002-04-22 Akim Demaille + + * src/output.h, src/output.c (get_lines_number): Remove. + +2002-04-19 Akim Demaille + + * doc/bison.texinfo (Actions): Make clear that `|' is not the same + as Lex/Flex'. + (Debugging): More details about enabling the debugging features. + (Table of Symbols): Describe $$, $n, @$, and @n. + Suggested by Tim Josling. + +2002-04-19 Akim Demaille + + * doc/bison.texinfo: Remove the uses of the obsolete @refill. + +2002-04-10 Akim Demaille + + * src/system.h: Rely on HAVE_LIMITS_H. + Suggested by Paul Eggert. + +2002-04-09 Akim Demaille + + * tests/calc.at (_AT_CHECK_CALC_ERROR): Receive as argument the + full stderr, and strip it according to the bison options, instead + of composing the error message from different bits. + This makes it easier to check for several error messages. + Adjust all the invocations. + Add an invocation exercising the error token. + Add an invocation demonstrating a stupid error message. + (_AT_DATA_CALC_Y): Follow the GCS: initial column is 1, not 0. + Adjust the tests. + Error message are for stderr, not stdout. + +2002-04-09 Akim Demaille + + * src/gram.h, src/gram.c (error_token_number): Remove, use + errtoken->number. + * src/reader.c (reader): Don't specify the user token number (2) + for $undefined, as it uselessly prevents using it. + * src/gram.h (token_number_t): Move to... + * src/symtab.h: here. + (state_t.number): Is a token_number_t. + * src/print.c, src/reader.c: Use undeftoken->number instead of + hard coded 2. + (Even though this 2 is not the same as above: the number of the + undeftoken remains being 2, it is its user token number which + might not be 2). + * src/output.c (prepare_tokens): Rename the `maxtok' muscle with + `user_token_number_max'. + Output `undef_token_number'. + * data/bison.simple, data/bison.c++: Use them. + Be sure to map invalid yylex return values to + `undef_token_number'. This saves us from gratuitous SEGV. + + * tests/conflicts.at (Solved SR Conflicts) + (Unresolved SR Conflicts): Adjust. + * tests/regression.at (Web2c Actions): Adjust. + +2002-04-08 Akim Demaille + + * data/bison.c++: s/b4_item_number_max/b4_rhs_number_max/. + Adding #line. + Remove the duplicate `typedefs'. + (RhsNumberType): Fix the declaration and various other typos. + Use __ofile__. + * data/bison.simple: Use __ofile__. + * src/scan-skel.l: Handle __ofile__. + +2002-04-08 Akim Demaille + + * src/gram.h (item_number_t): New, the type of item numbers in + RITEM. Note that it must be able to code symbol numbers as + positive number, and the negation of rule numbers as negative + numbers. + Adjust all dependencies (pretty many). + * src/reduce.c (rule): Remove this `short *' pointer: use + item_number_t. + * src/system.h (MINSHORT, MAXSHORT): Remove. + Include `limits.h'. + Adjust dependencies to using SHRT_MAX and SHRT_MIN. + (shortcpy): Remove. + (MAXTABLE): Move to... + * src/output.c (MAXTABLE): here. + (prepare_rules): Use output_int_table to output rhs. + * data/bison.simple, data/bison.c++: Adjust. + * tests/torture.at (Big triangle): Move the limit from 254 to + 500. + * tests/regression.at (Web2c Actions): Ajust. + + Trying with bigger grammars shows various phenomena: at 3000 (28Mb + of grammar file) bison is killed by my system, at 2000 (12Mb) bison + passes, but produces negative #line number, once fixed, GCC is + killed while compiling 14Mb, at 1500 (6.7 Mb of grammar, 8.2Mb of + C), it passes. + * src/state.h (state_h): Code input lines on ints, not shorts. + +2002-04-08 Akim Demaille + + * src/reduce.c (reduce_grammar): First reduce the nonterminals, + and then the grammar. + +2002-04-08 Akim Demaille + + * src/system.h: No longer using strndup. + +2002-04-07 Akim Demaille + + * src/muscle_tab.h (MUSCLE_INSERT_LONG_INT): New. + * src/output.c (output_table_data): Return the longest number. + (prepare_tokens): Output `token_number_max'). + * data/bison.simple, data/bison.c++ (b4_sint_type, b4_uint_type): + New. + Use them to define yy_token_number_type/TokenNumberType. + Use this type for yytranslate. + * tests/torture.at (Big triangle): Push the limit from 124 to + 253. + * tests/regression.at (Web2c Actions): Adjust. + +2002-04-07 Akim Demaille + + * tests/torture.at (Big triangle): New. + (GNU AWK Grammar, GNU Cim Grammar): Move to... + * tests/existing.at: here. + +2002-04-07 Akim Demaille + + * src/gram.h, src/gram.c (nitems): Remove, it is an alias of + nritems. + Adjust dependencies. + +2002-04-07 Akim Demaille + + * src/reader.c: Normalize increments to prefix form. + +2002-04-07 Akim Demaille + + * src/reader.c, symtab.c: Remove debugging code. + +2002-04-07 Akim Demaille + + Rename all the `bucket's as `symbol_t'. + + * src/gram.c, src/gram.h, src/lex.c, src/lex.h, src/output.c, + * src/reader.c, src/reader.h, src/reduce.c, src/state.h, + * src/symtab.c, src/symtab.h (bucket): Rename as... + (symbol_t): this. + (symbol_list_new, bucket_check_defined, bucket_make_alias) + (bucket_check_alias_consistence, bucket_pack, bucket_translation) + (bucket_new, bucket_free, hash_compare_bucket, hash_bucket) + (buckets_new, buckets_free, buckets_do): Rename as... + (symbol_list_new, symbol_check_defined, symbol_make_alias) + (symbol_check_alias_consistence, symbol_pack, symbol_translation) + (symbol_new, symbol_free, hash_compare_symbol_t, hash_symbol_t) + (symbols_new, symbols_free, symbols_do): these. + +2002-04-07 Akim Demaille + + Use lib/hash for the symbol table. + + * src/gram.c (ntokens): Initialize to 1, to reserve a slot for + EOF. + * src/lex.c (lex): Set the `number' member of new terminals. + * src/reader.c (bucket_check_defined, bucket_make_alias) + (bucket_check_alias_consistence, bucket_translation): New. + (reader, grammar_free, readgram, token_translations_init) + (packsymbols): Adjust. + (reader): Number the predefined tokens. + * src/reduce.c (inaccessable_symbols): Just use hard coded numbers + for predefined tokens. + * src/symtab.h (bucket): Remove all the hash table related + members. + * src/symtab.c (symtab): Replace by... + (bucket_table): this. + (bucket_new, bucket_free, hash_compare_bucket, hash_bucket) + (buckets_new, buckets_do): New. + +2002-04-07 Akim Demaille + + * src/gram.c (nitems, nrules, nsyms, ntokens, nvars, nritems) + (start_symbol, max_user_token_number, semantic_parser) + (error_token_number): Initialize. + * src/reader.c (grammar, start_flag, startval, typed, lastprec): + Initialize. + (reader): Don't. + (errtoken, eoftoken, undeftoken, axiom): Extern. + +2002-04-07 Akim Demaille + + * src/gram.h (rule_s): prec and precsym are now pointers + to the bucket giving the priority/associativity. + Member `associativity' removed: useless. + * src/reduce.c, src/conflicts.c: Adjust. + +2002-04-07 Akim Demaille + + * src/lalr.c, src/LR0.c, src/closure.c, src/gram.c, src/reduce.c: + Properly escape the symbols' TAG when outputting them. + +2002-04-07 Akim Demaille + + * src/lalr.h (LA): Is a bitsetv, not bitset*. + +2002-04-07 Akim Demaille + + * src/lalr.h, src/lalr.c (LAruleno): Replace with... + (LArule): this, which is an array to rule_t*. + * src/print.c, src/conflicts.c: Adjust. + +2002-04-07 Akim Demaille + + * src/gram.h (rule_t): Rename `number' as `user_number'. + `number' is a new member. + Adjust dependencies. + * src/reduce.c (reduce_grammar_tables): Renumber rule_t.number. + +2002-04-07 Akim Demaille + + As a result of the previous patch, it is no longer needed + to reorder ritem itself. + + * src/reduce.c (reduce_grammar_tables): Don't sort RITEM. + +2002-04-07 Akim Demaille + + Be sure never to walk through RITEMS, but use only data related to + the rules themselves. RITEMS should be banished. + + * src/output.c (output_token_translations): Rename as... + (prepare_tokens): this. + In addition to `translate', prepare the muscles `tname' and + `toknum', which were handled by... + (output_rule_data): this. + Remove, and move the remainder of its outputs into... + (prepare_rules): this new routines, which also merges content from + (output_gram): this. + (prepare_rules): Be sure never to walk through RITEMS. + (output_stos): Rename as... + (prepare_stos): this. + (output): Always invoke prepare_states, after all, just don't use it + in the output if you don't need it. + +2002-04-07 Akim Demaille + + * src/LR0.c (new_state): Display `nstates' as the name of the + newly created state. + Adjust to initialize first_state and last_state if needed. + Be sure to distinguish the initial from the final state. + (new_states): Create the itemset of the initial state, and use + new_state. + * src/closure.c (closure): Now that the initial state has its + items properly set, there is no need for a special case when + creating `ruleset'. + + As a result, now the rule 0, reducing to $axiom, is visible in the + outputs. Adjust the test suite. + + * tests/conflicts.at (Solved SR Conflicts) + (Unresolved SR Conflicts): Adjust. + * tests/regression.at (Web2c Report, Rule Line Numbers): Idem. + * tests/conflicts.at (S/R in initial): New. + +2002-04-07 Akim Demaille + + * src/LR0.c (allocate_itemsets): Don't loop over ritem: loop over + the RHS of the rules. + * src/output.c (output_gram): Likewise. + +2002-04-07 Akim Demaille + + * src/gram.h (rule_t): `lhs' is now a pointer to the symbol's + bucket. + Adjust all dependencies. + * src/reduce.c (nonterminals_reduce): Don't forget to renumber the + `number' of the buckets too. + * src/gram.h: Include `symtab.h'. + (associativity): Move to... + * src/symtab.h: here. + No longer include `gram.h'. + +2002-04-07 Akim Demaille + + * src/gram.h, src/gram.c (rules_rhs_length): New. + (ritem_longest_rhs): Use it. + * src/gram.h (rule_t): `number' is a new member. + * src/reader.c (packgram): Set it. + * src/reduce.c (reduce_grammar_tables): Move the useless rules at + the end of `rules', and count them out of `nrules'. + (reduce_output, dump_grammar): Adjust. + * src/print.c (print_grammar): It is no longer needed to check for + the usefulness of a rule, as useless rules are beyond `nrules + 1'. + * tests/reduce.at (Reduced Automaton): New test. + +2002-04-07 Akim Demaille + + * src/reduce.c (inaccessable_symbols): Fix a buglet: because of a + lacking `+ 1' to nrules, Bison reported as useless a token if it + was used solely to set the precedence of the last rule... + +2002-04-07 Akim Demaille + + * data/bison.c++, data/bison.simple: Don't output the current file + name in #line, to avoid useless diffs between two identical + outputs under different names. + +2002-04-07 Akim Demaille + + * src/closure.c, src/print.c, src/reader.c, src/reduce.c: + Normalize loops to using `< nrules + 1', not `<= nrules'. + +2002-04-07 Akim Demaille + + * TODO: Update. + +2002-04-07 Akim Demaille + + * src/output.c, src/reader.c, src/symtab.c, src/symtab.h: Rename + bucket.value as bucket.number. + +2002-04-07 Akim Demaille + + * src/closure.c, src/derives.c, src/gram.h, src/lalr.c, + * src/nullable.c, src/output.c, src/print.c, src/print_graph.c, + * src/reader.c, src/reduce.c: Let rule_t.rhs point directly to the + RHS, instead of being an index in RITEMS. + +2002-04-04 Paul Eggert + + * doc/bison.texinfo: Update copyright date. + (Rpcalc Lexer, Symbols, Token Decl): Don't assume ASCII. + (Symbols): Warn about running Bison in one character set, + but compiling and/or running in an incompatible one. + Warn about character code 256, too. + +2002-04-03 Paul Eggert + + * src/bison.data (YYSTACK_ALLOC): Depend on whether + YYERROR_VERBOSE is nonzero, not whether it is defined. + + Merge changes from bison-1_29-branch. + +2002-03-20 Paul Eggert + + Merge fixes from Debian bison_1.34-1.diff. + + * configure.in (AC_PREREQ): 2.53. + +2002-03-20 Akim Demaille + + * src/conflicts.c (log_resolution): Argument `resolution' is const. + +2002-03-19 Paul Eggert + + * src/bison.simple (YYCOPY): New macro. + (YYSTACK_RELOCATE): Use it. + Remove Type arg; no longer needed. All callers changed. + (yymemcpy): Remove; no longer needed. + + * Makefile.am (AUTOMAKE_OPTIONS): 1.6. + * doc/Makefile.am (AUTOMAKE_OPTIONS): Remove. + +2002-03-19 Akim Demaille + + Test and fix the #line outputs. + + * tests/atlocal.at (GCC): New. + * tests/synclines.at (AT_TEST_SYNCLINE): New macro. + (Prologue synch line, %union synch line, Postprologue synch line) + (Action synch line, Epilogue synch line): New tests. + * src/reader.c (parse_union_decl): Define the muscle stype_line. + * data/bison.simple, data/bison.c++: Use it. + +2002-03-19 Akim Demaille + + * tests/regression.at (%nonassoc and eof, Unresolved SR Conflicts) + (Solved SR Conflicts, %expect not enough, %expect right) + (%expect too much): Move to... + * tests/conflicts.at: this new file. + +2002-03-19 Akim Demaille + + * data/m4sugar/m4sugar.m4: Update from CVS Autoconf. + * data/bison.simple, data/bison.c++: Handle the `#define' part, so + that we can move to enums for instance. + * src/output.c (token_definitions_output): Output a list of + `token-name, token-number' instead of the #define. + (output_skeleton): Name this list `b4_tokens', not `b4_tokendefs'. + +2002-03-14 Akim Demaille + + Use Gettext 0.11.1. + +2002-03-09 Robert Anisko + + * data/bison.c++: Make the user able to add members to the generated + parser by subclassing. + +2002-03-05 Robert Anisko + + * src/reader.c (read_additionnal_code): `c' should be an integer, not + a character. + Reported by Nicolas Tisserand and Nicolas Burrus. + +2002-03-04 Robert Anisko + + * src/reader.c: Warn about lacking semi-colons, do not complain. + +2002-03-04 Robert Anisko + + * data/bison.c++: Remove a debug line. + +2002-03-04 Robert Anisko + + * data/bison.c++: Unmerge value as yylval and value as yyval. Unmerge + location as yylloc and location as yyloc. Use YYLLOC_DEFAULT, and + provide a default implementation. + +2002-03-04 Akim Demaille + + * tests/input.at (Invalid $n, Invalid @n): Add the ending `;'. + * tests/output.at (AT_CHECK_OUTPUT): Likewise. + * tests/headers.at (AT_TEST_CPP_GUARD_H): Ditto. + * tests/semantic.at (Parsing Guards): Similarly. + * src/reader.at (readgram): Complain if the last rule is not ended + with a semi-colon. + +2002-03-04 Akim Demaille + + * src/warshall.h, src/warshall.c (bitmatrix_print): Move to... + * src/closure.c: here. + (set_firsts): Use bitsetv_reflexive_transitive_closure instead of + RTC. + * src/warshall.h, src/warshall.c: Remove. + * tests/sets.at (Broken Closure): Adjust. + +2002-03-04 Akim Demaille + + * src/output.c (output_skeleton): tempdir is const. + bytes_read is unused. + +2002-03-04 Akim Demaille + + * lib/bbitset.h, lib/bitset.c, lib/bitset.h, lib/bitsetv.c, + * lib/bitsetv.h, lib/ebitset.c, lib/lbitset.c, lib/sbitset.c: + Update. + From Michael Hayes. + +2002-03-04 Akim Demaille + + * src/closure.c (closure): `r' is unused. + +2002-03-04 Akim Demaille + + * tests/sets.at (Broken Closure): Add the ending `;'. + * src/reader.at (readgram): Complain if a rule is not ended with a + semi-colon. + +2002-03-04 Akim Demaille + + * src/conflicts.c (set_conflicts): Use bitset_disjoint_p. + (count_sr_conflicts): Use bitset_count. + * src/reduce.c (inaccessable_symbols): Ditto. + (bits_size): Remove. + * src/warshall.h, src/warshall.c: Convert to bitsetv. + +2002-03-04 Akim Demaille + + * src/closure.c, src/conflicts.c, src/lalr.c, src/print.c, + * src/reduce.c: Remove the `bitset_zero's following the + `bitset_create's, as now it is performed by the latter. + +2002-03-04 Akim Demaille + + * lib/bitset.c, lib/bitset.h, lib/bitsetv.c, lib/bitsetv.h, + * lib/ebitset.c, lib/ebitset.h, lib/lbitset.c, lib/lbitset.h, + * lib/sbitset.c, lib/sbitset.h, lib/bbitset.h: Update from the + latest sources from Michael. + +2002-03-04 Akim Demaille + + * src/output.c (output): Don't free the grammar. + * src/reader.c (grammar_free): New. + * src/main.c (main): Call it and don't free symtab here. + +2002-03-04 Akim Demaille + + * src/lex.c (parse_percent_token): Be sure to 0-end token_buffer + before returning. + Reported by Benoit Perrot. + +2002-03-04 Akim Demaille + + Use bitset operations when possible, not loops over bits. + + * src/conflicts.c (set_conflicts, count_sr_conflicts): Use + bitset_or. + * src/print.c (print_reductions): Use bitset_and, bitset_andn. + * src/reduce.c (useless_nonterminals): Formatting changes. + * src/warshall.c (TC): Use bitset_or. + +2002-03-04 Akim Demaille + + * src/lalr.h, src/lalr.c (tokensetsize): Remove, unused. + * src/system.h (BITS_PER_WORD, WORDSIZE, SETBIT, RESETBIT, BITISSET): + Ditto. + +2002-03-04 Akim Demaille + + * src/lalr.c (F): Now a bitset*. + Adjust all dependencies. + +2002-03-04 Akim Demaille + + * src/conflicts.c (shiftset, lookaheadset): Now bitset. + Adjust all dependencies. + +2002-03-04 Akim Demaille + + * src/L0.c, src/LR0.h (nstates): Be size_t. + Adjust comparisons (signed vs unsigned). + * src/conflics.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a + bitset*. + Adjust all dependencies. + +2002-03-04 Akim Demaille + + * src/closure.c (firsts): Now, also a bitset. + Adjust all dependencies. + (varsetsize): Remove, now unused. + * src/warshall.h, src/warshall.c: Now work on arrays of bitsets. + +2002-03-04 Akim Demaille + + * src/print.c: Convert to use bitset.h, not hand coded iterations + over ints. + +2002-03-04 Akim Demaille + + * src/reduce.c: Convert to use bitset.h, not hand coded BSet. + +2002-03-04 Akim Demaille + + * src/closure.c (ruleset): Be a bitset. + (rulesetsize): Remove. + +2002-03-04 Akim Demaille + + * lib/bitset-int.h, lib/bitset.c, lib/bitset.h, lib/bitsetv.c, + * lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/lbitset.c, + * lib/lbitset.h, lib/sbitset.c, lib/sbitset.h: New. + * src/closure.c (fderives): Be an array of bitsets. + +2002-02-28 Robert Anisko + + * data/bison.c++: Merge the two generated headers. Insert a copyright + notice in each output file. + +2002-02-28 Akim Demaille + + * data/bison.c++: Copy the prologue of bison.simple to fetch + useful M4 definitions, such as b4_header_guard. + +2002-02-25 Akim Demaille + + * src/getargs.c (version): Give the name of the authors, and use a + translator friendly scheme for the bgr + copyright notice. + +2002-02-25 Akim Demaille + + * src/output.c (header_output): Remove, now handled completely via + M4. + +2002-02-25 Akim Demaille + + * m4/m4.m4: New, from CVS Autoconf. + * configure.in: Invoke it. + * src/output.c (output_skeleton): Use its result instead of the + hard coded name. + +2002-02-25 Akim Demaille + + * lib/tempname.c, lib/mkstemp.c, m4/mkstemp.m4: New, stolen from + Fileutils 4.1.5. + * configure.in: Invoke UTILS_FUNC_MKSTEMP. + * src/output.c (output_skeleton): Use mkstemp to create a real + temporary file. + Move the filling of `skeleton' and its muscle to... + (prepare): here. + (output): Move the definition of the prologue muscle to... + (prepare): here. + * src/system.h (DEFAULT_TMPDIR): New. + +2002-02-14 Paul Eggert + + Remove the support for C++ namespace cleanliness; it was + causing more problems than it was curing, since it didn't work + properly on some nonstandard C++ compilers. This can wait + for a proper C++ parser. + + * NEWS: Document this. + * doc/bison.texinfo (Bison Parser, Debugging): Remove special mention + of C++, as it's treated like C now. + * src/bison.simple (YYSTD): Remove. + (YYSIZE_T, YYFPRINTF, YYPARSE_PARAM_ARG, YYPARSE_PARAM_DECL): + Treat C++ just like Standard C instead of trying to support + namespace cleanliness. + +2002-02-14 Akim Demaille + + * tests/regression.at (else): Adjust to Andreas' change. + +2002-02-14 Akim Demaille + + * lib/Makefile.am (EXTRA_DIST): Ship strnlen.c. + +2002-02-13 Andreas Schwab + + * src/output.c (output_rule_data): Don't output NULL, it might + not be defined yet. + +2002-02-11 Robert Anisko + + * data/bison.c++ (YYDEBUG, YYERROR_VERBOSE): After the prologue. + (Copyright notice): Update. + +2002-02-11 Akim Demaille + + * tests/regression.at (%nonassoc and eof): Don't include + nonportable headers. + +2002-02-08 Robert Anisko + + * data/bison.c++: Correct error recovery. Make the user able to + initialize the starting location. + +2002-02-07 Akim Demaille + + * tests/input.at: New. + +2002-02-07 Robert Anisko + + * data/bison.c++: Replace some direct m4 expansions by constants. Be + more consistent when naming methods and variables. Put preprocessor + directives around tables only needed for debugging. + +2002-02-07 Robert Anisko + + * data/bison.c++ (yy::b4_name::print_): New method, replaces yyprint in + C++ parsers. + (yy::b4_name::parse): Use print_. + +2002-02-07 Robert Anisko + + * data/bison.c++ (yy::b4_name::parse): Error recovery is back. + +2002-02-07 Robert Anisko + + * data/bison.c++ (yy::b4_name::error_): New method, replaces yyerror in + C++ parsers. + (yy::b4_name::parse): Build verbose error messages, and use error_. + +2002-02-06 Robert Anisko + + * data/bison.c++: Fix m4 quoting in comments. + +2002-02-06 Robert Anisko + + * data/bison.c++: Adjust the parser code. Fix some muscles that were + not expanded by m4. + +2002-02-05 Akim Demaille + + * data/bison.c++: Adjust to the M4 back end. + More is certainly needed. + +2002-02-05 Akim Demaille + + Give a try to M4 as a back end. + + * lib/readpipe.c: New, from wdiff. + * src/Makefile.am (DEFS): Define PKGDATADIR, not BISON_SIMPLE and + BISON_HAIRY. + * src/system.h (BISON_HAIRY, BISON_SIMPLE): Remove the DOS and VMS + specific values. Now it is m4 that performs the lookup. + * src/parse-skel.y: Remove. + * src/muscle_tab.c, src/muscle_tab.h (muscles_m4_output): New. + * src/output.c (actions_output, guards_output) + (token_definitions_output): No longer keeps track of the output + line number, hence remove the second argument. + (guards_output): Check against the guard member of a rule, not the + action member. + Adjust callers. + (output_skeleton): Don't look for the skeleton location, let m4 do + that. + Create `/tmp/muscles.m4'. This is temporary, a proper temporary + file will be used. + Invoke `m4' on m4sugar.m4, muscles.m4, and the skeleton. + (prepare): Given that for the time being changesyntax is not + usable in M4, rename the muscles using `-' to `_'. + Define `defines_flag', `output_parser_name' and `output_header_name'. + * src/output.h (actions_output, guards_output) + (token_definitions_output): Adjust prototypes. + * src/scan-skel.l: Instead of scanning the skeletons, it now + processes the output of m4: `__oline__' and `#output'. + * data/bison.simple: Adjust to be used by M4(sugar). + * tests/Makefile.am: Use check_SCRIPTS to make sure `bison' is up + to date. + * tests/bison.in: Use the secrete envvar `BISON_PKGDATADIR' + instead of the dead `BISON_SIMPLE' and `BISON_HAIRY'. + * data/m4sugar/m4sugar.m4, data/m4sugar/version.m4: New, + shamelessly stolen from CVS Autoconf. + +2002-02-05 Akim Demaille + + * lib/hash.c, lib/hash.h: Replace with Fileutils 4.1's version. + * configure.in: Check for the declarations of free and malloc. + * src/muscle_tab.c: Adjust. + +2002-02-05 Akim Demaille + + * src/muscle_tab.c (muscle_init): Don't default to NULL muscle + which have no values. + +2002-02-05 Akim Demaille + + * src/bison.simple, src/bison.hairy, src/bison.c++: Move to... + * data/: here. + +2002-01-29 Paul Eggert + + * src/bison.simple (YYSIZE_T): Do not define merely because + YYSTACK_USE_ALLOCA is nonzero or alloca or _ALLOCA_H are defined. + On some platforms, does not declare YYSTD (size_t). + +2002-01-27 Akim Demaille + + Fix `%nonassoc and eof'. + + * src/state.c (errs_dup): Aaaah! The failure was due to bytes + which were not properly copied! Replace + memcpy (res->errs, src->errs, src->nerrs); + with + memcpy (res->errs, src->errs, src->nerrs * sizeof (src->errs[0])); + !!! + * tests/regression.at (%nonassoc and eof): Adjust to newest + Autotest: `.' is not in the PATH. + +2002-01-27 Akim Demaille + + * tests/sets.at (AT_EXTRACT_SETS): New. + (Nullable): Use it. + (Firsts): New. + +2002-01-26 Akim Demaille + + * tests/actions.at, tests/calc.at, tests/headers.at, + * tests/torture.at: Adjust to the newest Autotest which no longer + forces `.' in the PATH. + +2002-01-25 Akim Demaille + + * tests/regression.at (%nonassoc and eof): New. + Suggested by Robert Anisko. + +2002-01-24 Akim Demaille + + Bison dumps core when trying to complain about broken input files. + Reported by Cris van Pelt. + + * src/lex.c (parse_percent_token): Be sure to set token_buffer. + * tests/regression.at (Invalid input: 1, Invalid input: 2): Merge + into... + (Invalid inputs): Strengthen: exercise parse_percent_token. + +2002-01-24 Robert Anisko + + * src/Makefile.am: Add bison.c++. + * src/bison.c++: New skeleton. + +2002-01-21 Paolo Bonzini + + * po/it.po: New. + +2002-01-21 Kees Zeelenberg + + * src/files.c (skeleton_find) [MSDOS]: Fix cp definition. + +2002-01-20 Marc Autret + + * src/files.c (compute_output_file_names): Fix + +2002-01-20 Marc Autret + + * tests/output.at: New test. + * src/files.c (compute_base_names): Don't map extensions when + the YACC flag is set, use defaults. + Reported by Evgeny Stambulchik. + +2002-01-20 Marc Autret + + * src/system.h: Need to define __attribute__ away for non-GCC + compilers as well (i.e., the vendor C compiler). + Suggested by Albert Chin-A-Young. + +2002-01-11 Tim Van Holder + + * lib/hash.h, lib/hash.c: Renamed __P to PARAMS and used the + canonical definition. + * src/system.h: Use the canonical definition for PARAMS (avoids + a conflict with the macro from lib/hash.h). + +2002-01-11 Akim Demaille + + * configure.in: Use AC_FUNC_STRNLEN. + Fixes the failures observed on AIX 4.3 by H.Merijn Brand. + +2002-01-09 Akim Demaille + + * src/files.c, src/files.h (output_infix): New. + (tab_extension): Remove. + (compute_base_names): Compute the former, drop the latter. + * src/output.c (prepare): Insert the muscles `output-infix', and + `output-suffix'. + * src/parse-skel.y (string, string.1): New. + (section.header): Use it. + (section.yacc): Remove. + (prefix): Remove too. + * src/scan-skel.l: Adjust. + * src/bison.simple, src/bison.hairy: Adjust. + +2002-01-09 Akim Demaille + + * configure.in (WERROR_CFLAGS): Compute it. + * src/Makefile.am (CFLAGS): Pass it. + * tests/atlocal.in (CFLAGS): Idem. + * src/files.c: Fix a few warnings. + (get_extension_index): Remove, unused. + +2002-01-08 Akim Demaille + + * src/getargs.c (AS_FILE_NAME): New. + (getargs): Use it to convert DOSish file names. + * src/files.c (base_name): Rename as full_base_name to avoid + clashes with `base_name ()'. + (filename_split): New. + (compute_base_names): N-th rewrite, using filename_split. + +2002-01-08 Akim Demaille + + * lib/basename.c, lib/dirname.h, lib/dirname.c, lib/memrchr.c: + New, stolen from the Fileutils 4.1. + * lib/Makefile.am (libbison_a_SOURCES): Adjust. + * configure.in: Check for the presence of memrchr, and of its + prototype. + +2002-01-07 Tim Van Holder + + * lib/hash.h (__P): Added definition for this macro. + * src/Makefile.am: Add parse-skel.c and scan-skel.c to + BUILT_SOURCES, to ensure they are generated first. + * src/parse-skel.y: Use YYERROR_VERBOSE instead of + %error-verbose to allow bootstrapping with bison 1.30x. + +2002-01-06 Akim Demaille + + * src/reader.c (parse_braces): Don't fetch the next char, the + convention is to fetch on entry. + * tests/torture.at (GNU Cim Grammar): Reintroduce their weird + 'switch' without a following semicolon. + * tests/regression.at (braces parsing): New. + +2002-01-06 Akim Demaille + + Bison is dead wrong in its RR conflict reports. + + * tests/torture.at (GNU Cim Grammar): New. + * src/conflicts.c (count_rr_conflicts): Fix. + +2002-01-06 Akim Demaille + + Creating package.m4 from configure.ac causes too many problems. + + * tests/Makefile.am (package.m4): Create it by hand, + AC_CONFIG_TESTDIR no longer does in the most recent CVS Autoconf. + +2002-01-06 Akim Demaille + + * src/Makefile.am (bison_SOURCES): Add parse-skel.h and + skeleton.h. + +2002-01-04 Paul Eggert + + * doc/bison.texinfo (Debugging): + Remove YYSTDERR; it's no longer defined or used. + Also, s/cstdio.h/cstdio/. + +2002-01-03 Akim Demaille + + * tests/bison.in, tests/atlocal.in: Adjust to CVS Autoconf. + +2002-01-03 Akim Demaille + + * src/parse-skel.y (process_skeleton): Don't bind the parser's + tracing code to --trace, wait for a better --trace option, with + args. + +2002-01-03 Akim Demaille + + * src/bison.simple (YYSTDERR): Remove, replace `stderr'. + The ISO C++ standard is extremely clear about it: stderr is + considered a macro, not a regular symbol (see table 94 `Header + synopsis', [lib.c.files] 27.8.2 C Library files). + Therefore std:: does not apply to it. It still does with fprintf. + Also, s/cstdio.h/cstdio/. + +2002-01-03 Akim Demaille + + * lib/quotearg.c: Use `#include "..."' instead of `#include <...>' + for non system headers. + +2002-01-02 Akim Demaille + + Equip the skeleton chain with location tracking, runtime trace, + pure parser and scanner. + + * src/parse-skel.y: Request a pure parser, locations, and prefix + renaming. + (%union): Having several members with the same type does not help + type mismatches, simplify. + (YYPRINT, yyprint): New. + (yyerror): ``Rename'' (there is a #define yyerror skel_error) as... + (skel_error): this. + Handle locations. + * src/scan-skel.l: Adjust to these changes. + * src/skeleton.h (LOCATION_RESET, LOCATION_LINES, LOCATION_STEP) + (LOCATION_PRINT, skel_control_t): New. + +2001-12-30 Akim Demaille + + * src/parse-skel.y: Get rid of the shift/reduce conflict: + replace `gb' with BLANKS. + * src/scan-skel.l: Adjust. + +2001-12-30 Akim Demaille + + * src/system.h: We don't need nor want bcopy. + Throw away MS-DOS crap: we don't need getpid. + * configure.in: We don't need strndup. It was even causing + problems: because Flex includes the headers *before* us, + _GNU_SOURCE is not defined by config.h, and therefore strndup was + not visible. + * lib/xstrndup.c: New. + * src/scan-skel.l: Use it. + Be sure to initialize yylval.muscle member when scanning a MUSCLE. + * src/parse-skel.y: Use %directives instead of #defines. + +2001-12-30 Akim Demaille + + * src/skeleton.h: New. + * src/output.c (output_parser, output_master_parser): Remove, dead + code. + * src/output.h (get_lines_number, actions_output, guards_output) + (token_definitions_output): Prototype them. + * src/parse-skel.y: Add the license notice. + Include output.h and skeleton.h. + (process_skeleton): Returns void, and takes a single parameter. + * src/scan-skel.l: Add the license notice. + Include skeleton.h. + Don't use %option yylineno: it seems that then Flex imagines + REJECT has been used, and therefore it won't reallocate its + buffers (which makes no other sense to me than a bug). It results + in warnings for `unused: yy_flex_realloc'. + +2001-12-30 Robert Anisko + + * src/muscle_tab.h (MUSCLE_INSERT_INT, MUSCLE_INSERT_STRING) + (MUSCLE_INSERT_PREFIX): ...to there. + * src/output.c (MUSCLE_INSERT_INT, MUSCLE_INSERT_STRING) + (MUSCLE_INSERT_PREFIX): Move from here... + + * src/bison.hairy: Add a section directive. Put braces around muscle + names. This parser skeleton is still broken, but Bison should not + choke on a bad muscle 'syntax'. + * src/bison.simple: Add a section directive. Put braces around muscle + names. + + * src/files.h (strsuffix, stringappend): Add declarations. + (tab_extension): Add declaration. + (short_base_name): Add declaration. + + * src/files.c (strsuffix, stringappend): No longer static. These + functions are used in the skeleton parser. + (tab_extension): New. + (compute_base_names): Use the computations done in this function + to guess if the generated parsers should have '.tab' in their + names. + (short_base_name): No longer static. + + * src/output.c (output_skeleton): New. + (output): Disable call to output_master_parser, and give a try to + a new skeleton handling system. + (guards_output, actions_output): No longer static. + (token_definitions_output, get_lines_number): No longer static. + + * configure.in: Use AM_PROG_LEX and AC_PROG_YACC. + + * src/Makefile.am (bison_SOURCES): Add scan-skel.l and + parse-skel.y. + + * src/parse-skel.y: New file. + * src/scan-skel.l: New file. + +2001-12-29 Akim Demaille + + %name-prefix is broken. + + * src/files.c (spec_name_prefix): Initialize to NULL, not to "yy". + Adjust all dependencies. + * tests/headers.at (export YYLTYPE): Strengthen this test: use + %name-prefix. + + Renaming yylval but not yylloc is not consistent. Now we do. + + * src/bison.simple: Prefix yylloc if used. + * doc/bison.texinfo (Decl Summary): Document that. + +2001-12-29 Akim Demaille + + * doc/bison.texinfo: Promote `%long-directive' over + `%long_directive'. + Remove all references to fixed-output-files, yacc is enough. + +2001-12-29 Akim Demaille + + * src/bison.simple: Define YYDEBUG and YYERROR_VERBOSE *after* the + user prologue. These are defaults. + * tests/actions.at (Mid-rule actions): Make sure the user can + define YYDEBUG and YYERROR_VERBOSE. + +2001-12-29 Akim Demaille + + * src/output.c (header_output): Don't forget to export YYLTYPE and + yylloc. + * tests/headers.at (export YYLTYPE): New, make sure it does. + * tests/regression.at (%union and --defines, Invalid CPP headers): + Move to... + * tests/headers.at: here. + +2001-12-29 Akim Demaille + + * src/gram.h (rule_s): Member `assoc' is of type `associativity'. + +2001-12-29 Akim Demaille + + * tests/actions.at (Mid-rule actions): Output on a single line + instead of several. + +2001-12-29 Akim Demaille + + * doc/bison.texinfo: Formatting changes. + +2001-12-29 Akim Demaille + + Don't store the token defs in a muscle, just be ready to output it + on command. Now possible via `symbols'. Fixes a memory leak. + + * src/output.c (token_definitions_output): New. + (output_parser, header_output): Use it. + * src/reader.c (symbols_save): Remove. + +2001-12-29 Akim Demaille + + * src/bison.simple: Do not provide a default for YYSTYPE and + YYLTYPE before the user's prologue. Otherwise it's hardly... a + default. + +2001-12-29 Akim Demaille + + Mid-rule actions are simply... ignored! + + * src/reader.c (readgram): Be sure to attach mid-rule actions to + the empty-rule associated to the dummy symbol, not to the host + rule. + * tests/actions.at (Mid-rule actions): New. + +2001-12-29 Akim Demaille + + Memory leak. + + * src/reader.c (reader): Free grammar. + +2001-12-29 Akim Demaille + + Memory leak. + + * src/LR0.c (new_itemsets): Don't allocate `shift_symbol' here, + since it allocates it for each state, although only one is needed. + (allocate_storage): Do it here. + +2001-12-29 Akim Demaille + + * src/options.h, src/options.c (create_long_option_table): Rename + as... + (long_option_table_new): this, with a clearer prototype. + (percent_table): Remove, unused, + * src/getargs.c (getargs): Adjust. + +2001-12-29 Akim Demaille + + * src/LR0.c, src/conflicts.c, src/lalr.c, src/lalr.h, src/output.c + * src/print.c, src/print_graph.c, src/state.h: Rename state_table + as states. + +2001-12-29 Akim Demaille + + * src/lalr.c (build_relations): Rename `states' as `states1'. + Sorry, I don't understand exactly what it is, no better name... + +2001-12-29 Akim Demaille + + * src/closure.c, src/conflicts.c, src/derives.c, src/gram.c + * src/gram.h, src/lalr.c, src/nullable.c, src/output.c, src/print.c + * src/print_graph.c, src/reader.c, src/reduce.c: Rename rule_table + as rules. + +2001-12-29 Akim Demaille + + * src/gram.c (rprec, rprecsym, rassoc): Remove, unused since long + ago. + +2001-12-29 Akim Demaille + + * src/reader.c, src/reader.h (user_toknums): Remove. + Adjust all users to use symbols[i]->user_token_number. + +2001-12-29 Akim Demaille + + * src/gram.c, src/gram.h (sprec, sassoc): Remove. + Adjust all users to use symbols[i]->prec or ->assoc. + +2001-12-29 Akim Demaille + + * src/reader.c, src/reader.h (tags): Remove. + Adjust all users to use symbols[i]->tag. + +2001-12-29 Akim Demaille + + * src/gram.h, src/gram.c (symbols): New, similar to state_table + and rule_table. + * src/reader.c (packsymbols): Fill this table. + Drop sprec. + * src/conflicts.c (resolve_sr_conflict): Adjust. + * src/reduce.c (reduce_grammar): Adjust: just sort symbols, a + single table. + Use symbols[i]->tag instead of tags[i]. + +2001-12-29 Akim Demaille + + * tests/calc.at (_AT_DATA_CALC_Y): Also use %union. + In addition, put a comment in there, to replace... + * tests/regression.at (%union and C comments): Remove. + +2001-12-29 Akim Demaille + + * tests/regression.at (Web2c Actions): Blindly move the actual + output as expected output. The contents *seem* right to me, but I + can't pretend reading perfectly parser tables... Nonetheless, all + the other tests pass correctly, the table look OK, even though the + presence of `$axiom' is to be noted: AFAICS it is useless (but + harmless). + +2001-12-29 Akim Demaille + + * src/reader.c (readgram): Don't add the rule 0 if there were no + rules read. In other words, add it _after_ having performed + grammar sanity checks. + Fixes the `tests/regression.at (Invalid input: 1)' Failure. + +2001-12-29 Akim Demaille + + * tests/regression.at (Web2c Report): Catch up: the rule 0 is now + visible, and some states have now a different number. + +2001-12-29 Akim Demaille + + * src/reader.c (readgram): Bind the initial rule's lineno to that + of the first rule. + * tests/regression.at (Rule Line Numbers, Unresolved SR Conflicts): + (Solved SR Conflicts): Adjust rule 0's line number. + +2001-12-29 Akim Demaille + + Fix the `GAWK Grammar' failure. + + * src/LR0.c (final_state): Initialize to -1 so that we do compute + the reductions of the first state which was mistakenly confused + with the final state because precisely final_state was initialized + to 0. + * tests/sets.at (Nullable): Adjust: state 0 does have lookaheads, + now noticed by Bison. + * tests/regression.at (Rule Line Numbers): Adjust: state 0 does + have a reduction on $default. + +2001-12-29 Akim Demaille + + * src/gram.c (ritem_print): Be sure to subtract 1 when displaying + rule line numbers. + * src/closure.c (print_closure): Likewise. + * src/derives.c (print_derives): Likewise. + * tests/sets.at (Nullable): Adjust: the rule numbers are correct + now. + +2001-12-29 Akim Demaille + + * src/lalr.c (lookaheads_print): New. + (lalr): Call it when --trace-flag. + * tests/sets.at (Nullable): Adjust: when tracing, the lookaheads + are dumped. + +2001-12-29 Akim Demaille + + * src/derives.c (print_derives): Be sure to use `>= 0', not `> 0', + when walking through ritem, even via rule->rhs. + * src/reduce.c (dump_grammar, useful_production, reduce_output) + (useful_production, useless_nonterminals): Likewise. + (reduce_grammar_tables): Likewise, plus update nritems. + * src/nullable.c (set_nullable): Likewise. + * src/lalr.c (build_relations): Likewise. + * tests/sets.at (Nullable): Adjust. + Fortunately, now, the $axiom is no longer nullable. + +2001-12-29 Akim Demaille + + * src/LR0.c (generate_states): Use nritems, not nitems, nor using + the 0-sentinel. + * src/gram.c (ritem_longest_rhs): Likewise. + * src/reduce.c (nonterminals_reduce): Likewise. + * src/print_graph.c (print_graph): Likewise. + * src/output.c (output_rule_data): Likewise. + * src/nullable.c (set_nullable): Likewise. + +2001-12-29 Akim Demaille + + * src/output.c: Comment changes. + +2001-12-27 Paul Eggert + + * src/bison.simple (YYSTACK_ALLOC, YYSIZE_T): Remove special + cases for non-GNU systems like AIX, HP-UX, SGI, Sun, and + Sparc, as they were causing more porting problems than the + (minor) performance improvement was worth. + + Also, catch up with 1.31's YYSTD. + +2001-12-27 Akim Demaille + + * src/output.c (output_gram): Rely on nritems, not the + 0-sentinel. See below. + Use -1 as separator, not 0. + * src/bison.simple (yyparse): Subtract 1 to the rule numbers. + Rely on -1 as separator in yyrhs, instead of 0. + * tests/calc.at (AT_CHECK_CALC): Now, the parsers no longer issue + twice `Now at end of input', therefore there are two lines less to + expect. + +2001-12-27 Akim Demaille + + * tests/regression.at (Unresolved SR Conflicts): + (Solved SR Conflicts, Rule Line Numbers): Adjust to the changes + below. + +2001-12-27 Akim Demaille + + * src/LR0.c (new_state): Recognize the final state by the fact it + is reached by eoftoken. + (insert_start_shifting_state, insert_eof_shifting_state) + (insert_accepting_state, augment_automaton): Remove, since now + these states are automatically computed from the initial state. + (generate_states): Adjust. + * src/print.c: When reporting a rule number to the user, substract + 1, so that the axiom rule is rule 0, and the first user rule is 1. + * src/reduce.c: Likewise. + * src/print_graph.c (print_core): For the time being, just as for + the report, depend upon --trace-flags to dump the full set of + items. + * src/reader.c (readgram): Once the grammar read, insert the rule + 0: `$axiom: START-SYMBOL $'. + * tests/set.at: Adjust: rule 0 is now displayed, and since the + number of the states has changed (the final state is no longer + necessarily the last), catch up. + +2001-12-27 Akim Demaille + + Try to make the use of the eoftoken valid. Given that its value + is 0 which was also used as a sentinel in ritem, (i) make sure >= 0 + is used instead of > 0 where appropriate, (ii), depend upon nritems + instead of the 0-sentinel. + + * src/gram.h, src/gram.c (nritems): New. + Expected to be duplication of nitems, but for the time being... + * src/reader.c (packgram): Assert nritems and nitems are equal. + * src/LR0.c (allocate_itemsets, new_itemsets): Adjust. + * src/closure.c (print_closure, print_fderives): Likewise. + * src/gram.c (ritem_print): Likewise. + * src/print.c (print_core, print_grammar): Likewise. + * src/print_graph.c: Likewise. + +2001-12-27 Akim Demaille + + * src/main.c (main): If there are complains after grammar + reductions, then output the report anyway if requested, then die. + * src/symtab.c (bucket_new): Initialize `value' to -1, not 0. + * src/reader.c (eoftoken): New. + (parse_token_decl): If the token being defined has value `0', it + is the eoftoken. + (packsymbols): No longer hack `tags' to insert `$' by hand. + Be sure to preserve the value of the eoftoken. + (reader): Make sure eoftoken is defined. + Initialize nsyms to 0: now eoftoken is created just like the others. + * src/print.c (print_grammar): Don't special case the eof token. + * src/regression.at: Adjust: `$' has value 0, not -1, which was a + lie anyway, albeit pleasant. + * tests/calc.at: Exercise error messages with eoftoken. + Change the grammar so that empty input is invalid. + Adjust expectations. + When yyungeting, be sure to use a valid yylloc: use last_yylloc. + +2001-12-27 Akim Demaille + + * configure.in: Check the protos of strchr ans strspn. + Replace strchr if needed. + * src/system.h: Provide the protos of strchr, strspn and memchr if + missing. + * lib/strchr.c: New. + * src/reader.c (symbols_save): Use strchr. + +2001-12-27 Akim Demaille + + * src/print.c, src/print_graph.c (escape): New. + Use it to quote the TAGS outputs. + * src/print_graph.c (print_state): Now errors are in red, and + reductions in green. + Prefer high to wide: output the state number on a line of its own. + +2001-12-27 Akim Demaille + + * src/state.h, src/state.c (reductions_new): New. + * src/LR0.c (set_state_table): Let all the states have a + `reductions', even if reduced to 0. + (save_reductions): Adjust. + * src/lalr.c (initialize_LA, initialize_lookaheads): Adjust. + * src/print.c (print_reductions, print_actions): Adjust. + * src/output.c (action_row): Adjust. + +2001-12-27 Akim Demaille + + * src/state.h, src/state.c (errs_new, errs_dup): New. + * src/LR0.c (set_state_table): Let all the states have an errs, + even if reduced to 0. + * src/print.c (print_errs, print_reductions): Adjust. + * src/output.c (output_actions, action_row): Adjust. + * src/conflicts.c (resolve_sr_conflict): Adjust. + +2001-12-27 Akim Demaille + + * src/lalr.c (set_goto_map, initialize_F): Use SHIFT_SYMBOL. + +2001-12-27 Akim Demaille + + * src/conflicts.c, src/conflicts.h (print_reductions): Move to... + * src/print.c: here. + (lookaheadset, shiftset): New, used as additional storage by + print_reductions. + (print_results): Adjust. + (print_shifts, print_gotos, print_errs): New, extracted from... + (print_actions): here. + * src/print_graph.c (print_actions): Remove dead code. + +2001-12-27 Akim Demaille + + * src/reader.c (copy_dollar, copy_at): Better checking of `n' in + `$n' and `@n'. + +2001-12-27 Akim Demaille + + * src/lalr.c (add_lookback_edge): Use state_t instead of ints. + (build_relations): Adjust. + +2001-12-27 Akim Demaille + + * src/lalr.c (set_goto_map): Remove a wrong but benign loop + duplication. + +2001-12-27 Akim Demaille + + * src/reader.c (packgram): Catch nitems overflows. + +2001-12-27 Akim Demaille + + * src/files.c, src/files.h (guard_obstack): Remove. + * src/output.c (output): Adjust. + * src/reader.c (parse_braces): New, factoring... + (copy_action, copy_guard): these two which are renamed as... + (parse_action, parse_guard): these. + As a voluntary consequence, using braces around guards is now + mandatory. + +2001-12-27 Akim Demaille + + * src/gram.h (rule_t): `guard' and `guard_line' are new members. + * src/reader.c (symbol_list): `guard' and `guard_line' are new + members. + (symbol_list_new): Adjust. + (copy_action): action_line is the first line, not the last. + (copy_guard): Just as for actions, store the `action' only, not + the switch/case/break flesh. + Don't parse the user action that might follow the guard, let... + (readgram): do it, i.e., now, there can be an action after a + guard. + In other words the guard is just explicitly optional. + (packgram): Adjust. + * src/output.c (guards_output): New. + (output_parser): Call it when needed. + (output): Also free the guard and attrs obstacks. + * src/files.c, src/files.h (obstack_save): Remove. + (output_files): Remove. + As a result, if one needs the former `.act' file, using an + appropriate skeleton which requires actions and guards is now + required. + * src/main.c (main): Adjust. + * tests/semantic.at: New. + * tests/regression.at: Use `input.y' as input file name. + Avoid 8+3 problems by requiring input.c when the test needs the + parser. + +2001-12-27 Akim Demaille + + * src/reader.c (symbol_list_new): Be sure to initialize all the + fields. + +2001-12-27 Akim Demaille + + All the hacks using a final pseudo state are now useless. + + * src/LR0.c (set_state_table): state_table holds exactly nstates. + * src/lalr.c (nLA): New. + (initialize_LA, compute_lookaheads, initialize_lookaheads): Use it + instead of lookaheadsp from the pseudo state (nstate + 1). + +2001-12-27 Akim Demaille + + * src/output.c (action_row, token_actions): Use a state_t instead + of a integer, and nlookaheads instead of the following state's + lookaheadsp. + +2001-12-27 Akim Demaille + + * src/conflicts.c (log_resolution, flush_shift) + (resolve_sr_conflict, set_conflicts, solve_conflicts) + (count_sr_conflicts, count_rr_conflicts, conflicts_output) + (conflicts_print, print_reductions): Use a state_t instead of an + integer when referring to a state. + As much as possible, depend upon nlookaheads, instead of the + `lookaheadsp' member of the following state (since lookaheads of + successive states are successive, the difference between state n + 1 + and n served as the number of lookaheads for state n). + * src/lalr.c (add_lookback_edge): Likewise. + * src/print.c (print_core, print_actions, print_state) + (print_results): Likewise. + * src/print_graph.c (print_core, print_actions, print_state) + (print_graph): Likewise. + * src/conflicts.h: Adjust. + +2001-12-27 Akim Demaille + + * src/bison.hairy: Formatting/comment changes. + ANSIfy. + Remove `register' indications. + Add plenty of `static'. + +2001-12-27 Akim Demaille + + * src/output.c (prepare): Drop the muscle `ntbase' which + duplicates ntokens. + * src/bison.simple: Formatting/comment changes. + Use YYNTOKENS only, which is documented, but not YYNTBASE, which + is an undocumented synonym. + +2001-12-22 Akim Demaille + + * src/output.c (output_table_data): Change the prototype to use + `int' for array ranges: some invocations do pass an int, not a + short. + Reported by Wayne Green. + +2001-12-22 Akim Demaille + + Some actions of web2c.y are improperly triggered. + Reported by Mike Castle. + + * src/lalr.c (traverse): s/F (i)[k] = F (j)[k]/F (j)[k] = F (i)[k]/. + * tests/regression.at (Web2c): Rename as... + (Web2c Report): this. + (Web2c Actions): New. + +2001-12-22 Akim Demaille + + Reductions in web2c.y are improperly reported. + Reported by Mike Castle. + + * src/conflicts.c (print_reductions): Fix. + * tests/regression.at (Web2c): New. + +2001-12-18 Akim Demaille + + Some host fail on `assert (!"foo")', which expands to + ((!"foo") ? (void)0 : __assert("!"foo."", __FILE__, __LINE__)) + Reported by Nelson Beebee. + + * src/output.c, src/vcg.c: Replace `assert (!"it succeeded")' with + `#define it_succeeded 0' and `assert (it_succeeded)'. + +2001-12-17 Marc Autret + + * src/bison.simple: Don't hard code the skeleton line and filename. + * src/output.c (output_parser): Rename 'line' as 'output_line'. + New line counter 'skeleton_line' (skeleton-line muscle). + +2001-12-17 Paul Eggert + + * NEWS, doc/bison.texinfo, doc/bison.1, doc/bison.rnh: Document that + YYDEBUG must be defined to a nonzero value. + + * src/bison.simple (yytname): Do not assume that the user defines + YYDEBUG to a properly parenthesized expression. + +2001-12-17 Akim Demaille + + * src/state.h (state_t): Rename lookaheads as lookaheadsp. + nlookaheads is a new member. + Adjust all users. + * src/lalr.h (nlookaheads): Remove this orphan declaration. + * src/lalr.c (initialize_lookaheads): Set nlookaheads for each + state. + +2001-12-17 Akim Demaille + + * src/files.h, src/files.c (open_files, close_files): Remove. + * src/main.c (main): Don't open/close files, nor invoke lex_free, + let... + * src/reader.c (reader): Do it. + +2001-12-17 Akim Demaille + + * src/conflicts.c (print_reductions): Formatting changes. + +2001-12-17 Akim Demaille + + * src/conflicts.c (flush_shift): Also adjust lookaheadset. + (flush_reduce): New. + (resolve_sr_conflict): Adjust. + +2001-12-17 Akim Demaille + + * src/output.c (output_obstack): Be static and rename as... + (format_obstack): this, to avoid any confusion with files.c's + output_obstack. + * src/reader.h (muscle_obstack): Move to... + * src/output.h: here, since it's defined in output.c. + +2001-12-17 Akim Demaille + + * src/output.c (action_row, save_column, default_goto) + (sort_actions, matching_state, pack_vector): Better variable + locality. + +2001-12-17 Akim Demaille + + * src/output.c: Various formatting changes. + +2001-12-17 Akim Demaille + + * src/files.c (output_files): Free the output_obstack. + * src/main.c (main): Call print and print_graph conditionally. + * src/print.c (print): Work unconditionally. + * src/print_graph.c (print_graph): Work unconditionally. + * src/conflicts.c (log_resolution): Output only if verbose_flag. + +2001-12-16 Marc Autret + + * src/output.c (actions_output): Fix. When we use %no-lines, + there is one less line per action. + +2001-12-16 Marc Autret + + * src/bison.simple: Remove a useless #line directive. + s/#line %%line %%skeleton/#line %%line "%%parser-file-name"/'. + * src/output.c (get_lines_number): New. + (output_parser): Adjust, now takes care about the lines of a + output muscles. + Fix line numbering. + (actions_output): Computes the number of lines taken by actions. + (output_master_parser): Insert new skeleton which is the name of + the output parser file name. + +2001-12-15 Marc Autret + + * src/bison.simple [YYERROR_VERBOSE]: Restore backward compatibility. + +2001-12-15 Marc Autret + + * src/output.c (output_gram): Keep track of the hairy one. + +2001-12-15 Akim Demaille + + Make `make distcheck' work. + + * lib/Makefile.am (INCLUDES): Add top_srcdir/intl, since hash uses + system.h which uses libgettext.h. + +2001-12-15 Akim Demaille + + * src/nullable.c (set_nullable): Useless rules must be skipped, + otherwise, since we range over their symbols, we might look at a + nonterminal which no longer ``exists'', i.e., it is not counted in + `nvars', hence we overflow our arrays. + +2001-12-15 Akim Demaille + + The header can also be produced directly, without any obstack! + Yahoo! + + * src/files.c, src/files.h (defines_obstack): Remove. + (compute_header_macro): Global. + (defines_obstack_save): Remove. + * src/reader.c (parse_union_decl): No longer output to + defines_obstack: its content can be found in the `stype' muscle + anyway. + (output_token_translations): Merge into... + (symbols_output): this. + Rename as... + (symbols_save): this. + (reader): Adjust. + * src/output.c (header_output): New. + (output): Call it. + +2001-12-15 Akim Demaille + + * src/reader.c (parse_union_decl): Instead of handling two obstack + simultaneously, use one to define the `stype' muscle, and use the + value of the latter to fill defines_obstack. + (copy_comment): Remove. + (copy_comment2): Work for a single obstack. + Rename as... + (copy_comment): this. + +2001-12-15 Akim Demaille + + * src/lex.c, src/lex.h (xgetc): No longer static. + * src/reader.c (parse_union_decl): Revamp. + +2001-12-15 Akim Demaille + + Still making progress in separating Bison into (i) input, (ii) + process, (iii) output: now we can directly output the parser file + without using table_obstack at all. + + * src/files.c, src/files.h (table_obstack): Bye bye. + (parser_file_name): New. + * src/files.c (compute_output_file_names): Compute it. + * src/output.c (actions_output, output_parser) + (output_master_parser): To a file instead of an obstack. + +2001-12-15 Akim Demaille + + Attach actions to rules, instead of pre-outputting them to + actions_obstack. + + * src/gram.h (rule_t): action and action_line are new members. + * src/reader.c (symbol_list): Likewise. + (copy_action): Save the actions within the rule. + (packgram): Save them in rule_table. + * src/output.c (actions_output): New. + (output_parser): Use it on `%%actions'. + (output_rule_data): Don't free rule_table. + (output): Do it. + (prepare): Don't save the `action' muscle. + * src/bison.simple: s/%%action/%%actions/. + +2001-12-15 Akim Demaille + + * src/reader.c (copy_action): When --yacc, don't append a `;' + to the user action: let it fail if lacking. + Suggested by Arnold Robbins and Tom Tromey. + +2001-12-14 Akim Demaille + + * src/lex.c (literalchar): Simply return the char you decoded, non + longer mess around with obstacks and int pointers. + Adjust all callers. + +2001-12-14 Akim Demaille + + * src/lex.c (literalchar): Don't escape the special characters, + just decode them, and keep them as char (before, eol was output as + the 2 char string `\n' etc.). + * src/output.c (output_rule_data): Use quotearg to output the + token strings. + +2001-12-13 Paul Eggert + + * src/bison.simple (YYSIZE_T, YYSTACK_ALLOC, YYSTACK_FREE): + Do not infringe on the global user namespace when using C++. + (YYFPRINTF, YYSTDERR): New macros, needed for the above. + All uses of `fprintf' and `stderr' changed. + + * doc/bison.texinfo: Document YYFPRINTF, YYSTDERR. + +2001-12-13 Akim Demaille + + The computation of nullable is broken: it doesn't handle empty + RHS's properly. + + * tests/torture.at (GNU AWK Grammar): New. + * tests/sets.at (Nullable): New. + * src/nullable.c (set_nullable): Instead of blindly looping over + `ritems', loop over the rules, and then over their rhs's. + + Work around Autotest bugs. + + * src/warshall.c (bitmatrix_print): Don't use `+--+' as table + frame, because Autotest understand lines starting with a `+' as + traces from the shell. Then, they are not processed properly. + Admittedly an Autotest bug, but we don't have time to wait for + Autotest to catch up. + * tests/regression.at (Broken Closure): Adjust to the new table + frames. + Move to... + * tests/sets.at: here. + +2001-12-13 Akim Demaille + + * src/closure.c (closure): Use nrules instead of playing tricks + with BITS_PER_WORD. + +2001-12-13 Akim Demaille + + * src/print.c (print_actions): Output the handling of `$' as the + traces do: shifting the token EOF. Before EOF was treated as a + nonterminal. + * tests/regression.at: Adjust some tests. + * src/print_graph.c (print_core): Complete the set of items via + closure. The next-to-final and final states are still unsatisfying, + but that's to be addressed elsewhere. + No longer output the rule numbers, but do output the state number. + A single loop for the shifts + gotos is enough, but picked a + distinct color for each. + (print_graph): Initialize and finalize closure. + +2001-12-13 Akim Demaille + + * src/reader.c (readgram): Remove dead code, an strip useless + braces. + (get_type): Remove, unused. + +2001-12-12 Akim Demaille + + * src/complain.h, src/complain.c: Remove error_one_per_line, rely + on that of lib/error.c. + +2001-12-12 Akim Demaille + + Some hosts don't like `/' in includes. + + * src/system.h: Include libgettext.h without qualifying the path. + * src/Makefile.am (INCLUDES): Add $(top_srcdir)/intl, remove + $(top_srcdir). + +2001-12-11 Marc Autret + + * src/output.c (output_parser): Remove useless muscle. + +2001-12-11 Marc Autret + + * src/bison.simple: Remove #line just before %%epilogue. It + is now handled in ... + * src/reader.c (read_additionnal_code): Add the output of a + #line for the epilogue. + +2001-12-10 Marc Autret + + * src/reader.c (copy_definition): Re-use CPP-outed code which + replace precedent remove. + * src/bison.simple: Remove #line before %%prologue because + %%input-line is wrong at this time. + +2001-12-10 Marc Autret + + * src/reader.c (symbols_output): Clean up. + * src/output.c (output_gram, output): Clean up. + +2001-12-10 Akim Demaille + + * src/lalr.c (initialize_lookaheads): New. Extracted from... + * src/LR0.c (set_state_table): here. + * src/lalr.c (lalr): Call it. + +2001-12-10 Akim Demaille + + * src/state.h (shifts): Remove the `number' member: shifts are + attached to state, hence no longer need to be labelled with a + state number. + +2001-12-10 Akim Demaille + + Now that states have a complete set of members, the linked list of + shifts is useless: just fill directly the state's shifts member. + + * src/state.h (shifts): Remove the `next' member. + * src/LR0.c (first_state, last_state): Remove. + Adjust the callers. + (augment_automaton): Don't look for the shifts that must be added + a shift on EOF: it is those of the state we looked for! But now, + since shifts are attached, it is no longer needed to looking + merely by its id: its number. + +2001-12-10 Akim Demaille + + * src/LR0.c (augment_automaton): Better variable locality. + Remove an impossible branch: if there is a state corresponding to + the start symbol being shifted, then there is shift for the start + symbol from the initial state. + +2001-12-10 Akim Demaille + + * src/LR0.c (augment_automaton): Call `insert_eof_shifting_state' + only when appropriate: when insert_start_shifting_state' is not + invoked. + * tests/regression.at (Rule Line Numbers): Adjust. + +2001-12-10 Akim Demaille + + * src/LR0.c (augment_automaton): Now that all states have shifts, + merge the two cases addition shifts to the initial state. + +2001-12-10 Akim Demaille + + * src/lalr.c (set_state_table): Move to... + * src/LR0.c: here. + * src/lalr.c (lalr): Don't call it... + * src/LR0.c (generate_states): do it. + * src/LR0.h (first_state): Remove, only the table is used. + +2001-12-10 Akim Demaille + + * src/LR0.h (first_shift, first_reduction): Remove. + * src/lalr.c: Don't use first_shift: find shifts through the + states. + +2001-12-10 Akim Demaille + + * src/LR0.c: Attach shifts to states as soon as they are + computed. + * src/lalr.c (set_state_table): Instead of assigning shifts to + state, just assert that the mapping was properly done. + +2001-12-10 Akim Demaille + + * src/LR0.c (insert_start_shift): Rename as... + (insert_start_shifting_state): this. + (insert_eof_shifting_state, insert_accepting_state): New. + (augment_automaton): Adjust. + Better locality of the variables. + When looking if the start_symbol is shifted from the initial + state, using `while (... symbol != start_symbol ...)' sounds + better than `while (... symbol < start_symbol ...)': If fail + to see how the order between symbols could be relevant! + +2001-12-10 Akim Demaille + + * src/getargs.h: Don't declare `spec_name_prefix' and + `spec_file_prefix', declared by src/files.h. + * src/files.c, src/files.h: Default for spec_name_prefix is "yy". + * src/muscle_tab.c (muscle_init): Default prefix to NULL. + * src/output.c (prepare): Adjust. + * src/reader.c (symbols_output): Likewise. + * src/vmsgetargs.c: Vaguely adjust, but who cares? + +2001-12-10 Akim Demaille + + * src/muscle_tab.c (muscle_init): NULL is a better default than + `"0"'. + +2001-12-10 Akim Demaille + + * src/reader.c (reader): Calling symbols_output once is enough. + +2001-12-10 Akim Demaille + + Now that states have a complete set of members, the linked list of + reductions is useless: just fill directly the state's reductions + member. + + * src/state.h (struct reductions): Remove member `number' and + `next'. + * src/LR0.c (first_reduction, last_reduction): Remove. + (save_reductions): Don't link the new reductions, store them in + this_state. + * src/lalr.c (set_state_table): No need to attach reductions to + states, it's already done. + * src/output.c (output_actions): No longer free the shifts, then + the reductions, then the states: free all the states and their + members. + +2001-12-10 Akim Demaille + + * src/options.c (OPTN, DRTV, BOTH): New. + (option_table): Use them. + + * src/muscle_tab.c: Don't include xalloc.h and string.h: that's + the job of system.h. + * src/options.c: Don't include stdio.h and xalloc.h for the same + reasons. + +2001-12-10 Akim Demaille + + * src/output.c (output, prepare): Make sure the values of the + muscles `action' and `prologue' are 0-terminated. + +2001-12-10 Akim Demaille + + Clean up GCC warnings. + + * src/reader.c (copy_action): `buf' is not used. + (parse_skel_decl): Be static. + * src/muscle_tab.c (mhash1, mhash2, muscle_insert): Preserve `const'. + * src/options.h (create_long_option_table): Have a real prototype. + * lib/hash.c, lib/hash.h (hash_insert, hash_insert_at, hash_delete) + (hash_delete_at): Return const void *. + Adjust casts to preserve the const. + +2001-12-10 Akim Demaille + + * configure.in: Require 2.52g. + M4 is not needed, but AUTOM4TE is. + * m4/m4.m4: Remove. + * tests/Makefile.am: Adjust. + +2001-12-10 Akim Demaille + + One structure for states is enough, even though theoretically + there are LR(0) states and LALR(1) states. + + * src/lalr.h (state_t): Remove. + (state_table): Be state_t **, not state_t *. + * src/state.h (core, CORE_ALLOC): Rename as... + (state_t, STATE_ALLOC): this. + Add the LALR(1) members: shifts, reductions, errs. + * src/LR0.c (state_table): Rename as... + (state_hash): this, to avoid name clashes with the global + `state_table'. + * src/print_graph.c, src/LR0.c, src/LR0.h, src/conflicts.c + * src/lalr.c, src/lalr.h, src/output.c, src/print.c: Adjust. + +2001-12-10 Akim Demaille + + Bison dumps core on bash.y. + Reported by Pascal Bart. + + * src/warshall.c (bitmatrix_print): New. + (TC): Use it. + When performing a transitive closure R(i, j) && R(j, k) => R(i, k), + j must be the outer loop. + * tests/regression.at (Broken Closure): New. + +2001-12-05 Akim Demaille + + * tests/atlocal.in (CPPFLAGS): Do not leave a space between -I and + its argument. + Reported by Peter Hamorsky. + +2001-12-05 Akim Demaille + + * src/conflicts.c (err_table): Remove. + (resolve_sr_conflict): Adjust. + * src/lalr.h (state_t.reduction_table, state_t.shift_table): + Rename as... + (state_t.reductions, state_t.shifts): this. + +2001-12-05 Akim Demaille + + * src/reduce.c (reduce_grammar_tables): No longer disable the + removal of useless rules via CPP but via `if (0)', so that the + compiler still check the code is valid. + For instance, it should have noticed `rline' no longer exists: use + the `line' member of rule_t. + * src/gram.c (dummy, rline): Remove, unused. + +2001-12-05 Akim Demaille + + * src/output.c (pack_vector): Use assert, not berror. + * src/main.c (berror): Remove, unused. + +2001-12-05 Akim Demaille + + New experimental feature: if --verbose --trace output all the + items of a state, not only its kernel. + + * src/print.c (print_core): If `trace_flag', then invoke closure + before outputting the items of the state (print_core is no longer + a correct name them). + (print_results): Invoke new_closure/free_closure if needed. + +2001-12-05 Akim Demaille + + * src/LR0.c (new_itemsets): Use nshifts only, not shiftcount. + * src/closure.c, src/closure.h (itemsetsize): Rename as... + (nitemset): for consistency with the rest of the project. + +2001-12-05 Akim Demaille + + * src/closure.c (print_closure): Improve. + (closure): Use it for printing input and output. + +2001-12-05 Akim Demaille + + * src/closure.c (FIRSTS, FDERIVES): Adjust to reality: they are + indexed by nonterminals. + +2001-12-05 Akim Demaille + + * src/warshall.c (TC, RTC): De-obsfucate (source reduced to 22% of + what it was!). + * src/warshall.h: Remove accidental duplication of the content. + +2001-12-05 Akim Demaille + + * src/closure.c (set_fderives): De-obfuscate. + +2001-12-05 Akim Demaille + + * src/closure.c (print_firsts, print_fderives): De-obfuscate. + +2001-12-05 Akim Demaille + + * src/closure.c (set_firsts): De-obfuscate. + +2001-12-05 Akim Demaille + + * src/output.c (action_row): De-obfuscate + using the good o' techniques: arrays not pointers, variable + locality, BITISSET, RESETBIT etc. + +2001-12-05 Akim Demaille + + Pessimize the code to simplify it: from now on, all the states + have a valid SHIFTS, which NSHIFTS is possibly 0. + + * src/LR0.c (shifts_new): Be global and move to.. + * src/state.c, src/state.h: here. + * src/conflicts, src/lalr.c, src/output.c, src/print.c, + * src/print_graph: Adjust. + +2001-12-05 Akim Demaille + + * src/state.h (SHIFT_DISABLE, SHIFT_IS_DISABLED): New. + * src/conflicts.c: Use it. + Restore a few missing `if (!SHIFT_IS_DISABLED)' which were + incorrectly ``simplified''. + +2001-12-05 Akim Demaille + + * src/conflicts.c (flush_shift, resolve_sr_conflict): De-obfuscate + using the good o' techniques: arrays not pointers, variable + locality, BITISSET, RESETBIT etc. + +2001-12-05 Akim Demaille + + * src/state.h (SHIFT_SYMBOL): New. + * src/conflicts.c: Use it to deobfuscate. + +2001-12-05 Akim Demaille + + * src/conflicts.c (count_sr_conflicts, count_rr_conflicts) + (print_reductions): De-obfuscate using the good o' techniques: + arrays not pointers, variable locality, BITISSET. + +2001-12-05 Akim Demaille + + * src/conflicts.c (print_reductions): Arrays, not pointers. + Use BITISSET. + +2001-12-05 Akim Demaille + + * src/conflicts.c (print_reductions): Pessimize, but clarify. + +2001-12-05 Akim Demaille + + * src/conflicts.c (print_reductions): Improve variable locality. + +2001-12-05 Akim Demaille + + * src/conflicts.c (print_reductions): Pessimize, but clarify. + +2001-12-05 Akim Demaille + + * src/conflicts.c (print_reductions): Improve variable locality. + +2001-12-05 Akim Demaille + + * src/state.h (SHIFT_IS_ERROR, SHIFT_IS_GOTO, SHIFT_IS_SHIFT): New. + * src/lalr.c: Use them. + +2001-12-05 Akim Demaille + + * src/LR0.c (augment_automaton): Formatting changes. + Better variable locality. + +2001-12-05 Akim Demaille + + * src/lalr.c (matrix_print): New. + (transpose): Use it. + Use arrays instead of pointers. + +2001-12-05 Akim Demaille + + * src/lalr.c (maxrhs): Move to... + * src/gram.c, src/gram.h (ritem_longest_rhs): here. + * src/lalr.c (build_relations): Adjust. + +2001-12-05 Akim Demaille + + * src/lalr.c (transpose): Free the memory allocated to the + argument, as it is replaced by the results by the unique caller. + (build_relations): Merely invoke transpose: it handles the memory + deallocation. + Improve variable locality. + Avoid variables used as mere abbreviations. + (compute_lookaheads): Use arrays instead of pointers. + +2001-12-05 Akim Demaille + + * src/lalr.c (initialize_F): Improve variable locality. + Avoid variables used as mere abbreviations. + +2001-12-05 Akim Demaille + + * src/derives.c (print_derives): Display the ruleno. + * src/lalr.c (initialize_F, transpose): Better variable locality + to improve readability. + Avoid variables used as mere abbreviations. + +2001-12-05 Akim Demaille + + * src/lalr.c (traverse): Use arrays instead of pointers. + +2001-12-05 Akim Demaille + + * src/nullable.c (set_nullable): Use a for loop to de-obfuscate + the handling of squeue. + `symbol >= 0' is wrong now, use `rule_table[ruleno].useful'. + +2001-12-05 Akim Demaille + + Because useless nonterminals are now kept alive (instead of being + `destroyed'), we now sometimes examine them, and store information + related to them. Hence we need to know their number, and adjust + memory allocations. + + * src/reduce.c, src/reduce.h (nuseless_nonterminals): No longer + static. + * src/LR0.c (allocate_itemsets): The memory allocated to + `symbol_count' was used for two different purpose: once to count + the number of occurrences of each symbol, and later reassigned to + `shift_symbol', containing the symbol that can be shifted from a + given state. + Deobfuscate, i.e., allocate, use and free `symbol_count' here + only, and... + (new_itemsets): Allocate `shift_symbol' here. + (allocate_itemsets): symbol_count includes useless nonterminals. + Make room for them. + (free_storage): Use `free', not `XFREE', for pointers that cannot + be null. + +2001-12-05 Akim Demaille + + * src/nullable.c (set_nullable): Deobfuscate the handling of + ritem. + `symbol >= 0' is wrong now, use `rule_table[ruleno].useful'. + +2001-12-05 Akim Demaille + + * src/gram.c, src/gram.h (ritem_print): New. + * src/gram.c (dummy): Remove, now there is actual code in gram.c. + (This useless function was defined only to work around VMS linkers + that can't handle compilation units with variables only). + * src/reduce.c (dump_grammar): Use it to trace the construction of + ritem. + +2001-12-04 Paul Eggert + + * src/bison.simple (union yyalloc): Change member names + to be the same as the stack names. + (yyparse): yyptr is now union yyalloc *, not char *. + (YYSTACK_RELOCATE): Likewise. This avoids a GCC warning, + and may generate better code on some machines. + (yystpcpy): Use prototype if __STDC__ is defined, not just + if __cplusplus is defined. + +2001-11-30 Akim Demaille + + * configure.in (WARNING_CFLAGS): Add -Werror when possible. + (CFLAGS): Do not include the WARNING_CFLAGS here, since GNU + Gettext doesn't compile cleanly, and dies with -Werror. + * src/Makefile.am, lib/Makefile.am, tests/atlocal.in (CFLAGS): + Include WARNING_CFLAGS here. + * lib/xstrdup.c: Include xalloc.h, so that xstrdup be declared + before being defined. + +2001-11-27 Paul Eggert + + * lib/quotearg.h (quotearg_n, quotearg_n_style): + First arg is int, not unsigned. + * lib/quotearg.c (quotearg_n, quotearg_n_style): Likewise. + (SIZE_MAX, UINT_MAX): New macros. + (quotearg_n_options): Abort if N is negative. + Avoid overflow check on hosts where size_t is 64 bits and int + is 32 bits, as overflow is impossible there. + Fix off-by-one typo that caused unnecessary reallocation. + +2001-11-29 Paul Eggert + + Name space cleanup in generated parser. + + * doc/bison.texinfo (Bison Parser): Discuss system headers + and their effect on the user name space. + + * src/bison.simple: + (YYSTACK_ALLOC, YYSTACK_FREE, union yyalloc, YYSTACK_GAP_MAX, + YYSTACK_BYTES, YYSTACK_RELOCATE): Do not define unless necessary, + i.e. unless ! defined (yyoverflow) || defined (YYERROR_VERBOSE). + + (YYSIZE_T): New macro. Use it instead of size_t, to avoid infringing + on user names when possible. + + (YYSTACK_USE_ALLOCA): Do not define; just use any existing defn. + Simplify test for whather exists. + + (): Include if we will use malloc, and if standard C or C++. + + (): Include if YYDEBUG. + + (yymemcpy): Renamed from __yy_memcpy. Do not define unless + ! defined (yyoverflow) && ! defined (yymemcpy). + + (yymemcpy, yyparse): Rename local variables as needed so that + they all begin with 'yy'. + + (yystrlen, yystpcpy): New functions. + + (YY_DECL_NON_LSP_VARIABLES): Renamed from _YY_DECL_VARIABLES. + All uses changed. + + (yyparse): size_t -> YYSIZE_T. Use yystrlen and yystpcpy + instead of relying on string.h functions. Use YYSTACK_ALLOC + and YYSTACK_FREE instead of malloc and free. + +2001-11-30 Akim Demaille + + * src/bison.simple (YYSTYPE, YYLTYPE): Move their definitions + before their first uses. + (YYBISON, YYPURE): Move to the top of the output. + +2001-11-30 Akim Demaille + + * tests/reduce.at (Useless Nonterminals): Fix. + +2001-11-30 Akim Demaille + + * src/bison.simple (YYSTACK_FREE): Use `do {;} while (0)' as empty + if body instead of `;' to pacify GCC's warnings. + +2001-11-30 Akim Demaille + + Instead of mapping the LHS of unused rules to -1, keep the LHS + valid, but flag the rules as invalid. + + * src/gram.h (rule_t): `useful' is a new member. + * src/print.c (print_grammar): Adjust. + * src/derives.c (set_derives): Likewise. + * src/reader.c (packgram, reduce_output): Likewise. + * src/reduce.c (reduce_grammar_tables): Likewise. + * tests/reduce.at (Underivable Rules, Useless Rules): New. + +2001-11-30 Akim Demaille + + * src/reduce.c (reduce_output): Formatting changes. + * src/print.c (print_results, print_grammar): Likewise. + * tests/regression.at (Rule Line Numbers) + (Solved SR Conflicts, Unresolved SR Conflicts): Adjust. + +2001-11-30 Akim Demaille + + * src/reduce.c (nonterminals_reduce): Instead of throwing away + useless nonterminals, move them at the end of the symbol arrays. + (reduce_output): Adjust. + * tests/reduce.at (Useless Nonterminals): Adjust. + +2001-11-30 Akim Demaille + + * src/reduce.c: Various comment/formatting changes. + (nonterminals_reduce): New, extracted from... + (reduce_grammar_tables): here. + (reduce_grammar): Call nonterminals_reduce. + +2001-11-29 Paul Eggert + + * src/bison.simple (YYSTACK_REALLOC): Remove. + (YYSTACK_ALLOC): Resurrect this macro, with its old meaning. + (YYSTACK_FREE, YYSTACK_GAP_MAX, YYSTACK_BYTES, YYSTACK_RELOCATE): + New macros. + (union yyalloc): New type. + (__yy_memcpy): Last arg is size_t, not unsigned int, to remove + an arbitrary restriction on hosts where size_t is wider than int. + + (yyparse): Don't dump core if alloca or malloc fails; instead, report + a parser stack overflow. Allocate just one block of memory for all + three stacks, instead of allocating three blocks; this typically is + faster and reduces fragmentation. + + Do not limit the number of items in the stack to a value that fits + in 'int', as this is an arbitrary limit on hosts with 64-bit + size_t and 32-bit int. + +2001-11-29 Marc Autret + + * tests/calc.at [AT_DATA_CALC_Y]: Use %error-verbose instead + of defining YYERROR_VERBOSE. + [AT_DATA]: $4 is now out of C declarations in the prologue. + +2001-11-28 Marc Autret + + * src/reader.c (parse_dquoted_param): New. + (parse_skel_decl): Use it. + * src/lex.h: Add its prototype. + * src/lex.c (literalchar): Become not static. + +2001-11-28 Marc Autret + + * src/output.h: And put its extern declaration here. + * src/output.c (error_verbose): Define here. + (prepare): Echo name modification. + * src/getargs.h: Clean its extern declaration. + * src/getargs.c (error_verbose_flag): Remove. + (getargs): Remove case 'e'. + * src/options.c (option_table): 'error-verbose' is now seen as simple + percent option. + Include output.h. + + * src/reader.c (read_declarations): Remove case tok_include. + (parse_include_decl): Remove. + * src/lex.h (token_t): Remove tok_include. + * src/options.c (option_table): 'include' is now a simple command line + option. + +2001-11-28 Marc Autret + + * src/bison.simple: Adjust muscle names. + * src/muscle_tab.c (muscle_init): Also rename the muscles. + * src/output.c (prepare): s/_/-/ for the muscles names. + (output_parser): When scanning for a muscle, allow '-' instead of '_'. + +2001-11-28 Marc Autret + + * src/bison.simple: Fix debug. + [YYERROR_VERBOSE]: Re-integrate as an internal macro. + +2001-11-28 Akim Demaille + + * src/LR0.c (shifts_new): New. + (save_shifts, insert_start_shift, augment_automaton): Use it. + +2001-11-28 Akim Demaille + + * src/closure.c (closure): `b' and `ruleno' denote the same value: + keep ruleno only. + +2001-11-28 Akim Demaille + + * src/closure.c (closure): Instead of looping over word in array + then bits in words, loop over bits in array. + +2001-11-28 Akim Demaille + + * src/closure.c (closure): No longer optimize the special case + where all the bits of `ruleset[r]' are set to 0, to make the code + clearer. + +2001-11-28 Akim Demaille + + * src/closure.c (closure): `r' and `c' are new variables, used to + de-obfuscate accesses to RULESET and CORE. + +2001-11-28 Akim Demaille + + * src/reduce.c (reduce_print): Use ngettext. + (dump_grammar): Improve the trace accuracy. + +2001-11-28 Akim Demaille + + * src/reduce.c (dump_grammar): Don't translate trace messages. + +2001-11-28 Akim Demaille + + * tests/reduce.at (Useless Terminals, Useless Nonterminals): New. + * src/reduce.c (reduce_grammar_tables): Do not free useless tags, + as all tags are free'ed afterwards. + From Enrico Scholz. + +2001-11-27 Paul Eggert + + * src/bison.simple (YYSTACK_REALLOC): Fix typo that caused us to + use alloca when we didn't want to, and vice versa. + +2001-11-27 Marc Autret + + * src/muscle_tab.c (muscle_init): Remove 'verbose' muscle + initialization. + * src/output.c (prepare): Remove its update. + +2001-11-27 Marc Autret + + * tests/torture.at [AT_DATA]: Remove YYERROR_VERBOSE definition. + Use %error-verbose. + +2001-11-27 Marc Autret + + * src/bison.simple: Remove YYERROR_VERBOSE using. + Use %%error_verbose. + (yyparse): Likewise. + * src/output.c (prepare): Give its final value. + * src/muscle_tab.c (muscle_init): Init new muscle 'error_verbose'. + * src/getargs.h: Add its extern declaration. + * src/getargs.c (error_verbose_flag): New int. + (getargs): Update to catch new case. + * src/options.c (option_table): 'error-verbose' is a new option. + (shortopts): Update. + +2001-11-27 Akim Demaille + + * src/system.h: Use intl/libgettext.h. + * src/Makefile.am (INCLUDES): Add -I $(top_srcdir). + +2001-11-27 Akim Demaille + + * tests/torture.at (Exploding the Stack Size with Malloc): + s/YYSTACK_USE_ALLOCA_ALLOCA/YYSTACK_USE_ALLOCA/. + +2001-11-27 Akim Demaille + + * src/files.c: Include error.h. + Reported by Hans Aberg. + +2001-11-26 Marc Autret + + * src/reader.c (parse_include_decl): New, not yet implemented. + (read_declarations): Add case tok_include. + * src/getargs.h (include): Add its extern definition. + * src/getargs.c (include): New const char *. + (getargs): Add case '-I'. + * src/options.c (option_table): Add include as command line and + percent option. + * src/lex.h (token_t): Add tok_include. + +2001-11-26 Akim Demaille + + * src/reader.c (readgram): Make sure rules for mid-rule actions + have a lineno equal to that of their host rule. + Reported by Hans Aberg. + * tests/regression.at (Rule Line Numbers): New. + +2001-11-26 Akim Demaille + + * src/LR0.c (allocate_itemsets): kernel_size contains ints, not + size_ts. + +2001-11-26 Akim Demaille + + * src/complain.c, src/complain.h (error): Remove, provided by + lib/error.[ch]. + +2001-11-26 Akim Demaille + + * src/reader.c (read_declarations): Don't abort on tok_illegal, + issue an error message. + * tests/regression.at (Invalid %directive): New. + Reported by Hans Aberg. + +2001-11-26 Akim Demaille + + * configure.in: Invoke AC_FUNC_OBSTACK and AC_FUNC_ERROR_AT_LINE. + * lib/Makefile.am (libbison_a_SOURCES): Adjust. + +2001-11-26 Akim Demaille + + * src/conflicts.c (conflicts_print): Don't complain at all when + there are no reduce/reduce conflicts, and as many shift/reduce + conflicts as expected. + * tests/regression.at (%expect right): Adjust. + +2001-11-23 Akim Demaille + + * lib/alloca.c: Update, from fileutils. + +2001-11-23 Akim Demaille + + * lib/Makefile.am (libbison_a_LIBADD): Add @ALLOCA@. + +2001-11-23 Akim Demaille + + * src/system.h: Include alloca.h. + * src/main.c (main) [C_ALLOCA]: Call alloca (0). + +2001-11-23 Akim Demaille + + * src/print_graph.c (print_actions): Remove `rule', unused. + * src/LR0.c (kernel_size): Contain `int' instead of `size_t' to + pacify GCC's signed < unsigned warnings. + * src/closure.c (itemsetsize): Likewise. + * src/reader.c (symbol_list_new): Static. + +2001-11-23 Akim Demaille + + Attaching lineno to buckets is stupid, since only one copy of each + symbol is kept, only the line of the first occurrence is kept too. + + * src/symtab.h, src/symtab.c (bucket): Remove the line member. + * src/reader.c (rline_allocated): Remove, unused. + (symbol_list): Have a `line' member. + (symbol_list_new): New. + (readgram): Use it. + * src/print.c (print_grammar): Output the rule line numbers. + * tests/regression.at (Solved SR Conflicts) + (Unresolved SR Conflicts): Adjust. + Reported by Hans Aberg. + +2001-11-22 Marc Autret + + * src/bison.simple [YYERROR_VERBOSE]: Force its value to be 1 or 0. + +2001-11-22 Marc Autret + + * src/muscle_tab.c (muscle_init): Remove initialization of + skeleton muscle. + * src/output.c (output_master_parser): Do it here. + +2001-11-20 Akim Demaille + + * po/sv.po: New. + * configure.in (ALL_LINGUAS): Adjust. + * po/POTFILE.in: Remove `nullable.c' and `derives.c' which no + longer contains strings to translate. + +2001-11-19 Akim Demaille + + * src/conflicts.c (conflicts_print): Add a missing \n. + +2001-11-19 Akim Demaille + + * src/nullable.c (nullable_print): New. + (set_nullable): Call it when tracing. + Better locality of variables. + +2001-11-19 Akim Demaille + + * src/print.c (print_actions): Better locality of variables. + +2001-11-19 Akim Demaille + + * src/derives.c (print_derives): Fix and enrich. + * src/closure.c (print_fderives): Likewise. + +2001-11-19 Akim Demaille + + * src/closure.c (itemsetend): Remove, replaced with... + (itemsetsize): new. + +2001-11-19 Akim Demaille + + * src/LR0.c (kernel_end): Remove, replaced with... + (kernel_size): new. + +2001-11-19 Akim Demaille + + * src/conflicts.c (set_conflicts): Use arrays instead of pointers + to clarify. + +2001-11-19 Akim Demaille + + * src/closure.c (closure): Use arrays instead of pointers to clarify. + +2001-11-19 Akim Demaille + + * src/closure.c, src/derives.c, src/nullable.c: Adjust various + trace messages. + * src/LR0.c: Likewise. + (allocate_itemsets): Use arrays instead of pointers to clarify. + +2001-11-19 Akim Demaille + + * src/getargs.c (statistics_flag): Replace with... + (trace_flag): New. + (longopts): Accept --trace instead of --statistics. + * src/getargs.h, src/options.c: Adjust. + * src/LR0.c, src/closure.c, src/derives.c, src/nullable.c, + * src/reduce.c: Use trace_flags instead of the CPP conditional TRACE. + +2001-11-19 Akim Demaille + + * src/LR0.c (new_itemsets, get_state): Use more arrays and fewer + pointers to clarify the code. + (save_reductions, save_shifts): Factor common parts of alternatives. + +2001-11-19 Akim Demaille + + * src/LR0.c (new_state, get_state): Complete TRACE code. + * src/closure.c: Include `reader.h' to get `tags', needed by the + trace code. + Rename the conditional DEBUG as TRACE. + Output consistently TRACEs to stderr, not stdout. + * src/derives.c: Likewise. + * src/reduce.c: (inaccessable_symbols): Using if is better style + than goto. + Use `#if TRACE' instead of `#if 0' for tracing code. + +2001-11-19 Akim Demaille + + * src/system.h (LIST_FREE, shortcpy): New. + * src/LR0.c: Use them. + * src/output.c (free_itemsets, free_reductions, free_shifts): + Remove, replaced by LIST_FREE. + +2001-11-19 Akim Demaille + + * src/state.h (CORE_ALLOC, SHIFTS_ALLOC, ERRS_ALLOC) + (REDUCTIONS_ALLOC): New. + * src/LR0.c, src/conflicts.c: Use them to de-obfuscate memory + allocation. + +2001-11-19 Akim Demaille + + * src/LR0.c (new_state): Complete trace code. + * src/nullable.c (set_nullable): Don't translate traces. + +2001-11-19 Akim Demaille + + * src/print_graph.c (print_core): Better locality of variables. + * src/print.c (print_core): Likewise. + +2001-11-19 Akim Demaille + + * src/vcg.c: You do the output, so you are responsible of the + handling of VCG syntax, in particular: use quotearg. + * src/print_graph.c: Don't. + (print_actions): Don't output the actions as part of the nodes, + since that's the job of the edges. + (print_state): Don't output by hand: fill the node description, + and ask for its output. + +2001-11-19 Akim Demaille + + * src/bison.simple (yyparse): When verbosely reporting an error, + no longer put additional quotes around token names. + * tests/calc.at: Adjust. + +2001-11-19 Akim Demaille + + * src/symtab.h, src/symtab.c: `line' is a new member of `bucket'. + * src/reader.c (record_rule_lines, rline, rline_allocated): Remove. + * src/output.c: Adjust. + +2001-11-19 Akim Demaille + + * src/gram.h (rprec, rprecsym, rassoc): Remove, now part of... + (rule_t): this. + * src/conflicts.c, src/reader.c, src/reduce.c: Adjust. + +2001-11-19 Akim Demaille + + * src/gram.h (rule_t): New. + (rule_table): New. + (rrhs, rlhs): Remove, part of state_t. + * src/print_graph.c, src/closure.c, src/conflicts.c, src/derives.c, + * src/lalr.c, src/nullable.c, src/output.c, src/print.c, + * src/reader.c, src/reduce.c: Adjust. + +2001-11-19 Akim Demaille + + * src/reader.c (symbols_output): New, extracted from... + (packsymbols): Here. + (reader): Call it. + +2001-11-19 Akim Demaille + + * src/lalr.c (set_maxrhs, maxrhs): Remove, replaced with... + (maxrhs): this new function. + +2001-11-19 Akim Demaille + + * src/lalr.c (F): New macro to access the variable F. + Adjust. + +2001-11-19 Akim Demaille + + * src/lalr.h (LA): New macro to access the variable LA. + * src/output.c, src/lalr.c, src/print_graph.c, src/conflicts.c: + * src/lalr.c: Adjust. + +2001-11-19 Akim Demaille + + * src/lalr.c (initialize_LA): Only initialize LA. Let... + (set_state_table): handle the `lookaheads' members. + +2001-11-19 Akim Demaille + + * src/lalr.h (lookaheads): Removed array, whose contents is now + a member of... + (state_t): this structure. + * src/output.c, src/lalr.c, src/print_graph.c, src/conflicts.c: + Adjust. + +2001-11-19 Akim Demaille + + * src/lalr.h (consistent): Removed array, whose contents is now + a member of... + (state_t): this structure. + * src/output.c, src/lalr.c, src/print_graph.c, src/conflicts.c: + Adjust. + +2001-11-19 Akim Demaille + + * src/lalr.h (reduction_table, shift_table): Removed arrays, whose + contents are now members of... + (state_t): this structure. + * src/output.c, src/lalr.c, src/print_graph.c, src/conflicts.c: + Adjust. + +2001-11-19 Akim Demaille + + * src/lalr.h (state_t): New. + (state_table): Be a state_t * instead of a core **. + (accessing_symbol): Remove, part of state_t. + * src/lalr.c: Adjust. + (set_accessing_symbol): Merge into... + (set_state_table): this. + * src/print_graph.c, src/conflicts.c: Adjust. + +2001-11-14 Akim Demaille + + * tests/calc.at, tests/output.at, tests/regression.at, + * tests/testsuite.at, tests/torture.at: Rely on Autotest 2.52g: + now the tests are run in private dirs, therefore AC_CLEANUP and + family can be simplified to 0-ary. + * tests/atlocal.in: Now that we run `elsewhere' than in tests/, + use abs. path to find config.h. + * tests/calc.at (AT_CHECK_CALC): Don't try to check the compiler's + stderr, there can be way too much random noise. + Instead pass -Werror to GCC and rely on the exit status. + Reported by Wolfram Wagner. + +2001-11-14 Akim Demaille + + * src/bison.simple (yyparse): Let yyls1, yyss1 and yyvs1 be + defined only if yyoverflow is defined, to avoid `warning: unused + variable `yyvs1''. + Reported by The Test Suite. + +2001-11-14 Akim Demaille + + * src/print.c: Include reduce.h. + Reported by Hans Aberg. + +2001-11-14 Akim Demaille + + * src/lex.c, src/lex.h (token_buffer, unlexed_token_buffer): + Revert a previous patch: these are really const. + * src/conflicts.c (conflict_report): Additional useless pair of + braces to pacify GCC's warnings for `if () if () {} else {}'. + * src/lex.c (parse_percent_token): Replace equal_offset with + arg_offset. + arg is const. + Be sure to strdup `arg' when used, since there is no reason for + token_buffer not to change. + +2001-11-14 Akim Demaille + + * src/system.h (EXIT_SUCCESS, EXIT_FAILURE): Ensure a proper + definition. + * src/main.c (main): Use them. + Suggested by Hans Aberg. + +2001-11-12 Akim Demaille + + * src/system.h (ngettext): Now that we use ngettext, be sure to + provide a default definition when NLS are not used. + +2001-11-12 Akim Demaille + + * doc/bison.texinfo: Use `$' as shell prompt, not `%'. + Use @kbd to denote user input. + (Language and Grammar): ANSIfy the example. + Adjust its layout for info/notinfo. + (Location Tracking Calc): Output error messages to stderr. + Output locations in a more GNUtically correct way. + Fix a couple of Englishos. + Adjust @group/@end group pairs. + +2001-11-12 Akim Demaille + + %expect was not functioning at all. + + * src/conflicts.c (expected_conflicts): Set to -1. + (conflict_report): Use ngettext. + (conflicts_print): Check %expect and make its violation an error. + * doc/bison.texinfo (Expect Decl): Adjust. + * configure.in (AM_GNU_GETTEXT): Ask for ngettext. + * tests/regression.at (%expect not enough, %expect right) + (%expect too much): New. + +2001-11-12 Akim Demaille + + * tests/regression.at (Conflicts): Rename as... + (Unresolved SR Conflicts): this. + (Solved SR Conflicts): New. + +2001-11-12 Akim Demaille + + * src/reduce.c (print_results): Rename as... + (reduce_output): This. + Output to OUT, passed as argument, instead of output_obstack. + (dump_grammar): Likewise. + (reduce_free): New. + Also free V1. + (reduce_grammar): No longer call reduce_output, since... + * src/print.c (print_results): do it. + * src/main.c (main): Call reduce_free; + +2001-11-12 Akim Demaille + + * src/conflicts.c (print_reductions): Accept OUT as argument. + Output to it, not to output_obstack. + * src/print.c (print_actions): Adjust. + +2001-11-12 Akim Demaille + + * src/conflicts.c (count_sr_conflicts, count_rr_conflicts): Return + the result instead of using... + (src_total, rrc_total, src_count, rrc_count): Remove. + (any_conflicts): Remove. + (print_conflicts): Split into... + (conflicts_print, conflicts_output): New. + * src/conflicts.h: Adjust. + * src/main.c (main): Invoke both conflicts_output and conflicts_print. + * src/print.c (print_grammar): Issue `\n' between two rules. + * tests/regression.at (Conflicts): New. + Reported by Tom Lane. + +2001-11-12 Akim Demaille + + * tests/regression.at (Invalid input): Remove, duplicate with + ``Invalid input: 1''. + +2001-11-12 Akim Demaille + + * tests/torture.at (AT_DATA_STACK_TORTURE) + (Exploding the Stack Size with Alloca) + (Exploding the Stack Size with Malloc): New. + +2001-11-12 Akim Demaille + + * src/bison.simple (YYSTACK_REALLOC): New. + (yyparse) [!yyoverflow]: Use it and free the old stack. + Reported by Per Allansson. + +2001-11-12 Pascal Bart + + * src/bison.simple: Define type yystype instead of YYSTYPE, and + define CPP macro, which substitute YYSTYPE by yystype. + * src/reader.c (parse_union_decl): Output yystype/YYSTYPE as we do + with yyltype/YYLTYPE. This allows inclusion of the generated + header within the parser if the compiler, such as GGC, accepts + multiple equivalent #defines. + From Akim. + +2001-11-05 Akim Demaille + + * src/reader.c (symbols_output): New, extracted from... + (packsymbols): here. + (reader): Adjust. + +2001-11-05 Akim Demaille + + * src/lex.c (parse_percent_token): s/quotearg/quote/. + +2001-11-05 Akim Demaille + + * tests/regression.at (AT_TEST_CPP_GUARD_H): Adjust the clean up + pattern. + +2001-11-05 Akim Demaille + + * src/options.h (struct option_table_struct): set_flags is void*. + * src/options.c (longopts): Support `--output' and `%output'. + (usage): Adjust. + * src/lex.h (tok_setopt): Remove, replaced with... + (tok_intopt, tok_stropt): these new guys. + * src/lex.c (getopt.h): Not needed. + (token_buffer, unlexed_token_buffer): Not const. + (percent_table): Promote `-' over `_' in directive names. + Active `%name-prefix', `file-prefix', and `output'. + (parse_percent_token): Accept possible arguments to directives. + Promote `-' over `_' in directive names. + +2001-11-04 Akim Demaille + + * doc/bison.texinfo (Decl Summary): Split the list into + `directives for grammars' and `directives for bison'. + Sort'em. + Add description of `%name-prefix', `file-prefix', and `output'. + Promote `-' over `_' in directive names. + (Bison Options): s/%locactions/%locations/. Nice Freudian slip. + Simplify the description of `--name-prefix'. + Promote `-' over `_' in directive names. + Promote `--output' over `--output-file'. + Fix the description of `--defines'. + * tests/output.at: Exercise %file-prefix and %output. + +2001-11-02 Akim Demaille + + * doc/refcard.tex: Update. + +2001-11-02 Akim Demaille + + * src/symtab.h (SUNDEF): New. + * src/symtab.c (bucket_new): Init user_token_number to SUNDEF to + stand for `uninitialized', instead of 0. + * src/reader.c (packsymbols, parse_thong_decl): Adjust. + * src/lex.c (lex): Adjust. + + * tests/calc.at (_AT_DATA_CALC_Y): Declare a token for EOF. + Number it 0. + Let yylex return it instead of a plain 0. + Reported by Dick Streefland. + +2001-11-02 Akim Demaille + + * tests/regression.at (Mixing %token styles): New test. + +2001-11-02 Akim Demaille + + * src/reader.c (parse_thong_decl): Formatting changes. + (token_translations_init): New, extracted from... + (packsymbols): Here. + Adjust. + +2001-11-01 Akim Demaille + + * tests/regression.at (AT_TEST_CPP_GUARD_H): New. + Check that `9foo.y' produces correct cpp guards. + * src/files.c (compute_header_macro): Prepend `BISON_' to CPP + guards. + Reported by Wwp. + +2001-11-01 Akim Demaille + + * tests/regression.at (Invalid input: 2): New. + * src/lex.c (unlexed_token_buffer): New. + (lex, unlex): Adjust: when unlexing, be sure to save token_buffer + too. + Reported by Wwp. + +2001-11-01 Akim Demaille + + * tests/calc.at: Catch up with 1.30. + * configure.in: Bump to 1.49a. + Adjust to newer Autotest. + +2001-10-19 Pascal Bart + + * src/conflicts.c: Move global variables rrc_total and src_total ... + (print_conflicts): here. + * src/output.c (output): Free global variable user_toknums. + * src/lex.c (token_obstack): Become static. + +2001-10-18 Akim Demaille + + * tests/atlocal.in (GCC): Add. + * tests/calc.at: s/m4_match/m4_bmatch/. + s/m4_patsubst/m4_bpatsubst/. + (AT_CHECK_CALC): Check the compiler's stderr only if it's GCC. + * configure.in: AC_SUBST(GCC). + +2001-10-14 Marc Autret + + * src/options.c (create_long_option_table): Fix. + +2001-10-10 Akim Demaille + + * src/bison.simple: Be sure to set YYSTACK_USE_ALLOCA. + +2001-10-04 Akim Demaille + + * src/reader.c (parse_union_decl): Push the caracters in + union_obstack, not attrs_obstack. + +2001-10-04 Akim Demaille + + Merge in the branch 1.29. + + * src/reader.c (packsymbols): Use a temporary obstack for + `%%tokendef', since output_stack is already used elsewhere. + + 2001-10-02 Akim Demaille + + Bump 1.29d. + + 2001-10-02 Akim Demaille + + Version 1.29c. + + 2001-10-02 Akim Demaille + + * tests/regression.at (Invalid CPP headers): New. + From Alexander Belopolsky. + * src/files.c (compute_header_macro): Map non alnum chars to `_'. + + 2001-10-02 Akim Demaille + + * tests/regression.at (Invalid input): New. + * src/lex.c (lex): Be sure to set `token_buffer' in any case. + Reported by Shura. + + 2001-10-02 Akim Demaille + + * tests/calc.at: Now that --debug works, the tests must be adjusted. + + 2001-10-02 Akim Demaille + + * src/output.c (output_parser): Assert `skeleton'. + * src/files.c (skeleton_find): Look harder for skeletons on DOSish + systems. + From Shura. + + 2001-10-01 Marc Autret + + * src/lex.h: Echo modifications. + * src/lex.c (unlex): Parameter is now token_t. + From Hans Aberg. + + 2001-10-01 Marc Autret + + * src/main.c: Include lex.h. + From Hans Aberg. + + 2001-09-29 Akim Demaille + + * src/getargs.c (longopts): `--debug' is `-t', not `-d'. + + 2001-09-28 Akim Demaille + + * tests/testsuite.at: Update to newer Autotest. + * tests/Makefile.am (EXTRA_DIST): bison is not to be shipped. + + 2001-09-27 Akim Demaille + + Position independent wrapper. + + * tests/bison: Remove. + * tests/bison.in: New. + * configure.in: Adjust. + + 2001-09-27 Paul Eggert + + Port quotearg fixes from tar 1.13.24. + + * lib/quotearg.c: BSD/OS 4.1 wchar.h requires FILE and struct + tm to be declared. + (HAVE_MBSINIT): Undef if !HAVE_MBRTOWC. + (mbsinit): Define to 1 if !defined mbsinit && !HAVE_MBSINIT. + + * m4/Makefile.am (EXTRA_DIST): Add mbrtowc.m4. + * m4/mbrtowc.m4: New file. + * m4/prereq.m4 (jm_PREREQ_QUOTEARG): Check for mbsinit and stddef.h. + Use jm_FUNC_MBRTOWC instead of AC_CHECK_FUNCS(mbrtowc). + + 2001-09-27 Akim Demaille + + Bump to 1.29c. + + 2001-09-27 Akim Demaille + + Version 1.29b. + + 2001-09-25 Akim Demaille + + * src/system.h: Include `xalloc.h'. + Remove it from the C files. + * src/files.c (output_files): Free the obstacks. + * src/lex.c (init_lex): Rename as... + (lex_init): this. + (lex_free): New. + * src/main.c (main): Use it. + + 2001-09-24 Marc Autret + + * src/vcg.c (open_edge, close_edge, open_node, close_node): Change + to output informations in fout (FILE*). + (open_graph, close_graph): Likewise. + (output_graph, output_edge, output_node): Likewise. + * src/vcg.h: Update function prototypes. + * src/print_graph.c (print_graph): Open output graph file. + (print_actions): Adjust. + * src/files.h: Remove extern declaration. + * src/files.c: Remove graph_obstack declaration. + (open_files): Remove graph_obstack initialization. + (output_files): Remove graph_obstack saving. + + 2001-09-24 Marc Autret + + * src/files.c (compute_output_file_names): Fix. + + 2001-09-24 Marc Autret , + Akim Demaille + + * src/reader.c (reader): Remove call to free_symtab (). + * src/main.c (main): Call it here. + Include symtab.h. + * src/conflicts.c (initialize_conflicts): Rename as... + (solve_conflicts): this. + * src/print.c (print_core, print_actions, print_state) + (print_grammar): Dump to a file instead a `output_obstack'. + (print_results): Dump `output_obstack', and then proceed with the + FILE *. + * src/files.c (compute_output_file_names, close_files): New. + (output_files): Adjust. + * src/main.c (main): Adjust. + + 2001-09-23 Marc Autret + + * src/files.c (compute_header_macro): Computes header macro name + from spec_defines_file when given. + + 2001-09-23 Marc Autret + + * src/files.c (output_files): Add default extensions. + + 2001-09-22 Akim Demaille + + * src/conflicts.c (finalize_conflicts): Rename as... + (free_conflicts): this. + + 2001-09-22 Akim Demaille + + * src/gram.c (gram_free): Rename back as... + (dummy): this. + (output_token_translations): Free `token_translations'. + * src/symtab.c (free_symtab): Free the tag field. + + 2001-09-22 Akim Demaille + + Remove `translations' as it is always set to true. + + * src/gram.h: Adjust. + * src/reader.c (packsymbols, parse_token_decl): Adjust + * src/print.c (print_grammar): Adjust. + * src/output.c (output_token_translations): Adjust. + * src/lex.c (lex): Adjust. + * src/gram.c: Be sure the set pointers to NULL. + (dummy): Rename as... + (gram_free): this. + + 2001-09-22 Akim Demaille + + * configure.in: Invoke AM_LIB_DMALLOC. + * src/system.h: Use dmalloc. + * src/LR0.c: Be sure to have pointers initialized to NULL. + (allocate_itemsets): Allocate kernel_items only if needed. + + 2001-09-22 Akim Demaille + + * configure.in: Bump to 1.29b. + * tests/Makefile.am (DISTCLEANFILES): Add package.m4. + * tests/calc.at (_AT_DATA_CALC_Y): #undef malloc so that we don't + need xmalloc.c in calc.y. + From Pascal Bart. + + 2001-09-21 Akim Demaille + + Version 1.29a. + * Makefile.maint, config/config.guess, config/config.sub, + * config/missing: Update from masters. + * tests/Makefile.am ($(srcdir)/$(TESTSUITE)): No longer depend + upon package.m4. + * configure.in (ALL_LINGUAS): Add `tr'. + + 2001-09-21 Akim Demaille + + * tests/Makefile.am (package.m4): Move to... + ($(srcdir)/$(TESTSUITE)): here. + + 2001-09-20 Akim Demaille + + * src/complain.c: No longer try to be standalone: use system.h. + Don't assume __STDC__ is defined to 1. Just test if it is defined. + * src/complain.h: Likewise. + * src/reduce.c (useless_nonterminals, inaccessable_symbols): + Remove the unused variable `n'. + From Albert Chin-A-Young. + + 2001-09-18 Marc Autret + + * doc/bison.1: Update. + * doc/bison.texinfo (Bison Options): Update --defines and --graph + descriptions. + (Option Cross Key): Update. + Add --graph. + + 2001-09-18 Marc Autret + + * tests/regression.at: New test (comment in %union). + + 2001-09-18 Marc Autret + + * src/reader.c (parse_union_decl): Do not output '/'. Let copy_comment + do that. + Reported by Keith Browne. + + 2001-09-18 Marc Autret + + * tests/output.at: Add tests for --defines and --graph. + + 2001-09-18 Marc Autret + + * tests/output.at: Removes tests of %{header,src}_extension features. + + 2001-09-18 Akim Demaille + + * tests/Makefile.am (package.m4): New. + * tests/calc.at (_AT_CHECK_CALC): Just run `calc input'. + (_AT_CHECK_CALC_ERROR): Likewise. + Factor the `, ' part of verbose error messages. + + 2001-09-18 Marc Autret + + * src/getargs.c (longopts): Declare --defines and --graph as options + with optional arguments. + * src/files.h: Add extern declarations. + * src/files.c (spec_graph_file, spec_defines_file): New. + (output_files): Update. + Remove CPP-outed code. + + 2001-09-18 Marc Autret + + Turn off %{source,header}_extension feature. + + * src/files.c (compute_exts_from_gf): Update. + (compute_exts_from_src): Update. + (output_files): CPP-out useless code. + * src/files.h: Remove {header,source}_extension extern declarations. + * src/reader.c (parse_dquoted_param): CPP-out. + (parse_header_extension_decl): Remove. + (parse_source_extension_decl): Remove. + (read_declarations): Remove cases tok_{hdrext,srcext}. + * src/lex.c (percent_table): Remove {header,source}_extension entries. + * src/lex.h (token_t): Remove tok_hdrext and tok_srcext. + + 2001-09-10 Akim Demaille + + * tests/output.at (AT_CHECK_BISON_FLAGS, AT_CHECK_BISON_PERCENT): + (AT_CHECK_BISON_PERCENT_FLAGS): Merge into... + (AT_CHECK_OUTPUT): this. + Merely check ls' exit status, its output is useless. + + 2001-09-10 Akim Demaille + + * tests/calc.at: Use m4_match. + (_AT_DATA_CALC_Y): Check `yyin != NULL', not `stdin != NULL'. + + 2001-09-10 Marc Autret , + Akim Demaille + + * src/vcg.h (graph_s): color, textcolor, bordercolor are now + enum color_e. + * src/print_graph.c (print_graph): Initalize graph.layoutalgorithm + to `normal'. + * src/reader.c (parse_token_decl): Initialize token with tok_eof. + * src/lex.h: Adjust prototype. + (token_t): Add `tok_undef'. + * src/lex.c (struct percent_table_struct): Retval is now a token_t. + (parse_percent_token): Now returns token_t. + Add default statement in switch. + (lex): Separate `c' as an input variable, from the token_t result + part. + (unlexed): Is a token_t. + + 2001-09-10 Akim Demaille + + * configure.in: Bump to 1.29a. + + 2001-09-07 Akim Demaille + + Version 1.29. + + 2001-08-30 Akim Demaille + + * tests/atgeneral.m4, tests/atconfig.in, tests/suite.at: Remove. + * m4/atconfig.m4: Remove. + * tests/testsuite.at, tests/atlocal.in, tests/output.at, + * tests/bison: New. + * tests/regression.at, tests/calc.at: Use m4_define, AT_BANNER, + m4_if, m4_patsubst, and m4_regexp. + * tests/calc.at (_AT_CHECK_CALC, _AT_CHECK_CALC_ERROR): Use an + `input' file instead of echo. + + 2001-08-29 Akim Demaille + + Bump to 1.28e. + + 2001-08-29 Akim Demaille + + Version 1.28d. + + 2001-08-29 Paul Eggert + + * src/bison.simple (yyparse): Don't take the address of an + item before the start of an array, as that doesn't conform to + the C Standard. + + 2001-08-29 Robert Anisko + + * doc/bison.texinfo (Location Tracking Calc): New node. + + 2001-08-29 Paul Eggert + + * src/output.c (output): Do not define const, as this now + causes more problems than it cures. + + 2001-08-29 Akim Demaille + + * doc/bison.texinfo: Modernize `@node' and `@top' use: just name + the nodes. + Be sure to tag the `detailmenu'. + + 2001-08-29 Akim Demaille + + * Makefile.maint (do-po-update): Wget refuses to overwrite files: + download in a tmp dir. + + 2001-08-28 Marc Autret + + * config/depcomp: New file. + + 2001-08-28 Marc Autret + + * doc/bison.1 (mandoc): Adjust. + From Juan Manuel Guerrero. + + 2001-08-28 Marc Autret + + * src/print_graph.c (print_state): Fix. + + 2001-08-27 Marc Autret + + * src/vcg.h (classname_s, infoname_s, node_s): Constify the + char * members. + Echo modifications to the functions prototypes. + * src/vcg.c (add_classname, add_infoname): Adjust arguments. + + 2001-08-27 Marc Autret + + * src/vcg.c: Include `xalloc.h'. + (add_colorentry): New. + (add_classname): New. + (add_infoname): New. + * src/vcg.h: Add new prototypes. + + 2001-08-27 Akim Demaille + + * Makefile.maint: Sync. again with CVS Autoconf. + + 2001-08-27 Akim Demaille + + * Makefile.maint: Formatting changes. + (po-update, cvs-update, update): New targets. + (AMTAR): Remove. + + 2001-08-27 Akim Demaille + + * Makefile.am (AUTOMAKE_OPTIONS): 1.5. + * Makefile.maint: Sync. with CVS Autoconf. + + 2001-08-27 Marc Autret + + * src/vcg.h (struct infoname_s): New. + (struct colorentry_s): New. + (graph_s): New fields {vertical,horizontal}_order in structure. + Add `infoname' field. + Add `colorentry' field; + * src/vcg_defaults.h (G_VERTICAL_ORDER): New. + (G_HORIZONTAL_ORDER): New. + (G_INFONAME): New. + (G_COLORENTRY): New. + * src/vcg.c (output_graph): Add output of {vertical,horizontal}_order. + Add output of `infoname'. + Add output of `colorentry'. + + 2001-08-27 Marc Autret + + * src/reader.c (parse_dquoted_param): Rename variable `index' to `i'. + This one shadowed a global parameter. + + 2001-08-24 Marc Autret + + * src/print_graph.c (node_output_size): Declared POSIX `size_t' type, + instead of `unsigned'. + (print_state): Do not call obstack_object_size () in obstack_grow () + to avoid macro variables shadowing. + + 2001-08-23 Marc Autret + + * src/lex.c (percent_table): Typo: s/naem/name/. + Add graph option. + Normalize new options declarations. + + 2001-08-20 Pascal Bart + + * tests/suite.at: Exercise %header_extension and %source_extension. + + 2001-08-16 Marc Autret + + * src/reader.c (parse_dquoted_param): New. + (parse_header_extension_decl): Use it. + (parse_source_extension_decl): Likewise. + + 2001-08-16 Marc Autret + + * src/vcg.c: Remove includes of `complain.h' and `xalloc.h'. + (get_xxxx_str): Use assert () instead of complain (). + Remove return invokations in default cases. + (get_decision_str): Modify default behaviour. Remove second argument. + Echo modifications on calls. + (output_graph): Fix. + + 2001-08-16 Marc Autret + + * src/getargs.c (usage): Update with ``-g, --graph''. + + 2001-08-16 Marc Autret + + * doc/bison.texinfo (Bison Options): Add items `-g', `--graph'. + (Option Cross Key): Likewise. + * doc/bison.1: Update. + +2001-09-25 Pascal Bart + + * src/output.c (output_master_parser): Don't finish action_obstack. + (output_parser): Don't care about the muscle action, here. + (prepare): Copy the action_obstack in the action muscle. + (output): Free action_obstack. + +2001-09-23 Pascal Bart + + * src/reader.c (parse_union_decl): Add new obstack union_obstack. Which + will contain `%union' declaration. + (parse_union_decl): Delete #line directive output. + (parse_union_decl): Substitute /attrs_obstack/union_obstack for all + informations about %union. + (parse_union_decl): Copy the union_obstack in the muscle stype. + * src/bison.simple: Add new #line directive. + Add typdef %%stype YYSTYPE. + +2001-09-23 Pascal Bart + + * src/bison.simple: Add new `#line' directive. + +2001-09-22 Pascal Bart + + * src/bison.simple: New `#line' directive. + * src/output.c (output_parser): Support new dynamic muscle input_line. + +2001-09-22 Marc Autret + + * src/output.c (output_master_parser): New. + (output_parser): Be more re-entrant. + +2001-09-21 Marc Autret + + * src/reader.c (copy_definition, parse_union_decl): Update and use + `linef' muscle. + (copy_action): Likewise. + Use obstack_1grow (). + * src/muscle_tab.c (muscle_init): Add muscle `linef'. + +2001-09-21 Marc Autret + + * src/options.c (option_table): Adjust. + * src/lex.c (parse_percent_token): Fix. + +2001-09-20 Pascal Bart + + * src/options.c (symtab.h): Include it, need by lex.h. + +2001-09-20 Pascal Bart + + * src/lex.c (parse_percent_token): Change type of variable `tx', which + is now an option_table_struct*. + (option_strcmp): New function option_strcmp. + (parse_percent_token): Call option_strcmp. + * src/getargs.c (xalloc.h, options.h): Include it. + (getargs): Call create_long_option_table. + (getargs): Free longopts at the end of the function. + (shortopts): Move in options.c. + * src/options.c (create_long_option_table): New function. Convert + information from option_table to option structure. + * src/reader.c (options.h): Include it. + + * src/Makefile.am: Adjust. + * src/options.c (option_table): Create from longopts and percent_table. + * src/getargs.c (longopts): Delete. + * src/lex.c (struct percent_table_struct): Delete. + (percent_table): Delete. + (options.h): Include it. + * src/options.c: Create. + * src/options.h: Create. + Declare enum opt_access_e. + Define struct option_table_struct. + +2001-09-20 Marc Autret + + * doc/bison.texinfo: Adjust terminologies about prologue and epilogue + sections of Bison. + +2001-09-19 Pascal Bart + + * src/bison.simple: s/%%filename/%%skeleton. + * src/muscle_tab.c (getargs.h): Include it. + (muscle_init): Insert new muscle skeleton. + +2001-09-18 Pascal Bart + + * src/output.c (output_parser): Delete unused variable actions_dumped. + +2001-09-07 Pascal Bart + + * src/output.c (output): Delete call to reader_output_yylsp. + * src/reader.c (reader): Likewise. + * src/reader.h: Delete declaration of reader_output_yylsp. + +2001-09-02 Marc Autret + + * src/reader.c: Include muscle_tab.h. + (parse_union_decl): Update. + (parse_macro_decl): Rename parse_muscle_decl. + Update to use renamed functions and variable. + (read_declarations, copy_action, read_additionnal_code, : Updated + with correct variables and functions names. + (packsymbols, reader): Likewise. + + * src/reader.h (muscle_obstack): Extern declaration update. + + * src/output.c: Include muscle_tab.h + In all functions using macro_insert, change by using muscle_insert (). + (macro_obstack): Rename muscle_obstack. + Echo modifications in the whole file. + (MACRO_INSERT_INT): Rename MUSCLE_INSERT_INT. + (MACRO_INSERT_STRING): Rename MUSCLE_INSERT_STRING. + (MACRO_INSERT_PREFIX): Rename MUSCLE_INSERT_PREFIX. + + * src/muscle_tab.h: Update double inclusion macros. + (macro_entry_s): Rename muscle_entry_s. + Update prototypes. + + * src/muscle_tab.c: Include muscle_tab.h. + Rename macro_tabble to muscle_table. + (mhash1, mhash2, mcmp): Use muscle_entry. + (macro_init): Rename muscle_init. Update. + (macro_insert): Rename muscle_insert. Update. + (macro_find): Rename muscle_find. Update. + + * src/main.c: Include muscle_tab.h. + (main): Call muscle_init (). + * src/Makefile.am (bison_SOURCES): Echo modifications. + +2001-09-02 Marc Autret + + Now the files macro_tab.[ch] are named muscle_tab.[ch]. + + * src/muscle_tab.c, src/muscle_tab.h: Add files. + +2001-09-02 Marc Autret + + * src/macrotab.c, src/macrotab.h: Remove. + +2001-09-01 Pascal Bart + + * src/reader.c (copy_guard): Use muscle to specify the `#line' + filename. + +2001-09-01 Marc Autret + + * tests/calc.at (exp): Now, YYERROR_VERBOSE need to be set + to an explicit value to activate the feature. We do it here. + +2001-08-31 Pascal Bart + + * src/output.c (prepare): Delete the `filename' muscule insertion. + * src/reader.c (copy_action): Use `filename' muscule with `#line'. + (parse_union_decl): Likewise. + * src/macrotab.c (macro_init): Initialize filename by infile. + +2001-08-31 Marc Autret + + * src/bison.simple (YYLSP_NEEDED): New definition. + * src/output.c (prepare): Add macro insertion of `locations_flag' + +2001-08-31 Pascal Bart + + * src/output.c (prepare): Delete insertion of previous muscles, + and insert the `prefix' muscles. + * src/macrotab.c (macro_init): Likewise. + (macro_init): Initialization prefix directive by `yy'. + * src/bison.simple: Substitute all %%yylex, %%yychar, %%yylval, + %%yydebug, %%yyerror, %%yynerrs and %%yyparse by yylex, yychar, + yylval, yydebug, yyerror, yynerrs and yyparse. + New directive `#define' to substitute yydebug, ... with option + name_prefix. + +2001-08-31 Pascal Bart + + * src/main.c (main): Standardize. + * src/output.c (output_table_data, output_parser): Likewise. + * src/macrotab.h, src/macrotab.c, src/bison.simple: Likewise. + +2001-08-31 Pascal Bart , Marc Autret + + * src/reader.c (read_additionnal_code): Rename %%user_code to + %%epilogue. + * src/output.c (output): Rename %%declarations to %%prologue. + * src/bison.simple: Echo modifications. + +2001-08-31 Marc Autret + + * src/reader.c (readgram): CleanUp. + (output_token_defines): Likewise. + (packsymbols): Likewise. + (reader): Likewise. + * src/output.c (output): CPP-out useless code. + +2001-08-31 Pascal Bart + + * src/reader.c (reader): Delete obsolete call to function + output_trailers and output_headers. + * src/output.h: Remove obsolete functions prototypes of output_headers + and output_trailers. + +2001-08-30 Pascal Bart + + * src/main.c: Include macrotab.h. + * src/macrotab.h (macro_entry_s): Constify fields. + Adjust functions prototypes. + * src/macrotab.c (macro_insert): Constify key and value. + (macro_find): Constify key. + (macro_insert): Include 'xalloc.h' + (macro_insert): Use XMALLOC. + (macro_find): Constify return value. + * src/output.c (output_table_data): Rename table to table_data. + (output_parser): Constify macro_key, macro_value. + +2001-08-30 Marc Autret + + * src/reader.c (parse_skel_decl): New. + (read_declarations): Add case `tok_skel', call parse_skel_decl (). + * src/lex.h (token_t): New token `tok_skel'. + * src/lex.c (percent_table): Add skeleton option entry. + Standardize. + +2001-08-29 Marc Autret + + * src/bison.simple: Add %%user_code directive at the end. + * src/reader.c (read_additionnal_code): New. + (reader): Use it. + * src/output.c (output_program): Remove. + (output): Update. + +2001-08-28 Marc Autret + + * src/output.c (output_actions): Clean up. + (output_gram): CPP-out useless code. + * src/reader.c (reader): Clean up, CPP-out useless code. + +2001-08-28 Pascal Bart + + * src/output.c (output): Copy attrs_obstack in the '%%definitions' + directive. + * src/bison.simple: Add `%%definitions'. + +2001-08-28 Marc Autret + + * config/depcomp: New file. + +2001-08-27 Paul Eggert + + * src/bison.simple (yyparse): Don't take the address of an + item before the start of an array, as that doesn't conform to + the C Standard. + +2001-08-27 Robert Anisko + + * src/output.c (output): Remove the initialization of the macro + obstack. It was done too late here. + + * src/reader.c (parse_macro_decl): Fix. Use of the macro obstack was + completely wrong. + (reader): Initialize the macro obstack here, since we need it to grow + '%define' directives. + + * src/reader.h: Declare the macro obstack as extern. + +2001-08-27 Robert Anisko + + * src/output.c (output_parser): Fix. Store single '%' characters in + the output obstack instead of throwing them away. + +2001-08-27 Akim Demaille + + * Makefile.am (AUTOMAKE_OPTIONS): 1.5. + +2001-08-25 Robert Anisko + + * lib/Makefile.am: Adjust. + +2001-08-25 Robert Anisko + + * src/bison.simple: Update and add '%%' directives. + +2001-08-25 Robert Anisko + + * src/reader.c (reader): Remove calls to 'output_headers' and + 'output_trailers'. Remove some C output. + (readgram): Disable a piece of code that was writing a default + definition for 'YYSTYPE'. + (reader_output_yylsp): Remove. + (packsymbols): Output token defintions to a macro. + (copy_definition): Disable C output. + + * src/reader.c (parse_macro_decl): New function used to parse macro + declarations. + (copy_string2): Put the body of copy_string into this new function. + Add a parameter to let the caller choose whether he wants to copy the + string delimiters or not. + (copy_string): Be a simple call to copy_string2 with the last argument + bound to true. + (read_declarations): Add case for macro definition. + (copy_identifier): New. + (parse_macro_decl): Read macro identifiers using copy_identifier + rather than lex. + +2001-08-25 Robert Anisko + + * src/output.c (prepare): Add prefixed names. + (output_parser): Output semantic actions. + (output_parser): Fix bug on '%%line' directives. + + * src/output.c (output_headers): Remove. The C code printed by this + function should now be in the skeletons. + (output_trailers): Remove. + (output): Disable call to 'reader_output_yylsp'. + (output_rule_data): Do not output tables to the table obstack. + + * src/output.c: Remove some C dedicated output. + Improve the use of macro and output obstacks. + (output_defines): Remove. + + * src/output.c (output_token_translations): Associate 'translate' + table with a macro. No output to the table obstack. + (output_gram): Same for 'rhs' and 'prhs'. + (output_stos): Same for 'stos'. + (output_rule_data): Same for 'r1' and 'r2'. + (token_actions): Same for 'defact'. + (goto_actions): Same for 'defgoto'. + (output_base): Same for 'pact' and 'pgoto'. + (output_table): Same for 'table'. + (output_check): Same for 'check'. + + * src/output.c (output_table_data): New function. + (output_short_table): Remove. + (output_short_or_char_table): Remove. + + * src/output.c (output_parser): Replace most of the skeleton copy code + with something new. Skeletons are now processed character by character + rather than line by line, and Bison looks for '%%' macros. This is the + first step in making Bison's output process (a lot) more flexible. + (output_parser): Use the macro table. + +2001-08-25 Robert Anisko + + * src/main.c (main): Initialize the macro table. + +2001-08-25 Robert Anisko + + * src/lex.c (percent_table): Add tok_define. + * src/lex.h: Add tok_define. + +2001-08-25 Robert Anisko + + * src/macrotab.c: New file. + * src/macrotab.h: New file. + * src/Makefile.am: Update. + +2001-08-25 Robert Anisko + + * lib/hash.c: New file. + * lib/hash.h: New file. + * lib/Makefile.am: Update. + +2001-08-15 Akim Demaille + + Version 1.28c. + +2001-08-15 Marc Autret + + * src/reader.c (readgram): Indent output macro YYSTYPE. + (packsymbols): Likewise. + (output_token_defines): Likewise. + * src/files.c: Standardize. + (compute_header_macro): New. + (defines_obstack_save): New. Use compute_header_macro. + (output_files): Update. Use defines_obstack_save. + +2001-08-15 Akim Demaille + + * doc/bison.texinfo (Table of Symbols): Document + YYSTACK_USE_ALLOCA. + +2001-08-15 Akim Demaille + + * missing: Update from CVS Automake. + * config/config.guess, config/config.sub, config/texinfo.tex: + Update from gnu.org. + +2001-08-15 Akim Demaille + + * Makefile.maint: Sync with CVS Autoconf. + +2001-08-14 Pascal Bart + + * doc/bison.texinfo: Include GNU Free Documentation License from + `fdl.texi'. + * doc/fdl.texi: Add to package. + +2001-08-14 Marc Autret + + Turn on %{source,header}_extension features. + + * src/lex.c (percent_table): Un-CPP out header_extension and + source_extension. + * src/files.c (compute_exts_from_gf): Compare pointers with NULL. + (compute_exts_from_src): Remove conditions. It restores priorities + between options. + +2001-08-14 Marc Autret + + * src/files.c (compute_base_names): Add extensions computing when + `--file-prefix' used. + Standardize function calls. + +2001-08-13 Marc Autret + + * src/bison.simple (YYSTACK_USE_ALLOCA): Changed to allow users + defining it (defined but null disables alloca). + +2001-08-13 Marc Autret + + * src/bison.simple (_yy_memcpy): CPP reformat. + +2001-08-13 Pascal Bart + + * tests/atconfig.in (CPPFLAGS): Fix. + +2001-08-10 Pascal Bart + + * doc/bison.texinfo: Include GNU General Public License from + `gpl.texi'. + * doc/gpl.texi: Add to package. + +2001-08-10 Marc Autret + + * src/print_graph.h: Fix. + * src/reader.c (read_declarations): Use parse_header_extension_decl (). + +2001-08-10 Akim Demaille + + * src/system.h: Provide default declarations for stpcpy, strndup, + and strnlen. + +2001-08-10 Robert Anisko + + * doc/bison.texinfo (Locations): Update @$ stuff. + +2001-08-09 Robert Anisko + + * src/bison.simple (YYLLOC_DEFAULT): Update. + (yyparse): Adjust. + +2001-08-08 Marc Autret + + * doc/bison.texinfo: Change @samp{$<@dots{}>} to + @samp{$<@dots{}>@var{n}} in Section Actions in Mid-Rule. + Reported by Fabrice Bauzac. + +2001-08-08 Marc Autret + + * src/vcg_default.h: Use NULL instead of 0 to initialize pointers. + * src/vcg.c (output_node): Fix. + * src/vcg.h: Cleanup. + * src/print_graph.c: Add comments. + (node_output_size): New global variable. Simplify the formatting of + the VCG graph output. + (print_actions): Unused code is now used. It notifies the final state + and no action states in the VCG graph. It also give the reduce actions. + The `shift and goto' edges are red and the `go to state' edges are + blue. + Get the current node name and node_obstack by argument. + (node_obstack): New variable. + (print_state): Manage node_obstack. + (print_core): Use node_obstack given by argument. + A node is not only computed here but in print_actions also. + (print_graph): CPP out useless code instead of commenting it. + +2001-08-07 Pascal Bart + + * tests/atconfig.in (CPPFLAGS): Fix. + +2001-08-07 Akim Demaille + + * src/print_graph.c (quote): New. + (print_core): Use it. + +2001-08-06 Akim Demaille , Marc Autret + + * src/vcg.c (complain.h): Include it. + Unepitaize `return' invocations. + [NDEBUG] (main): Remove. + * src/vcg.h (node_t, edge_t, graph_t): Constify the char * members. + * src/files.c (open_files): Initialize graph_obstack. + * src/print_graph.c (print_actions): CPP out useless code. + (print_core): Don't output the last `\n' in labels. + Use `quote'. + * src/files.c (output_files): Output the VCG file. + * src/main.c (main): Invoke print_graph (); + +2001-08-06 Marc Autret + + Automaton VCG graph output. + Using option ``-g'' or long option ``--graph'', you can generate + a gram_filename.vcg file containing a VCG description of the LALR (1) + automaton of your grammar. + + * src/main.c: Call to print_graph() function. + * src/getargs.h: Update. + * src/getargs.c (options): Update to catch `-g' and `--graph' options. + (graph_flag): New flag. + (longopts): Update. + (getargs): Add case `g'. + * src/files.c (graph_obstack): New obstack struct. + (open_files): Initialize new obstack. + (output_files): Saves graph_obstack if required. + * src/files.h (graph_obstack): New extern declaration. + * src/Makefile.am: Add new source files. + +2001-08-06 Marc Autret + + * src/print_graph.c, src/print_graph.h (graph): New. + * src/vcg.h: New file. + * src/vcg.c: New file, VCG graph handling. + +2001-08-06 Marc Autret + + Add of %source_extension and %header_extension which specify + the source or/and the header output file extension. + + * src/files.c (compute_base_names): Remove initialisation of + src_extension and header_extension. + (compute_exts_from_gf): Update. + (compute_exts_from_src): Update. + (output_files): Update. + * src/reader.c (parse_header_extension_decl): New. + (parse_source_extension_decl): New. + (read_declarations): New case statements for the new tokens. + * src/lex.c (percent_table): Add entries for %source_extension + and %header_extension. + * src/lex.h (token_e): New tokens tok_hdrext and tok_srcext. + +2001-08-06 Marc Autret + + * configure.in: Bump to 1.28c. + * doc/bison.texinfo: Texinfo thingies. + +2001-08-04 Pascal Bart + + * tests/atconfig.in (CPPFLAGS): Add. + * tests/calc.at (AT_CHECK): Use CPPFLAGS. + +2001-08-03 Akim Demaille + + Version 1.28b. + +2001-08-03 Akim Demaille + + * tests/Makefile.am (check-local): Ship testsuite. + * tests/calc.at (_AT_DATA_CALC_Y): Prototype all the functions. + Include `string.h'. + +2001-08-03 Akim Demaille + + * configure.in: Try using -Wformat when compiling. + +2001-08-03 Akim Demaille + + * configure.in: Bump to 1.28b. + +2001-08-03 Akim Demaille + + * src/complain.c: Adjust strerror_r portability issues. + +2001-08-03 Akim Demaille + + Version 1.28a. + +2001-08-03 Akim Demaille + + * src/getargs.c, src/getarg.h (skeleton)): Constify. + * src/lex.c (literalchar): Avoid name clashes on `buf'. + * src/getargs.c: Include complain.h. + * src/files.c, src/files.h (skeleton_find): Avoid name clashes. + * lib/quotearg.c, lib/quotearg.h: Update from fileutils 4.1. + +2001-08-03 Akim Demaille + + * src/reader.c (readgram): Display hidden chars in error messages. + +2001-08-03 Akim Demaille + + Update to gettext 0.10.39. + +2001-08-03 Akim Demaille + + * lib/strspn.c: New. + +2001-08-01 Marc Autret + + * doc/bison.texinfo: Update. + * doc/bison.1 (mandoc): Update. + * src/system.h (EXT_GUARD_C, EXT_STYPE_H): Remove .c and .h. + * src/files.c: Support output files extensions computing. + (src_extension): New static variable. + (header_extension): New static variable. + (tr): New function. + (get_extension_index): New function, gets the index of an extension + filename in a string. + (compute_exts_from_gf): New function, computes extensions from the + grammar file extension. + (compute_exts_from_src): New functions, computes extensions from the + C source file extension, file given by ``-o'' option. + (compute_base_names): Update. + (output_files): Update. + +2001-08-01 Robert Anisko + + * doc/bison.texi: Document @$. + (Locations): New section. + +2001-07-18 Akim Demaille + + * Makefile.maint, GNUmakefile: New, from Autoconf 2.52. + * config/prev-version.txt, config/move-if-change: New. + * Makefile.am: Adjust. + +2001-07-08 Pascal Bart + + * src/bison.simple (yyparse): Suppress warning `comparaison + between signed and unsigned'. + +2001-07-05 Pascal Bart + + * src/getargs.h (raw_flag): Remove. + * src/getargs.c: Die on `-r'/`--raw'. + * src/lex.c (parse_percent_token): Die on `%raw'. + * src/reader.c (output_token_defines): Suppress call to `raw_flag'. + * tests/calc.at: Suppress test with option `--raw'. + +2001-07-14 Akim Demaille + + * config/: New. + * configure.in: Require Autoconf 2.50. + Update to gettext 0.10.38. + +2001-03-16 Akim Demaille + + * doc/bison.texinfo: ANSIfy the examples. + +2001-03-16 Akim Demaille + + * getargs.c (skeleton): New variable. + (longopts): --skeleton is a new option. + (shortopts, getargs): -S is a new option. + * getargs.h: Declare skeleton. + * output.c (output_parser): Use it. + +2001-03-16 Akim Demaille + + * m4/strerror_r.m4: New. + * m4/error.m4: Run AC_FUNC_STRERROR_R. + * lib/error.h, lib/error.c: Update. + +2001-03-16 Akim Demaille + + * src/getargs.c (longopts): Clean up. + +2001-02-21 Akim Demaille + + * src/reader.c (gensym): `gensym_count' is your own. + Use a static buf to create the symbol name, as token_buffer is no + longer a buffer. + +2001-02-08 Akim Demaille + + * src/conflicts.c (conflict_report): Be sure not to append to res + between two calls, which could happen if both first sprintf were + skipped, but not the first cp += strlen. + +2001-02-08 Akim Demaille + + * lib/memchr.c, lib/stpcpy.c, lib/strndup.c, lib/strnlen.c: + New, from fileutils 4.0.37. + * configure.in: Require Autoconf 2.49c. I took some time before + making this decision. This is the only way out for portability + issues in Bison, it would mean way too much duplicate effort to + import in Bison features implemented in 2.49c since 2.13. + AC_REPLACE_FUNCS and AC_CHECK_DECLS the functions above. + +2001-02-02 Akim Demaille + + * lib/malloc.c, lib/realloc.c: New, from the fileutils 4.0.37. + * lib/xalloc.h, lib/xmalloc.c: Update. + +2001-01-19 Akim Demaille + + Get rid of the ad hoc handling of token_buffer in the scanner: use + the obstacks. + + * src/lex.c (token_obstack): New. + (init_lex): Initialize it. No longer call... + (grow_token_buffer): this. Remove it. + Adjust all the places which used it to use the obstack. + +2001-01-19 Akim Demaille + + * src/lex.h: Rename all the tokens: + s/\bENDFILE\b/tok_eof/g; + s/\bIDENTIFIER\b/tok_identifier/g; + etc. + Let them be enums, not #define, to ease debugging. + Adjust all the code. + +2001-01-18 Akim Demaille + + * src/lex.h (MAXTOKEN, maxtoken, grow_token_buffer): Remove, private. + * src/lex.c (maxtoken, grow_token_buffer): Static. + +2001-01-18 Akim Demaille + + Since we now use obstacks, more % directives can be enabled. + + * src/lex.c (percent_table): Also accept `%yacc', + `%fixed_output_files', `%defines', `%no_parser', `%verbose', and + `%debug'. + Handle the actions for `%semantic_parser' and `%pure_parser' here, + instead of returning a token. + * src/lex.h (SEMANTIC_PARSER, PURE_PARSER): Remove, unused. + * src/reader.c (read_declarations): Adjust. + * src/files.c (open_files): Don't call `compute_base_names', don't + compute `attrsfile' since they depend upon data which might be + *in* the input file now. + (output_files): Do it here. + * src/output.c (output_headers): Document the fact that this patch + introduces a guaranteed SEGV for semantic parsers. + * doc/bison.texinfo: Document them. + * tests/suite.at: Exercise these %options. + +2000-12-20 Akim Demaille + + Also handle the output file (--verbose) with obstacks. + + * files.c (foutput): Remove. + (output_obstack): New. + Adjust all dependencies. + * src/conflicts.c: Return a string. + * src/system.h (obstack_grow_string): Rename as... + (obstack_sgrow): this. Be ready to work with non literals. + (obstack_fgrow4): New. + +2000-12-20 Akim Demaille + + * src/files.c (open_files): Fix the computation of short_base_name + in the case of `-o foo.tab.c'. + +2000-12-20 Akim Demaille + + * src/reader.c (copy_string, copy_comment, copy_comment2, copy_at) + (copy_dollar): Now that everything uses obstacks, get rid of the + FILE * parameters. + +2000-12-20 Akim Demaille + + * src/files.c (open_files): Actually the `.output' file is based + on the short_base_name, not base_name. + * tests/suite.at (Checking output file names): Adjust. + +2000-12-20 Akim Demaille + + * src/bison.s1: Remove, we now use directly... + * src/bison.simple: this. + * src/Makefile.am: Use pkgdata instead of data. + +2000-12-20 Akim Demaille + + * src/files.c (guard_obstack): New. + (open_files): Initialize it. + (output_files): Dump it... + * src/files.h: Export it. + * src/reader.c (copy_guard): Use it. + +2000-12-19 Akim Demaille + + * src/files.c (outfile, defsfile, actfile): Removed as global + vars. + (open_files): Don't compute them. + (output_files): Adjust. + (base_name, short_base_name): Be global. + Adjust dependencies. + +2000-12-19 Akim Demaille + + * src/files.c (strsuffix): New. + (stringappend): Be just like strcat but allocate. + (base_names): Eve out from open_files. + Try to simplify the rather hairy computation of base_name and + short_base_name. + (open_files): Use it. + * tests/suite.at (Checking output file names): New test. + +2000-12-19 Akim Demaille + + * src/system.h (obstack_grow_literal_string): Rename as... + (obstack_grow_string): this. + * src/output.c (output_parser): Recognize `%% actions' instead of + `$'. + * src/bison.s1: s/$/%% actions/. + * src/bison.hairy: Likewise. + +2000-12-19 Akim Demaille + + * src/output.c (output_parser): Compute the `#line' lines when + there are. + * src/Makefile.am (bison.simple): Be a simple copy of bison.s1. + Suggested by Hans Aberg. + +2000-12-19 Akim Demaille + + Let the handling of the skeleton files be local to the procedures + that use it. + + * src/files.c (xfopen, xfclose, skeleton_find, guardfile): No + longer static. + (fparser, open_extra_files): Remove. + (open_files, output_files): Don't take care of fparser. + * src/files.h: Adjust. + * src/output.c (output_parser): Open and close the file to the + skeleton. + * src/reader.c (read_declarations): When %semantic_parser, open + fguard. + +2000-12-19 Akim Demaille + + * src/file.h (BISON_SIMPLE, BISON_HAIRY): Move from here... + * src/system.h (BISON_SIMPLE, BISON_HAIRY): ... to here. + +2000-12-19 Akim Demaille + + * src/files.c (open_files): Yipee! We no longer need all the code + looking for `/tmp' since we have no tmp file. + +2000-12-19 Akim Demaille + + * src/system.h (EXT_TAB, EXT_OUTPUT, EXT_STYPE_H, EXT_GUARD_C): + New macros. + * src/files.c (open_files): Less dependency on MSDOS etc. + +2000-12-14 Akim Demaille + + * src/bison.s1 (YYLLOC_DEFAULT): New macro. + Provide a default definition. + Use it when executing the default @ action. + * src/reader.c (reader_output_yylsp): No longer include + `timestamp' and `text' in the default YYLTYPE. + +2000-12-12 Akim Demaille + + * src/reader.c (copy_definition, parse_union_decl, copy_action) + (copy_guard): Quote the file names. + Reported by Laurent Mascherpa. + +2000-12-12 Akim Demaille + + * src/output.c (output_headers, output_program, output): Be sure + to escape special characters when outputting filenames. + (ACTSTR_PROLOGUE, ACTSTR_EPILOGUE): Remove. + (output_headers): Don't depend on them, Use ACTSTR. + +2000-11-17 Akim Demaille + + * lib/obstack.h: Formatting changes. + (obstack_grow, obstack_grow0): Don't cast WHERE at all: it + prevents type checking. + (obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't + cast the value to (void *): assigning a `foo *' to a `void *' + variable is valid. + (obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int. + * src/reader.c (parse_union_decl): Typo: use obstack_1grow to + append characters. + +2000-11-17 Akim Demaille + + * tests/Makefile.am (suite.m4, regression.m4, calc.m4): Rename + as... + (suite.m4, regression.m4, calc.m4): these. + * tests/atgeneral.m4: Update from CVS Autoconf. + +2000-11-17 Akim Demaille + + * tests/regression.m4 (%union and --defines): New test, + demonstrating a current bug in the obstack implementation. + +2000-11-17 Akim Demaille + + * src/bison.s1 (_YY_DECL_VARIABLES, YY_DECL_VARIABLES): New + macros. + Use them to declare the variables which are global or local to + `yyparse'. + +2000-11-17 Akim Demaille + + * acconfig.h: Remove, no longer used. + +2000-11-07 Akim Demaille + + * src: s/Copyright (C)/Copyright/g. + +2000-11-07 Akim Demaille + + * src/reader.c (reader): #define YYLSP_NEEDED to 1 instead of just + defining. + * src/bison.s1: s/#ifdef YYLSP_NEEDED/#if YYLSP_NEEDED/. + +2000-11-07 Akim Demaille + + * src/bison.s1 (YYLEX): Use #if instead of #ifdef. + Merge in a single CPP if/else. + +2000-11-07 Akim Demaille + + * src/output.c (output): Remove useless variables. + * lib/obstack.c (obstack_grow, obstack_grow0): Rename the second + argument `data' for consistency with the prototypes. + Qualify it `const'. + (obstack_copy, obstack_copy0): Rename the second argument as + `address' for consistency. Qualify it `const'. + * lib/obstack.h (obstack_copy, obstack_copy0, obstack_grow) + (obstack_grow0, obstack_ptr_grow, obstack_ptr_grow_fast): Qualify + `const' their input argument (`data' or `address'). + Adjust the corresponding macros to include `const' in casts. + +2000-11-03 Akim Demaille + + * src/Makefile.am (INCLUDES): s/PFILE/BISON_SIMPLE/. + s/PFILE1/BISON_HAIRY/. + Adjust dependencies. + +2000-11-03 Akim Demaille + + For some reason, this was not applied. + + * src/files.c [VMS]: No longer include `ssdef.h', no longer define + `unlink': it's no longer used. + +2000-11-03 Akim Demaille + + * src/files.c (skeleton_find): New function, eved out of... + (open_files, open_extra_files): here. + +2000-11-03 Akim Demaille + + Don't use `atexit'. + + * src/files.c (obstack_save): New function. + (done): Rename as... + (output_files): this. + Use `obstack_save'. + * src/main.c (main): Don't use `atexit' to register `done', since + it no longer has to remove tmp files, just call `output_files' + when there are no errors. + +2000-11-02 Akim Demaille + + * src/files.c [VMS]: No longer include `ssdef.h', no longer define + `unlink': it's no longer used. + * src/files.h: Formatting changes. + +2000-11-02 Akim Demaille + + Remove the last uses of mktemp and unlink/delete. + + * src/files.c (fdefines, ftable): Removed. + (defines_ostack, table_obstack): New. + Adjust dependencies of the former into uses of the latter. + * src/output.c (output_short_or_char_table, output_short_table): + Convert to using obstacks. + * src/reader.c (copy_comment2): Accept one FILE * and two + obstacks. + (output_token_defines, reader_output_yylsp): Use obstacks. + * src/system.h (obstack_fgrow3): New. + * po/POTFILES.in: Adjust. + +2000-11-01 Akim Demaille + + Change each use of `fattrs' into a use of `attrs_obstack'. + + * src/reader.c (copy_at): Typo: s/yylloc/yyloc/. + * src/files.c (fattrs): Remove. + (attrs_obstack): New. + Adjust all dependencies. + (done): If SEMANTIC_PARSER, dump attrs_obstack into attrsfile. + +2000-11-01 Akim Demaille + + Introduce obstacks. + Change each use of `faction' into a use of `action_obstack'. + + * lib/obstack.h, lib/obstack.c: New files. + * src/files.c (faction): Remove. + (action_obstack): New. + Adjust all dependencies. + +2000-10-20 Akim Demaille + + * lib/quote.h (PARAMS): New macro. Use it. + +2000-10-16 Akim Demaille + + * src/output.c (output_short_or_char_table): New function. + (output_short_table, output_token_translations): Use it. + (goto_actions): Use output_short_table. + +2000-10-16 Akim Demaille + + * src/symtab.c (bucket_new): New function. + (getsym): Use it. + + * src/output.c (output_short_table): New argument to display the + comment associated with the table. + Adjust dependencies. + (output_gram): Use it. + (output_rule_data): Nicer output layout for YYTNAME. + +2000-10-16 Akim Demaille + + * src/lex.c (read_typename): New function. + (lex): Use it. + * src/reader.c (copy_dollar): Likewise. + +2000-10-16 Akim Demaille + + * src/reader.c (copy_comment2): Expect the input stream to be on + the `/' which is suspected to open a comment, instead of being + called after `//' or `/*' was read. + (copy_comment, copy_definition, parse_union_decl, copy_action) + (copy_guard): Adjust. + +2000-10-16 Akim Demaille + + * src/reader.c (parse_expect_decl): Use `skip_white_space' and + `read_signed_integer'. + +2000-10-16 Akim Demaille + + * src/reader.c (copy_dollar): New function. + (copy_guard, copy_action): Use it. + +2000-10-16 Akim Demaille + + * lib/quote.h, lib/quote.c, lib/quotearg.h, lib/quotearg.c: + * m4/prereq.m4, m4/c-bs-a.m4, m4/mbstate.m4: + New files, from Fileutils 4.0.27. + * src/main.c (printable_version): Remove. + * src/lex.c, src/reader.c: Use `quote'. + +2000-10-04 Akim Demaille + + * lib/error.c, lib/error.h: New files, needed by xmalloc.c. + +2000-10-04 Akim Demaille + + * doc/bison.texinfo: Various typos spotted by Neil Booth. + +2000-10-04 Akim Demaille + + When a literal string is used to define two different tokens, + `bison -v' segfaults. + Reported by Piotr Gackiewicz, and fixed by Neil Booth. + + * tests/regression.m4: New file. + Include the core of the sample provided by Piotr Gackiewicz. + * src/reader.c (parse_token_decl): Diagnose bad cases, and proceed + properly. + +2000-10-04 Akim Demaille + + * src/reader.c (parse_expect_decl): Keep `count' within the size + of `buffer'. + From Neil Booth. + +2000-10-02 Paul Eggert + + * bison.s1 (yyparse): Assign the default value + unconditionally, to avoid a GCC warning and make the parser a + tad smaller. + +2000-10-02 Akim Demaille + + * src/getargs.c (getargs): Don't dump `--help' on unrecognized + options. + +2000-10-02 Akim Demaille + + * src/derives.c, src/print.c, src/reduce.c: To ease the + translation, move some `\n' out of the translated strings. + +2000-10-02 Akim Demaille + + The location tracking mechanism is precious for parse error + messages. Nevertheless, it is enabled only when `@n' is used in + the grammar, which is a different issue (you can use it in error + message, but not in the grammar per se). Therefore, there should + be another means to enable it. + + * src/getargs.c (getargs): Support `--locations'. + (usage): Report it. + * src/getargs.h (locationsflag): Export it. + * src/lex.c (percent_table): Support `%locations'. + * src/reader.c (yylsp_needed): Remove this variable, now replaced + with `locationsflag'. + * doc/bison.texinfo: Document `--locations' and `%locations'. + Sort the options. + * tests/calc.m4: Test it. + + For regularity of the names, replace each + (nolineflag, toknumflag, rawtokenumflag, noparserflag): with... + (no_lineflag, token_tableflag, rawflag, no_parserflag): this. + In addition replace each `flag' with `_flag'. + +2000-10-02 Akim Demaille + + Also test parse error messages, including with YYERROR_VERBOSE. + + * tests/calc.m4 (calc.y): Add support for `exp = exp' (non + associative). + Use it to check the computations. + Use it to check `nonassoc' is honored. + (AT_DATA_CALC_Y): Equip `calc.y' with YYERROR_VERBOSE when passed + `--yyerror-verbose'. + (_AT_CHECK_CALC): Adjust to this option. + (_AT_CHECK_CALC_ERROR): New macro to check parse error messages. + +2000-10-02 Akim Demaille + + Test also `--verbose', `--defines' and `--name-prefix'. Testing + the latter demonstrates a flaw in the handling of non debugging + parsers introduced by myself on 2000-03-16: `#define yydebug 0' + was used in order to simplify: + + #if YYDEBUG + if (yydebug) + { + ... + } + #endif + + into + + if (yydebug) + { + ... + } + + unfortunately this leads to a CPP conflict when + `--name-prefix=foo' is used since it produces `#define yydebug + foodebug'. + + * src/bison.s1 [!YYDEBUG]: Do not define yydebug. + (YYDPRINTF): New macro. + Spread its use. + * tests/calc.m4 (AT_CHECK_CALC): Do require a title, build it from + the bison options. + Also test `--verbose', `--defines' and `--name-prefix'. + +2000-10-02 Akim Demaille + + Improve the readability of the produced parsers. + + * src/bison.s1: Formatting changes. + Improve the comment related to the `$' mark. + (yydefault): Don't fall through to `yyresume': `goto' there. + * src/output.c (output_parser): When the `$' is met, skip the end + of its line. + New variable, `number_of_dollar_signs', to check there's exactly + one `$' in the parser skeleton. + +2000-10-02 Akim Demaille + + * lib/xstrdup.c: New file, from the fileutils. + * src/reader.c (parse_token_decl, get_type_name, parse_type_decl) + (parse_assoc_decl, parse_thong_decl, get_type): Use `xstrdup' + instead of strlen + xmalloc + strcpy. + * src/symtab.c (copys): Remove, use xstrdup instead. + +2000-10-02 Akim Demaille + + * src/gram.h (associativity): New enum type which replaces the + former CPP macros `RIGHT_ASSOC', `LEFT_ASSOC' and `NON_ASSOC' with + `right_assoc', `left_assoc' and `non_assoc'. + Adjust all dependencies. + * src/reader.c: Formatting changes. + (LTYPESTR): Don't define it, use it as a literal in + `reader_output_yylsp'. + * src/symtab.h (symbol_class): New enum type which replaces the + former CPP macros `SUNKNOWN', `STOKEN and `SNTERM' with + `sunknown', `stoken and `snterm'. + +2000-10-02 Akim Demaille + + * src/getargs.c (fixed_outfiles): Rename as... + (yaccflag): for consistency and accuracy. + Adjust dependencies. + +2000-10-02 Akim Demaille + + Use the more standard files `xalloc.h' and `xmalloc.c' instead of + Bison's `allocate.c' and `alloc.h'. This patch was surprisingly + difficult and introduced a lot of core dump. It turns out that + Bison used an implementation of `xmalloc' based on `calloc', and + at various places it does depend upon the initialization to 0. I + have not tried to isolate the pertinent places, and all the former + calls to Bison's `xmalloc' are now using `XCALLOC'. Someday, + someone should address this issue. + + * src/allocate.c, src/alloc.h, m4/bison-decl.m4: Remove. + * lib/xmalloc.c, lib/xalloc.h, m4/malloc.m4, m4/realloc.m4: New + files. + Adjust dependencies. + * src/warshall.h: New file. + Propagate. + +2000-10-02 Akim Demaille + + Various anti-`extern in *.c' changes. + + * src/system.h: Include `assert.h'. + +2000-10-02 Akim Demaille + + * src/state.h (nstates, final_state, first_state, first_shift) + (first_reduction): Move their exportation from here... + * src/LR0.h: to here. + Adjust dependencies. + * src/getargs.c (statisticsflag): New variable. + Add support for `--statistics'. + Adjust dependencies. + + Remove a lot of now useless `extern' statements in most files. + +2000-10-02 Akim Demaille + + * src/LR0.h: New file. + Propagate its use. + +2000-10-02 Akim Demaille + + * src/print.h: New file. + Propagate its use. + * src/print.c: Formatting and ordering changes. + (verbose, terse): Replace with... + (print_results): this new function. + Adjust dependencies. + +2000-10-02 Akim Demaille + + * src/conflicts.c (conflict_report): New function. + (conflict_log, verbose_conflict_log): Replace with... + (print_conflicts): this function. + Adjust dependencies. + * src/conflicts.h: New file. + Propagate its inclusion. + +2000-10-02 Akim Demaille + + * src/nullable.h: New file. + Propagate its inclusion. + * src/nullable.c: Formatting changes. + +2000-10-02 Akim Demaille + + * src/reduce.h: New file. + Propagate its inclusion. + * src/reduce.c: Topological sort and other formatting changes. + (bool, TRUE, FALSE): Move their definition to... + * src/system.h: here. + +2000-10-02 Akim Demaille + + * src/files.c: Formatting changes. + (tryopen, tryclose, openfiles): Rename as... + (xfopen, xfclose, open_files): this. + (stringappend): static. + * src/files.h: Complete the list of exported symbols. + Propagate its use. + +2000-10-02 Akim Demaille + + * src/reader.h: New file. + Propagate its use instead of tedious list of `extern' and + prototypes. + * src/reader.c: Formatting changes, topological sort, + s/register//. + +2000-10-02 Akim Demaille + + * src/lex.h: Prototype `lex.c' exported functions. + * src/reader.c: Adjust. + * src/lex.c: Formatting changes. + (safegetc): Rename as... + (xgetc): this. + +2000-10-02 Akim Demaille + + * src/lalr.h: New file. + Propagate its inclusion instead of prototypes and `extern'. + * src/lalr.c: Formatting changes, topological sorting etc. + +2000-10-02 Akim Demaille + + * src/output.c (token_actions): Introduce a temporary array, + YYDEFACT, that makes it possible for this function to use + output_short_table. + +2000-10-02 Akim Demaille + + `user_toknums' is output as a `short[]' in `output.c', while it is + defined as a `int[]' in `reader.c'. For consistency with the + other output tables, `user_toknums' is now defined as a table of + shorts. + + * src/reader.c (user_toknums): Be a short table instead of an int + table. + Adjust dependencies. + + Factor the short table outputs. + + * src/output.c (output_short_table): New function. + * src/output.c (output_gram, output_stos, output_rule_data) + (output_base, output_table, output_check): Use it. + +2000-10-02 Akim Demaille + + * src/output.c (output): Topological sort of the functions, in + order to get rid of the `static' prototypes. + No longer use `register'. + * src/output.h: New file. + Propagate its inclusion in files explicitly prototyping functions + from output.c. + +2000-09-21 Akim Demaille + + * src/atgeneral.m4: Update from Autoconf. + +2000-09-21 Akim Demaille + + * src/closure.h: New file. + * src/closure.c: Formatting changes, topological sort over the + functions, use of closure.h. + (initialize_closure, finalize_closure): Rename as... + (new_closure, free_closure): these. Adjust dependencies. + * src/LR0.c: Formatting changes, topological sort, use of + cloture.h. + (initialize_states): Rename as... + (new_states): this. + * src/Makefile.am (noinst_HEADERS): Adjust. + +2000-09-20 Akim Demaille + + * src/acconfig.h: Don't protect config.h against multiple + inclusion. + Don't define PARAMS. + * src/system.h: Define PARAMS. + Remove some of the ad-hoc CPP magic for DOS, VMS etc.: this is the + purpose of config.h. system.h must not try to fix wrong + definitions in config.h. + +2000-09-20 Akim Demaille + + * src/derives.h: New file. + * src/main.c, src/derives.h: Use it. + Formatting changes. + * src/Makefile.am (noinst_HEADERS): Adjust. + +2000-09-20 Akim Demaille + + * tests/atgeneral.m4: Update from Autoconf. + * tests/calc.m4 (_AT_DATA_CALC_Y, AT_DATA_CALC_Y, _AT_CHECK_CALC) + (AT_CHECK_CALC): New macros. + Use these macros to test bison with options `', `--raw', + `--debug', `--yacc', `--yacc --debug'. + +2000-09-19 Akim Demaille + + * src/output.c: Formatting changes. + * src/machine.h: Remove, leaving its contents in... + * src/system.h: here. + Include stdio.h. + Adjust all dependencies on stdio.h and machine.h. + * src/getargs.h: New file. + Let all `extern' declarations about getargs.c be replaced with + inclusion of `getargs.h'. + * src/Makefile.am (noinst_HEADERS): Adjust. + + * tests/calc.m4 (yyin): Be initialized in main, not on the global + scope. + (yyerror): Returns void, not int. + * doc/bison.texinfo: Formatting changes. + +2000-09-19 Akim Demaille + + * tests/calc.m4 (calc.y): Do not assign to stdin, as it's not + portable. + +2000-09-18 Akim Demaille + + * configure.in: Append WARNING_CFLAGS to CFLAGS. + * src/Makefile.am (INCLUDES): Don't. + Be ready to fetch headers in lib/. + +2000-09-18 Akim Demaille + + * doc/bison.texinfo: Update the copyright. + ANSIfy and GNUify the examples. + Remove the old menu. + +2000-09-18 Akim Demaille + + First set of tests: use the `calc' example from the documentation. + + * src/bison.s1 (yyparse): Condition the code using `yytname' which + is defined only when YYDEBUG is. + * m4/atconfig.m4 (AT_CONFIG): Adjust to Autoconf 2.13. + * src/files.c (tryopen, tryclose): Formatting changes. + Move to the top and be static. + * src/reader.c (read_signed_integer): Likewise. + * tests/calc.m4: New file. + * Makefile.am, suite.m4: Adjust. + * m4/atconfig.m4: Set BISON_SIMPLE and BISON_HAIRY. + +2000-09-18 Akim Demaille + + Add support for an Autotest test suite for Bison. + + * m4/m4.m4, m4/atconfig.m4: New files. + * m4/Makefile.am (EXTRA_DIST): Adjust. + * tests/suite.m4, tests/Makefile.am, tests/atgeneral.m4: New + files. + * src/getargs.c: Display a more standard --version message. + * src/reader.c (reader): Formatting changes. + No longer depend upon VERSION_STRING. + * configure.in: No longer use `dnl'. + Set up the test suite and the new directory `tests/. + (VERSION_STRING): Remove. + +2000-04-14 Akim Demaille + + * src/reader.c (copy_comment2): New function, same as former + `copy_comment', but outputs into two FILE *. + (copy_comment): Use it. + (parse_union_decl): Use it. + (get_type, parse_start_decl): Use the same `invalid' message. + (parse_start_decl, parse_union_decl): Use the same `multiple' + message. + (parse_union_decl, copy_guard, copy_action): Use the same + `unmatched' message. + * m4/Makefile.am (EXTRA_DIST): Add `warning.m4'. + +2000-03-31 Akim Demaille + + * src/files.c (tryopen, tryclose): Move to the top. + Be static. + +2000-03-31 Akim Demaille + + * src/main.c (main): Don't call `done', exit does it. + +2000-03-31 Akim Demaille + + * allocate.c: s/return (foo)/return foo/. + * lalr.c: Likewise. + * LR0.c: Likewise. + * output.c: Likewise. + * reader.c: Likewise. + * symtab.c: Likewise. + * vmsgetargs.c: Likewise. + +2000-03-31 Akim Demaille + + Clean up the error reporting functions. + + * src/report.c: New file. + * src/report.h: Likewise. + * src/Makefile.am: Adjust. + * m4/error.m4: New file. + * m4/Makefile.am: Adjust. + * configure.in (jm_PREREQ_ERROR): Call it. + * src/main.c (int_to_string, banner, fatal_banner, warn_banner): + Remove. + (fatal, fatals): Remove. All callers use complain.c::fatal. + (warn, warni, warns, warnss, warnss): Remove. All callers use + complain.c::complain. + (toomany): Remove, use fatal instead. + * src/files.c (done): No argument, use complain_message_count. + * src/main.c (main): Register `done' to `atexit'. + + * src/getargs.c (usage): More `fputs', less `fprintf'. + +2000-03-28 Akim Demaille + + * lib/: New directory. + * Makefile.am (SUBDIRS): Adjust. + * configure.in: Adjust. + (LIBOBJS): Although not used yet, AC_SUBST it, otherwise it's + useless. + * src/alloca.c: Moved to lib/. + * src/getopt.c: Likewise. + * src/getopt1.c: Likewise. + * src/getopt.h: Likewise. + * src/ansi2knr.c: Likewise. + * src/ansi2knr.1: Likewise. + * src/Makefile.am: Adjust. + * lib/Makefile.am: New file. + +2000-03-28 Akim Demaille + + * src/getargs.c (usage): Refresh the help message. + +2000-03-17 Akim Demaille + + * src/getopt1.c: Updated from textutils 2.0e + * src/getopt.c: Likewise. + * src/getopt.h: Likewise. + +2000-03-17 Akim Demaille + + * src/Makefile.am (bison.simple): Fix the awk program: quote only + the file name, not the whole `#line LINE FILE'. + +2000-03-17 Akim Demaille + + On syntax errors, report the token on which we choked. + + * src/bison.s1 (yyparse): In the label yyerrlab, when + YYERROR_VERBOSE, add yychar in msg. + +2000-03-17 Akim Demaille + + * src/reader.c (copy_at): New function. + (copy_guard): Use it. + (copy_action): Use it. + +2000-03-17 Akim Demaille + + Be kind to translators, save some useless translations. + + * src/main.c (banner): New function. + (fatal_banner): Use it. + (warn_banner): Use it. + +2000-03-17 Akim Demaille + + * src/reader.c (copy_definition): Use copy_string and + copy_comment. Removed now unused `match', `ended', + `cplus_comment'. + (copy_comment, copy_string): Moved, to be visible from + copy_definition. + +2000-03-17 Akim Demaille + + * src/reader.c (copy_string): Declare `static inline'. No + problems with inline, since it is checked by configure. + (copy_comment): Likewise. + +2000-03-17 Akim Demaille + + * src/reader.c (packsymbols): Formatting changes. + +2000-03-17 Akim Demaille + + * src/reader.c (copy_comment): New function, factored out from: + (copy_action): Use it. Removed now unused `match', `ended', + `cplus_comment'. + (copy_guard): Likewise. + +2000-03-17 Akim Demaille + + * src/reader.c (copy_string): New function, factored out from: + (copy_action): Use it. + (copy_guard): Likewise. + +2000-03-17 Akim Demaille + + Change the handling of @s so that they behave exactly like $s. + There is now a pseudo variable @$ (readble and writable), location + of the lhs of the rule (by default ranging from the location of + the first symbol of the rhs, to the location of the last symbol, + or, if the rhs is empty, YYLLOC). + + * src/bison.s1 [YYLSP_NEEDED] (yyloc): New variable, twin of + yyval. + (yyparse): When providing a default semantic action, provide a + default location action. + (after the $): No longer change `*YYLSP', just stack YYLOC the + same way you stack YYVAL. + * src/reader.c (read_declarations): Use warns. + (copy_guard, case '@'): Also recognize `@$', expanded as `YYLOC'. + (copy_action, case '@'): Likewise. + Use a standard error message, to save useless work from + translators. + +2000-03-17 Akim Demaille + + * src/bison.s1: Formatting and cosmetics changes. + * src/reader.c: Likewise. + Update the Copyright notice. + +2000-03-17 Akim Demaille + + * src/bison.s1 (#line): All set to `#line' only, since the + Makefile now handles them. + +2000-03-16 Akim Demaille + + * src/output.c (output_rule_data): Output the documentation of + some of the tables. + (Copyright notice): Update. + Formatting changes. + +2000-03-16 Akim Demaille + + * src/bison.s1 [!YYDEBUG]: Define yydebug to 0. This allows to + remove most `#if YYDEBUG != 0', since `if (yydebug)' is enough. + One `#if YYDEBUG' remains, since it uses variables which are + defined only if `YYDEBUG != 0'. + +2000-03-16 Akim Demaille + + * src/bison.s1 (yyparse): Reorganize the definitions of the stacks + and related variables so that the similarities are highlighted. + +2000-03-16 Akim Demaille + + * src/bison.s1: Properly indent CPP directives. + +2000-03-16 Akim Demaille + + * src/bison.s1: Properly indent the `alloca' CPP section. + +2000-03-16 Akim Demaille + + Do not hard code values of directories in `configure.in'. + Update the `configure' tool chain. + + * configure.in (XPFILE, XPFILE1, LOCALEDIR): Remove, handled by + src/makefile.am. + (VERSION_STRING): Use the third arg of AC_DEFINE_UNQUOTED. + (AC_OUTPUT): Add m4/Makefile. + Bump to bison 1.28a, 1.29 has never been released. + * acconfig.h (XPFILE, XPFILE1, LOCALEDIR): Remove, since they are + handled via src/Makefile.am. + (VERSION_STRING, PROTOTYPES, ENABLE_NLS, HAVE_CATGETS, + HAVE_GETTEXT, HAVE_LC_MESSAGES, HAVE_STPCPY): Remove, handled by + autoheader. + * Makefile.am (SUBDIRS): Add m4. + (ACLOCAL_AM_FLAGS): New variable. + (AUTOMAKE_OPTIONS): Add check-news. + * src/Makefile.am (bison.simple): Use awk to replace #line lines with + the proper line number and file name. + (DEFS): Propagate the location of bison library files and of the + locale files. + (INCLUDES): Added `-I ..' so that one can compile with srcdir != + builddir. + * acinclude.m4: Remove, replaced by the directory m4. + * m4/Makefile.am (EXTRA_DIST): New variable. + * m4/gettext.m4: New file, from the fileutils. + * m4/lcmessage.m4: Likewise + * m4/progtest.m4: Likewise. + * m4/bison-decl.m4: New file, extracted from former acinclude.m4. + +2000-03-10 Akim Demaille + + * src/closure.c: + Formatting changes of various comments. + Respect the GNU coding standards at various places. + Don't use `_()' when no translation is needed. + +1999-12-13 Jesse Thilo + + * src/files.c: + OS/2 honors TMPDIR environment variable. + +1999-12-13 Jesse Thilo + + * doc/bison.texinfo: Tweaked spelling and grammar. + Updated ISBN. + Removed reference to price of printed copy. + Mention BISON_SIMPLE and BISON_HAIRY. + +1999-12-13 Jesse Thilo + + * configure.in, NEWS: + Bison 1.29 released. + +1999-10-27 Jesse Thilo + + * doc/.cvsignore, doc/Makefile.am, doc/refcard.tex: + Added reference card. + +1999-07-26 Jesse Thilo + + * po/ru.po: Added Russian translation. + +1999-07-26 Jesse Thilo + + * configure.in: Added Russian translation. + +1999-07-06 Jesse Thilo + + * configure.in, NEWS, README: + Released version 1.28. + +1999-06-14 Jesse Thilo + + * src/system.h: + Squashed redefinition warning on some systems. + + * src/getargs.c, src/Makefile.am, src/reader.c, src/version.c: + Have configure build version string instead of relying on ANSI string + concatentation. + +1999-06-14 Jesse Thilo + + * po/POTFILES.in: Got rid of version.c. + +1999-06-14 Jesse Thilo + + * acconfig.h, configure.in: + Have configure build version string instead of relying on ANSI string + concatentation. + +1999-06-08 Jesse Thilo + + * doc/bison.1: + Dropped mention of `+' for long-named options. + +1999-05-30 Jesse Thilo + + * src/files.c: Added for unlink(). + + * src/Makefile.am, src/system.h: + I18n fixes. + +1999-05-30 Jesse Thilo + + * README: Added a FAQ list. + + * configure.in, acconfig.h: + I18n fixes. + +1999-05-30 Jesse Thilo + + * doc/FAQ, doc/Makefile.am: + Added a FAQ list. + +1999-05-19 Jesse Thilo + + * src/alloc.h, src/symtab.h, src/version.c: + Protected inclusion of "config.h" with HAVE_CONFIG_H. + +1999-04-18 Jesse Thilo + + * src/.cvsignore, src/Makefile.am: + Reorganized: sources in `src', documentation in `doc'. + + * src/lex.c (literalchar): + fixed the code for escaping double quotes (thanks + Jonathan Czisny.) + +1999-04-18 Jesse Thilo + + * po/de.po, po/es.po, po/fr.po, po/nl.po, po/POTFILES.in: + Adjusted paths to reflect directory reorganization. + +1999-04-18 Jesse Thilo + + * doc/.cvsignore, doc/Makefile.am: + Reorganized: sources in `src', documentation in `doc'. + +1999-04-18 Jesse Thilo + + * configure.in: + Updated AC_INIT file to reflect directory reorganization. + + * configure.in, .cvsignore, Makefile.am, POTFILES.in: + Reorganized: sources in `src', documentation in `doc'. + +1999-04-13 Jesse Thilo + + * src/allocate.c: + Don't declare calloc() and realloc() if not necessary. + +1999-04-13 Jesse Thilo + + * configure.in, acconfig.h, acinclude.m4: + Don't declare calloc() and realloc() if not necessary. + +1999-03-23 Jesse Thilo + + * po/.cvsignore: Added i18n support. + +1999-03-23 Jesse Thilo + + * acconfig.h, configure.in, Makefile.am: + Added i18n support. + +1999-03-22 Jesse Thilo + + * src/bison.s1: Fixed #line numbers. + +1999-03-15 Jesse Thilo + + * po/es.po, po/fr.po, po/nl.po, po/de.po: + Added PO files from Translation Project. + +1999-03-03 Jesse Thilo + + * Makefile.am: + Added support for non-ANSI compilers (ansi2knr). + +1999-02-16 Jesse Thilo + + * configure.in: Bumped version number to 1.27. + + * Makefile.am: + Added `bison.simple' to list of files removed by `make distclean'. + +1999-02-12 Jesse Thilo + + * src/files.c, src/files.h: + Defined locations of parser files in config.h instead of Makefile. + +1999-02-12 Jesse Thilo + + * acconfig.h, acinclude.m4, configure.in, Makefile.am: + Defined locations of parser files in config.h instead of Makefile. + +1999-02-09 Jesse Thilo + + * Makefile.am: + Removed inappropriate use of $< macro. + +1999-02-05 Jesse Thilo + + * po/Makefile.in.in, po/POTFILES.in: + Add `po' directory skeleton. + +1999-01-27 Jesse Thilo + + * README: Document help-bison list. + + * configure.in: Add check for mkstemp(). + +1999-01-20 Jesse Thilo + + * src/conflicts.c, src/LR0.c, src/output.c, src/reader.c: + Hush a few compiler warnings. + + * src/files.c: + Add tryclose(), which verifies that fclose was successful. + Hush a couple of compiler warnings. + +1999-01-20 Jesse Thilo + + * Makefile.am, OChangeLog: + ChangeLog is now automatically generated. Include the old version as + OChangeLog. + +1999-01-14 Jesse Thilo + + * src/gram.h, src/lalr.c, src/lex.c, src/lex.h, src/machine.h, src/main.c, src/nullable.c, src/output.c, src/print.c, src/reader.c, src/reduce.c, src/state.h, src/symtab.c, src/symtab.h, src/types.h, src/vmsgetargs.c, src/warshall.c, src/allocate.c, src/alloc.h, src/bison.s1, src/closure.c, src/conflicts.c, src/derives.c, src/files.c, src/files.h, src/getargs.c, src/gram.c, src/LR0.c: + Update FSF address. + +1999-01-14 Jesse Thilo + + * doc/bison.texinfo: Fix formatting glitch. + + * doc/bison.texinfo: Update FSF address. + +1999-01-14 Jesse Thilo + + * acconfig.h: Update FSF address. + +1999-01-08 Jesse Thilo + + * src/system.h: + Don't define PACKAGE here, since config.h defines it. + +1998-12-30 Jesse Thilo + + * src/reader.c: Update copyright date. + + * src/main.c: + Ditch sprintf to statically-sized buffers in fatal/warn functions in + favor of output directly to stderr (avoids buffer overruns). + + * src/reader.c: Some checks for premature EOF. + + * src/allocate.c, src/alloc.h, src/closure.c, src/conflicts.c, src/derives.c, src/getargs.c, src/gram.c, src/lalr.c, src/lex.c, src/LR0.c, src/main.c, src/nullable.c, src/output.c, src/print.c, src/reduce.c, src/symtab.c, src/symtab.h, src/warshall.c: + Use prototypes if the compiler understands them. + + * src/files.c: Honor TMPDIR on Unix hosts. + Use prototypes if the compiler understands them. + + * src/reader.c: + Fix a couple of buffer overrun bugs. + Use prototypes if the compiler understands them. + + * src/system.h: Include unistd.h and ctype.h. + Use #ifdef instead of #if for NLS symbols. + +1998-12-30 Jesse Thilo + + * doc/bison.texinfo: + Delete comment "consider using @set for edition number, etc..." since + we now are doing so. + +1998-12-30 Jesse Thilo + + * configure.in: + Use prototypes if the compiler understands them. + + * NEWS: Document 1.26 highlights. + + * Makefile.am: Require Automake 1.3 or later. + + * acconfig.h: + Use prototypes if the compiler understands them. + +1998-12-29 Jesse Thilo + + * src/version.c: + Use VERSION symbol from automake for version number. + +1998-12-29 Jesse Thilo + + * acconfig.h, configure.in, version.cin: + Use VERSION symbol from automake for version number. + +1998-11-28 Jesse Thilo + + * Makefile.am: + Distribute original version of simple parser (bison.s1), not built + version (bison.simple). + +1998-11-28 Jesse Thilo + + * doc/bison.texinfo: Add info dir entry. + + * doc/bison.texinfo: + Let automake put version number into documentation. + +1998-11-26 Jesse Thilo + + * src/bison.cld, src/build.com, src/vmshlp.mar: + Add non-RCS files from /gd/gnu/bison. + +1998-11-26 Jesse Thilo + + * doc/bison.1: + Document the BISON_HAIRY and BISON_SIMPLE variables. + +1998-11-25 Jesse Thilo + + * src/version.c: Build version.c automatically. + + * src/reader.c: + Fix token numbering (used to start at 258, not 257). + + * src/system.h: Include config.h. + + * src/getargs.c: Update bug report address. + + * src/alloca.c, src/getopt1.c, src/getopt.c, src/getopt.h: + Get latest copies of alloca.c, getopt.c, getopt.h, getopt1.c from gnu.org. + +1998-11-25 Jesse Thilo + + * Makefile.am: + Rename bison.simple to bison.s1 (bison.simple is then built from bison.s1). + + * configure.in, version.cin: + Build version.c automatically. + + * AUTHORS: Add AUTHORS file. + + * README: Update bug report address. + + * bison.simple: + Rename bison.simple to bison.s1 (bison.simple is then built from bison.s1). + + * configure.in, Makefile.am, Makefile.in, stamp-h.in: + Add automake stuff. + +1998-11-25 Jesse Thilo + + * doc/bison.texinfo: Clean up some formatting. + +1998-05-05 Richard Stallman + + * doc/bison.texinfo: + Explain better why to make a pure parser. + +1998-01-05 Richard Stallman + + * src/files.c (openfiles): + [_WIN32 && !__CYGWIN32__] Use TEMP or Temp to + find a temporary directory, if possible. Do not unlink files while + they are open. + +1997-08-25 Richard Stallman + + * src/reader.c (stack_offset;): + Change some warni to warns. + + * src/lex.c (literalchar): Use warns, not warni. + +1997-06-28 Richard Stallman + + * src/bison.s1: Add a Bison version comment. + + * src/main.c (fatal, warn, berror): + Use program_name. + +1997-06-28 Richard Stallman + + * Makefile.in (bison_version): New variable. + (dist): Use that variable. + (bison.s1): Substitute the Bison version into bison.simple. + + * bison.simple: Add a Bison version comment. + +1997-06-18 Richard Stallman + + * src/main.c (fatal, warn, berror): + Make error messages standard. + (toomany): Improve error message text. + + * src/LR0.c, src/closure.c, src/conflicts.c, src/derives.c, src/files.c, src/lalr.c, src/lex.c, src/nullable.c, src/output.c, src/print.c, src/reader.c, src/reduce.c, src/symtab.c: + new.h renamed to alloc.h. + +1997-06-18 Richard Stallman + + * Makefile.in: new.h renamed to alloc.h. + +1997-05-24 Richard Stallman + + * src/lex.c (literalchar): + Fix the code for escaping \, " and '. + + (lex): Avoid trouble when there are many chars + to discard in a char literal with just several chars in it. + +1997-05-17 Richard Stallman + + * src/bison.s1: + Use malloc, if using alloca is troublesome. + (YYSTACK_USE_ALLOCA): New flag macro. + Define it for some systems and compilers. + (YYSTACK_ALLOC): New macro. + (yyparse): Use YYSTACK_ALLOC to allocate stack. + If it was malloc'd, free it. + +1997-05-17 Richard Stallman + + * bison.simple: + Use malloc, if using alloca is troublesome. + (YYSTACK_USE_ALLOCA): New flag macro. + Define it for some systems and compilers. + (YYSTACK_ALLOC): New macro. + (yyparse): Use YYSTACK_ALLOC to allocate stack. + If it was malloc'd, free it. + +1997-04-23 Richard Stallman + + * src/bison.s1: + (alloca) [__hpux]: Always define as __builtin_alloca. + +1997-04-23 Richard Stallman + + * bison.simple: + (alloca) [__hpux]: Always define as __builtin_alloca. + +1997-04-22 Richard Stallman + + * src/bison.s1: + [__hpux]: Include alloca.h (right for HPUX 10) + instead of declaring alloca (right for HPUX 9). + + * src/bison.s1 (__yy_memcpy): + Declare arg `count' as unsigned int. + (yyparse): Cast third arg to __yy_memcpy to unsigned int. + +1997-04-22 Richard Stallman + + * bison.simple: + [__hpux]: Include alloca.h (right for HPUX 10) + instead of declaring alloca (right for HPUX 9). + + * bison.simple (__yy_memcpy): + Declare arg `count' as unsigned int. + (yyparse): Cast third arg to __yy_memcpy to unsigned int. + +1997-01-03 Richard Stallman + + * src/allocate.c: [__STDC__ or _MSC_VER]: + Declare calloc and realloc to return void *. + +1997-01-02 Richard Stallman + + * src/system.h: + [_MSC_VER]: Include stdlib.h and process.h. + [_MSC_VER] (getpid): Define as macro--translate it to _getpid. + + * src/main.c (main): Return FAILURE as a value. + (printable_version): Declare arg as int, not char. + +1997-01-02 Richard Stallman + + * Makefile.in (dist): + Explicitly check for symlinks, and copy them. + +1996-12-19 Richard Stallman + + * src/files.c: + [_MSC_VER] (XPFILE, XPFILE1): Define, if not already defined. + +1996-12-18 Paul Eggert + + * src/bison.s1 (yyparse): + If __GNUC__ and YYPARSE_PARAM are both defined, + declare yyparse to have a void * argument. + +1996-12-18 Paul Eggert + + * bison.simple (yyparse): + If __GNUC__ and YYPARSE_PARAM are both defined, + declare yyparse to have a void * argument. + +1996-12-17 Richard Stallman + + * src/reduce.c (nbits): Add some casts. + +1996-08-12 Richard Stallman + + * src/bison.s1: Test _MSDOS as well as _MSDOS_. + +1996-08-12 Richard Stallman + + * bison.simple: Test _MSDOS as well as _MSDOS_. + +1996-07-31 Richard Stallman + + * src/bison.s1: + [__sun && __i386]: Include alloca.h. + +1996-07-31 Richard Stallman + + * bison.simple: + [__sun && __i386]: Include alloca.h. + +1996-07-30 Richard Stallman + + * src/bison.s1: Comment change. + + * src/bison.s1: Test _MSDOS_, not MSDOS. + +1996-07-30 Richard Stallman + + * bison.simple: Comment change. + + * bison.simple: Test _MSDOS_, not MSDOS. + +1996-06-01 Richard Stallman + + * src/reduce.c, src/reader.c, src/print.c, src/output.c, src/nullable.c, src/lex.c, src/lalr.c, src/getargs.c, src/derives.c, src/conflicts.c, src/closure.c, src/allocate.c: + Insert `_' macro around many string constants. + + * src/main.c: + Insert `_' macro around many string constants. + + (main): Call setlocale, bindtextdomain and textdomain. + + * src/system.h: [HAVE_LOCALE_H]: Include locale.h. + [! HAVE_LOCALE_H] (setlocale): Define as no-op. + [ENABLE_NLS]: Include libintl.h. + [ENABLE_NLS] (gettext): Define. + [! ENABLE_NLS] (bintextdomain, textdomain, _): Consolation definitions. + (N_, PACKAGE, LOCALEDIR): New macros. + +1996-06-01 Richard Stallman + + * POTFILES.in: New file. + + * Makefile.in (allocate.o): + Define target explicitly. + + * Makefile.in (CFLAGS): Set to @CFLAGS@. + (LDFLAGS): Set to @LDFLAGS@. + (configure): Run autoconf only if preceding `cd' succeeds. + (bison.s1): Redirect output to temporary file then move the + temporary to the target, rather than redirecting directly to bison.s1. + (clean): Remove config.status and config.log. + (distclean): Don't remove config.status here. + +1996-05-12 Richard Stallman + + * src/bison.s1: + (__yy_memcpy) [__cplusplus]: Reorder declarations of variables f and t. + +1996-05-12 Richard Stallman + + * bison.simple: + (__yy_memcpy) [__cplusplus]: Reorder declarations of variables f and t. + +1996-05-11 Richard Stallman + + * src/bison.s1 (__yy_memcpy): + Really reorder the args, as was supposedly done on Feb 14 1995. + (yyparse): Calls changed accordingly. + +1996-05-11 Richard Stallman + + * Makefile.in (dist): Don't use $(srcdir). + + * bison.simple (__yy_memcpy): + Really reorder the args, as was supposedly done on Feb 14 1995. + (yyparse): Calls changed accordingly. + +1996-01-27 Richard Stallman + + * src/output.c (output_rule_data): + Test YYERROR_VERBOSE in the conditional + around the definition of ttyname. + +1995-12-29 Richard Stallman + + * src/bison.s1: + Fix line numbers in #line commands. + +1995-12-29 Richard Stallman + + * bison.simple: + Fix line numbers in #line commands. + +1995-12-27 Richard Stallman + + * src/bison.s1 (YYPARSE_PARAM_DECL): + In C++, make it always null. + (YYPARSE_PARAM_ARG): New macro. + (yyparse): Use YYPARSE_PARAM_ARG. + +1995-12-27 Richard Stallman + + * bison.simple (YYPARSE_PARAM_DECL): + In C++, make it always null. + (YYPARSE_PARAM_ARG): New macro. + (yyparse): Use YYPARSE_PARAM_ARG. + +1995-11-29 Richard Stallman + + * doc/bison.texinfo: + Describe literal string tokens, %raw, %no_lines, %token_table. + +1995-11-29 Daniel Hagerty + + * doc/bison.texinfo: Fixed update date + +1995-10-16 Richard Stallman + + * src/version.c: Version 1.25. + +1995-10-16 Richard Stallman + + * NEWS: *** empty log message *** + +1995-10-16 Richard Stallman + + * doc/bison.1, doc/bison.rnh: + Add new options. + +1995-10-15 Richard Stallman + + * src/vmsgetargs.c, src/getargs.c: + Added -n, -k, and -raw switches. + (noparserflag, toknumflag, rawtoknumflag): New variables. + + * src/symtab.h (SALIAS): + New #define for adding aliases to %token. + (struct bucket): Added `alias' field. + + * src/reduce.c (reduce_grammar): + Revise error message. + (print_notices): Remove final `.' from error message. + + * src/reader.c (reader_output_yylsp): + New function. + (readgram): Use `#if 0' around code that accepted %command + inside grammar rules: The documentation doesn't allow it, + and it will fail since the %command processors scan for the next %. + (parse_token_decl): Extended the %token + declaration to allow a multi-character symbol as an alias. + (parse_thong_decl): New function. + (read_declarations): Added %thong declarations. + (read_declarations): Handle NOOP to deal with allowing + % declarations as another means to specify the flags. + (readgram): Allow %prec prior to semantics embedded in a rule. + (skip_to_char, read_declarations, copy_definition) + (parse_token_decl, parse_start_decl, parse_type_decl) + (parse_assoc_decl, parse_union_decl, parse_expect_decl) + (get_type_name, copy_guard, copy_action, readgram) + (get_type, packsymbols): Revised most error messages. + Changed `fatal' to `warnxxx' to avoid aborting for error. + Revised and use multiple warnxxx functions to avoid using VARARGS1. + (read_declarations): Improve the error message for + an invalid character. Do not abort. + (read_declarations, copy_guard, copy_action): Use + printable_version to avoid unprintable characters in printed output. + (parse_expect_decl): Error if argument to %expect exceeds 10 digits. + (parse_token_decl, parse_assoc_decl, parse_type_decl, get_type): + Allow the type of a non-terminal can be given + more than once, as long as all specifications give the same type. + + * src/output.c: + (output_headers, output_trailers, output, output_gram) + (output_rule_data): Implement noparserflag variable. + Implement toknumflag variable. + (output): Call reader_output_yylsp to output LTYPESTR. + + * src/main.c (main): + If reader sees an error, don't process the grammar. + (fatals): Updated to not use VARARGS1. + (printable_version, int_to_string, warn, warni, warns, warnss) + (warnsss): New error reporting functions. Avoid abort for error. + + * src/lex.h: + Added THONG and NOOP for alias processing. + Added SETOPT for the new code that allows setting options with %flags. + + * src/lex.c: + Include getopt.h. Add some extern decls. + (safegetc): New function to deal with EOF gracefully. + (literalchar); new function to deal with reading \ escapes. + (lex): Use literalchar. + (lex): Implemented "..." tokens. + (literalchar, lex, parse_percent_token): Made tokenbuffer + always contain the token. This includes growing the token + buffer while reading an integer. + (parse_percent_token): Replaced if-else statement with percent_table. + (parse_percent_token): Added % declarations as another + way to specify the flags -n, -l, and -r. Also added hooks for + -d, -k, -y, -v, -t, -p, -b, -o, but implementation requires + major changes to files.c. + (lex) Retain in the incoming stream a character following + an incorrect '/'. + (skip_white_space, lex): Revised most error messages + and changed fatal to warn to avoid aborting. + (percent_table): Added %thong declarations. + + * src/gram.h: Comment changes. + + * src/files.c (openfiles, open_extra_files, done): + Add faction flag + and actfile file. Handle noparserflag. Both for -n switch. + + * src/conflicts.c (resolve_sr_conflict): + Remove use of alloca. + +1995-06-01 Jim Meyering + + * doc/bison.texinfo: *** empty log message *** + +1995-05-06 Richard Stallman + + * src/bison.s1: Comment change. + +1995-05-06 Richard Stallman + + * bison.simple: Comment change. + +1995-05-03 Richard Stallman + + * src/version.c: Version now 1.24. + + * src/bison.s1: Change distribution terms. + + * src/version.c: Version now 1.23. + +1995-05-03 Richard Stallman + + * doc/bison.texinfo: + Rewrite "Conditions for Using Bison". + Update version to 1.24. + +1995-05-03 Richard Stallman + + * bison.simple: Change distribution terms. + +1995-02-23 Richard Stallman + + * src/files.c: Test __VMS_POSIX as well as VMS. + +1995-02-14 Jim Meyering + + * src/bison.s1 (__yy_memcpy): + Renamed from __yy_bcopy to avoid + confusion. Reverse FROM and TO arguments to be consistent with + those of memcpy. + +1995-02-14 Jim Meyering + + * bison.simple (__yy_memcpy): + Renamed from __yy_bcopy to avoid + confusion. Reverse FROM and TO arguments to be consistent with + those of memcpy. + +1994-11-10 David J. MacKenzie + + * NEWS: reformat + + * NEWS: New file. + + * Makefile.in (DISTFILES): Include NEWS. + + * Makefile.in (DISTFILES): + Include install-sh, not install.sh. + + * configure.in: Update to Autoconf v2 macro names. + +1994-10-05 David J. MacKenzie + + * Makefile.in: fix typo + + * Makefile.in (prefix, exec_prefix): + Let configure set them. + +1994-09-28 David J. MacKenzie + + * Makefile.in: Set datadir to $(prefix)/share. + +1994-09-15 Richard Stallman + + * src/bison.s1: + Update copyright notice and GPL version. + +1994-09-15 Richard Stallman + + * bison.simple: + Update copyright notice and GPL version. + +1994-07-12 Richard Stallman + + * src/reduce.c, src/reader.c: + entered into RCS + +1994-05-05 David J. MacKenzie + + * Makefile.in: entered into RCS + +1994-03-26 Richard Stallman + + * src/bison.s1: entered into RCS + +1994-03-26 Richard Stallman + + * bison.simple: entered into RCS + +1994-03-25 Richard Stallman + + * src/main.c: entered into RCS + +1994-03-24 Richard Stallman + + * src/conflicts.c: entered into RCS + +1994-01-02 Richard Stallman + + * Makefile.in: *** empty log message *** + +1993-11-21 Richard Stallman + + * src/bison.s1: *** empty log message *** + +1993-11-21 Richard Stallman + + * doc/bison.texinfo: entered into RCS + + * doc/bison.texinfo: *** empty log message *** + +1993-11-21 Richard Stallman + + * bison.simple: *** empty log message *** + +1993-10-25 David J. MacKenzie + + * doc/bison.texinfo: *** empty log message *** + +1993-10-19 Richard Stallman + + * src/bison.s1: *** empty log message *** + +1993-10-19 Richard Stallman + + * bison.simple: *** empty log message *** + +1993-10-14 Richard Stallman + + * src/bison.s1: *** empty log message *** + +1993-10-14 Richard Stallman + + * bison.simple: *** empty log message *** + +1993-09-14 David J. MacKenzie + + * doc/bison.texinfo: *** empty log message *** + +1993-09-13 Noah Friedman + + * Makefile.in: *** empty log message *** + +1993-09-10 Richard Stallman + + * src/conflicts.c: *** empty log message *** + + * src/system.h: entered into RCS + +1993-09-10 Richard Stallman + + * doc/bison.1: entered into RCS + +1993-09-06 Noah Friedman + + * src/version.c: entered into RCS + +1993-09-06 Noah Friedman + + * Makefile.in: *** empty log message *** + +1993-07-30 David J. MacKenzie + + * Makefile.in: *** empty log message *** + +1993-07-24 Richard Stallman + + * src/bison.s1: *** empty log message *** + +1993-07-24 Richard Stallman + + * bison.simple: *** empty log message *** + +1993-07-08 David J. MacKenzie + + * Makefile.in: *** empty log message *** + +1993-07-04 Richard Stallman + + * src/bison.s1: *** empty log message *** + +1993-07-04 Richard Stallman + + * bison.simple: *** empty log message *** + +1993-06-26 David J. MacKenzie + + * src/getargs.c: entered into RCS + +1993-06-26 David J. MacKenzie + + * doc/bison.texinfo: *** empty log message *** + + * doc/bison.1: New file. + +1993-06-25 Richard Stallman + + * src/getargs.c: New file. + +1993-06-16 Richard Stallman + + * src/bison.s1: *** empty log message *** + +1993-06-16 Richard Stallman + + * bison.simple: *** empty log message *** + +1993-06-03 Richard Stallman + + * src/bison.s1: New file. + +1993-06-03 Richard Stallman + + * doc/bison.texinfo: *** empty log message *** + +1993-06-03 Richard Stallman + + * bison.simple: New file. + +1993-05-19 Richard Stallman + + * doc/bison.texinfo: New file. + +1993-05-07 Noah Friedman + + * Makefile.in: *** empty log message *** + +1993-04-28 Noah Friedman + + * src/reader.c: *** empty log message *** + +1993-04-23 Noah Friedman + + * src/alloc.h: entered into RCS + +1993-04-20 David J. MacKenzie + + * src/version.c: *** empty log message *** + + * src/files.c, src/allocate.c: + entered into RCS + + * src/reader.c: *** empty log message *** + + * src/lex.c: entered into RCS + + * src/conflicts.c: New file. + + * src/symtab.c: entered into RCS + + * src/alloc.h: New file. + + * src/LR0.c: entered into RCS + +1993-04-18 Noah Friedman + + * src/reader.c: New file. + + * src/version.c: *** empty log message *** + +1993-04-18 Noah Friedman + + * Makefile.in: *** empty log message *** + +1993-04-17 Noah Friedman + + * Makefile.in: *** empty log message *** + +1993-04-15 Richard Stallman + + * src/main.c, src/files.c: + New file. + +1993-04-15 Noah Friedman + + * configure.in: entered into RCS + + * configure.in: *** empty log message *** + + * configure.in: New file. + +1993-04-14 Richard Stallman + + * Makefile.in: New file. + +1993-04-13 Richard Stallman + + * src/version.c: New file. + +1993-03-25 Richard Stallman + + * src/output.c: entered into RCS + +1992-09-25 Richard Stallman + + * configure.bat: entered into RCS + +1992-06-22 Richard Stallman + + * src/vmsgetargs.c: entered into RCS + +1992-06-22 Richard Stallman + + * doc/bison.rnh: entered into RCS + +1992-04-20 David J. MacKenzie + + * README: entered into RCS + +1992-01-22 Richard Stallman + + * src/machine.h: entered into RCS + +1991-12-21 Richard Stallman + + * src/lalr.c, src/closure.c: + entered into RCS + +1991-12-20 Richard Stallman + + * src/state.h: entered into RCS + +1991-12-18 Richard Stallman + + * src/print.c, src/nullable.c, src/derives.c: + entered into RCS + +1991-11-03 David J. MacKenzie + + * src/warshall.c, src/types.h, src/symtab.h, src/lex.h, src/gram.c, src/gram.h, src/files.h: + entered into RCS + +1988-09-09 Richard Stallman + + * src/bison.hairy: entered into RCS + +1987-12-16 Richard Stallman + + * REFERENCES: entered into RCS + + + ----- + + Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. + + Copying and distribution of this file, with or without + modification, are permitted provided the copyright notice and this + notice are preserved. diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..0fdd3fa --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,112 @@ +# Having a separate GNUmakefile lets me `include' the dynamically +# generated rules created via cfg.mk (package-local configuration) +# as well as maint.mk (generic maintainer rules). +# 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-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 . + +# 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 + +# If the user runs GNU make but has not yet run ./configure, +# give them a diagnostic. +_have-Makefile := $(shell test -f Makefile && echo yes) +ifeq ($(_have-Makefile),yes) + +# Make tar archive easier to reproduce. +export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner + +include Makefile + +# Some projects override e.g., _autoreconf here. +-include $(srcdir)/cfg.mk +include $(srcdir)/maint.mk + +# Allow cfg.mk to override these. +_build-aux ?= build-aux +_autoreconf ?= autoreconf + +# Ensure that $(VERSION) is up to date for dist-related targets, but not +# for others: rerunning autoreconf and recompiling everything isn't cheap. +_have-git-version-gen := \ + $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes) +ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL)) + _is-dist-target ?= $(filter-out %clean, \ + $(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS))) + _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS))) + ifneq (,$(_is-dist-target)$(_is-install-target)) + _curr-ver := $(shell cd $(srcdir) \ + && $(_build-aux)/git-version-gen .tarball-version) + ifneq ($(_curr-ver),$(VERSION)) + ifeq ($(_curr-ver),UNKNOWN) + $(info WARNING: unable to verify if $(VERSION) is correct version) + else + ifneq (,$(_is-install-target)) + # GNU Coding Standards state that 'make install' should not cause + # recompilation after 'make all'. But as long as changing the version + # string alters config.h, the cost of having 'make all' always have an + # up-to-date version is prohibitive. So, as a compromise, we merely + # warn when installing a version string that is out of date; the user + # should run 'autoreconf' (or something like 'make distcheck') to + # fix the version, 'make all' to propagate it, then 'make install'. + $(info WARNING: version string $(VERSION) is out of date;) + $(info run '$(MAKE) _version' to fix it) + else + $(info INFO: running autoreconf for new version string: $(_curr-ver)) + _dummy := $(shell $(MAKE) $(AM_MAKEFLAGS) _version) + endif + endif + endif + endif +endif + +.PHONY: _version +_version: + cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf) + +else + +.DEFAULT_GOAL := abort-due-to-no-makefile +srcdir = . + +# The package can override .DEFAULT_GOAL to run actions like autoreconf. +-include ./cfg.mk +include ./maint.mk + +ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile) +$(MAKECMDGOALS): abort-due-to-no-makefile +endif + +abort-due-to-no-makefile: + @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: diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..8b82ade --- /dev/null +++ b/INSTALL @@ -0,0 +1,291 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008 Free Software Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 6. Often, you can also type `make uninstall' to remove the installed + files again. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *Note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..932c3bb --- /dev/null +++ b/Makefile.am @@ -0,0 +1,59 @@ +## Process this file with automake to produce Makefile.in -*-Makefile-*- +## 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 +# 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 . + +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = build-aux po runtime-po lib data src doc examples tests etc + +# Files installed for use by Automake. +aclocaldir = @aclocaldir@ +aclocal_DATA = m4/bison-i18n.m4 + +EXTRA_DIST = .prev-version .version cfg.mk maint.mk \ + OChangeLog PACKAGING \ + djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \ + djgpp/config.sed djgpp/config.site djgpp/config_h.sed \ + djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \ + djgpp/fnchange.lst djgpp/testsuite.sed + + +.PHONY: maintainer-check +maintainer-check: + cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: maintainer-push-check +maintainer-push-check: + cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: maintainer-xml-check +maintainer-xml-check: + 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 diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..e9746e1 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,1000 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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 . + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/build-aux/javacomp.sh.in \ + $(top_srcdir)/build-aux/javaexec.sh.in $(top_srcdir)/configure \ + ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS README-alpha \ + THANKS TODO +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = javacomp.sh javaexec.sh +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(aclocaldir)" +aclocalDATA_INSTALL = $(INSTALL_DATA) +DATA = $(aclocal_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ + +# Files installed for use by Automake. +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +ACLOCAL_AMFLAGS = -I m4 +SUBDIRS = build-aux po runtime-po lib data src doc examples tests etc +aclocal_DATA = m4/bison-i18n.m4 +EXTRA_DIST = .prev-version .version cfg.mk maint.mk \ + OChangeLog PACKAGING \ + djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \ + djgpp/config.sed djgpp/config.site djgpp/config_h.sed \ + djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \ + djgpp/fnchange.lst djgpp/testsuite.sed + + +# 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 +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnits '; \ + cd $(srcdir) && $(AUTOMAKE) --gnits \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +javacomp.sh: $(top_builddir)/config.status $(top_srcdir)/build-aux/javacomp.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +javaexec.sh: $(top_builddir)/config.status $(top_srcdir)/build-aux/javaexec.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-aclocalDATA: $(aclocal_DATA) + @$(NORMAL_INSTALL) + test -z "$(aclocaldir)" || $(MKDIR_P) "$(DESTDIR)$(aclocaldir)" + @list='$(aclocal_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(aclocalDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(aclocaldir)/$$f'"; \ + $(aclocalDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(aclocaldir)/$$f"; \ + done + +uninstall-aclocalDATA: + @$(NORMAL_UNINSTALL) + @list='$(aclocal_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(aclocaldir)/$$f'"; \ + rm -f "$(DESTDIR)$(aclocaldir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @case `sed 15q $(srcdir)/NEWS` in \ + *"$(VERSION)"*) : ;; \ + *) \ + echo "NEWS not updated; not releasing" 1>&2; \ + exit 1;; \ + esac + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(aclocaldir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-aclocalDATA + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-aclocalDATA + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-hook dist-lzma dist-shar dist-tarZ dist-zip distcheck \ + distclean distclean-generic distclean-tags distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-aclocalDATA install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-recursive uninstall \ + uninstall-aclocalDATA uninstall-am + + +.PHONY: maintainer-check +maintainer-check: + cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: maintainer-push-check +maintainer-push-check: + cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: maintainer-xml-check +maintainer-xml-check: + cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ +$(top_srcdir)/.version: configure + echo $(VERSION) > $@-t && mv $@-t $@ +dist-hook: + echo $(VERSION) > $(distdir)/.tarball-version +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..7d1a444 --- /dev/null +++ b/NEWS @@ -0,0 +1,1067 @@ +Bison News +---------- + +* Changes in version 2.4.1 (2008-12-11): + +** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc + declarations have been fixed. + +** Temporary hack for adding a semicolon to the user action. + + Bison used to prepend a trailing semicolon at the end of the user + action for reductions. This allowed actions such as + + exp: exp "+" exp { $$ = $1 + $3 }; + + instead of + + exp: exp "+" exp { $$ = $1 + $3; }; + + Some grammars still depend on this `feature'. Bison 2.4.1 restores + the previous behavior in the case of C output (specifically, when + neither %language or %skeleton or equivalent command-line options + are used) to leave more time for grammars depending on the old + behavior to be adjusted. Future releases of Bison will disable this + feature. + +** A few minor improvements to the Bison manual. + +* Changes in version 2.4 (2008-11-02): + +** %language is an experimental feature. + + We first introduced this feature in test release 2.3b as a cleaner + alternative to %skeleton. Since then, we have discussed the possibility of + modifying its effect on Bison's output file names. Thus, in this release, + we consider %language to be an experimental feature that will likely evolve + in future releases. + +** Forward compatibility with GNU M4 has been improved. + +** Several bugs in the C++ skeleton and the experimental Java skeleton have been + fixed. + +* Changes in version 2.3b (2008-05-27): + +** The quotes around NAME that used to be required in the following directive + are now deprecated: + + %define NAME "VALUE" + +** The directive `%pure-parser' is now deprecated in favor of: + + %define api.pure + + which has the same effect except that Bison is more careful to warn about + unreasonable usage in the latter case. + +** Push Parsing + + Bison can now generate an LALR(1) parser in C with a push interface. That + is, instead of invoking `yyparse', which pulls tokens from `yylex', you can + push one token at a time to the parser using `yypush_parse', which will + return to the caller after processing each token. By default, the push + interface is disabled. Either of the following directives will enable it: + + %define api.push_pull "push" // Just push; does not require yylex. + %define api.push_pull "both" // Push and pull; requires yylex. + + See the new section `A Push Parser' in the Bison manual for details. + + The current push parsing interface is experimental and may evolve. More user + feedback will help to stabilize it. + +** The -g and --graph options now output graphs in Graphviz DOT format, + not VCG format. Like --graph, -g now also takes an optional FILE argument + and thus cannot be bundled with other short options. + +** Java + + Bison can now generate an LALR(1) parser in Java. The skeleton is + `data/lalr1.java'. Consider using the new %language directive instead of + %skeleton to select it. + + See the new section `Java Parsers' in the Bison manual for details. + + The current Java interface is experimental and may evolve. More user + feedback will help to stabilize it. + +** %language + + This new directive specifies the programming language of the generated + parser, which can be C (the default), C++, or Java. Besides the skeleton + that Bison uses, the directive affects the names of the generated files if + the grammar file's name ends in ".y". + +** XML Automaton Report + + Bison can now generate an XML report of the LALR(1) automaton using the new + `--xml' option. The current XML schema is experimental and may evolve. More + user feedback will help to stabilize it. + +** The grammar file may now specify the name of the parser header file using + %defines. For example: + + %defines "parser.h" + +** When reporting useless rules, useless nonterminals, and unused terminals, + Bison now employs the terms "useless in grammar" instead of "useless", + "useless in parser" instead of "never reduced", and "unused in grammar" + instead of "unused". + +** Unreachable State Removal + + Previously, Bison sometimes generated parser tables containing unreachable + states. A state can become unreachable during conflict resolution if Bison + disables a shift action leading to it from a predecessor state. Bison now: + + 1. Removes unreachable states. + + 2. Does not report any conflicts that appeared in unreachable states. + WARNING: As a result, you may need to update %expect and %expect-rr + directives in existing grammar files. + + 3. For any rule used only in such states, Bison now reports the rule as + "useless in parser due to conflicts". + + This feature can be disabled with the following directive: + + %define lr.keep_unreachable_states + + See the %define entry in the `Bison Declaration Summary' in the Bison manual + for further discussion. + +** Lookahead Set Correction in the `.output' Report + + When instructed to generate a `.output' file including lookahead sets + (using `--report=lookahead', for example), Bison now prints each reduction's + lookahead set only next to the associated state's one item that (1) is + associated with the same rule as the reduction and (2) has its dot at the end + of its RHS. Previously, Bison also erroneously printed the lookahead set + next to all of the state's other items associated with the same rule. This + bug affected only the `.output' file and not the generated parser source + code. + +** --report-file=FILE is a new option to override the default `.output' file + name. + +** The `=' that used to be required in the following directives is now + deprecated: + + %file-prefix "parser" + %name-prefix "c_" + %output "parser.c" + +** An Alternative to `%{...%}' -- `%code QUALIFIER {CODE}' + + Bison 2.3a provided a new set of directives as a more flexible alternative to + the traditional Yacc prologue blocks. Those have now been consolidated into + a single %code directive with an optional qualifier field, which identifies + the purpose of the code and thus the location(s) where Bison should generate + it: + + 1. `%code {CODE}' replaces `%after-header {CODE}' + 2. `%code requires {CODE}' replaces `%start-header {CODE}' + 3. `%code provides {CODE}' replaces `%end-header {CODE}' + 4. `%code top {CODE}' replaces `%before-header {CODE}' + + See the %code entries in section `Bison Declaration Summary' in the Bison + manual for a summary of the new functionality. See the new section `Prologue + Alternatives' for a detailed discussion including the advantages of %code + over the traditional Yacc prologues. + + The prologue alternatives are experimental. More user feedback will help to + determine whether they should become permanent features. + +** Revised warning: unset or unused mid-rule values + + Since Bison 2.2, Bison has warned about mid-rule values that are set but not + used within any of the actions of the parent rule. For example, Bison warns + about unused $2 in: + + exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; }; + + Now, Bison also warns about mid-rule values that are used but not set. For + example, Bison warns about unset $$ in the mid-rule action in: + + exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; }; + + However, Bison now disables both of these warnings by default since they + sometimes prove to be false alarms in existing grammars employing the Yacc + constructs $0 or $-N (where N is some positive integer). + + To enable these warnings, specify the option `--warnings=midrule-values' or + `-W', which is a synonym for `--warnings=all'. + +** Default %destructor or %printer with `<*>' or `<>' + + Bison now recognizes two separate kinds of default %destructor's and + %printer's: + + 1. Place `<*>' in a %destructor/%printer symbol list to define a default + %destructor/%printer for all grammar symbols for which you have formally + declared semantic type tags. + + 2. Place `<>' in a %destructor/%printer symbol list to define a default + %destructor/%printer for all grammar symbols without declared semantic + type tags. + + Bison no longer supports the `%symbol-default' notation from Bison 2.3a. + `<*>' and `<>' combined achieve the same effect with one exception: Bison no + longer applies any %destructor to a mid-rule value if that mid-rule value is + not actually ever referenced using either $$ or $n in a semantic action. + + The default %destructor's and %printer's are experimental. More user + feedback will help to determine whether they should become permanent + features. + + See the section `Freeing Discarded Symbols' in the Bison manual for further + details. + +** %left, %right, and %nonassoc can now declare token numbers. This is required + by POSIX. However, see the end of section `Operator Precedence' in the Bison + manual for a caveat concerning the treatment of literal strings. + +** The nonfunctional --no-parser, -n, and %no-parser options have been + completely removed from Bison. + +* Changes in version 2.3a, 2006-09-13: + +** Instead of %union, you can define and use your own union type + YYSTYPE if your grammar contains at least one tag. + Your YYSTYPE need not be a macro; it can be a typedef. + This change is for compatibility with other Yacc implementations, + and is required by POSIX. + +** Locations columns and lines start at 1. + In accordance with the GNU Coding Standards and Emacs. + +** You may now declare per-type and default %destructor's and %printer's: + + For example: + + %union { char *string; } + %token STRING1 + %token STRING2 + %type string1 + %type string2 + %union { char character; } + %token CHR + %type chr + %destructor { free ($$); } %symbol-default + %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1 + %destructor { } + + guarantees that, when the parser discards any user-defined symbol that has a + semantic type tag other than `', it passes its semantic value to + `free'. However, when the parser discards a `STRING1' or a `string1', it + also prints its line number to `stdout'. It performs only the second + `%destructor' in this case, so it invokes `free' only once. + + [Although we failed to mention this here in the 2.3a release, the default + %destructor's and %printer's were experimental, and they were rewritten in + future versions.] + +** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y', + `--yacc', or `%yacc'), Bison no longer generates #define statements for + associating token numbers with token names. Removing the #define statements + helps to sanitize the global namespace during preprocessing, but POSIX Yacc + requires them. Bison still generates an enum for token names in all cases. + +** Handling of traditional Yacc prologue blocks is now more consistent but + potentially incompatible with previous releases of Bison. + + As before, you declare prologue blocks in your grammar file with the + `%{ ... %}' syntax. To generate the pre-prologue, Bison concatenates all + prologue blocks that you've declared before the first %union. To generate + the post-prologue, Bison concatenates all prologue blocks that you've + declared after the first %union. + + Previous releases of Bison inserted the pre-prologue into both the header + file and the code file in all cases except for LALR(1) parsers in C. In the + latter case, Bison inserted it only into the code file. For parsers in C++, + the point of insertion was before any token definitions (which associate + token numbers with names). For parsers in C, the point of insertion was + after the token definitions. + + Now, Bison never inserts the pre-prologue into the header file. In the code + file, it always inserts it before the token definitions. + +** Bison now provides a more flexible alternative to the traditional Yacc + prologue blocks: %before-header, %start-header, %end-header, and + %after-header. + + For example, the following declaration order in the grammar file reflects the + order in which Bison will output these code blocks. However, you are free to + declare these code blocks in your grammar file in whatever order is most + convenient for you: + + %before-header { + /* Bison treats this block like a pre-prologue block: it inserts it into + * the code file before the contents of the header file. It does *not* + * insert it into the header file. This is a good place to put + * #include's that you want at the top of your code file. A common + * example is `#include "system.h"'. */ + } + %start-header { + /* Bison inserts this block into both the header file and the code file. + * In both files, the point of insertion is before any Bison-generated + * token, semantic type, location type, and class definitions. This is a + * good place to define %union dependencies, for example. */ + } + %union { + /* Unlike the traditional Yacc prologue blocks, the output order for the + * new %*-header blocks is not affected by their declaration position + * relative to any %union in the grammar file. */ + } + %end-header { + /* Bison inserts this block into both the header file and the code file. + * In both files, the point of insertion is after the Bison-generated + * definitions. This is a good place to declare or define public + * functions or data structures that depend on the Bison-generated + * definitions. */ + } + %after-header { + /* Bison treats this block like a post-prologue block: it inserts it into + * the code file after the contents of the header file. It does *not* + * insert it into the header file. This is a good place to declare or + * define internal functions or data structures that depend on the + * Bison-generated definitions. */ + } + + If you have multiple occurrences of any one of the above declarations, Bison + will concatenate the contents in declaration order. + + [Although we failed to mention this here in the 2.3a release, the prologue + alternatives were experimental, and they were rewritten in future versions.] + +** The option `--report=look-ahead' has been changed to `--report=lookahead'. + The old spelling still works, but is not documented and may be removed + in a future release. + +* Changes in version 2.3, 2006-06-05: + +** GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING', + for compatibility with LALR(1) grammars. + +** It is now documented that any definition of YYSTYPE or YYLTYPE should + be to a type name that does not contain parentheses or brackets. + +* Changes in version 2.2, 2006-05-19: + +** The distribution terms for all Bison-generated parsers now permit + using the parsers in nonfree programs. Previously, this permission + was granted only for Bison-generated LALR(1) parsers in C. + +** %name-prefix changes the namespace name in C++ outputs. + +** The C++ parsers export their token_type. + +** Bison now allows multiple %union declarations, and concatenates + their contents together. + +** New warning: unused values + Right-hand side symbols whose values are not used are reported, + if the symbols have destructors. For instance: + + exp: exp "?" exp ":" exp { $1 ? $1 : $3; } + | exp "+" exp + ; + + will trigger a warning about $$ and $5 in the first rule, and $3 in + the second ($1 is copied to $$ by the default rule). This example + most likely contains three errors, and could be rewritten as: + + exp: exp "?" exp ":" exp + { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); } + | exp "+" exp + { $$ = $1 ? $1 : $3; if ($1) free ($3); } + ; + + However, if the original actions were really intended, memory leaks + and all, the warnings can be suppressed by letting Bison believe the + values are used, e.g.: + + exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); } + | exp "+" exp { $$ = $1; (void) $3; } + ; + + If there are mid-rule actions, the warning is issued if no action + uses it. The following triggers no warning: $1 and $3 are used. + + exp: exp { push ($1); } '+' exp { push ($3); sum (); }; + + The warning is intended to help catching lost values and memory leaks. + If a value is ignored, its associated memory typically is not reclaimed. + +** %destructor vs. YYABORT, YYACCEPT, and YYERROR. + Destructors are now called when user code invokes YYABORT, YYACCEPT, + and YYERROR, for all objects on the stack, other than objects + corresponding to the right-hand side of the current rule. + +** %expect, %expect-rr + Incorrect numbers of expected conflicts are now actual errors, + instead of warnings. + +** GLR, YACC parsers. + The %parse-params are available in the destructors (and the + experimental printers) as per the documentation. + +** Bison now warns if it finds a stray `$' or `@' in an action. + +** %require "VERSION" + This specifies that the grammar file depends on features implemented + in Bison version VERSION or higher. + +** lalr1.cc: The token and value types are now class members. + The tokens were defined as free form enums and cpp macros. YYSTYPE + was defined as a free form union. They are now class members: + tokens are enumerations of the `yy::parser::token' struct, and the + semantic values have the `yy::parser::semantic_type' type. + + If you do not want or can update to this scheme, the directive + `%define "global_tokens_and_yystype" "1"' triggers the global + definition of tokens and YYSTYPE. This change is suitable both + for previous releases of Bison, and this one. + + If you wish to update, then make sure older version of Bison will + fail using `%require "2.2"'. + +** DJGPP support added. + +* Changes in version 2.1, 2005-09-16: + +** The C++ lalr1.cc skeleton supports %lex-param. + +** Bison-generated parsers now support the translation of diagnostics like + "syntax error" into languages other than English. The default + language is still English. For details, please see the new + Internationalization section of the Bison manual. Software + distributors should also see the new PACKAGING file. Thanks to + Bruno Haible for this new feature. + +** Wording in the Bison-generated parsers has been changed slightly to + simplify translation. In particular, the message "memory exhausted" + has replaced "parser stack overflow", as the old message was not + always accurate for modern Bison-generated parsers. + +** Destructors are now called when the parser aborts, for all symbols left + behind on the stack. Also, the start symbol is now destroyed after a + successful parse. In both cases, the behavior was formerly inconsistent. + +** When generating verbose diagnostics, Bison-generated parsers no longer + quote the literal strings associated with tokens. For example, for + a syntax error associated with '%token NUM "number"' they might + print 'syntax error, unexpected number' instead of 'syntax error, + unexpected "number"'. + +* Changes in version 2.0, 2004-12-25: + +** Possibly-incompatible changes + + - Bison-generated parsers no longer default to using the alloca function + (when available) to extend the parser stack, due to widespread + problems in unchecked stack-overflow detection. You can "#define + YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read + the manual to determine safe values for YYMAXDEPTH in that case. + + - Error token location. + During error recovery, the location of the syntax error is updated + to cover the whole sequence covered by the error token: it includes + the shifted symbols thrown away during the first part of the error + recovery, and the lookahead rejected during the second part. + + - Semicolon changes: + . Stray semicolons are no longer allowed at the start of a grammar. + . Semicolons are now required after in-grammar declarations. + + - Unescaped newlines are no longer allowed in character constants or + string literals. They were never portable, and GCC 3.4.0 has + dropped support for them. Better diagnostics are now generated if + forget a closing quote. + + - NUL bytes are no longer allowed in Bison string literals, unfortunately. + +** New features + + - GLR grammars now support locations. + + - New directive: %initial-action. + This directive allows the user to run arbitrary code (including + initializing @$) from yyparse before parsing starts. + + - A new directive "%expect-rr N" specifies the expected number of + reduce/reduce conflicts in GLR parsers. + + - %token numbers can now be hexadecimal integers, e.g., `%token FOO 0x12d'. + This is a GNU extension. + + - The option `--report=lookahead' was changed to `--report=look-ahead'. + [However, this was changed back after 2.3.] + + - Experimental %destructor support has been added to lalr1.cc. + + - New configure option --disable-yacc, to disable installation of the + yacc command and -ly library introduced in 1.875 for POSIX conformance. + +** Bug fixes + + - For now, %expect-count violations are now just warnings, not errors. + This is for compatibility with Bison 1.75 and earlier (when there are + reduce/reduce conflicts) and with Bison 1.30 and earlier (when there + are too many or too few shift/reduce conflicts). However, in future + versions of Bison we plan to improve the %expect machinery so that + these violations will become errors again. + + - Within Bison itself, numbers (e.g., goto numbers) are no longer + arbitrarily limited to 16-bit counts. + + - Semicolons are now allowed before "|" in grammar rules, as POSIX requires. + +* Changes in version 1.875, 2003-01-01: + +** The documentation license has been upgraded to version 1.2 + of the GNU Free Documentation License. + +** syntax error processing + + - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error + locations too. This fixes bugs in error-location computation. + + - %destructor + It is now possible to reclaim the memory associated to symbols + discarded during error recovery. This feature is still experimental. + + - %error-verbose + This new directive is preferred over YYERROR_VERBOSE. + + - #defining yyerror to steal internal variables is discouraged. + It is not guaranteed to work forever. + +** POSIX conformance + + - Semicolons are once again optional at the end of grammar rules. + This reverts to the behavior of Bison 1.33 and earlier, and improves + compatibility with Yacc. + + - `parse error' -> `syntax error' + Bison now uniformly uses the term `syntax error'; formerly, the code + and manual sometimes used the term `parse error' instead. POSIX + requires `syntax error' in diagnostics, and it was thought better to + be consistent. + + - The documentation now emphasizes that yylex and yyerror must be + declared before use. C99 requires this. + + - Bison now parses C99 lexical constructs like UCNs and + backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires. + + - File names are properly escaped in C output. E.g., foo\bar.y is + output as "foo\\bar.y". + + - Yacc command and library now available + The Bison distribution now installs a `yacc' command, as POSIX requires. + Also, Bison now installs a small library liby.a containing + implementations of Yacc-compatible yyerror and main functions. + This library is normally not useful, but POSIX requires it. + + - Type clashes now generate warnings, not errors. + + - If the user does not define YYSTYPE as a macro, Bison now declares it + using typedef instead of defining it as a macro. + For consistency, YYLTYPE is also declared instead of defined. + +** Other compatibility issues + + - %union directives can now have a tag before the `{', e.g., the + directive `%union foo {...}' now generates the C code + `typedef union foo { ... } YYSTYPE;'; this is for Yacc compatibility. + The default union tag is `YYSTYPE', for compatibility with Solaris 9 Yacc. + For consistency, YYLTYPE's struct tag is now `YYLTYPE' not `yyltype'. + This is for compatibility with both Yacc and Bison 1.35. + + - `;' is output before the terminating `}' of an action, for + compatibility with Bison 1.35. + + - Bison now uses a Yacc-style format for conflict reports, e.g., + `conflicts: 2 shift/reduce, 1 reduce/reduce'. + + - `yystype' and `yyltype' are now obsolescent macros instead of being + typedefs or tags; they are no longer documented and are planned to be + withdrawn in a future release. + +** GLR parser notes + + - GLR and inline + Users of Bison have to decide how they handle the portability of the + C keyword `inline'. + + - `parsing stack overflow...' -> `parser stack overflow' + GLR parsers now report `parser stack overflow' as per the Bison manual. + +** Bison now warns if it detects conflicting outputs to the same file, + e.g., it generates a warning for `bison -d -o foo.h foo.y' since + that command outputs both code and header to foo.h. + +** #line in output files + - --no-line works properly. + +** Bison can no longer be built by a K&R C compiler; it requires C89 or + later to be built. This change originally took place a few versions + ago, but nobody noticed until we recently asked someone to try + building Bison with a K&R C compiler. + +* Changes in version 1.75, 2002-10-14: + +** Bison should now work on 64-bit hosts. + +** Indonesian translation thanks to Tedi Heriyanto. + +** GLR parsers + Fix spurious parse errors. + +** Pure parsers + Some people redefine yyerror to steal yyparse' private variables. + Reenable this trick until an official feature replaces it. + +** Type Clashes + In agreement with POSIX and with other Yaccs, leaving a default + action is valid when $$ is untyped, and $1 typed: + + untyped: ... typed; + + but the converse remains an error: + + typed: ... untyped; + +** Values of mid-rule actions + The following code: + + foo: { ... } { $$ = $1; } ... + + was incorrectly rejected: $1 is defined in the second mid-rule + action, and is equal to the $$ of the first mid-rule action. + +* Changes in version 1.50, 2002-10-04: + +** GLR parsing + The declaration + %glr-parser + causes Bison to produce a Generalized LR (GLR) parser, capable of handling + almost any context-free grammar, ambiguous or not. The new declarations + %dprec and %merge on grammar rules allow parse-time resolution of + ambiguities. Contributed by Paul Hilfinger. + + Unfortunately Bison 1.50 does not work properly on 64-bit hosts + like the Alpha, so please stick to 32-bit hosts for now. + +** Output Directory + When not in Yacc compatibility mode, when the output file was not + specified, running `bison foo/bar.y' created `foo/bar.c'. It + now creates `bar.c'. + +** Undefined token + The undefined token was systematically mapped to 2 which prevented + the use of 2 by the user. This is no longer the case. + +** Unknown token numbers + If yylex returned an out of range value, yyparse could die. This is + no longer the case. + +** Error token + According to POSIX, the error token must be 256. + Bison extends this requirement by making it a preference: *if* the + user specified that one of her tokens is numbered 256, then error + will be mapped onto another number. + +** Verbose error messages + They no longer report `..., expecting error or...' for states where + error recovery is possible. + +** End token + Defaults to `$end' instead of `$'. + +** Error recovery now conforms to documentation and to POSIX + When a Bison-generated parser encounters a syntax error, it now pops + the stack until it finds a state that allows shifting the error + token. Formerly, it popped the stack until it found a state that + allowed some non-error action other than a default reduction on the + error token. The new behavior has long been the documented behavior, + and has long been required by POSIX. For more details, please see + Paul Eggert, "Reductions during Bison error handling" (2002-05-20) + . + +** Traces + Popped tokens and nonterminals are now reported. + +** Larger grammars + Larger grammars are now supported (larger token numbers, larger grammar + size (= sum of the LHS and RHS lengths), larger LALR tables). + Formerly, many of these numbers ran afoul of 16-bit limits; + now these limits are 32 bits on most hosts. + +** Explicit initial rule + Bison used to play hacks with the initial rule, which the user does + not write. It is now explicit, and visible in the reports and + graphs as rule 0. + +** Useless rules + Before, Bison reported the useless rules, but, although not used, + included them in the parsers. They are now actually removed. + +** Useless rules, useless nonterminals + They are now reported, as a warning, with their locations. + +** Rules never reduced + Rules that can never be reduced because of conflicts are now + reported. + +** Incorrect `Token not used' + On a grammar such as + + %token useless useful + %% + exp: '0' %prec useful; + + where a token was used to set the precedence of the last rule, + bison reported both `useful' and `useless' as useless tokens. + +** Revert the C++ namespace changes introduced in 1.31 + as they caused too many portability hassles. + +** Default locations + By an accident of design, the default computation of @$ was + performed after another default computation was performed: @$ = @1. + The latter is now removed: YYLLOC_DEFAULT is fully responsible of + the computation of @$. + +** Token end-of-file + The token end of file may be specified by the user, in which case, + the user symbol is used in the reports, the graphs, and the verbose + error messages instead of `$end', which remains being the default. + For instance + %token MYEOF 0 + or + %token MYEOF 0 "end of file" + +** Semantic parser + This old option, which has been broken for ages, is removed. + +** New translations + Brazilian Portuguese, thanks to Alexandre Folle de Menezes. + Croatian, thanks to Denis Lackovic. + +** Incorrect token definitions + When given `%token 'a' "A"', Bison used to output `#define 'a' 65'. + +** Token definitions as enums + Tokens are output both as the traditional #define's, and, provided + the compiler supports ANSI C or is a C++ compiler, as enums. + This lets debuggers display names instead of integers. + +** Reports + In addition to --verbose, bison supports --report=THINGS, which + produces additional information: + - itemset + complete the core item sets with their closure + - lookahead [changed to `look-ahead' in 1.875e through 2.3, but changed back] + explicitly associate lookahead tokens to items + - solved + describe shift/reduce conflicts solving. + Bison used to systematically output this information on top of + the report. Solved conflicts are now attached to their states. + +** Type clashes + Previous versions don't complain when there is a type clash on + the default action if the rule has a mid-rule action, such as in: + + %type bar + %% + bar: '0' {} '0'; + + This is fixed. + +** GNU M4 is now required when using Bison. + +* Changes in version 1.35, 2002-03-25: + +** C Skeleton + Some projects use Bison's C parser with C++ compilers, and define + YYSTYPE as a class. The recent adjustment of C parsers for data + alignment and 64 bit architectures made this impossible. + + Because for the time being no real solution for C++ parser + generation exists, kludges were implemented in the parser to + maintain this use. In the future, when Bison has C++ parsers, this + kludge will be disabled. + + This kludge also addresses some C++ problems when the stack was + extended. + +* Changes in version 1.34, 2002-03-12: + +** File name clashes are detected + $ bison foo.y -d -o foo.x + fatal error: header and parser would both be named `foo.x' + +** A missing `;' at the end of a rule triggers a warning + In accordance with POSIX, and in agreement with other + Yacc implementations, Bison will mandate this semicolon in the near + future. This eases the implementation of a Bison parser of Bison + grammars by making this grammar LALR(1) instead of LR(2). To + facilitate the transition, this release introduces a warning. + +** Revert the C++ namespace changes introduced in 1.31, as they caused too + many portability hassles. + +** DJGPP support added. + +** Fix test suite portability problems. + +* Changes in version 1.33, 2002-02-07: + +** Fix C++ issues + Groff could not be compiled for the definition of size_t was lacking + under some conditions. + +** Catch invalid @n + As is done with $n. + +* Changes in version 1.32, 2002-01-23: + +** Fix Yacc output file names + +** Portability fixes + +** Italian, Dutch translations + +* Changes in version 1.31, 2002-01-14: + +** Many Bug Fixes + +** GNU Gettext and %expect + GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that + Bison dies on incorrect %expectations, we fear there will be + too many bug reports for Gettext, so _for the time being_, %expect + does not trigger an error when the input file is named `plural.y'. + +** Use of alloca in parsers + If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use + malloc exclusively. Since 1.29, but was not NEWS'ed. + + alloca is used only when compiled with GCC, to avoid portability + problems as on AIX. + +** yyparse now returns 2 if memory is exhausted; formerly it dumped core. + +** When the generated parser lacks debugging code, YYDEBUG is now 0 + (as POSIX requires) instead of being undefined. + +** User Actions + Bison has always permitted actions such as { $$ = $1 }: it adds the + ending semicolon. Now if in Yacc compatibility mode, the semicolon + is no longer output: one has to write { $$ = $1; }. + +** Better C++ compliance + The output parsers try to respect C++ namespaces. + [This turned out to be a failed experiment, and it was reverted later.] + +** Reduced Grammars + Fixed bugs when reporting useless nonterminals. + +** 64 bit hosts + The parsers work properly on 64 bit hosts. + +** Error messages + Some calls to strerror resulted in scrambled or missing error messages. + +** %expect + When the number of shift/reduce conflicts is correct, don't issue + any warning. + +** The verbose report includes the rule line numbers. + +** Rule line numbers are fixed in traces. + +** Swedish translation + +** Parse errors + Verbose parse error messages from the parsers are better looking. + Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'('' + Now: parse error: unexpected '/', expecting "number" or '-' or '(' + +** Fixed parser memory leaks. + When the generated parser was using malloc to extend its stacks, the + previous allocations were not freed. + +** Fixed verbose output file. + Some newlines were missing. + Some conflicts in state descriptions were missing. + +** Fixed conflict report. + Option -v was needed to get the result. + +** %expect + Was not used. + Mismatches are errors, not warnings. + +** Fixed incorrect processing of some invalid input. + +** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H. + +** Fixed some typos in the documentation. + +** %token MY_EOF 0 is supported. + Before, MY_EOF was silently renumbered as 257. + +** doc/refcard.tex is updated. + +** %output, %file-prefix, %name-prefix. + New. + +** --output + New, aliasing `--output-file'. + +* Changes in version 1.30, 2001-10-26: + +** `--defines' and `--graph' have now an optional argument which is the + output file name. `-d' and `-g' do not change; they do not take any + argument. + +** `%source_extension' and `%header_extension' are removed, failed + experiment. + +** Portability fixes. + +* Changes in version 1.29, 2001-09-07: + +** The output file does not define const, as this caused problems when used + with common autoconfiguration schemes. If you still use ancient compilers + that lack const, compile with the equivalent of the C compiler option + `-Dconst='. autoconf's AC_C_CONST macro provides one way to do this. + +** Added `-g' and `--graph'. + +** The Bison manual is now distributed under the terms of the GNU FDL. + +** The input and the output files has automatically a similar extension. + +** Russian translation added. + +** NLS support updated; should hopefully be less troublesome. + +** Added the old Bison reference card. + +** Added `--locations' and `%locations'. + +** Added `-S' and `--skeleton'. + +** `%raw', `-r', `--raw' is disabled. + +** Special characters are escaped when output. This solves the problems + of the #line lines with path names including backslashes. + +** New directives. + `%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose', + `%debug', `%source_extension' and `%header_extension'. + +** @$ + Automatic location tracking. + +* Changes in version 1.28, 1999-07-06: + +** Should compile better now with K&R compilers. + +** Added NLS. + +** Fixed a problem with escaping the double quote character. + +** There is now a FAQ. + +* Changes in version 1.27: + +** The make rule which prevented bison.simple from being created on + some systems has been fixed. + +* Changes in version 1.26: + +** Bison now uses automake. + +** New mailing lists: and . + +** Token numbers now start at 257 as previously documented, not 258. + +** Bison honors the TMPDIR environment variable. + +** A couple of buffer overruns have been fixed. + +** Problems when closing files should now be reported. + +** Generated parsers should now work even on operating systems which do + not provide alloca(). + +* Changes in version 1.25, 1995-10-16: + +** Errors in the input grammar are not fatal; Bison keeps reading +the grammar file, and reports all the errors found in it. + +** Tokens can now be specified as multiple-character strings: for +example, you could use "<=" for a token which looks like <=, instead +of chosing a name like LESSEQ. + +** The %token_table declaration says to write a table of tokens (names +and numbers) into the parser file. The yylex function can use this +table to recognize multiple-character string tokens, or for other +purposes. + +** The %no_lines declaration says not to generate any #line preprocessor +directives in the parser file. + +** The %raw declaration says to use internal Bison token numbers, not +Yacc-compatible token numbers, when token names are defined as macros. + +** The --no-parser option produces the parser tables without including +the parser engine; a project can now use its own parser engine. +The actions go into a separate file called NAME.act, in the form of +a switch statement body. + +* Changes in version 1.23: + +The user can define YYPARSE_PARAM as the name of an argument to be +passed into yyparse. The argument should have type void *. It should +actually point to an object. Grammar actions can access the variable +by casting it to the proper pointer type. + +Line numbers in output file corrected. + +* Changes in version 1.22: + +--help option added. + +* Changes in version 1.20: + +Output file does not redefine const for C++. + +Local Variables: +mode: outline +End: + +----- + +Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, +2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This file is part of Bison, the GNU Compiler Compiler. + +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 . diff --git a/OChangeLog b/OChangeLog new file mode 100644 index 0000000..5ae60b9 --- /dev/null +++ b/OChangeLog @@ -0,0 +1,1500 @@ +1998-01-04 J.J. van der Heijden + + * src/files.c (openfiles) [_WIN32 && !__CYGWIN32__]: Use TEMP or + Temp to find a temporary directory, if possible. Do not unlink + files while they are open. + +1997-08-25 Richard Stallman + + * src/reader.c (stack_offset;): Change some warni to warns. + + * src/lex.c (literalchar): Use warns, not warni. + +1997-06-28 Richard Stallman + + * src/bison.simple: Add a Bison version comment. + + * Makefile.in (bison_version): New variable. + (dist): Use that variable. + (bison.s1): Substitute the Bison version into bison.simple. + + * src/main.c (fatal, warn, berror): Use program_name. + +1997-06-18 Richard Stallman + + * Makefile.in: new.h renamed to alloc.h. + * src/*.c: src/new.h renamed to src/alloc.h. + + * src/alloc.h: Renamed from src/new.h. + +1997-06-15 Richard Stallman + + * src/main.c (fatal, warn, berror): Make error messages standard. + (toomany): Improve error message text. + +1997-05-24 Richard Stallman + + * src/lex.c (literalchar): Fix the code for escaping \, " and '. + +1997-05-23 Richard Stallman + + * src/lex.c (lex): Avoid trouble when there are many chars + to discard in a char literal with just several chars in it. + +1997-05-17 Richard Stallman + + * src/bison.simple: Use malloc, if using alloca is troublesome. + (YYSTACK_USE_ALLOCA): New flag macro. + Define it for some systems and compilers. + (YYSTACK_ALLOC): New macro. + (yyparse): Use YYSTACK_ALLOC to allocate stack. + If it was malloc'd, free it. + +1997-05-02 Richard Stallman + + * src/bison.simple [_AIX]: Don't include malloc.h. + +1997-04-23 Richard Stallman + + * src/bison.simple (alloca) [__hpux]: Always define as + __builtin_alloca. + +1997-04-22 Richard Stallman + + * src/bison.simple (__yy_memcpy): Declare arg `count' as unsigned + int. + (yyparse): Cast third arg to __yy_memcpy to unsigned int. + + * src/bison.simple (alloca) [__hpux]: Include alloca.h (right for + HPUX 10) instead of declaring alloca (right for HPUX 9). + +1997-01-02 Richard Stallman + + * src/allocate.c [__STDC__ or _MSC_VER]: + Declare calloc and realloc to return void *. + + * Makefile.in (dist): Explicitly check for symlinks, and copy them. + +1996-12-17 Paul Eggert + + * src/bison.simple (yyparse): If __GNUC__ and YYPARSE_PARAM are + both defined, declare yyparse to have a void * argument. + +1996-12-17 Richard Stallman + + * src/system.h [_MSC_VER]: Include stdlib.h and process.h. + [_MSC_VER] (getpid): Define as macro--translate it to _getpid. + + * src/reduce.c (nbits): Add some casts. + + * src/main.c (main): Return FAILURE as a value. + (printable_version): Declare arg as int, not char. + + * src/files.c [_MSC_VER] (XPFILE, XPFILE1): Define, if not already + defined. + +1996-12-16 Richard Stallman + + * src/main.c (printable_version): Use type `int' for the arg. + +1996-08-12 Richard Stallman + + * src/bison.simple: Test _MSDOS as well as _MSDOS_. + +1996-07-31 Richard Stallman + + * src/bison.simple [__sun && __i386]: Include alloca.h. + +1996-07-30 Richard Stallman + + * src/bison.simple: Test _MSDOS_, not MSDOS. + +1996-06-01 Richard Stallman + + * All files: Insert `_' macro around many string constants. + + * src/system.h [HAVE_LOCALE_H]: Include locale.h. + [! HAVE_LOCALE_H] (setlocale): Define as no-op. + [ENABLE_NLS]: Include libintl.h. + [ENABLE_NLS] (gettext): Define. + [! ENABLE_NLS] (bintextdomain, textdomain, _): Consolation definitions. + (N_, PACKAGE, LOCALEDIR): New macros. + + * src/main.c (main): Call setlocale, bindtextdomain and textdomain. + + * POTFILES.in: New file. + + * Makefile.in (allocate.o): Define target explicitly. + +1996-06-01 Jim Meyering + + * Makefile.in (CFLAGS): Set to @CFLAGS@. + (LDFLAGS): Set to @LDFLAGS@. + (configure): Run autoconf only if preceding `cd' succeeds. + (src/bison.s1): Redirect output to temporary file then move the + temporary to the target, rather than redirecting directly to + src/bison.s1. + (clean): Remove config.status and config.log. + (distclean): Don't remove config.status here. + +1996-05-12 Jim Meyering + + * src/bison.simple (__yy_memcpy) [__cplusplus]: Reorder declarations + of variables f and t. + +1996-05-11 Richard Stallman + + * Version 1.25 released. + + * Makefile.in (dist): Don't use $(srcdir). + + * src/bison.simple (__yy_memcpy): Really reorder the args, as was + supposedly done on Feb 14 1995. + (yyparse): Calls changed accordingly. + +1996-01-24 Richard Stallman + + * src/output.c (output_rule_data): Test YYERROR_VERBOSE in the + conditional around the definition of ttyname. + +1995-12-28 Richard Stallman + + * src/bison.simple: Fix line numbers in #line commands. + +1995-12-24 Richard Stallman + + * src/bison.simple (YYPARSE_PARAM_DECL): In C++, make it always + null. + (YYPARSE_PARAM_ARG): New macro. + (yyparse): Use YYPARSE_PARAM_ARG. + +1995-10-15 Richard Stallman + + * src/version.c: Version now 1.25. + + * src/main.c (warn): Set `failure'. + +1995-08-01 Wilfred J. Hansen + + * src/bison.cld, src/getargs.c, src/vmsgetargs.c: Added -n, -k, + and -raw switches. + (noparserflag, toknumflag, rawtoknumflag): New variables. + + * src/conflicts.c (resolve_sr_conflict): Remove use of alloca. + + * src/files.c (openfiles, open_extra_files, done): Add faction flag + and actfile file. Handle noparserflag. Both for -n switch. + + * src/lex.c: Include getopt.h. Add some extern decls. + (safegetc): New function to deal with EOF gracefully. + (literalchar); new function to deal with reading \ escapes. + (lex): Use literalchar. + (lex): Implemented "..." tokens. + (literalchar, lex, parse_percent_token): Made tokenbuffer + always contain the token. This includes growing the token + buffer while reading an integer. + (parse_percent_token): Replaced if-else statement with percent_table. + (parse_percent_token): Added % declarations as another + way to specify the flags -n, -l, and -r. Also added hooks for + -d, -k, -y, -v, -t, -p, -b, -o, but implementation requires + major changes to src/files.c. + (lex) Retain in the incoming stream a character following + an incorrect '/'. + (skip_white_space, lex): Revised most error messages + and changed fatal to warn to avoid aborting. + (percent_table): Added %thong declarations. + + * src/lex.h: Added THONG and NOOP for alias processing. + Added SETOPT for the new code that allows setting options with %flags. + + * src/main.c (main): If reader sees an error, don't process the + grammar. + (fatals): Updated to not use VARARGS1. + (printable_version, int_to_string, warn, warni, warns, warnss) + (warnsss): New error reporting functions. Avoid abort for error. + + * src/output.c (output_headers, output_trailers, output, output_gram) + (output_rule_data): Implement noparserflag variable. + Implement toknumflag variable. + (output): Call reader_output_yylsp to output LTYPESTR. + + * src/reader.c (reader_output_yylsp): New function. + (readgram): Use `#if 0' around code that accepted %command inside + grammar rules: The documentation doesn't allow it, and it will + fail since the %command processors scan for the next %. + (parse_token_decl): Extended the %token declaration to allow a + multi-character symbol as an alias. + (parse_thong_decl): New function. + (read_declarations): Added %thong declarations. + (read_declarations): Handle NOOP to deal with allowing % + declarations as another means to specify the flags. + (readgram): Allow %prec prior to semantics embedded in a rule. + (skip_to_char, read_declarations, copy_definition) + (parse_token_decl, parse_start_decl, parse_type_decl) + (parse_assoc_decl, parse_union_decl, parse_expect_decl) + (get_type_name, copy_guard, copy_action, readgram) + (get_type, packsymbols): Revised most error messages. Changed + `fatal' to `warnxxx' to avoid aborting for error. Revised and use + multiple warnxxx functions to avoid using VARARGS1. + (read_declarations): Improve the error message for an invalid + character. Do not abort. + (read_declarations, copy_guard, copy_action): Use + printable_version to avoid unprintable characters in printed + output. + (parse_expect_decl): Error if argument to %expect exceeds 10 + digits. + (parse_token_decl, parse_assoc_decl, parse_type_decl, get_type): + Allow the type of a non-terminal can be given more than once, as + long as all specifications give the same type. + + * src/reduce.c (reduce_grammar): Revise an error message. + (print_notices): Remove final `.' from error message. + + * src/symtab.h (SALIAS): New #define for adding aliases to %token. + (struct bucket): Added `alias' field. + +1995-05-03 Richard Stallman + + * src/bison.simple: Change distribution terms. + + * src/version.c: Version now 1.23. No, 1.24. + +1995-02-23 Richard Stallman + + * src/files.c: Test __VMS_POSIX as well as VMS. + +1995-02-14 Jim Meyering + + * src/bison.simple (__yy_memcpy): Renamed from __yy_bcopy to avoid + confusion. Reverse FROM and TO arguments to be consistent with + those of memcpy. + +1994-11-10 David J. MacKenzie + + * Makefile.in (DISTFILES): Include install-sh, not install.sh. + Include NEWS. + + * configure.in: Update to Autoconf v2 macro names. + +1994-10-04 David J. MacKenzie + + * Makefile.in (prefix, exec_prefix): Let configure set them. + +1994-09-28 David J. MacKenzie + + * Makefile.in: Set datadir to $(prefix)/share. + +1994-07-12 Richard Stallman + + * src/reader.c (reader): Rename undefined-token token to + `$undefined.'. + +1994-05-05 David J. MacKenzie + + * Makefile.in (DISTFILES): Add install.sh. + (install): Remove chmod commands. + +1994-03-26 Richard Stallman + + * src/bison.simple: Fix #line commands. + +1994-03-24 Richard Stallman + + * src/conflicts.c (print_reductions): Increment both fp1 and fp2 + while printing reductions in multi-rule case. + +1994-01-02 Richard Stallman + + * Makefile.in (LDFLAGS): Make it empty by default. + (bison): Use CFLAGS. + +1993-11-21 Richard Stallman + + * src/bison.simple (YYLEX): Take notice of YYLEX_PARAM. + +1993-10-18 Richard Stallman + + * src/bison.simple (YYPARSE_PARAM_DECL): Always define this. + +1993-10-14 Richard Stallman + + * src/bison.simple (yyparse): Support YYPARSE_PARAM. + +1993-09-13 Noah Friedman + + * Makefile.in (check): New target. + +1993-09-10 Richard Stallman + + * src/conflicts.c (alloca): #undef before defining. + + * src/system.h (bcopy): Don't define if already defined. + +1993-09-06 Noah Friedman + + * Version 1.22 released. + + * mkinstalldirs: New file. + + * Makefile.in (dist): Use .gz for extension, not .z. + (DISTFILES): New variable. + (dist): Use it instead of explicit file list. + Try to link each file separately, then copy file if ln fails. + (installdirs): Use mkinstalldirs script. + +1993-07-29 David J. MacKenzie + + * Makefile.in (config.status): Run config.status --recheck, not + configure, to get the right args passed. + +1993-07-24 Richard Stallman + + * src/bison.simple (yyparse): Init yychar1 to avoid warning. + +1993-07-04 Richard Stallman + + * src/bison.simple (yyparse): Don't set yyval when yylen is 0. + +1993-06-26 David J. MacKenzie + + * src/getargs.c (getargs): Exit after printing the version number. + Add --help and -h options. + (usage): New function. + +1993-06-25 Richard Stallman + + * src/getargs.c (longopts): Allow `output' as an alternative. + +1993-06-16 Richard Stallman + + * src/bison.simple (yyparse): Conditionalize the entire call to + yyoverflow, not just two arguments in it. + +1993-06-03 Richard Stallman + + * src/bison.simple [__hpux] (alloca): Don't specify arg types. + +1993-05-07 Noah Friedman + + * Makefile.in (install): Depend on `uninstall' and `installdirs'. + (installdirs): New target. + +1993-04-28 Noah Friedman + + * src/reader.c: Remove declaration of atoi. + +1993-04-23 Noah Friedman + + * src/new.h [!__STDC__] (FREE): Check x != 0. + Make expr to call `free' evaluate to 0. + +1993-04-20 David J. MacKenzie + + * src/files.c [MSDOS]: Use xmalloc, not malloc. + * src/allocate.c (xmalloc): Renamed from mallocate. Remove old + wrapper. + * src/conflicts.c, src/symtab.c, src/files.c, src/LR0.c, + src/new.h: Change callers. + * src/allocate.c (xrealloc): New function. + * src/new.h: Declare it. + * src/lex.c, src/reader.c: Use it. + +1993-04-18 Noah Friedman + + * Version 1.21 released. + + * src/reader.c : Don't declare `realloc'. + + * Makefile.in (bison.s1): use `rm -f' since it's quieter. + (dist): make gzipped tar file. + +1993-04-16 Noah Friedman + + * Makefile.in (Makefile, config.status, configure): New targets. + +1993-04-15 Richard Stallman + + * src/main.c: Don't declare `abort'. + + * src/files.c: Don't declare `exit'. + +1993-04-15 Noah Friedman + + * configure.in: Add AC_CONST. + +1993-04-14 Richard Stallman + + * Makefile.in (all): Depend on bison.s1. + +1993-04-13 Richard Stallman + + * Version 1.20 released. + +1993-03-24 Richard Stallman + + * src/output.c (output_headers): Rename yynerrs if -p. + +1993-03-18 Noah Friedman + + * src/system.h: Don't try to include stdlib.h unless HAVE_STDLIB_H + is defined. + + * configure.in: Check for stdlib.h. + +1993-03-17 Richard Stallman + + * src/bison.simple [__hpux, not __GNUC__]: Declare alloca. + (yyparse): When printing the expected token types for an error, + Avoid negative indexes in yycheck and yytname. + +1993-03-13 Richard Stallman + + * Makefile.in (files.o, .c.o): Put CPPFLAGS and CFLAGS last. + +1993-03-01 Richard Stallman + + * src/bison.simple: Test __sgi like __sparc. + +1993-02-17 Richard Stallman + + * src/conflicts.c (resolve_sr_conflict): Add extra parens in + alloca call. + + * src/bison.simple [__GNUC__] (yyparse): Declare with prototype. + +1993-01-15 Richard Stallman + + * src/conflicts.c (print_reduction): Near end, increment fp2 when + mask recycles. + +1993-01-13 Richard Stallman + + * Makefile.in (bison.s1): New target. Modifies bison.simple. + (install): Install bison.s1, without changing it. + (clean): Delete bison.s1. + +1993-01-04 Richard Stallman + + * src/reader.c (reader): Put Bison version in comment in output + file. + +1992-12-22 Richard Stallman + + * src/files.c (openfiles): Use .output, not .out, for outfile, + regardless of spec_name_prefix. + +1992-12-15 Richard Stallman + + * src/output.c (output_gram): Include yyrhs in the same #if as + yyprhs. + +1992-12-15 Noah Friedman + + * src/output.c (output): output directives checking for + __cplusplus as well as __STDC__ to determine when to define + "const" as an empty token. (Patch from Wolfgang Glunz + ) + +1992-12-08 David J. MacKenzie + + * src/system.h, src/conflicts.c: Replace USG with HAVE_STRING_H + and HAVE_MEMORY_H. + +1992-11-21 David J. MacKenzie + + * Makefile.in: Set and use $(MAKEINFO). + +1992-11-20 Richard Stallman + + * src/files.c (done) [MSDOS]: Delete the tmpdefsfile with the + rest. + +1992-10-08 Richard Stallman + + * Makefile.in (dist): Put configure.bat in the distribution. + +1992-10-01 David J. MacKenzie + + * Makefile.in (install): cd to $(srcdir) before installing info + files. + +1992-09-30 Richard Stallman + + * Makefile.in (files.o): Supply $(DEFS), and $(CPPFLAGS). + +1992-09-25 Richard Stallman + + * Version 1.19 released. + + * src/reader.c (parse_union_decl): Fix ending of C++ comment; + don't lose the char after the newline. + + * configure.bat: New file. + +1992-09-24 Richard Stallman + + * src/conflicts.c: Check for using alloca.h as getopt.c does. + +1992-09-06 Karl Berry + + * src/files.c (openfiles): open `fdefines' after we have assigned + a name to `tmpdefsfile', and only if `definesflag' is set. + (done): only create the real .tab.h file if `definesflag' is set. + * src/reader.c (packsymbols): don't close `fdefines' here. + +1992-09-05 Richard Stallman + + * src/files.c (openfiles): Open fdefines as temp file, like + ftable. + (done): Copy temp defines file to real one, like main output file. + +1992-08-21 Richard Stallman + + * Makefile.in (dist): Don't release mergedir.awk + (install): Use sed, not awk. Don't depend on mergedir.awk. + * mergedir.awk: File effectively deleted. + +1992-07-29 Richard Stallman + + * src/bison.simple: Test __sparc along with __sparc__. + +1992-07-11 Richard Stallman + + * src/lex.c (skip_white_space): Count \n just once at end of c++ + comment. + +1992-06-26 Richard Stallman + + * src/bison.simple: Comment fix; #line command updated. + +1992-06-24 Richard Stallman + + * Makefile.in (install): Specify full new file name for the + executable. + +1992-06-22 Richard Stallman + + * Makefile.in (dist): Include bison.rnh in distribution. + +Sun Jun 21 22:42:13 1992 Eric Youngdale + + Clean up rough edges in VMS port of bison, add support for + remaining command line options. + + * src/bison.cld: Add /version, /yacc, /file_prefix, and + /name_prefix switches. + + * src/build.com: General cleanup: add logic to automatically sense + which C compiler is present; add code to cwd to the directory that + contains bison sources; do not define XPFILE, XPFILE1 + (correct defaults are applied in src/file.c). + + * src/files.c: Append _tab, not .tab when using /file_prefix under + VMS. + + * src/system.h: Include string.h instead of strings.h (a la USG). + + * src/vmsgetargs.c: Add support for all switches added to + src/bison.cld. + +1992-06-21 Richard Stallman + + * Makefile.in (install): Always specify new file name for install. + Redirect awk output to temp file and install that. + +1992-05-27 Richard Stallman + + * src/bison.simple (yyparse): Make yybackup and yyerrlab1 always + be used. + +1992-05-22 Richard Stallman + + * Makefile.in (dist): Depend on bison.info + (bison.info): Delete spurious <. + +1992-05-17 Richard Stallman + + * Makefile.in (.c.o): New rule. Use $(DEFS) directly. + (CFLAGS): Use just -g by default. + (CDEBUG): Variable deleted. + +1992-05-07 Richard Stallman + + * src/reader.c (copy_guard): Fix typo skipping comment. + +1992-05-04 Richard Stallman + + * Version 1.18. + + * src/getargs.c (getargs): Change '0' to 0 in case for long + options. + +1992-04-19 Richard Stallman + + * src/reader.c (packsymbols): Handle -p when declaring yylval. + +1992-04-18 Richard Stallman + + * src/output.c (output_gram): Output #endif properly at end of + decl. + +1992-03-30 Richard Stallman + + * Version 1.17. + + * Makefile.in (clean): Don't delete configuration files or TAGS. + (distclean): New target; do delete those. + +1992-03-28 Richard Stallman + + * src/output.c (output_gram): Conditionalize yyprhs on YYDEBUG. + + * src/LR0.c (augment_automaton): If copying sp->shifts to insert + new shift, handle case of inserting at end. + +1992-03-21 Richard Stallman + + * src/lex.c (skip_white_space): Handle C++ comments. + * src/reader.c (copy_definition, parse_union_decl, copy_guard): + (copy_action): Likewise. + +1992-03-08 Richard Stallman + + * src/bison.simple (YYPOPSTACK): Fix typo. + +1992-02-29 Richard Stallman + + * Makefile.in (install): Install bison.info* files one by one. + +1992-02-28 David J. MacKenzie + + * src/bison.1: Document long options as starting with `--', not + `+'. + +1992-02-01 Richard Stallman + + * src/getargs.c (getargs): Accept value 0 from getopt_long. + +1992-01-30 Richard Stallman + + * Makefile.in (mostlyclean): Renamed from `clean'. + (clean): Renamed from 'distclean'. Dep on mostlyclean, not + realclean. + (realclean): Dep on clean. + +1992-01-27 Richard Stallman + + * src/bison.simple: Use malloc, not xmalloc, and handle failure + explicitly. + +1992-01-26 Richard Stallman + + * src/conflicts.c (total_conflicts): Delete unused arg to fprintf. + +1992-01-21 Richard Stallman + + * Version 1.16. + +1992-01-06 Richard Stallman + + * Makefile (distclean): Depend on clean, not realclean. Don't rm + TAGS. + (realclean): rm TAGS here. + + * src/symtab.c (free_symtab): Don't free the type names. + +1991-12-29 Richard Stallman + + * src/machine.h: MSDOS has 32-bit ints if __GO32__. + +1991-12-25 David J. MacKenzie + + * src/bison.simple [_AIX]: Indent `#pragma alloca', so old C + compilers don't choke on it. + +1991-12-23 Richard Stallman + + * src/getopt.c, src/getopt1.c, src/getopt.h: Link them to standard + source location. + * src/alloca.c: Likewise. + * Makefile.in (dist): Copy those files from current dir. + + * src/getargs.c: Update usage message. + + * src/LR0.c (augment_automaton): Put new shift in proper order. + +1991-12-20 Richard Stallman + + * src/conflicts.c: Use memcpy if ANSI C library. + + * src/closure.c (set_fderives): Delete redundant assignment to + vrow. + + * src/closure.c (print_firsts): Fix bounds and offset checking + tags. + + * src/closure.c (tags): Declare just once at start of file. + + * src/LR0.c (allocate_itemsets): Eliminate unused var max. + (augment_automaton): Test sp is non-null. + + * src/lalr.c (initialize_LA): Make the vectors at least 1 element + long. + + * src/reader.c (readgram): Remove separate YYSTYPE default for + MSDOS. + +1991-12-18 Richard Stallman + + * src/print.c (print_grammar): Don't print disabled rules. + +1991-12-17 Richard Stallman + + * src/lex.c (lex): Parse hex escapes properly. + Handle \v when filling token_buffer. + + * src/lex.c: Include new.h. + (token_buffer): Change to a pointer. + (init_lex): Allocate initial buffer. + (grow_token_buffer): New function. + (lex, parse_percent_token): Use that. + + * src/reader.c (read_declarations): Call open_extra_files just + once. + (parse_token_decl): Don't free previous typename value. Don't + increment nvars if symbol is already a nonterminal. + (parse_union_decl): Catch unmatched close-brace. + (parse_expect_decl): Null-terminate buffer. + (copy_guard): Set brace_flag for {, not for }. + + * src/reader.c: Fix %% in calls to fatal. + + * src/reader.c (token_buffer): Just one extern decl, at top level. + Declare as pointer. + + * src/symtab.c (free_symtab): Free type_name fields. Free symtab + itself. + +1991-11-25 Richard Stallman + + * src/bison.simple: Handle alloca for AIX. + + * Makefile.in (mandir): Compute default using manext. + +1991-11-02 David J. MacKenzie + + * Update all files to GPL version 2. + +1991-09-06 Richard Stallman + + * src/bison.simple (__yy_bcopy): Use builtin if GCC version 2. + +1991-08-26 Richard Stallman + + * src/reader.c (parse_assoc_decl): Error if same symbol gets two + precs. + +1991-08-26 David J. MacKenzie + + * Makefile.in, configure: Only put $< in Makefile if using VPATH, + because older makes don't understand it. + +1991-08-23 David J. MacKenzie + + * src/conflicts.c [_AIX]: #pragma alloca. + * src/reduce.c: Don't define TRUE and FALSE if already defined. + +1991-08-12 Richard Stallman + + * Makefile.in: Add deps on system.h. + (install): Add some deps. + +1991-08-02 David J. MacKenzie + + * Makefile.in (dist): Include texinfo.tex. + + * configure: Create config.status. Remove it and Makefile if + interrupted while creating them. + +1991-08-01 David J. MacKenzie + + * configure: Check for +srcdir etc. arg and look for + Makefile.in in that directory. Set VPATH if srcdir is not `.'. + * Makefile.in (prefix): Renamed from DESTDIR. + +1991-07-31 Richard Stallman + + * src/print.c (print_grammar): Make output prettier. Break lines. + +1991-07-30 Richard Stallman + + * src/print.c (print_grammar): New function. + (verbose): Call it instead of printing token names here. + +1991-07-22 Richard Stallman + + * src/vmsgetargs.c (spec_name_prefix, spec_file_prefix): Define + variables. + +1991-07-10 David J. MacKenzie + + * configure, Makefile.in: $(INSTALLPROG) -> $(INSTALL), + $(INSTALLTEXT) -> $(INSTALLDATA). + +1991-07-09 David J. MacKenzie + + * src/bison.simple: Don't include malloc.h if __TURBOC__. + +1991-07-06 David J. MacKenzie + + * Replace Makefile with configure and Makefile.in. Update README + with current compilation instructions. + +1991-07-01 Richard Stallman + + * src/reader.c (reader): Make the output define YYBISON. + +1991-06-20 David J. MacKenzie + + * Makefile (MANDIR, MANEXT): Install man page in + /usr/local/man/man1/bison.1 by default, instead of + /usr/man/manl/bison.l, for consistency with other GNU programs. + * Makefile: Rename BINDIR et al. to lowercase to conform to + GNU coding standards. + (install): Make man page non-executable. + +1991-05-31 Richard Stallman + + * Makefile (bison.info): New target. + (realclean): New target. + +1991-05-02 Richard Stallman + + * src/bison.simple: Use YYPRINT to print a token, if it's defined. + +1991-04-29 Richard Stallman + + * src/lalr.c (transpose): Rename R to R_arg. + (initialize_LA): Avoid shadowing variable j. + + * src/reader.c (packsymbols): Avoid shadowing variable i. + + * src/files.c: Declare exit and perror. + + * src/machine.h: Define MAXSHORT and MINSHORT for the eta-10. + +1991-04-02 Richard Stallman + + * src/allocate.c (mallocate): Always allocate at least one byte. + +1991-03-19 Richard Stallman + + * Makefile (dist): Put alloca.c into distribution. + +1991-03-06 Richard Stallman + + * src/print.c (print_actions): Nicer output for final states. + +1991-02-21 Richard Stallman + + * src/output.c (output_rule_data): Break lines in yytline based on + hpos. + +1991-02-07 Richard Stallman + + * src/bison.simple (yyparse): Move decl of yylsa before use. + +1991-01-15 Richard Stallman + + * Version 1.14. + + * src/output.c (output_rule_data): Handle NULL in tags[i]. + +1991-01-11 Richard Stallman + + * src/bison.simple: On MSDOS, include malloc.h. + +1990-12-29 David J. MacKenzie + + * src/files.c: Use `mallocate' instead of `xmalloc' so no extra + decl is needed. + +1990-12-19 Richard Stallman + + * src/reader.c (readgram): Alternate YYSTYPE defn for MSDOS. + * src/files.c [MSDOS]: Declare xmalloc. + +1990-12-13 Richard Stallman + + * src/output.c (output_rule_data): Put all symbols in yytname. + + * src/bison.simple (yyparse): Delete extra fprintf arg + when printing a result of reduction. + +1990-12-10 Richard Stallman + + * src/reader.c (packsymbols): Don't declare yylval if pure_parser. + +1990-10-30 Richard Stallman + + * Version 1.12. + + * src/LR0.c (augment_automaton): Fix bugs adding sp2 to chain of + shifts. + +1990-10-23 Richard Stallman + + * src/bison.simple: Don't define alloca if already defined. + +1990-10-21 Richard Stallman + + * src/getopt.c: On VMS, use string.h. + + * src/main.c (main): Return type int. + +1990-09-10 Richard Stallman + + * src/output.c (output_headers): Output macro defs for -p. + + * src/reader.c (readgram): Handle consecutive actions. + + * src/getargs.c (getargs): Rename -a to -p. + * src/files.c (openfiles): Change names used for -b. + +1990-08-27 Richard Stallman + + * src/reduce.c (reduce_grammar_tables): Don't map rlhs of disabled + rule. + +1990-08-26 Richard Stallman + + * src/closure.c (print_firsts, print_fderives): Use BITISSET to + test bits. + +1990-08-23 Richard Stallman + + * src/closure.c (print_firsts): vrowsize => varsetsize. + (print_fderives): rrowsize => rulesetsize. + +1990-08-10 Richard Stallman + + * src/bison.simple (alloca): Don't define if already defined. + (__yy_bcopy): Alternate definition for C++. + +1990-07-11 David J. MacKenzie + + * src/getargs.c (getargs): Mention +yacc in usage message. + +1990-07-10 Richard Stallman + + * src/reader.c (parse_token_decl, copy_action): Set + value_components_used if appropriate. + (readgram): Inhibit output of YYSTYPE definition in that case. + +1990-06-30 Richard Stallman + + * src/output.c (output_parser): Define YYPURE if pure, and not + otherwise. Don't define YYIMPURE. + * src/bison.simple: Adjust conditionals accordingly. + * src/bison.simple (YYLEX): If locations not in use, don't pass + &yylloc. + +1990-06-28 Richard Stallman + + * src/getargs.c (longopts): Add `yacc'. + +1990-06-28 David J. MacKenzie + + * src/getargs.c (getargs): Add long options. + * Makefile: Link with getopt1.o and add getopt1.c and getopt.h to + dist. + + * Move version number and description back into version.c from + Makefile and getargs.c. + * Makefile (dist): Extract version number from version.c. + +1990-06-26 Richard Stallman + + * src/output.c (output): Always call output_gram. + * src/bison.simple (yyparse): Print rhs and lhs symbols of + reduction rule. + +1990-06-21 David J. MacKenzie + + * src/main.c: New global var `program_name' to hold argv[0] for + error messages. + * src/allocate.c, src/files.c, src/getargs.c, src/reader.c: Use + `program_name' in messages instead of hardcoded "bison". + +1990-06-20 David J. MacKenzie + + * Makefile: Specify Bison version here. Add rule to pass it to + version.c. Encode it in distribution directory and tar file names. + * src/version.c: Use version number from Makefile. + * src/getargs.c (getargs): Print additional text that used to be + part of version_string in version.c. Use -V instead of -version + to print Bison version info. Print a usage message and exit if + given an invalid option. + +1990-06-19 Richard Stallman + + * src/bison.simple: Fix a #line. + + * Makefile (INSTALL): New parameter. + (install): Use that. + (CFLAGS): Move definition to top. + +1990-06-17 Richard Stallman + + * src/reader.c (parse_type_decl): Ignore semicolon. + Remove excess % from error messages. + +1990-06-16 Richard Stallman + + * Version 1.11. + + * Makefile (install): Ensure installed files readable. + +Tue Jun 12 12:50:56 EDT 1990 Jay Fenlason + + * src/getargs.c: Declare spec_file_prefix + + * src/lex.c (lex): \a is '\007' instead of '007' + + * src/reader.c: include machine.h + + * src/files.h: Declare extern spec_name_prefix. + + Trivial patch from Thorsten Ohl + +1990-05-31 Richard Stallman + + * Version 1.10. + + * src/bison.simple (YYBACKUP, YYRECOVERING): New macros. + (YYINITDEPTH): This is what used to be YYMAXDEPTH. + (YYMAXDEPTH): This is what used to be YYMAXLIMIT. + If the value is 0, use the default instead. + (yyparse): Return 2 on stack overflow. + +1990-05-30 Richard Stallman + + * src/bison.simple (YYERROR): Jump to new label; don't print error + message. + (yyparse): Define label yyerrlab1. + +1990-05-16 Richard Stallman + + * src/files.c (openfiles): Support -b. + * src/getargs.c (getargs): Likewise. + + * src/reader.c (readgram): Error if too many symbols. + + * src/lex.c (lex): Handle \a. Make error msgs more reliable. + * src/reader.c (read_declarations): Make error msgs more reliable. + +1990-05-13 Richard Stallman + + * Version 1.09. + + * src/reduce.c (reduce_grammar_tables): Fix backward test. + +1990-05-12 Richard Stallman + + * Makefile (bison-dist.*): Rename targets and files to bison.*. + (bison.tar): Make tar file to unpack into subdirectory named `bison'. + +1990-04-30 Richard Stallman + + * src/reduce.c (reduce_grammar_tables): Set rlhs to -1 for useless + rules. + * src/nullable.c (set_nullable): Ignore those rules. + * src/derives.c (set_derives): Likewise. + +1990-04-23 Richard Stallman + + * src/bison.simple (yyparse): Mention rule number as well as line + number. + +1990-03-29 Richard Stallman + + * src/bison.simple (__yy_bcopy): New function. + (yyparse): Use that, not bcopy. + +1990-03-28 Richard Stallman + + * src/print.c (print_actions): Don't alter i and j spuriously when + errp==0. + +1990-03-12 Jim Kingdon + + * src/bison.simple [__GNUC__]: Use builtin_alloca. + +1990-03-07 Richard Stallman + + * Makefile (install): Use mergedir.awk to process bison.simple + for installation. + + * src/bison.simple (yyparse): New feature to include possible valid + tokens in parse error message. + +1990-03-03 Richard Stallman + + * Version 1.08. + +1990-02-26 Jim Kingdon + + * src/print.c (print_actions) + * src/conflicts.c (print_reductions): Change "shift %d" to + "shift, and go to state %d" and "reduce %d" to "reduce using rule %d" + and "goto %d" to "go to state %d". + * src/print.c (print_core): Change "(%d)" to "(rule %d)". + +1990-02-20 Jay Fenlason + + * src/bison.simple: Comment out unused yyresume: label. + +1990-02-09 Jay Fenlason + + * src/bison.simple : surround all declarations and (remaining) + uses of yyls* and yylloc with #ifdef YYLSP_NEEDED This will + significantly cut down on stack usage, and gets rid of + unused-variable msgs from GCC. + +1990-01-31 Richard Stallman + + * src/files.c (done) [VMS]: Don't delete files that weren't used. + [VMS]: Let user override XPFILE and XPFILE1. + +1990-01-03 Richard Stallman + + * Version 1.07. + +1989-12-16 Richard Stallman + + * src/gram.c (dummy): New function. + + * src/reader.c (readgram): Detect error if two consec actions. + +1989-11-15 Richard Stallman + + * src/reduce.c (reduce_grammar_tables): Update rline like other + tables. + + * Makefile (install): Install the man page. + +1989-11-11 Richard Stallman + + * src/output.c (output_rule_data): Write #if YYDEBUG around yyrline. + +1989-10-18 Richard Stallman + + * Version 1.06. + + * src/vmsgetargs.c (getargs): Downcase specified output file name. + +1989-10-13 Richard Stallman + + * src/reader.c (readgram): Warn if there is no default to use for + $$ and one is needed. + +1989-09-29 Richard Stallman + + * Version 1.05. + + * src/vmsgetargs.h (getargs): Process outfile option. + +1989-09-08 Richard Stallman + + * Version 1.04. + + * src/reader.c (parse_union_decl): Count newlines even in + comments. + +1989-09-06 Richard Stallman + + * src/files.c (openfiles): short_base_length was always == + base_length. + +1989-08-24 Richard Stallman + + * Version 1.03. + + * src/files.c (openfiles): Write output into same dir as input, by + default. + +1989-08-23 Jay Fenlason + + * Makefile: Include system.h in bison-dist.tar + +1989-08-15 Richard Stallman + + * version 1.03. + + * src/reader.c (reader): Output LTYPESTR to fdefines + only after reading the grammar. + +1989-08-06 Richard Stallman + + * src/reader.c (read_declarations): Put space before comment + to avoid bug in Green Hills C compiler. + +1989-06-19 Richard Stallman + + * src/allocate.c (xmalloc): New function. + +1989-06-16 Richard Stallman + + * src/build.com: Compile and link reduce.c. + +1989-06-09 Richard Stallman + + * src/reduce.c (reduce_grammar_tables): Adjust start_symbol when + #s change. + +1989-05-27 Richard Stallman + + * src/reader.c (copy_definition, copy_guard): Don't object to + \-newline inside strings. + +1989-05-22 Richard Stallman + + * src/files.c (openfiles): Alternate file names for MSDOS. + (open_extra_files): Likewise. + (done): On MSDOS, unlink temp files here, not in openfiles. + + * src/machine.h (BITS_PER_WORD): 16 on MSDOS. + (MAXTABLE): Now defined in this file. + + * src/system.h: New file includes system-dependent headers. + All relevant .c files include it. + +1989-04-27 Richard Stallman + + * src/version.c: Version 1.01. + +1989-04-18 Randall Smith + + * src/conflicts.c (total_conflicts): Fixed typo in yacc style + output; mention conflicts if > 0. + +1989-04-15 Richard Stallman + + * src/reader.c (packsymbols): Start new symbols after 256. + +1989-04-12 Richard Stallman + + * src/reader.c (reader): Always assign code 256 to `error' token. + Always set `translations' to 1 so this code gets handled. + * src/bison.simple (YYERRCODE): Define it. + +1989-04-11 Richard Stallman + + * src/conflicts.c: If GNU C, use builtin alloca. + + * Makefile (install): Delete parser files before copying them. + +1989-03-30 Richard Stallman + + * src/getargs.c (getargs): Turn off checking of name Bison was + invoked by. + + * Makefile (dist): Include ChangeLog in distrib. + +1989-03-23 Jay Fenlason + + * src/LR0.c src/closure.c src/conflicts.c src/derives.c + src/files.c src/getargs.c src/lalr.c src/lex.c src/main.c + src/nullable.c src/output.c src/print.c src/reader.c src/reduce.c + src/symtab.c src/warshall.c: A first pass at getting gcc -Wall to + shut up. Mostly declared functions as void, etc. + + * src/reduce.c moved 'extern int fixed_outfiles;' into print_notices + where it belongs. + +1989-03-01 Randall Smith + + * src/types.h, src/symtab.h, src/state.h, src/new.h, + src/machine.h, src/lex.h, src/gram.h, src/files.h, src/closure.c, + src/vmsgetargs.c, src/warshall.c, src/symtab.c, src/reduce.c, + src/reader.c, src/print.c, src/output.c, src/nullable.c, + src/main.c, src/lex.c, src/lalr.c, src/gram.c, src/getargs.c, + src/files.c, src/derives.c, src/conflicts.c, src/allocate.c, + src/LR0.c, Makefile, src/bison.simple: Changed copyright notices + to be in accord with the new General Public License. + * COPYING: Made a link to the new copying file. + +1989-02-22 Richard Stallman + + * src/new.h (FREE): Alternate definition for __STDC__ avoids error + if `free' returns void. + +1989-02-21 Richard Stallman + + * src/reader.c (read_declarations): Double a `%' in a format string. + (copy_definition, parse_start_decl, parse_token_decl): Likewise. + (parse_type_decl, parse_union_decl, copy_guard, readgram, get_type). + (copy_action): change a `fatal' to `fatals'. + + * src/lalr.c (map_goto): Initial high-end of binary search was off + by 1. + +1989-02-18 Richard Stallman + + * src/bison.simple [sparc]: Include alloca.h. + +1989-02-15 Richard Stallman + + * src/reader.c (packsymbols): Write decl of yylval into .tab.h file. + +1989-01-28 Richard Stallman + + * src/bison.simple: Avoid comments on `#line' lines. + + * src/reader.c (LTYPESTR): Rearrange to avoid whitespace after + \-newline. + +1989-01-09 Richard Stallman + + * src/conflicts.c (total_conflicts): if -y, use output syntax + POSIX wants. + * src/reduce.c (print_notices): likewise. + + * src/lex.c (lex): Handle \v, and \x hex escapes. + + * src/reader.c (reader): Merge output_ltype into here. Don't + output YYLTYPE definition to .tab.h file unless the @ construct is + used. + + * src/bison.simple: Define YYERROR, YYABORT, YYACCEPT here. + * src/reader.c (output_ltype): Don't output them here. + + * src/bison.simple: YYDEBUG now should be 0 or 1. + * src/output.c (output): For YYDEBUG, output conditional to define it + only if not previously defined. + +1989-01-02 Richard Stallman + + * src/bison.simple (yyparse) [YYPURE]: Add local yynerrs. + (yydebug): Declare global, but don't initialize, regardless of + YYPURE. + (yyparse): Don't declare yydebug here. + +1988-12-22 Richard Stallman + + * src/reduce.c (print_notices): Typo in message. + +1988-12-11 Richard Stallman + + * src/output.c (pack_table): Free only nonzero the elts of froms & + tos. + +1988-12-08 Richard Stallman + + * src/gram.c (rprecsym): New vector indicates the %prec symbol for + a rule. + * src/reader.c (packgram): Allocate it and fill it in. + * src/reduce.c (inaccessable_symbols): Use it to set V1. + * src/reduce.c (print_results): Don't complain about useless token + if it's in V1. + +1988-12-05 Richard Stallman + + * src/machine.h (RESETBIT, BITISSET): New macros. + (SETBIT, WORDSIZE): Change to use BITS_PER_WORD. + + * src/reduce.c: New file, by David Bakin. Reduces the grammar. + * Makefile: Compile it, link it, put it in dist. + + * src/main.c (main): Call reduce_grammar (in reduce.c). + +1988-11-17 Richard Stallman + + * src/conflicts.c: Don't declare alloca if including alloca.h. + + * src/bison.cld: Define qualifiers `nolines', `debug'. + * src/vmsgetargs.c (getargs): Handle them. + + * src/output.c (output_program): Notice `nolinesflag'. + + * src/output.c (output_parser): Simplify logic for -l and #line. + Avoid writing EOF char into output. + +1988-10-12 Richard Stallman + + * Implement `-l' option. + * src/getopt.c: Set flag `nolinesflag'. + * src/reader.c (copy_definition, parse_union_decl, copy_guard, + copy_action) Obey that flag; don't generate #line. + * src/output.c (output_parser): Discard #line's when copying the + parser. + +1988-09-12 Richard Stallman + + * src/reader.c (copy_guard): Fix brace-counting for + brace-surrounded guard. + +1988-09-08 Richard Stallman + + * src/bison.simple: Correct number in #line command. + (yyparse): Call YYABORT instead of YYERROR, due to last change in + output_ltype. + +1988-09-05 Richard Stallman + + * Makefile: New variable LIBS. Alternatives for USG. + * src/conflicts.c [USG]: Define bcopy. + * src/symtab.c [USG]: Include string.h instead of strings.h. + + * src/conflicts.c [sparc]: Include alloca.h. + +1988-08-02 Richard Stallman + + * src/reader.c (parse_token_decl): Ignore commas. + +1988-06-25 Richard Stallman + + * src/reader.c (output_ltype): Make YYERROR yacc-compatible (like + YYFAIL). + +1988-06-24 Richard Stallman + + * src/getargs.c (getargs): -t sets debugflag. + Eliminate upper case duplicate options. + * src/output.c (output): If debugflag, output `#define YYDEBUG'. + +1988-05-26 Richard Stallman + + * src/allocate.c (mallocate): New name for `allocate' (which loses + in VMS). Calls changed in LR0.c, conflicts.c, symtab.c, new.h. + + * src/getargs.c (getargs): If argv[0] is "yacc", set fixed_outfiles. + +1988-05-17 Richard Stallman + + * src/conflicts.c: Declare alloca. + * src/reader.c: Declare realloc. + * src/warshall.c (TC): Fix one arithmetic op that was omitted last + time. + +1988-05-05 Richard Stallman + + * src/bison.simple: Conditionalize most refs to yylsp on + YYLSP_NEEDED. + * src/reader.c (copy_guard, copy_action): Notice if `@' is used. + (reader): If it was, output `#define YYLSP_NEEDED'. + +1988-04-18 Richard Stallman + + * src/bison.simple: New variable yynerr counts calls to yyerror. + + * src/lex.c (lex, case '='): Update lineno when skipping a newline. + + * src/reader.c (parse_expect_decl): ungetc the char that ends the + number; don't read any further. This handles multi-line comments + right and avoids incorrect lineno. + + * src/reader.c: Delete duplicate decl of symval. + + * src/warshall.c (RTC, TC): Cast ptrs to char *, not unsigned, for + arith. diff --git a/PACKAGING b/PACKAGING new file mode 100644 index 0000000..c549b44 --- /dev/null +++ b/PACKAGING @@ -0,0 +1,54 @@ +Packaging hints for binary package distributors +=============================================== + +Although the source of the bison package comes as a single package, +in distributions of binary packages the installed files should +be split into two packages: + + bison-runtime + Contents: Runtime libraries and programs. + Audience: Anyone who wants to run internationalized programs + that contain Bison-generated parsers. + + bison + Contents: Tools and documentation for developers that use Bison. + Audience: Anyone who wants to develop programs that use parsers. + Dependencies: requires bison-runtime. + +The 'bison-runtime' binary package is much smaller than the 'bison' +binary package. It should be included in any distribution that +contains localized programs that use the diagnostics contained in +Bison-generated parsers. + +If you want to install both packages at the same time, you simply do +at the toplevel directory: + + ./configure + make + make install + +After installation, the file + + $prefix/share/locale/*/LC_MESSAGES/bison-runtime.mo + +belongs to the bison-runtime package; all other installed files belong +to the bison package. + +----- + +Copyright (C) 2002, 2005 Free Software Foundation, Inc. + +This file is part of Bison, the GNU Compiler Compiler. + +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 . diff --git a/README b/README new file mode 100644 index 0000000..498671f --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +This package contains the GNU Bison parser generator. + +See the file INSTALL for generic compilation and installation instructions. + +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". + +Bison requires GNU m4 1.4.6 or later. See: + +ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz + +Bison can work with pre-1.4.6 distributions of GNU m4 if they are +sufficiently patched, but if you encounter a bug with an older +distribution and report a bug we will probably suggest that you +upgrade to 1.4.6 as the first step in trying to fix it. + +Please send bug reports to . Please include the +version number from `bison --version', and a complete, self-contained +test case in each bug report. + +If you have questions about using Bison and the documentation does +not answer them, please send mail to . + +----- + +Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005, 2008 Free Software Foundation, Inc. + +This file is part of Bison, the GNU Compiler Compiler. + +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 . diff --git a/README-alpha b/README-alpha new file mode 100644 index 0000000..550ca32 --- /dev/null +++ b/README-alpha @@ -0,0 +1,30 @@ +-*- text -*- + +This is a test release of this package. Using it more or less +implicitly signs you up to help us find whatever problems you report. + +The documentation still needs more work. Suggestions welcome. +Patches even more welcome. + +Please send comments and problem reports about this test release to +. This program will get better only if you report +the problems you encounter. + +----- + +Copyright (C) 2002, 2004 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 . diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..40291c7 --- /dev/null +++ b/THANKS @@ -0,0 +1,104 @@ +Bison was originally written by Robert Corbett. It would not be what +it is today without the invaluable help of these people: + +Airy Andre Airy.Andre@edf.fr +Akim Demaille akim@freefriends.org +Albert Chin-A-Young china@thewrittenword.com +Alexander Belopolsky alexb@rentec.com +Alexandre Duret-Lutz adl@src.lip6.fr +Andreas Schwab schwab@suse.de +Andrew Suffield asuffield@users.sourceforge.net +Anthony Heading ajrh@ajrh.net +Arnold Robbins arnold@skeeve.com +Art Haas ahaas@neosoft.com +Baron Schwartz baron@sequent.org +Benoit Perrot benoit.perrot@epita.fr +Bert Deknuydt Bert.Deknuydt@esat.kuleuven.ac.be +Bob Rossi bob@brasko.net +Brandon Lucia blucia@gmail.com +Bruce Lilly blilly@erols.com +Bruno Haible bruno@clisp.org +Charles-Henri de Boysson de-boy_c@epita.fr +Christian Burger cburger@sunysb.edu +Cris Bailiff c.bailiff+bison@awayweb.com +Cris van Pelt cris@amf03054.office.wxs.nl +Csaba Raduly csaba_22@yahoo.co.uk +Daniel Hagerty hag@gnu.org +David J. MacKenzie djm@gnu.org +Derek M. Jones derek@knosof.co.uk +Di-an Jan dianj@freeshell.org +Dick Streefland dick.streefland@altium.nl +Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de +Eric Blake ebb9@byu.net +Evgeny Stambulchik fnevgeny@plasma-gate.weizmann.ac.il +Fabrice Bauzac noon@cote-dazur.com +Florian Krohm florian@edamail.fishkill.ibm.com +Frank Heckenbach frank@g-n-u.de +Frans Englich frans.englich@telia.com +Georg Sauthoff gsauthof@TechFak.Uni-Bielefeld.DE +Goran Uddeborg goeran@uddeborg.se +Guido Trentalancia trentalg@aston.ac.uk +H. Merijn Brand h.m.brand@hccnet.nl +Hans Aberg haberg@matematik.su.se +Jan Nieuwenhuizen janneke@gnu.org +Jesse Thilo jthilo@gnu.org +Jim Kent jkent@arch.sel.sony.com +Jim Meyering jim@meyering.net +Joel E. Denny jdenny@ces.clemson.edu +Juan Manuel Guerrero juan.guerrero@gmx.de +Kees Zeelenberg kzlg@users.sourceforge.net +Keith Browne kbrowne@legato.com +Laurent Mascherpa laurent.mascherpa@epita.fr +Magnus Fromreide magfr@lysator.liu.se +Marc Autret autret_m@epita.fr +Martin Mokrejs mmokrejs@natur.cuni.cz +Martin Nylin martin.nylin@linuxmail.org +Matt Kraai kraai@alumni.cmu.edu +Matt Rosing rosing@peakfive.com +Michael Hayes m.hayes@elec.canterbury.ac.nz +Mickael Labau labau_m@epita.fr +Mike Castle dalgoda@ix.netcom.com +Neil Booth NeilB@earthling.net +Nelson H. F. Beebe beebe@math.utah.edu +Nicolas Burrus nicolas.burrus@epita.fr +Nicolas Tisserand nicolas.tisserand@epita.fr +Noah Friedman friedman@gnu.org +Oleg Smolsky oleg.smolsky@pacific-simulators.co.nz +Paolo Bonzini bonzini@gnu.org +Pascal Bart pascal.bart@epita.fr +Paul Eggert eggert@cs.ucla.edu +Paul Hilfinger Hilfinger@CS.Berkeley.EDU +Per Allansson per@appgate.com +Peter Fales psfales@lucent.com +Peter Hamorsky hamo@upjs.sk +Piotr Gackiewicz gacek@intertel.com.pl +Quoc Peyrot chojin@lrde.epita.fr +R Blake blakers@mac.com +Raja R Harinath harinath@cs.umn.edu +Richard Stallman rms@gnu.org +Robert Anisko anisko_r@epita.fr +Satya Kiran Popuri satyakiran@gmail.com +Sebastien Fricker sebastien.fricker@gmail.com +Sebastian Setzer sebastian.setzer.ext@siemens.com +Sergei Steshenko sergstesh@yahoo.com +Shura debil_urod@ngs.ru +Steve Murphy murf@parsetree.com +Tim Josling tej@melbpc.org.au +Tim Van Holder tim.van.holder@pandora.be +Tom Lane tgl@sss.pgh.pa.us +Tom Tromey tromey@cygnus.com +Tommy Nordgren tommy.nordgren@chello.se +Troy A. Johnson troyj@ecn.purdue.edu +Tys Lefering twlevo@xs4all.nl +Vin Shelton acs@alumni.princeton.edu +Wayne Green wayne@infosavvy.com +Wolfram Wagner ww@mpi-sb.mpg.de +Wwp subscript@free.fr +Zack Weinberg zack@codesourcery.com + +Many people are not named here because we lost track of them. We +thank them! Please, help us keeping this list up to date. + +Local Variables: +mode: text +End: diff --git a/TODO b/TODO new file mode 100644 index 0000000..b2bca35 --- /dev/null +++ b/TODO @@ -0,0 +1,309 @@ +-*- outline -*- + +* Header guards + +From Franc,ois: should we keep the directory part in the CPP guard? + + +* Yacc.c: CPP Macros + +Do some people use YYPURE, YYLSP_NEEDED like we do in the test suite? +They should not: it is not documented. But if they need to, let's +find something clean (not like YYLSP_NEEDED...). + + +* Installation + +* Documentation +Before releasing, make sure the documentation ("Understanding your +parser") refers to the current `output' format. + +* lalr1.cc +** vector +Move to using vector, drop stack.hh. + +** I18n +Catch up with yacc.c. + +* Report + +** GLR +How would Paul like to display the conflicted actions? In particular, +what when two reductions are possible on a given lookahead token, but one is +part of $default. Should we make the two reductions explicit, or just +keep $default? See the following point. + +** Disabled Reductions +See `tests/conflicts.at (Defaulted Conflicted Reduction)', and decide +what we want to do. + +** Documentation +Extend with error productions. The hard part will probably be finding +the right rule so that a single state does not exhibit too many yet +undocumented ``features''. Maybe an empty action ought to be +presented too. Shall we try to make a single grammar with all these +features, or should we have several very small grammars? + +** --report=conflict-path +Provide better assistance for understanding the conflicts by providing +a sample text exhibiting the (LALR) ambiguity. See the paper from +DeRemer and Penello: they already provide the algorithm. + +** Statically check for potential ambiguities in GLR grammars. See + for an approach. + + +* Extensions + +** Labeling the symbols +Have a look at the Lemon parser generator: instead of $1, $2 etc. they +can name the values. This is much more pleasant. For instance: + + exp (res): exp (a) '+' exp (b) { $res = $a + $b; }; + +I love this. I have been bitten too often by the removal of the +symbol, and forgetting to shift all the $n to $n-1. If you are +unlucky, it compiles... + +But instead of using $a etc., we can use regular variables. And +instead of using (), I propose to use `:' (again). Paul suggests +supporting `->' in addition to `:' to separate LHS and RHS. In other +words: + + r:exp -> a:exp '+' b:exp { r = a + b; }; + +That requires an significant improvement of the grammar parser. Using +GLR would be nice. It also requires that Bison know the type of the +symbols (which will be useful for %include anyway). So we have some +time before... + +Note that there remains the problem of locations: `@r'? + + +** $-1 +We should find a means to provide an access to values deep in the +stack. For instance, instead of + + baz: qux { $$ = $-1 + $0 + $1; } + +we should be able to have: + + foo($foo) bar($bar) baz($bar): qux($qux) { $baz = $foo + $bar + $qux; } + +Or something like this. + +** %if and the like +It should be possible to have %if/%else/%endif. The implementation is +not clear: should it be lexical or syntactic. Vadim Maslow thinks it +must be in the scanner: we must not parse what is in a switched off +part of %if. Akim Demaille thinks it should be in the parser, so as +to avoid falling into another CPP mistake. + +** -D, --define-muscle NAME=VALUE +To define muscles via cli. Or maybe support directly NAME=VALUE? + +** XML Output +There are couple of available extensions of Bison targeting some XML +output. Some day we should consider including them. One issue is +that they seem to be quite orthogonal to the parsing technique, and +seem to depend mostly on the possibility to have some code triggered +for each reduction. As a matter of fact, such hooks could also be +used to generate the yydebug traces. Some generic scheme probably +exists in there. + +XML output for GNU Bison and gcc + http://www.cs.may.ie/~jpower/Research/bisonXML/ + +XML output for GNU Bison + http://yaxx.sourceforge.net/ + +* Unit rules +Maybe we could expand unit rules, i.e., transform + + exp: arith | bool; + arith: exp '+' exp; + bool: exp '&' exp; + +into + + exp: exp '+' exp | exp '&' exp; + +when there are no actions. This can significantly speed up some +grammars. I can't find the papers. In particular the book `LR +parsing: Theory and Practice' is impossible to find, but according to +`Parsing Techniques: a Practical Guide', it includes information about +this issue. Does anybody have it? + + + +* Documentation + +** History/Bibliography +Some history of Bison and some bibliography would be most welcome. +Are there any Texinfo standards for bibliography? + + + +* Java, Fortran, etc. + + +* Coding system independence +Paul notes: + + Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is + 255). It also assumes that the 8-bit character encoding is + the same for the invocation of 'bison' as it is for the + invocation of 'cc', but this is not necessarily true when + people run bison on an ASCII host and then use cc on an EBCDIC + host. I don't think these topics are worth our time + addressing (unless we find a gung-ho volunteer for EBCDIC or + PDP-10 ports :-) but they should probably be documented + somewhere. + + More importantly, Bison does not currently allow NUL bytes in + tokens, either via escapes (e.g., "x\0y") or via a NUL byte in + the source code. This should get fixed. + +* --graph +Show reductions. + +* Broken options ? +** %token-table +** Skeleton strategy +Must we keep %token-table? + +* src/print_graph.c +Find the best graph parameters. + +* BTYacc +See if we can integrate backtracking in Bison. Charles-Henri de +Boysson is working on this, and already has some +results. Vadim Maslow, the maintainer of BTYacc was contacted, and we +stay in touch with him. Adjusting the Bison grammar parser will be +needed to support some extra BTYacc features. This is less urgent. + +** Keeping the conflicted actions +First, analyze the differences between byacc and btyacc (I'm referring +to the executables). Find where the conflicts are preserved. + +** Compare with the GLR tables +See how isomorphic the way BTYacc and the way the GLR adjustments in +Bison are compatible. *As much as possible* one should try to use the +same implementation in the Bison executables. I insist: it should be +very feasible to use the very same conflict tables. + +** Adjust the skeletons +Import the skeletons for C and C++. + +** Improve the skeletons +Have them support yysymprint, yydestruct and so forth. + + +* Precedence + +** Partial order +It is unfortunate that there is a total order for precedence. It +makes it impossible to have modular precedence information. We should +move to partial orders (sounds like series/parallel orders to me). + +** Correlation b/w precedence and associativity +Also, I fail to understand why we have to assign the same +associativity to operators with the same precedence. For instance, +why can't I decide that the precedence of * and / is the same, but the +latter is nonassoc? + +If there is really no profound motivation, we should find a new syntax +to allow specifying this. + +** RR conflicts +See if we can use precedence between rules to solve RR conflicts. See +what POSIX says. + + +* $undefined +From Hans: +- If the Bison generated parser experiences an undefined number in the +character range, that character is written out in diagnostic messages, an +addition to the $undefined value. + +Suggest: Change the name $undefined to undefined; looks better in outputs. + + +* Default Action +From Hans: +- For use with my C++ parser, I transported the "switch (yyn)" statement +that Bison writes to the bison.simple skeleton file. This way, I can remove +the current default rule $$ = $1 implementation, which causes a double +assignment to $$ which may not be OK under C++, replacing it with a +"default:" part within the switch statement. + +Note that the default rule $$ = $1, when typed, is perfectly OK under C, +but in the C++ implementation I made, this rule is different from +$$ = $1. I therefore think that one should implement +a Bison option where every typed default rule is explicitly written out +(same typed ruled can of course be grouped together). + +Note: Robert Anisko handles this. He knows how to do it. + + +* Warnings +It would be nice to have warning support. See how Autoconf handles +them, it is fairly well described there. It would be very nice to +implement this in such a way that other programs could use +lib/warnings.[ch]. + +Don't work on this without first announcing you do, as I already have +thought about it, and know many of the components that can be used to +implement it. + + +* Pre and post actions. +From: Florian Krohm +Subject: YYACT_EPILOGUE +To: bug-bison@gnu.org +X-Sent: 1 week, 4 days, 14 hours, 38 minutes, 11 seconds ago + +The other day I had the need for explicitly building the parse tree. I +used %locations for that and defined YYLLOC_DEFAULT to call a function +that returns the tree node for the production. Easy. But I also needed +to assign the S-attribute to the tree node. That cannot be done in +YYLLOC_DEFAULT, because it is invoked before the action is executed. +The way I solved this was to define a macro YYACT_EPILOGUE that would +be invoked after the action. For reasons of symmetry I also added +YYACT_PROLOGUE. Although I had no use for that I can envision how it +might come in handy for debugging purposes. +All is needed is to add + +#if YYLSP_NEEDED + YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen)); +#else + YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen); +#endif + +at the proper place to bison.simple. Ditto for YYACT_PROLOGUE. + +I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE +to bison. If you're interested, I'll work on a patch. + +* Better graphics +Equip the parser with a means to create the (visual) parse tree. + +----- + +Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, +Inc. + +This file is part of Bison, the GNU Compiler Compiler. + +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 . diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..cf71ab0 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1023 @@ +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.62],, +[m4_warning([this file was generated for autoconf 2.62. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# codeset.m4 serial 2 (gettext-0.16) +dnl Copyright (C) 2000-2002, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET); return !cs;], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +]) + +# glibc21.m4 serial 3 +dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Test for the GNU C Library, version 2.1 or newer. +# From Bruno Haible. + +AC_DEFUN([gl_GLIBC21], + [ + AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, + ac_cv_gnu_library_2_1, + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + ], + ac_cv_gnu_library_2_1=yes, + ac_cv_gnu_library_2_1=no) + ] + ) + AC_SUBST(GLIBC21) + GLIBC21="$ac_cv_gnu_library_2_1" + ] +) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 13 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +dnl Make sure AC_PROG_CC is never called again, or it will override our +dnl setting of CC. +m4_define([AC_PROG_CC], + [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/argmatch.m4]) +m4_include([m4/bison-i18n.m4]) +m4_include([m4/c-working.m4]) +m4_include([m4/config-h.m4]) +m4_include([m4/cxx.m4]) +m4_include([m4/dirname.m4]) +m4_include([m4/dmalloc.m4]) +m4_include([m4/dos.m4]) +m4_include([m4/double-slash-root.m4]) +m4_include([m4/environ.m4]) +m4_include([m4/errno_h.m4]) +m4_include([m4/error.m4]) +m4_include([m4/exitfail.m4]) +m4_include([m4/extensions.m4]) +m4_include([m4/getopt.m4]) +m4_include([m4/gettext.m4]) +m4_include([m4/gnulib-common.m4]) +m4_include([m4/gnulib-comp.m4]) +m4_include([m4/hash.m4]) +m4_include([m4/iconv.m4]) +m4_include([m4/include_next.m4]) +m4_include([m4/inline.m4]) +m4_include([m4/intlmacosx.m4]) +m4_include([m4/inttypes-pri.m4]) +m4_include([m4/inttypes.m4]) +m4_include([m4/javacomp.m4]) +m4_include([m4/javaexec.m4]) +m4_include([m4/lib-ld.m4]) +m4_include([m4/lib-link.m4]) +m4_include([m4/lib-prefix.m4]) +m4_include([m4/localcharset.m4]) +m4_include([m4/longlong.m4]) +m4_include([m4/m4.m4]) +m4_include([m4/malloc.m4]) +m4_include([m4/mbrtowc.m4]) +m4_include([m4/mbstate_t.m4]) +m4_include([m4/mbswidth.m4]) +m4_include([m4/nls.m4]) +m4_include([m4/po.m4]) +m4_include([m4/progtest.m4]) +m4_include([m4/quote.m4]) +m4_include([m4/quotearg.m4]) +m4_include([m4/setenv.m4]) +m4_include([m4/stdbool.m4]) +m4_include([m4/stdint.m4]) +m4_include([m4/stdio-safer.m4]) +m4_include([m4/stdlib_h.m4]) +m4_include([m4/stpcpy.m4]) +m4_include([m4/strerror.m4]) +m4_include([m4/string_h.m4]) +m4_include([m4/strndup.m4]) +m4_include([m4/strnlen.m4]) +m4_include([m4/strtol.m4]) +m4_include([m4/strtoul.m4]) +m4_include([m4/strverscmp.m4]) +m4_include([m4/subpipe.m4]) +m4_include([m4/timevar.m4]) +m4_include([m4/unistd-safer.m4]) +m4_include([m4/unistd_h.m4]) +m4_include([m4/unlocked-io.m4]) +m4_include([m4/warnings.m4]) +m4_include([m4/wchar.m4]) +m4_include([m4/wchar_t.m4]) +m4_include([m4/wctype.m4]) +m4_include([m4/wcwidth.m4]) +m4_include([m4/wint_t.m4]) +m4_include([m4/xalloc.m4]) +m4_include([m4/xstrndup.m4]) diff --git a/build-aux/Makefile.am b/build-aux/Makefile.am new file mode 100644 index 0000000..2facd9d --- /dev/null +++ b/build-aux/Makefile.am @@ -0,0 +1,2 @@ +## Process this file with automake to produce Makefile.in -*-Makefile-*- +EXTRA_DIST = prev-version.txt cross-options.pl diff --git a/build-aux/Makefile.in b/build-aux/Makefile.in new file mode 100644 index 0000000..0529a1c --- /dev/null +++ b/build-aux/Makefile.in @@ -0,0 +1,615 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = build-aux +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in compile \ + config.guess config.rpath config.sub depcomp install-sh \ + mdate-sh missing texinfo.tex ylwrap +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = prev-version.txt cross-options.pl +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits build-aux/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits build-aux/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/build-aux/announce-gen b/build-aux/announce-gen new file mode 100755 index 0000000..d1a4b25 --- /dev/null +++ b/build-aux/announce-gen @@ -0,0 +1,520 @@ +#!/usr/bin/perl -w +# Generate a release announcement message. + +my $VERSION = '2008-12-02 16:28'; # UTC +# The definition above must lie within the first 8 lines in order +# for the Emacs time-stamp write hook (at end) to update it. +# If you change this file with Emacs, please let the write hook +# do its job. Otherwise, update this string manually. + +# Copyright (C) 2002-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 . + +# Written by Jim Meyering + +use strict; + +use Getopt::Long; +use Digest::MD5; +use Digest::SHA1; +use POSIX qw(strftime); + +(my $ME = $0) =~ s|.*/||; + +my %valid_release_types = map {$_ => 1} qw (alpha beta major); + +END +{ + # Nobody ever checks the status of print()s. That's okay, because + # if any do fail, we're guaranteed to get an indicator when we close() + # the filehandle. + # + # Close stdout now, and if there were no errors, return happy status. + # If stdout has already been closed by the script, though, do nothing. + defined fileno STDOUT + or return; + close STDOUT + and return; + + # Errors closing stdout. Indicate that, and hope stderr is OK. + warn "$ME: closing standard output: $!\n"; + + # Don't be so arrogant as to assume that we're the first END handler + # defined, and thus the last one invoked. There may be others yet + # to come. $? will be passed on to them, and to the final _exit(). + # + # If it isn't already an error, make it one (and if it _is_ an error, + # preserve the value: it might be important). + $? ||= 1; +} + +sub usage ($) +{ + my ($exit_code) = @_; + my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); + if ($exit_code != 0) + { + print $STREAM "Try `$ME --help' for more information.\n"; + } + else + { + my @types = sort keys %valid_release_types; + print $STREAM < = C + +Compute the sizes of the C<@file> and return them as a hash. Return +C if one of the computation failed. + +=cut + +sub sizes (@) +{ + my (@file) = @_; + + my $fail = 0; + my %res; + foreach my $f (@file) + { + my $cmd = "du --human $f"; + my $t = `$cmd`; + # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS + $@ + and (warn "$ME: command failed: `$cmd'\n"), $fail = 1; + chomp $t; + $t =~ s/^([\d.]+[MkK]).*/${1}B/; + $res{$f} = $t; + } + return $fail ? undef : %res; +} + +=item C dedicated to the list of <@file>, which +sizes are stored in C<%size>, and which are available from the C<@url>. + +=cut + +sub print_locations ($\@\%@) +{ + my ($title, $url, $size, @file) = @_; + print "Here are the $title:\n"; + foreach my $url (@{$url}) + { + for my $file (@file) + { + print " $url/$file"; + print " (", $$size{$file}, ")" + if exists $$size{$file}; + print "\n"; + } + } + print "\n"; +} + +=item C. + +=cut + +sub print_checksums (@) +{ + my (@file) = @_; + + print "Here are the MD5 and SHA1 checksums:\n"; + print "\n"; + + foreach my $meth (qw (md5 sha1)) + { + foreach my $f (@file) + { + open IN, '<', $f + or die "$ME: $f: cannot open for reading: $!\n"; + binmode IN; + my $dig = + ($meth eq 'md5' + ? Digest::MD5->new->addfile(*IN)->hexdigest + : Digest::SHA1->new->addfile(*IN)->hexdigest); + close IN; + print "$dig $f\n"; + } + } + + +} + +=item C addressing changes +between versions C<$prev_version> and C<$curr_version>. + +=cut + +sub print_news_deltas ($$$) +{ + my ($news_file, $prev_version, $curr_version) = @_; + + print "\n$news_file\n\n"; + + # Print all lines from $news_file, starting with the first one + # that mentions $curr_version up to but not including + # the first occurrence of $prev_version. + my $in_items; + + my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/; + + open NEWS, '<', $news_file + or die "$ME: $news_file: cannot open for reading: $!\n"; + while (defined (my $line = )) + { + if ( ! $in_items) + { + # Match lines like these: + # * Major changes in release 5.0.1: + # * Noteworthy changes in release 6.6 (2006-11-22) [stable] + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o + or next; + $in_items = 1; + print $line; + } + else + { + # This regexp must not match version numbers in NEWS items. + # For example, they might well say `introduced in 4.5.5', + # and we don't want that to match. + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o + and last; + print $line; + } + } + close NEWS; + + $in_items + or die "$ME: $news_file: no matching lines for `$curr_version'\n"; +} + +sub print_changelog_deltas ($$) +{ + my ($package_name, $prev_version) = @_; + + # Print new ChangeLog entries. + + # First find all CVS-controlled ChangeLog files. + use File::Find; + my @changelog; + find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS' + and push @changelog, $File::Find::name}}, + '.'); + + # If there are no ChangeLog files, we're done. + @changelog + or return; + my %changelog = map {$_ => 1} @changelog; + + # Reorder the list of files so that if there are ChangeLog + # files in the specified directories, they're listed first, + # in this order: + my @dir = qw ( . src lib m4 config doc ); + + # A typical @changelog array might look like this: + # ./ChangeLog + # ./po/ChangeLog + # ./m4/ChangeLog + # ./lib/ChangeLog + # ./doc/ChangeLog + # ./config/ChangeLog + my @reordered; + foreach my $d (@dir) + { + my $dot_slash = $d eq '.' ? $d : "./$d"; + my $target = "$dot_slash/ChangeLog"; + delete $changelog{$target} + and push @reordered, $target; + } + + # Append any remaining ChangeLog files. + push @reordered, sort keys %changelog; + + # Remove leading `./'. + @reordered = map { s!^\./!!; $_ } @reordered; + + print "\nChangeLog entries:\n\n"; + # print join ("\n", @reordered), "\n"; + + $prev_version =~ s/\./_/g; + my $prev_cvs_tag = "\U$package_name\E-$prev_version"; + + my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered"; + open DIFF, '-|', $cmd + or die "$ME: cannot run `$cmd': $!\n"; + # Print two types of lines, making minor changes: + # Lines starting with `+++ ', e.g., + # +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247 + # and those starting with `+'. + # Don't print the others. + my $prev_printed_line_empty = 1; + while (defined (my $line = )) + { + if ($line =~ /^\+\+\+ /) + { + my $separator = "*"x70 ."\n"; + $line =~ s///; + $line =~ s/\s.*//; + $prev_printed_line_empty + or print "\n"; + print $separator, $line, $separator; + } + elsif ($line =~ /^\+/) + { + $line =~ s///; + print $line; + $prev_printed_line_empty = ($line =~ /^$/); + } + } + close DIFF; + + # The exit code should be 1. + # Allow in case there are no modified ChangeLog entries. + $? == 256 || $? == 128 + or warn "$ME: warning: `cmd' had unexpected exit code or signal ($?)\n"; +} + +sub get_tool_versions ($$) +{ + my ($tool_list, $gnulib_version) = @_; + @$tool_list + or return (); + + my $fail; + my @tool_version_pair; + foreach my $t (@$tool_list) + { + if ($t eq 'gnulib') + { + push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; + next; + } + # Assume that the last "word" on the first line of + # `tool --version` output is the version string. + my ($first_line, undef) = split ("\n", `$t --version`); + if ($first_line =~ /.* (\d[\w.-]+)$/) + { + $t = ucfirst $t; + push @tool_version_pair, "$t $1"; + } + else + { + defined $first_line + and $first_line = ''; + warn "$ME: $t: unexpected --version output\n:$first_line"; + $fail = 1; + } + } + + $fail + and exit 1; + + return @tool_version_pair; +} + +{ + # Neutralize the locale, so that, for instance, "du" does not + # issue "1,2" instead of "1.2", what confuses our regexps. + $ENV{LC_ALL} = "C"; + + my $release_type; + my $package_name; + my $prev_version; + my $curr_version; + my $gpg_key_id; + my @url_dir_list; + my @news_file; + my $bootstrap_tools; + my $gnulib_version; + + GetOptions + ( + 'release-type=s' => \$release_type, + 'package-name=s' => \$package_name, + 'previous-version=s' => \$prev_version, + 'current-version=s' => \$curr_version, + 'gpg-key-id=s' => \$gpg_key_id, + 'url-directory=s' => \@url_dir_list, + 'news=s' => \@news_file, + 'bootstrap-tools=s' => \$bootstrap_tools, + 'gnulib-version=s' => \$gnulib_version, + + help => sub { usage 0 }, + version => sub { print "$ME version $VERSION\n"; exit }, + ) or usage 1; + + my $fail = 0; + # Ensure that sure each required option is specified. + $release_type + or (warn "$ME: release type not specified\n"), $fail = 1; + $package_name + or (warn "$ME: package name not specified\n"), $fail = 1; + $prev_version + or (warn "$ME: previous version string not specified\n"), $fail = 1; + $curr_version + or (warn "$ME: current version string not specified\n"), $fail = 1; + $gpg_key_id + or (warn "$ME: GnuPG key ID not specified\n"), $fail = 1; + @url_dir_list + or (warn "$ME: URL directory name(s) not specified\n"), $fail = 1; + + my @tool_list = split ',', $bootstrap_tools; + + grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version + and (warn "$ME: when specifying gnulib as a tool, you must also specify\n" + . "--gnulib-version=V, where V is the result of running git describe\n" + . "in the gnulib source directory.\n"), $fail = 1; + + exists $valid_release_types{$release_type} + or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1; + + @ARGV + and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"), + $fail = 1; + $fail + and usage 1; + + my $my_distdir = "$package_name-$curr_version"; + my $tgz = "$my_distdir.tar.gz"; + my $tbz = "$my_distdir.tar.bz2"; + my $lzma = "$my_distdir.tar.lzma"; + my $xz = "$my_distdir.tar.xz"; + + my $xd = "$package_name-$prev_version-$curr_version.xdelta"; + + my @tarballs = grep {-f $_} ($tgz, $tbz, $lzma, $xz); + @tarballs + or die "$ME: none of $tgz, $tbz, $lzma or $xz were found\n"; + my @sizable = @tarballs; + -f $xd + and push @sizable, $xd; + my %size = sizes (@sizable); + %size + or exit 1; + + # The markup is escaped as <\# so that when this script is sent by + # mail (or part of a diff), Gnus is not triggered. + print < + +FIXME: put comments here + +EOF + + print_locations ("compressed sources", @url_dir_list, %size, @tarballs); + -f $xd + and print_locations ("xdelta diffs (useful? if so, " + . "please tell bug-gnulib\@gnu.org)", + @url_dir_list, %size, $xd); + my @sig_files = map { "$_.sig" } @tarballs; + print_locations ("GPG detached signatures[*]", @url_dir_list, %size, + @sig_files); + + print_checksums (@sizable); + + print <. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file `INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; +esac + +ofile= +cfile= +eat= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/build-aux/config.guess b/build-aux/config.guess new file mode 100755 index 0000000..c466aa7 --- /dev/null +++ b/build-aux/config.guess @@ -0,0 +1,1544 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-12-11' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. Note that the full path to + # /usr/bin/echo is necessary to work around the shell builtins for + # echo that do not handle newlines. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if /usr/bin/echo '\n#ifdef __amd64\nIS_64BIT_ARCH\n#endif' | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd | genuineintel) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build-aux/config.rpath b/build-aux/config.rpath new file mode 100755 index 0000000..85c2f20 --- /dev/null +++ b/build-aux/config.rpath @@ -0,0 +1,672 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2008 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's _LT_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + darwin*) + case $cc_basename in + xlc*) + wl='-Wl,' + ;; + esac + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + newsos6) + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + ecc*) + wl='-Wl,' + ;; + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + pgcc | pgf77 | pgf90) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we cannot use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if test "$GCC" = yes ; then + : + else + case $cc_basename in + xlc*) + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix[4-9]*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + library_names_spec='$libname.a' + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32* | cegcc*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd1*) + ;; + freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + nto-qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build-aux/cross-options.pl b/build-aux/cross-options.pl new file mode 100755 index 0000000..31733e7 --- /dev/null +++ b/build-aux/cross-options.pl @@ -0,0 +1,37 @@ +#! /usr/bin/env perl + +use warnings; +use 5.005; +use strict; + +my %option; +while (<>) +{ + if (/^\s* # Initial spaces. + (?:(-\w),\s+)? # $1: Possible short option. + (--[-\w]+) # $2: Long option. + (\[?) # $3: '[' iff the argument is optional. + (?:=([-\w]+))? # $4: Possible argument name. + /x) + { + my ($short, $long, $opt, $arg) = ($1, $2, $3, $4); + $short = defined $short ? '@option{' . $short . '}' : ''; + if ($arg) + { + $arg =~ s/^=//; + $arg = '@var{' . lc ($arg) . '}'; + $arg = '[' . $arg . ']' + if $opt eq '['; + $option{"$long=$arg"} = $short ? "$short $arg" : ''; + } + else + { + $option{"$long"} = "$short"; + } + } +} + +foreach my $long (sort keys %option) +{ + printf "\@item %-40s \@tab %s\n", '@option{' . $long . '}', $option{$long}; +} diff --git a/build-aux/depcomp b/build-aux/depcomp new file mode 100755 index 0000000..0f2bf43 --- /dev/null +++ b/build-aux/depcomp @@ -0,0 +1,587 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2007-03-29.01 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 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 . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen new file mode 100755 index 0000000..710870c --- /dev/null +++ b/build-aux/git-version-gen @@ -0,0 +1,152 @@ +#!/bin/sh +# Print a version string. +scriptversion=2008-04-08.07 + +# Copyright (C) 2007-2008 Free Software Foundation +# +# 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/. +# It may be run two ways: +# - from a git repository in which the "git describe" command below +# produces useful output (thus requiring at least one signed tag) +# - from a non-git-repo directory containing a .tarball-version file, which +# presumes this script is invoked like "./git-version-gen .tarball-version". + +# In order to use intra-version strings in your project, you will need two +# separate generated version string files: +# +# .tarball-version - present only in a distribution tarball, and not in +# a checked-out repository. Created with contents that were learned at +# the last time autoconf was run, and used by git-version-gen. Must not +# be present in either $(srcdir) or $(builddir) for git-version-gen to +# give accurate answers during normal development with a checked out tree, +# but must be present in a tarball when there is no version control system. +# Therefore, it cannot be used in any dependencies. GNUmakefile has +# hooks to force a reconfigure at distribution time to get the value +# correct, without penalizing normal development with extra reconfigures. +# +# .version - present in a checked-out repository and in a distribution +# tarball. Usable in dependencies, particularly for files that don't +# want to depend on config.h but do want to track version changes. +# Delete this file prior to any autoconf run where you want to rebuild +# files to pick up a version string change; and leave it stale to +# minimize rebuild time after unrelated changes to configure sources. +# +# It is probably wise to add these two files to .gitignore, so that you +# don't accidentally commit either generated file. +# +# Use the following line in your configure.ac, so that $(VERSION) will +# automatically be up-to-date each time configure is run (and note that +# since configure.ac no longer includes a version string, Makefile rules +# should not depend on configure.ac for version updates). +# +# AC_INIT([GNU project], +# m4_esyscmd([build-aux/git-version-gen .tarball-version]), +# [bug-project@example]) +# +# Then use the following lines in your Makefile.am, so that .version +# will be present for dependencies, and so that .tarball-version will +# exist in distribution tarballs. +# +# BUILT_SOURCES = $(top_srcdir)/.version +# $(top_srcdir)/.version: +# echo $(VERSION) > $@-t && mv $@-t $@ +# dist-hook: +# echo $(VERSION) > $(distdir)/.tarball-version + +case $# in + 1) ;; + *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;; +esac + +tarball_version_file=$1 +nl=' +' + +# First see if there is a tarball-only version file. +# then try "git describe", then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || exit 1 + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test -z "$v" \ + && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2 +fi + +if test -n "$v" +then + : # use $v +elif test -d .git \ + && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \ + || git describe --abbrev=4 HEAD 2>/dev/null` \ + && case $v in + v[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Is this a new git that lists number of commits since the last + # tag or the previous older version that did not? + # Newer: v6.10-77-g0f8faeb + # Older: v6.10-g0f8faeb + case $v in + *-*-*) : git describe is okay three part flavor ;; + *-*) + : git describe is older two part flavor + # Recreate the number of commits and rewrite such that the + # result is the same as if we were using the newer version + # of git describe. + vtag=`echo "$v" | sed 's/-.*//'` + numcommits=`git rev-list "$vtag"..HEAD | wc -l` + v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; + ;; + esac + + # Change the first '-' to a '.', so version-comparing tools work properly. + # Remove the "g" in git describe's output string, to save a byte. + v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`; +else + v=UNKNOWN +fi + +v=`echo "$v" |sed 's/^v//'` + +# Don't declare a version "dirty" merely because a time stamp has changed. +git status > /dev/null 2>&1 + +dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= +case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; +esac + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +echo "$v" | tr -d '\012' + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/build-aux/install-sh b/build-aux/install-sh new file mode 100755 index 0000000..a5897de --- /dev/null +++ b/build-aux/install-sh @@ -0,0 +1,519 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2006-12-25.00 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/build-aux/javacomp.sh.in b/build-aux/javacomp.sh.in new file mode 100644 index 0000000..254190e --- /dev/null +++ b/build-aux/javacomp.sh.in @@ -0,0 +1,75 @@ +#!/bin/sh +# Compile a Java program. + +# Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. +# Written by Bruno Haible , 2001. +# +# 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 . + +# This uses the same choices as javacomp.c, but instead of relying on the +# environment settings at run time, it uses the environment variables +# present at configuration time. +# +# This is a separate shell script, because it must be able to unset JAVA_HOME +# in some cases, which a simple shell command cannot do. +# +# The extra CLASSPATH must have been set prior to calling this script. +# Options that can be passed are -O, -g and "-d DIRECTORY". + +CONF_JAVAC='@CONF_JAVAC@' +CONF_CLASSPATH='@CLASSPATH@' +if test -n "@HAVE_JAVAC_ENVVAR@"; then + # Combine given CLASSPATH and configured CLASSPATH. + if test -n "$CLASSPATH"; then + CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}" + else + CLASSPATH="$CONF_CLASSPATH" + fi + export CLASSPATH + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" + exec $CONF_JAVAC "$@" +else + unset JAVA_HOME + if test -n "@HAVE_GCJ_C@"; then + # In this case, $CONF_JAVAC starts with "gcj -C". + CLASSPATH="$CLASSPATH" + export CLASSPATH + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" + exec $CONF_JAVAC "$@" + else + if test -n "@HAVE_JAVAC@"; then + # In this case, $CONF_JAVAC starts with "javac". + CLASSPATH="$CLASSPATH" + export CLASSPATH + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" + exec $CONF_JAVAC "$@" + else + if test -n "@HAVE_JIKES@"; then + # In this case, $CONF_JAVAC starts with "jikes". + # Combine given CLASSPATH and configured CLASSPATH. + if test -n "$CLASSPATH"; then + CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}" + else + CLASSPATH="$CONF_CLASSPATH" + fi + export CLASSPATH + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" + exec $CONF_JAVAC "$@" + else + echo 'Java compiler not found, try installing gcj or set $JAVAC, then reconfigure' 1>&2 + exit 1 + fi + fi + fi +fi diff --git a/build-aux/javaexec.sh.in b/build-aux/javaexec.sh.in new file mode 100644 index 0000000..a67d0c9 --- /dev/null +++ b/build-aux/javaexec.sh.in @@ -0,0 +1,70 @@ +#!/bin/sh +# Execute a Java program. + +# Copyright (C) 2001, 2006 Free Software Foundation, Inc. +# Written by Bruno Haible , 2001. +# +# 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 . + +# This uses the same choices as javaexec.c, but instead of relying on the +# environment settings at run time, it uses the environment variables +# present at configuration time. +# +# This is a separate shell script, because it must be able to unset JAVA_HOME +# in some cases, which a simple shell command cannot do. +# +# The extra CLASSPATH must have been set prior to calling this script. + +CONF_JAVA='@CONF_JAVA@' +CONF_CLASSPATH='@CLASSPATH@' +if test -n "@HAVE_JAVA_ENVVAR@"; then + # Combine given CLASSPATH and configured CLASSPATH. + if test -n "$CLASSPATH"; then + CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}" + else + CLASSPATH="$CONF_CLASSPATH" + fi + export CLASSPATH + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" + exec $CONF_JAVA "$@" +else + unset JAVA_HOME + export CLASSPATH + if test -n "@HAVE_GIJ@"; then + # In this case, $CONF_JAVA is "gij". + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" + exec $CONF_JAVA "$@" + else + if test -n "@HAVE_JAVA@"; then + # In this case, $CONF_JAVA is "java". + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" + exec $CONF_JAVA "$@" + else + if test -n "@HAVE_JRE@"; then + # In this case, $CONF_JAVA is "jre". + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" + exec $CONF_JAVA "$@" + else + if test -n "@HAVE_JVIEW@"; then + # In this case, $CONF_JAVA is "jview". + test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" + exec $CONF_JAVA "$@" + else + echo 'Java virtual machine not found, try installing gij or set $JAVA, then reconfigure' 1>&2 + exit 1 + fi + fi + fi + fi +fi diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h new file mode 100644 index 0000000..fda0194 --- /dev/null +++ b/build-aux/link-warning.h @@ -0,0 +1,28 @@ +/* GL_LINK_WARNING("literal string") arranges to emit the literal string as + a linker warning on most glibc systems. + We use a linker warning rather than a preprocessor warning, because + #warning cannot be used inside macros. */ +#ifndef GL_LINK_WARNING + /* This works on platforms with GNU ld and ELF object format. + Testing __GLIBC__ is sufficient for asserting that GNU ld is in use. + Testing __ELF__ guarantees the ELF object format. + Testing __GNUC__ is necessary for the compound expression syntax. */ +# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__ +# define GL_LINK_WARNING(message) \ + GL_LINK_WARNING1 (__FILE__, __LINE__, message) +# define GL_LINK_WARNING1(file, line, message) \ + GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */ +# define GL_LINK_WARNING2(file, line, message) \ + GL_LINK_WARNING3 (file ":" #line ": warning: " message) +# define GL_LINK_WARNING3(message) \ + ({ static const char warning[sizeof (message)] \ + __attribute__ ((__unused__, \ + __section__ (".gnu.warning"), \ + __aligned__ (1))) \ + = message "\n"; \ + (void)0; \ + }) +# else +# define GL_LINK_WARNING(message) ((void) 0) +# endif +#endif diff --git a/build-aux/mdate-sh b/build-aux/mdate-sh new file mode 100755 index 0000000..757a5dc --- /dev/null +++ b/build-aux/mdate-sh @@ -0,0 +1,204 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2007-03-30.02 + +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007 Free Software +# Foundation, Inc. +# written by Ulrich Drepper , June 1995 +# +# 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 . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# GNU ls changes its time format in response to the TIME_STYLE +# variable. Since we cannot assume `unset' works, revert this +# variable to its documented default. +if test "${TIME_STYLE+set}" = set; then + TIME_STYLE=posix-long-iso + export TIME_STYLE +fi + +save_arg1=$1 + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi +# Avoid user/group names that might have spaces, when possible. +if ls -n /dev/null 1>/dev/null 2>&1; then + ls_command="$ls_command -n" +fi + +# A `ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named `Jan', or `Feb', etc. However, it's unlikely that `/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`$ls_command /` + +# Find which argument is the month. +month= +command= +until test $month +do + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/build-aux/missing b/build-aux/missing new file mode 100755 index 0000000..4758c82 --- /dev/null +++ b/build-aux/missing @@ -0,0 +1,372 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2008-11-24.07 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# 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 . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed 's/^gnu-//; t; s/^gnu//; t; s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/build-aux/prev-version.txt b/build-aux/prev-version.txt new file mode 100644 index 0000000..cd5ac03 --- /dev/null +++ b/build-aux/prev-version.txt @@ -0,0 +1 @@ +2.0 diff --git a/build-aux/texinfo.tex b/build-aux/texinfo.tex new file mode 100644 index 0000000..9887086 --- /dev/null +++ b/build-aux/texinfo.tex @@ -0,0 +1,9172 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2008-12-03.17} +% +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +% 2007, 2008 Free Software Foundation, Inc. +% +% This texinfo.tex file 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 texinfo.tex file 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 . +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + + +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t +\let\ptextop=\top +{\catcode`\'=\active +\global\let\ptexquoteright'}% Math-mode def from plain.tex. + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dashChar = `\- +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\lquoteChar= `\` +\chardef\questChar = `\? +\chardef\rquoteChar= `\' +\chardef\semiChar = `\; +\chardef\underChar = `\_ + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingyyy.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 24pt + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \indexdummies + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1\relax \unvbox#1\relax +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\argtorun{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \argtorun. +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as environments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At run-time, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Environment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi + \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=\endofsentencespacefactor\space} + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=\endofsentencespacefactor\space} + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \fi\fi +} + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +% Old definition--didn't work. +%\parseargdef\need{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include FILE -- \input text of FILE. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable % we want to expand any @value in FILE. + \turnoffactive % and allow special characters in the expansion + \indexnofonts % Allow `@@' and other weird things in file names. + \edef\temp{\noexpand\input #1 }% + % + % This trickery is to read FILE outside of a group, in case it makes + % definitions, etc. + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other + \catcode`\`=\other + \catcode`\'=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \catcode`' = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + \let' = \ptexquoteright + } +} + +% Some math mode symbols. +\def\bullet{$\ptexbullet$} +\def\geq{\ifmmode \ge\else $\ge$\fi} +\def\leq{\ifmmode \le\else $\le$\fi} +\def\minus{\ifmmode -\else $-$\fi} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% (and related messages, the final outcome is that it is up to the TeX +% user to double the backslashes and otherwise make the string valid, so +% that's what we do). + +% double active backslashes. +% +{\catcode`\@=0 \catcode`\\=\active + @gdef@activebackslashdouble{% + @catcode`@\=@active + @let\=@doublebackslash} +} + +% To handle parens, we must adopt a different approach, since parens are +% not active characters. hyperref.dtx (which has the same problem as +% us) handles it with this amazing macro to replace tokens, with minor +% changes for Texinfo. It is included here under the GPL by permission +% from the author, Heiko Oberdiek. +% +% #1 is the tokens to replace. +% #2 is the replacement. +% #3 is the control sequence with the string. +% +\def\HyPsdSubst#1#2#3{% + \def\HyPsdReplace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \HyReturnAfterFi{% + \HyPsdReplace##2\END + }% + \fi + }% + \xdef#3{\expandafter\HyPsdReplace#3#1\END}% +} +\long\def\HyReturnAfterFi#1\fi{\fi#1} + +% #1 is a control sequence in which to do the replacements. +\def\backslashparens#1{% + \xdef#1{#1}% redefine it as its expansion; the definition is simply + % \lastnode when called from \setref -> \pdfmkdest. + \HyPsdSubst{(}{\realbackslash(}{#1}% + \HyPsdSubst{)}{\realbackslash)}{#1}% +} + +\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images +with PDF output, and none of those formats could be found. (.eps cannot +be supported due to the design of the PDF format; use regular TeX (DVI +output) for that.)} + +\ifpdf + % + % Color manipulation macros based on pdfcolor.tex. + \def\cmykDarkRed{0.28 1 1 0.35} + \def\cmykBlack{0 0 0 1} + % + \def\pdfsetcolor#1{\pdfliteral{#1 k}} + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\cmykBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } + % + % + \pdfcatalog{/PageMode /UseOutlines} + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % pdftex (and the PDF format) support .png, .jpg, .pdf (among + % others). Let's try in that order. + \let\pdfimgext=\empty + \begingroup + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \errhelp = \nopdfimagehelp + \errmessage{Could not find image file #1 for pdf}% + \else \gdef\pdfimgext{PDF}% + \fi + \else \gdef\pdfimgext{pdf}% + \fi + \else \gdef\pdfimgext{JPG}% + \fi + \else \gdef\pdfimgext{jpeg}% + \fi + \else \gdef\pdfimgext{jpg}% + \fi + \else \gdef\pdfimgext{png}% + \fi + \closein 1 + \endgroup + % + % without \immediate, ancient pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifdim \wd0 >0pt width \imagewidth \fi + \ifdim \wd2 >0pt height \imageheight \fi + \ifnum\pdftexversion<13 + #1.\pdfimgext + \else + {#1.\pdfimgext}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + % + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \indexnofonts + \turnoffactive + \activebackslashdouble + \makevalueexpandable + \def\pdfdestname{#1}% + \backslashparens\pdfdestname + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + }} + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1} + % + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\cmykDarkRed} + \def\linkcolor{\cmykDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + % Doubled backslashes in the name. + {\activebackslashdouble \xdef\pdfoutlinedest{#3}% + \backslashparens\pdfoutlinedest}% + \fi + % + % Also double the backslashes in the display string. + {\activebackslashdouble \xdef\pdfoutlinetext{#1}% + \backslashparens\pdfoutlinetext}% + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \setupdatafile + \catcode`\\=\active \otherbackslash + \input \tocreadfilename + \endgroup + } + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + \leavevmode\setcolor{\urlcolor}% + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \setcolor{\linkcolor}#1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + % non-pdf mode + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Unfortunately, we have to override this for titles and the like, since +% in those cases "rm" is bold. Sigh. +\def\rmisbold{\rm\def\curfontstyle{bf}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% +\def\setleading#1{% + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% PDF CMaps. See also LaTeX's t1.cmap. +% +% do nothing with this by default. +\expandafter\let\csname cmapOT1\endcsname\gobble +\expandafter\let\csname cmapOT1IT\endcsname\gobble +\expandafter\let\csname cmapOT1TT\endcsname\gobble + +% if we are producing pdf, and we have \pdffontattr, then define cmaps. +% (\pdffontattr was introduced many years ago, but people still run +% older pdftex's; it's easy to conditionalize, so we do.) +\ifpdf \ifx\pdffontattr\undefined \else + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\fi\fi + + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass +% empty to omit). +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble +% emacs-page end of cmaps + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Definitions for a main text size of 11pt. This is the default in +% Texinfo. +% +\def\definetextfontsizexi{% +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1095} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2}{OT1} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 +\def\sececsize{1440} + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315}{OT1} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 +\def\ssececsize{1200} + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 +\def\reducedecsize{1000} + +% reset the current fonts +\textfonts +\rm +} % end of 11pt text font size definitions + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1}{OT1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000}{OT1} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 +\def\ssececsize{1000} + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 +\def\reducedecsize{0900} + +% reduce space between paragraphs +\divide\parskip by 2 + +% reset the current fonts +\textfonts +\rm +} % end of 10pt text font size definitions + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xword{10} +\def\xiword{11} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + \wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rmisbold #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + +% Define these just so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% --karl, 24jan03. + +% Set up the default fonts, so we can use them for creating boxes. +% +\definetextfontsizexi + + +\message{markup,} + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will +% define and register \INITMACRO to be called on markup style changes. +% \INITMACRO can check \currentmarkupstyle for the innermost +% style and the set of \ifmarkupSTYLE switches for all styles +% currently in effect. +\newif\ifmarkupvar +\newif\ifmarkupsamp +\newif\ifmarkupkey +%\newif\ifmarkupfile % @file == @samp. +%\newif\ifmarkupoption % @option == @samp. +\newif\ifmarkupcode +\newif\ifmarkupkbd +%\newif\ifmarkupenv % @env == @code. +%\newif\ifmarkupcommand % @command == @code. +\newif\ifmarkuptex % @tex (and part of @math, for now). +\newif\ifmarkupexample +\newif\ifmarkupverb +\newif\ifmarkupverbatim + +\let\currentmarkupstyle\empty + +\def\setupmarkupstyle#1{% + \csname markup#1true\endcsname + \def\currentmarkupstyle{#1}% + \markupstylesetup +} + +\let\markupstylesetup\empty + +\def\defmarkupstylesetup#1{% + \expandafter\def\expandafter\markupstylesetup + \expandafter{\markupstylesetup #1}% + \def#1% +} + +% Markup style setup for left and right quotes. +\defmarkupstylesetup\markupsetuplq{% + \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuplqdefault \else \temp \fi +} + +\defmarkupstylesetup\markupsetuprq{% + \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuprqdefault \else \temp \fi +} + +{ +\catcode`\'=\active +\catcode`\`=\active + +\gdef\markupsetuplqdefault{\let`\lq} +\gdef\markupsetuprqdefault{\let'\rq} + +\gdef\markupsetcodequoteleft{\let`\codequoteleft} +\gdef\markupsetcodequoteright{\let'\codequoteright} + +\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft} +} + +\let\markupsetuplqcode \markupsetcodequoteleft +\let\markupsetuprqcode \markupsetcodequoteright +\let\markupsetuplqexample \markupsetcodequoteleft +\let\markupsetuprqexample \markupsetcodequoteright +\let\markupsetuplqverb \markupsetcodequoteleft +\let\markupsetuprqverb \markupsetcodequoteright +\let\markupsetuplqverbatim \markupsetcodequoteleft +\let\markupsetuprqverbatim \markupsetcodequoteright + +\let\markupsetuplqsamp \markupsetnoligaturesquoteleft +\let\markupsetuplqkbd \markupsetnoligaturesquoteleft + +% Allow an option to not replace quotes with a regular directed right +% quote/apostrophe (char 0x27), but instead use the undirected quote +% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it +% the default, but it works for pasting with more pdf viewers (at least +% evince), the lilypond developers report. xpdf does work with the +% regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + % [Knuth] pp. 380,381,391 + % \relax disables Spanish ligatures ?` and !` of \tt font. + \relax`% + \else \char'22 \fi + \else \char'22 \fi +} + +% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. +\def\noligaturesquoteleft{\relax\lq} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% @cite is like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\def\var#1{{\setupmarkupstyle{var}\smartslanted{#1}}} +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @b, explicit bold. Also @strong. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +% @t, explicit typewriter. +\def\t#1{% + {\tt \rawbackslash \plainfrenchspacing #1}% + \null +} + +% @samp. +\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} + +% definition of @key that produces a lozenge. Doesn't adjust to text size. +%\setfont\keyrm\rmshape{8}{1000}{OT1} +%\font\keysy=cmsy9 +%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% +% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% +% \vbox{\hrule\kern-0.4pt +% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% +% \kern-0.4pt\hrule}% +% \kern-.06em\raise0.4pt\hbox{\angleright}}}} + +% definition of @key with no lozenge. If the current font is already +% monospace, don't change it; that way, we respect @kbdinputstyle. But +% if it isn't monospace, then use \tt. +% +\def\key#1{{\setupmarkupstyle{key} + \nohyphenation + \ifmonospace\else\tt\fi + #1}\null} + +% ctrl is no longer a Texinfo command. +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \plainfrenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + \global\let'=\rq \global\let`=\lq % default definitions + % + \global\def\code{\begingroup + \setupmarkupstyle{code}% + % The following should really be moved into \setupmarkupstyle handlers. + \catcode\dashChar=\active \catcode\underChar=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\realdash + \let_\realunder + \fi + \codex + } +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} +\def\codex #1{\tclose{#1}\endgroup} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is undesirable in +% some manuals, especially if they don't have long identifiers in +% general. @allowcodebreaks provides a way to control this. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \fi\fi +} + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. +\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct'. +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + + +\message{glyphs,} + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, they should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} +\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% Hacks for glyphs from the EC fonts similar to \euro. We don't +% use \let for the aliases, because sometimes we redefine the original +% macro, and the alias should reflect the redefinition. +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +% This positioning is not perfect (see the ogonek LaTeX package), but +% we have the precomposed glyphs for the most common cases. We put the +% tests to use those glyphs in the single \ogonek macro so we have fewer +% dummy definitions to worry about for index entries, etc. +% +% ogonek is also used with other letters in Lithuanian (IOU), but using +% the precomposed glyphs for those is not so easy since they aren't in +% the same EC font. +\def\ogonek#1{{% + \def\temp{#1}% + \ifx\temp\macrocharA\Aogonek + \else\ifx\temp\macrochara\aogonek + \else\ifx\temp\macrocharE\Eogonek + \else\ifx\temp\macrochare\eogonek + \else + \ecfont \setbox0=\hbox{#1}% + \ifdim\ht0=1ex\accent"0C #1% + \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% + \fi + \fi\fi\fi\fi + }% +} +\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} +\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} +\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} +\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} +% +\def\ecfont{% + % We can't distinguish serif/sans and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \thisecfont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rmisbold #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\secfonts\rmisbold \leftline{#1}}% + \fi +} + + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: +% +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{% +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a . + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \obeylines + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M@end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \relax + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} + % + % So: + \let\endinput = \empty + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies + \otherbackslash +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control% words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\L + \definedummyword\OE + \definedummyword\O + \definedummyword\aa + \definedummyword\ae + \definedummyword\l + \definedummyword\oe + \definedummyword\o + \definedummyword\ss + \definedummyword\exclamdown + \definedummyword\questiondown + \definedummyword\ordf + \definedummyword\ordm + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright + \definedummyword\expansion + \definedummyword\minus + \definedummyword\ogonek + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase + \definedummyword\result + \definedummyword\textdegree + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ogonek + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sc + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\acronym + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% + \def\result{=>}% + \def\textdegree{degrees}% + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \safewhatsit\dosubindwrite + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks/skips around a whatsit: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +\newskip\whatsitskip +\newcount\whatsitpenalty +% +% ..., ready, GO: +% +\def\safewhatsit#1{% +\ifhmode + #1% +\else + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \whatsitskip = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \whatsitpenalty = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\whatsitskip glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\whatsitskip + \fi + % + #1% + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\whatsitskip + \fi +\fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \plainfrenchspacing + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this freezes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like plain.tex's \dotfill, except uses up at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + % The following penalty ensures that the page builder is exercised + % _before_ we change the output routine. This is necessary in the + % following situation: + % + % The last section of the index consists only of a single entry. + % Before this section, \pagetotal is less than \pagegoal, so no + % break occurs before the last section starts. However, the last + % section, consisting of \initial and the single \entry, does not + % fit on the page and has to be broken off. Without the following + % penalty the page builder will not be exercised until \eject + % below, and by that time we'll already have changed the output + % routine to the \balancecolumns version, so the next-to-last + % double-column page will be processed with \balancecolumns, which + % is wrong: The two columns will go to the main vertical list, with + % the broken-off section in the recent contributions. As soon as + % the output routine finishes, TeX starts reconsidering the page + % break. The two columns and the broken-off section both fit on the + % page, because the two columns now take up only half of the page + % goal. When TeX sees \eject from below which follows the final + % section, it invokes the new output routine that we've set after + % \balancecolumns below; \onepageout will try to fit the two columns + % and the final section into the vbox of \pageheight (see + % \pagebody), causing an overfull box. + % + % Note that glue won't work here, because glue does not exercise the + % page builder, unlike penalties (see The TeXbook, pp. 280-281). + \penalty0 + % + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. +\def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} +\def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rmisbold #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% + \hbox to 0pt{}% + \chappager + \endgroup + \fi +} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. + \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % + {% + \chapfonts \rmisbold + % + % Have to define \lastsection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\lastsection{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \nobreak % Avoid page breaks at the interline glue. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rmisbold #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\seckeyword{sec} +% +\def\sectionheading#1#2#3#4{% + {% + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rmisbold + % + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark + % + % Only insert the space after the number if we have a section number. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\lastsection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \lastsection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\lastsection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\lastsection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chapmacro. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chapmacro. + \donoderef{#3}% + % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + }% + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \tocreadfilename +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} + +% Normal (long) toc. +% +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\envdef\tex{% + \setupmarkupstyle{tex}% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \catcode`\`=\other + \catcode`\'=\other + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + \expandafter \let\csname top\endcsname=\ptextop % outer + \let\frenchspacing=\plainfrenchspacing + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + % end paragraph for sake of leading, in case document has no blank + % line. This is redundant with what happens in \aboveenvbreak, but + % we need to do it before changing the fonts, and it's inconvenient + % to change the fonts afterward. + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt\setupmarkupstyle{example}% + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenv {display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenv{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\def\quotationstart{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +\envdef\quotation{% + \setnormaldispenv + \quotationstart +} + +\envdef\smallquotation{% + \setsmalldispenv + \quotationstart +} +\let\Esmallquotation = \Equotation + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% + % Don't do the quotes -- if we do, @set txicodequoteundirected and + % @set txicodequotebacktick will not have effect on @verb and + % @verbatim, and ?` and !` ligatures won't get disabled. + %\do\`\do\'% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \setupmarkupstyle{verb}% + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +% +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup + +% start the verbatim environment. +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \tabexpand + \setupmarkupstyle{verbatim}% + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \indexnofonts % Allow `@@' and other weird things in file names. + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \printdefunline, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + % As a minor refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty\defunpenalty % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remaining is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). +\def\badparencount{% + \message{Warning: unbalanced parentheses in @def...}% + \global\parencount=0 +} +\def\badbrackcount{% + \message{Warning: unbalanced square brackets in @def...}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% + \scanctxt + \catcode`\\=\other +} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + \addtomacrolist{\the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \macnamexxx} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \lastsection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\lastsection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout + }% + \fi +} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + {\indexnofonts + \turnoffactive + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. + \getfilename{#4}% + % + % See comments at \activebackslashdouble. + {\activebackslashdouble \xdef\pdfxrefdest{#1}% + \backslashparens\pdfxrefdest}% + % + \leavevmode + \startlink attr{/Border [0 0 0]}% + \ifnum\filenamelength>0 + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \setcolor{\linkcolor}% + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}{}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. + \indexnofonts + \turnoffactive + \xdef\safexrefname{#1}% + }% + % + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR\safexrefname\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 + {\safexrefname}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count1=128 + \def\loop{% + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 +\endgroup} + + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarly, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\medskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \fi + % + % Leave vertical mode so that indentation from an enclosing + % environment such as @quotation is respected. On the other hand, if + % it's at the top level, we don't want the normal paragraph indentation. + \noindent + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \medskip \fi % space after the standalone image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \lastsection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\lastsection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \lastsection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + + +\message{localization,} + +% For single-language documents, @documentlanguage is usually given very +% early, just after @documentencoding. Single argument is the language +% (de) or locale (de_DE) abbreviation. +% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames + \tex % read txi-??.tex file in plain TeX. + % Read the file by the name they passed if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \documentlanguagetrywithoutunderscore{#1_\finish}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 + \endgroup % end raw TeX +\endgroup} +} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\def\documentlanguagetrywithoutunderscore#1_#2\finish{% + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 +} +% +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? Putting it in the current +directory should work if nowhere else does.} + +% This macro is called from txi-??.tex files; the first argument is the +% \language name to set (without the "\lang@" prefix), the second and +% third args are \{left,right}hyphenmin. +% +% The language names to pass are determined when the format is built. +% See the etex.log file created at that time, e.g., +% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. +% +% With TeX Live 2008, etex now includes hyphenation patterns for all +% available languages. This means we can support hyphenation in +% Texinfo, at least to some extent. (This still doesn't solve the +% accented characters problem.) +% +\catcode`@=11 +\def\txisetlanguage#1#2#3{% + % do not set the language if the name is undefined in the current TeX. + \expandafter\ifx\csname lang@#1\endcsname \relax + \message{no patterns for #1}% + \else + \global\language = \csname lang@#1\endcsname + \fi + % but there is no harm in adjusting the hyphenmin values regardless. + \global\lefthyphenmin = #2\relax + \global\righthyphenmin = #3\relax +} + +% Helpers for encodings. +% Set the catcode of characters 128 through 255 to the specified number. +% +\def\setnonasciicharscatcode#1{% + \count255=128 + \loop\ifnum\count255<256 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +% @documentencoding sets the definition of non-ASCII characters +% according to the specified encoding. +% +\parseargdef\documentencoding{% + % Encoding being declared for the document. + \def\declaredencoding{\csname #1.enc\endcsname}% + % + % Supported encodings: names converted to tokens in order to be able + % to compare them with \ifx. + \def\ascii{\csname US-ASCII.enc\endcsname}% + \def\latnine{\csname ISO-8859-15.enc\endcsname}% + \def\latone{\csname ISO-8859-1.enc\endcsname}% + \def\lattwo{\csname ISO-8859-2.enc\endcsname}% + \def\utfeight{\csname UTF-8.enc\endcsname}% + % + \ifx \declaredencoding \ascii + \asciichardefs + % + \else \ifx \declaredencoding \lattwo + \setnonasciicharscatcode\active + \lattwochardefs + % + \else \ifx \declaredencoding \latone + \setnonasciicharscatcode\active + \latonechardefs + % + \else \ifx \declaredencoding \latnine + \setnonasciicharscatcode\active + \latninechardefs + % + \else \ifx \declaredencoding \utfeight + \setnonasciicharscatcode\active + \utfeightchardefs + % + \else + \message{Unknown document encoding #1, ignoring.}% + % + \fi % utfeight + \fi % latnine + \fi % latone + \fi % lattwo + \fi % ascii +} + +% A message to be logged when using a character that isn't available +% the default font encoding (OT1). +% +\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} + +% Take account of \c (plain) vs. \, (Texinfo) difference. +\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} + +% First, make active non-ASCII characters in order for them to be +% correctly categorized when TeX reads the replacement text of +% macros containing the character definitions. +\setnonasciicharscatcode\active +% +% Latin1 (ISO-8859-1) character definitions. +\def\latonechardefs{% + \gdef^^a0{~} + \gdef^^a1{\exclamdown} + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} + \gdef^^aa{\ordf} + \gdef^^ab{\guillemetleft} + \gdef^^ac{$\lnot$} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} + \gdef^^af{\={}} + % + \gdef^^b0{\textdegree} + \gdef^^b1{$\pm$} + \gdef^^b2{$^2$} + \gdef^^b3{$^3$} + \gdef^^b4{\'{}} + \gdef^^b5{$\mu$} + \gdef^^b6{\P} + % + \gdef^^b7{$^.$} + \gdef^^b8{\cedilla\ } + \gdef^^b9{$^1$} + \gdef^^ba{\ordm} + % + \gdef^^bb{\guilletright} + \gdef^^bc{$1\over4$} + \gdef^^bd{$1\over2$} + \gdef^^be{$3\over4$} + \gdef^^bf{\questiondown} + % + \gdef^^c0{\`A} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\~A} + \gdef^^c4{\"A} + \gdef^^c5{\ringaccent A} + \gdef^^c6{\AE} + \gdef^^c7{\cedilla C} + \gdef^^c8{\`E} + \gdef^^c9{\'E} + \gdef^^ca{\^E} + \gdef^^cb{\"E} + \gdef^^cc{\`I} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\"I} + % + \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER ETH}} + \gdef^^d1{\~N} + \gdef^^d2{\`O} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\~O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\O} + \gdef^^d9{\`U} + \gdef^^da{\'U} + \gdef^^db{\^U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\missingcharmsg{LATIN CAPITAL LETTER THORN}} + \gdef^^df{\ss} + % + \gdef^^e0{\`a} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\~a} + \gdef^^e4{\"a} + \gdef^^e5{\ringaccent a} + \gdef^^e6{\ae} + \gdef^^e7{\cedilla c} + \gdef^^e8{\`e} + \gdef^^e9{\'e} + \gdef^^ea{\^e} + \gdef^^eb{\"e} + \gdef^^ec{\`{\dotless i}} + \gdef^^ed{\'{\dotless i}} + \gdef^^ee{\^{\dotless i}} + \gdef^^ef{\"{\dotless i}} + % + \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER ETH}} + \gdef^^f1{\~n} + \gdef^^f2{\`o} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\~o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\o} + \gdef^^f9{\`u} + \gdef^^fa{\'u} + \gdef^^fb{\^u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\missingcharmsg{LATIN SMALL LETTER THORN}} + \gdef^^ff{\"y} +} + +% Latin9 (ISO-8859-15) encoding character definitions. +\def\latninechardefs{% + % Encoding is almost identical to Latin1. + \latonechardefs + % + \gdef^^a4{\euro} + \gdef^^a6{\v S} + \gdef^^a8{\v s} + \gdef^^b4{\v Z} + \gdef^^b8{\v z} + \gdef^^bc{\OE} + \gdef^^bd{\oe} + \gdef^^be{\"Y} +} + +% Latin2 (ISO-8859-2) character definitions. +\def\lattwochardefs{% + \gdef^^a0{~} + \gdef^^a1{\ogonek{A}} + \gdef^^a2{\u{}} + \gdef^^a3{\L} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\v L} + \gdef^^a6{\'S} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\v S} + \gdef^^aa{\cedilla S} + \gdef^^ab{\v T} + \gdef^^ac{\'Z} + \gdef^^ad{\-} + \gdef^^ae{\v Z} + \gdef^^af{\dotaccent Z} + % + \gdef^^b0{\textdegree} + \gdef^^b1{\ogonek{a}} + \gdef^^b2{\ogonek{ }} + \gdef^^b3{\l} + \gdef^^b4{\'{}} + \gdef^^b5{\v l} + \gdef^^b6{\'s} + \gdef^^b7{\v{}} + \gdef^^b8{\cedilla\ } + \gdef^^b9{\v s} + \gdef^^ba{\cedilla s} + \gdef^^bb{\v t} + \gdef^^bc{\'z} + \gdef^^bd{\H{}} + \gdef^^be{\v z} + \gdef^^bf{\dotaccent z} + % + \gdef^^c0{\'R} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\u A} + \gdef^^c4{\"A} + \gdef^^c5{\'L} + \gdef^^c6{\'C} + \gdef^^c7{\cedilla C} + \gdef^^c8{\v C} + \gdef^^c9{\'E} + \gdef^^ca{\ogonek{E}} + \gdef^^cb{\"E} + \gdef^^cc{\v E} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\v D} + % + \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER D WITH STROKE}} + \gdef^^d1{\'N} + \gdef^^d2{\v N} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\H O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\v R} + \gdef^^d9{\ringaccent U} + \gdef^^da{\'U} + \gdef^^db{\H U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\cedilla T} + \gdef^^df{\ss} + % + \gdef^^e0{\'r} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\u a} + \gdef^^e4{\"a} + \gdef^^e5{\'l} + \gdef^^e6{\'c} + \gdef^^e7{\cedilla c} + \gdef^^e8{\v c} + \gdef^^e9{\'e} + \gdef^^ea{\ogonek{e}} + \gdef^^eb{\"e} + \gdef^^ec{\v e} + \gdef^^ed{\'\i} + \gdef^^ee{\^\i} + \gdef^^ef{\v d} + % + \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER D WITH STROKE}} + \gdef^^f1{\'n} + \gdef^^f2{\v n} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\H o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\v r} + \gdef^^f9{\ringaccent u} + \gdef^^fa{\'u} + \gdef^^fb{\H u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\cedilla t} + \gdef^^ff{\dotaccent{}} +} + +% UTF-8 character definitions. +% +% This code to support UTF-8 is based on LaTeX's utf8.def, with some +% changes for Texinfo conventions. It is included here under the GPL by +% permission from Frank Mittelbach and the LaTeX team. +% +\newcount\countUTFx +\newcount\countUTFy +\newcount\countUTFz + +\gdef\UTFviiiTwoOctets#1#2{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\endcsname} +% +\gdef\UTFviiiThreeOctets#1#2#3{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} +% +\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} + +\gdef\UTFviiiDefined#1{% + \ifx #1\relax + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \else + \expandafter #1% + \fi +} + +\begingroup + \catcode`\~13 + \catcode`\"12 + + \def\UTFviiiLoop{% + \global\catcode\countUTFx\active + \uccode`\~\countUTFx + \uppercase\expandafter{\UTFviiiTmp}% + \advance\countUTFx by 1 + \ifnum\countUTFx < \countUTFy + \expandafter\UTFviiiLoop + \fi} + + \countUTFx = "C2 + \countUTFy = "E0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \UTFviiiLoop + + \countUTFx = "E0 + \countUTFy = "F0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \UTFviiiLoop + + \countUTFx = "F0 + \countUTFy = "F4 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \UTFviiiLoop +\endgroup + +\begingroup + \catcode`\"=12 + \catcode`\<=12 + \catcode`\.=12 + \catcode`\,=12 + \catcode`\;=12 + \catcode`\!=12 + \catcode`\~=13 + + \gdef\DeclareUnicodeCharacter#1#2{% + \countUTFz = "#1\relax + \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + \begingroup + \parseXMLCharref + \def\UTFviiiTwoOctets##1##2{% + \csname u8:##1\string ##2\endcsname}% + \def\UTFviiiThreeOctets##1##2##3{% + \csname u8:##1\string ##2\string ##3\endcsname}% + \def\UTFviiiFourOctets##1##2##3##4{% + \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \gdef\UTFviiiTmp{#2}% + \endgroup} + + \gdef\parseXMLCharref{% + \ifnum\countUTFz < "A0\relax + \errhelp = \EMsimple + \errmessage{Cannot define Unicode char value < 00A0}% + \else\ifnum\countUTFz < "800\relax + \parseUTFviiiA,% + \parseUTFviiiB C\UTFviiiTwoOctets.,% + \else\ifnum\countUTFz < "10000\relax + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \else + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiA!% + \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \fi\fi\fi + } + + \gdef\parseUTFviiiA#1{% + \countUTFx = \countUTFz + \divide\countUTFz by 64 + \countUTFy = \countUTFz + \multiply\countUTFz by 64 + \advance\countUTFx by -\countUTFz + \advance\countUTFx by 128 + \uccode `#1\countUTFx + \countUTFz = \countUTFy} + + \gdef\parseUTFviiiB#1#2#3#4{% + \advance\countUTFz by "#10\relax + \uccode `#3\countUTFz + \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} +\endgroup + +\def\utfeightchardefs{% + \DeclareUnicodeCharacter{00A0}{\tie} + \DeclareUnicodeCharacter{00A1}{\exclamdown} + \DeclareUnicodeCharacter{00A3}{\pounds} + \DeclareUnicodeCharacter{00A8}{\"{ }} + \DeclareUnicodeCharacter{00A9}{\copyright} + \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} + \DeclareUnicodeCharacter{00AD}{\-} + \DeclareUnicodeCharacter{00AE}{\registeredsymbol} + \DeclareUnicodeCharacter{00AF}{\={ }} + + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} + \DeclareUnicodeCharacter{00B4}{\'{ }} + \DeclareUnicodeCharacter{00B8}{\cedilla{ }} + \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} + \DeclareUnicodeCharacter{00BF}{\questiondown} + + \DeclareUnicodeCharacter{00C0}{\`A} + \DeclareUnicodeCharacter{00C1}{\'A} + \DeclareUnicodeCharacter{00C2}{\^A} + \DeclareUnicodeCharacter{00C3}{\~A} + \DeclareUnicodeCharacter{00C4}{\"A} + \DeclareUnicodeCharacter{00C5}{\AA} + \DeclareUnicodeCharacter{00C6}{\AE} + \DeclareUnicodeCharacter{00C7}{\cedilla{C}} + \DeclareUnicodeCharacter{00C8}{\`E} + \DeclareUnicodeCharacter{00C9}{\'E} + \DeclareUnicodeCharacter{00CA}{\^E} + \DeclareUnicodeCharacter{00CB}{\"E} + \DeclareUnicodeCharacter{00CC}{\`I} + \DeclareUnicodeCharacter{00CD}{\'I} + \DeclareUnicodeCharacter{00CE}{\^I} + \DeclareUnicodeCharacter{00CF}{\"I} + + \DeclareUnicodeCharacter{00D1}{\~N} + \DeclareUnicodeCharacter{00D2}{\`O} + \DeclareUnicodeCharacter{00D3}{\'O} + \DeclareUnicodeCharacter{00D4}{\^O} + \DeclareUnicodeCharacter{00D5}{\~O} + \DeclareUnicodeCharacter{00D6}{\"O} + \DeclareUnicodeCharacter{00D8}{\O} + \DeclareUnicodeCharacter{00D9}{\`U} + \DeclareUnicodeCharacter{00DA}{\'U} + \DeclareUnicodeCharacter{00DB}{\^U} + \DeclareUnicodeCharacter{00DC}{\"U} + \DeclareUnicodeCharacter{00DD}{\'Y} + \DeclareUnicodeCharacter{00DF}{\ss} + + \DeclareUnicodeCharacter{00E0}{\`a} + \DeclareUnicodeCharacter{00E1}{\'a} + \DeclareUnicodeCharacter{00E2}{\^a} + \DeclareUnicodeCharacter{00E3}{\~a} + \DeclareUnicodeCharacter{00E4}{\"a} + \DeclareUnicodeCharacter{00E5}{\aa} + \DeclareUnicodeCharacter{00E6}{\ae} + \DeclareUnicodeCharacter{00E7}{\cedilla{c}} + \DeclareUnicodeCharacter{00E8}{\`e} + \DeclareUnicodeCharacter{00E9}{\'e} + \DeclareUnicodeCharacter{00EA}{\^e} + \DeclareUnicodeCharacter{00EB}{\"e} + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} + + \DeclareUnicodeCharacter{00F1}{\~n} + \DeclareUnicodeCharacter{00F2}{\`o} + \DeclareUnicodeCharacter{00F3}{\'o} + \DeclareUnicodeCharacter{00F4}{\^o} + \DeclareUnicodeCharacter{00F5}{\~o} + \DeclareUnicodeCharacter{00F6}{\"o} + \DeclareUnicodeCharacter{00F8}{\o} + \DeclareUnicodeCharacter{00F9}{\`u} + \DeclareUnicodeCharacter{00FA}{\'u} + \DeclareUnicodeCharacter{00FB}{\^u} + \DeclareUnicodeCharacter{00FC}{\"u} + \DeclareUnicodeCharacter{00FD}{\'y} + \DeclareUnicodeCharacter{00FF}{\"y} + + \DeclareUnicodeCharacter{0100}{\=A} + \DeclareUnicodeCharacter{0101}{\=a} + \DeclareUnicodeCharacter{0102}{\u{A}} + \DeclareUnicodeCharacter{0103}{\u{a}} + \DeclareUnicodeCharacter{0104}{\ogonek{A}} + \DeclareUnicodeCharacter{0105}{\ogonek{a}} + \DeclareUnicodeCharacter{0106}{\'C} + \DeclareUnicodeCharacter{0107}{\'c} + \DeclareUnicodeCharacter{0108}{\^C} + \DeclareUnicodeCharacter{0109}{\^c} + \DeclareUnicodeCharacter{0118}{\ogonek{E}} + \DeclareUnicodeCharacter{0119}{\ogonek{e}} + \DeclareUnicodeCharacter{010A}{\dotaccent{C}} + \DeclareUnicodeCharacter{010B}{\dotaccent{c}} + \DeclareUnicodeCharacter{010C}{\v{C}} + \DeclareUnicodeCharacter{010D}{\v{c}} + \DeclareUnicodeCharacter{010E}{\v{D}} + + \DeclareUnicodeCharacter{0112}{\=E} + \DeclareUnicodeCharacter{0113}{\=e} + \DeclareUnicodeCharacter{0114}{\u{E}} + \DeclareUnicodeCharacter{0115}{\u{e}} + \DeclareUnicodeCharacter{0116}{\dotaccent{E}} + \DeclareUnicodeCharacter{0117}{\dotaccent{e}} + \DeclareUnicodeCharacter{011A}{\v{E}} + \DeclareUnicodeCharacter{011B}{\v{e}} + \DeclareUnicodeCharacter{011C}{\^G} + \DeclareUnicodeCharacter{011D}{\^g} + \DeclareUnicodeCharacter{011E}{\u{G}} + \DeclareUnicodeCharacter{011F}{\u{g}} + + \DeclareUnicodeCharacter{0120}{\dotaccent{G}} + \DeclareUnicodeCharacter{0121}{\dotaccent{g}} + \DeclareUnicodeCharacter{0124}{\^H} + \DeclareUnicodeCharacter{0125}{\^h} + \DeclareUnicodeCharacter{0128}{\~I} + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} + \DeclareUnicodeCharacter{012A}{\=I} + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} + \DeclareUnicodeCharacter{012C}{\u{I}} + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} + + \DeclareUnicodeCharacter{0130}{\dotaccent{I}} + \DeclareUnicodeCharacter{0131}{\dotless{i}} + \DeclareUnicodeCharacter{0132}{IJ} + \DeclareUnicodeCharacter{0133}{ij} + \DeclareUnicodeCharacter{0134}{\^J} + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} + \DeclareUnicodeCharacter{0139}{\'L} + \DeclareUnicodeCharacter{013A}{\'l} + + \DeclareUnicodeCharacter{0141}{\L} + \DeclareUnicodeCharacter{0142}{\l} + \DeclareUnicodeCharacter{0143}{\'N} + \DeclareUnicodeCharacter{0144}{\'n} + \DeclareUnicodeCharacter{0147}{\v{N}} + \DeclareUnicodeCharacter{0148}{\v{n}} + \DeclareUnicodeCharacter{014C}{\=O} + \DeclareUnicodeCharacter{014D}{\=o} + \DeclareUnicodeCharacter{014E}{\u{O}} + \DeclareUnicodeCharacter{014F}{\u{o}} + + \DeclareUnicodeCharacter{0150}{\H{O}} + \DeclareUnicodeCharacter{0151}{\H{o}} + \DeclareUnicodeCharacter{0152}{\OE} + \DeclareUnicodeCharacter{0153}{\oe} + \DeclareUnicodeCharacter{0154}{\'R} + \DeclareUnicodeCharacter{0155}{\'r} + \DeclareUnicodeCharacter{0158}{\v{R}} + \DeclareUnicodeCharacter{0159}{\v{r}} + \DeclareUnicodeCharacter{015A}{\'S} + \DeclareUnicodeCharacter{015B}{\'s} + \DeclareUnicodeCharacter{015C}{\^S} + \DeclareUnicodeCharacter{015D}{\^s} + \DeclareUnicodeCharacter{015E}{\cedilla{S}} + \DeclareUnicodeCharacter{015F}{\cedilla{s}} + + \DeclareUnicodeCharacter{0160}{\v{S}} + \DeclareUnicodeCharacter{0161}{\v{s}} + \DeclareUnicodeCharacter{0162}{\cedilla{t}} + \DeclareUnicodeCharacter{0163}{\cedilla{T}} + \DeclareUnicodeCharacter{0164}{\v{T}} + + \DeclareUnicodeCharacter{0168}{\~U} + \DeclareUnicodeCharacter{0169}{\~u} + \DeclareUnicodeCharacter{016A}{\=U} + \DeclareUnicodeCharacter{016B}{\=u} + \DeclareUnicodeCharacter{016C}{\u{U}} + \DeclareUnicodeCharacter{016D}{\u{u}} + \DeclareUnicodeCharacter{016E}{\ringaccent{U}} + \DeclareUnicodeCharacter{016F}{\ringaccent{u}} + + \DeclareUnicodeCharacter{0170}{\H{U}} + \DeclareUnicodeCharacter{0171}{\H{u}} + \DeclareUnicodeCharacter{0174}{\^W} + \DeclareUnicodeCharacter{0175}{\^w} + \DeclareUnicodeCharacter{0176}{\^Y} + \DeclareUnicodeCharacter{0177}{\^y} + \DeclareUnicodeCharacter{0178}{\"Y} + \DeclareUnicodeCharacter{0179}{\'Z} + \DeclareUnicodeCharacter{017A}{\'z} + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} + \DeclareUnicodeCharacter{017C}{\dotaccent{z}} + \DeclareUnicodeCharacter{017D}{\v{Z}} + \DeclareUnicodeCharacter{017E}{\v{z}} + + \DeclareUnicodeCharacter{01C4}{D\v{Z}} + \DeclareUnicodeCharacter{01C5}{D\v{z}} + \DeclareUnicodeCharacter{01C6}{d\v{z}} + \DeclareUnicodeCharacter{01C7}{LJ} + \DeclareUnicodeCharacter{01C8}{Lj} + \DeclareUnicodeCharacter{01C9}{lj} + \DeclareUnicodeCharacter{01CA}{NJ} + \DeclareUnicodeCharacter{01CB}{Nj} + \DeclareUnicodeCharacter{01CC}{nj} + \DeclareUnicodeCharacter{01CD}{\v{A}} + \DeclareUnicodeCharacter{01CE}{\v{a}} + \DeclareUnicodeCharacter{01CF}{\v{I}} + + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} + \DeclareUnicodeCharacter{01D1}{\v{O}} + \DeclareUnicodeCharacter{01D2}{\v{o}} + \DeclareUnicodeCharacter{01D3}{\v{U}} + \DeclareUnicodeCharacter{01D4}{\v{u}} + + \DeclareUnicodeCharacter{01E2}{\={\AE}} + \DeclareUnicodeCharacter{01E3}{\={\ae}} + \DeclareUnicodeCharacter{01E6}{\v{G}} + \DeclareUnicodeCharacter{01E7}{\v{g}} + \DeclareUnicodeCharacter{01E8}{\v{K}} + \DeclareUnicodeCharacter{01E9}{\v{k}} + + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} + \DeclareUnicodeCharacter{01F1}{DZ} + \DeclareUnicodeCharacter{01F2}{Dz} + \DeclareUnicodeCharacter{01F3}{dz} + \DeclareUnicodeCharacter{01F4}{\'G} + \DeclareUnicodeCharacter{01F5}{\'g} + \DeclareUnicodeCharacter{01F8}{\`N} + \DeclareUnicodeCharacter{01F9}{\`n} + \DeclareUnicodeCharacter{01FC}{\'{\AE}} + \DeclareUnicodeCharacter{01FD}{\'{\ae}} + \DeclareUnicodeCharacter{01FE}{\'{\O}} + \DeclareUnicodeCharacter{01FF}{\'{\o}} + + \DeclareUnicodeCharacter{021E}{\v{H}} + \DeclareUnicodeCharacter{021F}{\v{h}} + + \DeclareUnicodeCharacter{0226}{\dotaccent{A}} + \DeclareUnicodeCharacter{0227}{\dotaccent{a}} + \DeclareUnicodeCharacter{0228}{\cedilla{E}} + \DeclareUnicodeCharacter{0229}{\cedilla{e}} + \DeclareUnicodeCharacter{022E}{\dotaccent{O}} + \DeclareUnicodeCharacter{022F}{\dotaccent{o}} + + \DeclareUnicodeCharacter{0232}{\=Y} + \DeclareUnicodeCharacter{0233}{\=y} + \DeclareUnicodeCharacter{0237}{\dotless{j}} + + \DeclareUnicodeCharacter{02DB}{\ogonek{ }} + + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} + + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} + + \DeclareUnicodeCharacter{1E20}{\=G} + \DeclareUnicodeCharacter{1E21}{\=g} + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} + \DeclareUnicodeCharacter{1E26}{\"H} + \DeclareUnicodeCharacter{1E27}{\"h} + + \DeclareUnicodeCharacter{1E30}{\'K} + \DeclareUnicodeCharacter{1E31}{\'k} + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} + \DeclareUnicodeCharacter{1E3E}{\'M} + \DeclareUnicodeCharacter{1E3F}{\'m} + + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} + + \DeclareUnicodeCharacter{1E54}{\'P} + \DeclareUnicodeCharacter{1E55}{\'p} + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} + + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} + + \DeclareUnicodeCharacter{1E7C}{\~V} + \DeclareUnicodeCharacter{1E7D}{\~v} + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} + + \DeclareUnicodeCharacter{1E80}{\`W} + \DeclareUnicodeCharacter{1E81}{\`w} + \DeclareUnicodeCharacter{1E82}{\'W} + \DeclareUnicodeCharacter{1E83}{\'w} + \DeclareUnicodeCharacter{1E84}{\"W} + \DeclareUnicodeCharacter{1E85}{\"w} + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} + \DeclareUnicodeCharacter{1E8C}{\"X} + \DeclareUnicodeCharacter{1E8D}{\"x} + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} + + \DeclareUnicodeCharacter{1E90}{\^Z} + \DeclareUnicodeCharacter{1E91}{\^z} + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} + \DeclareUnicodeCharacter{1E97}{\"t} + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} + + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} + + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} + \DeclareUnicodeCharacter{1EBC}{\~E} + \DeclareUnicodeCharacter{1EBD}{\~e} + + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} + + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} + + \DeclareUnicodeCharacter{1EF2}{\`Y} + \DeclareUnicodeCharacter{1EF3}{\`y} + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} + + \DeclareUnicodeCharacter{1EF8}{\~Y} + \DeclareUnicodeCharacter{1EF9}{\~y} + + \DeclareUnicodeCharacter{2013}{--} + \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} + \DeclareUnicodeCharacter{2022}{\bullet} + \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} + \DeclareUnicodeCharacter{20AC}{\euro} + + \DeclareUnicodeCharacter{2192}{\expansion} + \DeclareUnicodeCharacter{21D2}{\result} + + \DeclareUnicodeCharacter{2212}{\minus} + \DeclareUnicodeCharacter{2217}{\point} + \DeclareUnicodeCharacter{2261}{\equiv} +}% end of \utfeightchardefs + + +% US-ASCII character definitions. +\def\asciichardefs{% nothing need be done + \relax +} + +% Make non-ASCII characters printable again for compatibility with +% existing Texinfo documents that may use them, even without declaring a +% document encoding. +% +\setnonasciicharscatcode \other + + +\message{formatting,} + +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{607.2pt}{6in}% that's 46 lines + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.25 trim size. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {-.2in}{0in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{673.2pt}{160mm}% that's 51 lines + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1\relax + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% DEL is a comment character, in case @c does not suffice. +\catcode`\^^? = 14 + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active +@def@normalbackslash{{@tt@backslashcurfont}} +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +@gdef@rawbackslash{@let\=@backslashcurfont} +@gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% +@def@normalturnoffactive{% + @let\=@normalbackslash + @let"=@normaldoublequote + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @markupsetuplqdefault + @markupsetuprqdefault + @unsepspaces +} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\' in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + +@c Finally, make ` and ' active, so that txicodequoteundirected and +@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we +@c don't make ` and ' active, @code will not get them as active chars. +@c Do this last of all since we use ` in the previous @catcode assignments. +@catcode`@'=@active +@catcode`@`=@active +@markupsetuplqdefault +@markupsetuprqdefault + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff --git a/build-aux/ylwrap b/build-aux/ylwrap new file mode 100755 index 0000000..7278b6a --- /dev/null +++ b/build-aux/ylwrap @@ -0,0 +1,223 @@ +#! /bin/sh +# ylwrap - wrapper for lex/yacc invocations. + +scriptversion=2007-11-22.22 + +# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, +# 2007 Free Software Foundation, Inc. +# +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case "$1" in + '') + echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 + exit 1 + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... + +Wrapper for lex/yacc invocations, renaming files as desired. + + INPUT is the input file + OUTPUT is one file PROG generates + DESIRED is the file we actually want instead of OUTPUT + PROGRAM is program to run + ARGS are passed to PROG + +Any number of OUTPUT,DESIRED pairs may be used. + +Report bugs to . +EOF + exit $? + ;; + -v|--v*) + echo "ylwrap $scriptversion" + exit $? + ;; +esac + + +# The input. +input="$1" +shift +case "$input" in + [\\/]* | ?:[\\/]*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. + input="`pwd`/$input" + ;; +esac + +pairlist= +while test "$#" -ne 0; do + if test "$1" = "--"; then + shift + break + fi + pairlist="$pairlist $1" + shift +done + +# The program to run. +prog="$1" +shift +# Make any relative path in $prog absolute. +case "$prog" in + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog="`pwd`/$prog" ;; +esac + +# FIXME: add hostname here for parallel makes that run commands on +# other machines. But that might take us over the 14-char limit. +dirname=ylwrap$$ +trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 +mkdir $dirname || exit 1 + +cd $dirname + +case $# in + 0) "$prog" "$input" ;; + *) "$prog" "$@" "$input" ;; +esac +ret=$? + +if test $ret -eq 0; then + set X $pairlist + shift + first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + + # The directory holding the input. + input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` + # Quote $INPUT_DIR so we can use it in a regexp. + # FIXME: really we should care about more than `.' and `\'. + input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` + + while test "$#" -ne 0; do + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" + else + if test $from = "y.tab.h"; then + from="y_tab.h" + fi + fi + fi + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend `../'. + case "$2" in + [\\/]* | ?:[\\/]*) target="$2";; + *) target="../$2";; + esac + + # We do not want to overwrite a header file if it hasn't + # changed. This avoid useless recompilations. However the + # parser itself (the first file) should always be updated, + # because it is the destination of the .y.c rule in the + # Makefile. Divert the output of all other files to a temporary + # file so we can compare them to existing versions. + if test $first = no; then + realtarget="$target" + target="tmp-`echo $target | sed s/.*[\\/]//g`" + fi + # Edit out `#line' or `#' directives. + # + # We don't want the resulting debug information to point at + # an absolute srcdir; it is better for it to just mention the + # .y file with no path. + # + # We want to use the real output file name, not yy.lex.c for + # instance. + # + # We want the include guards to be adjusted too. + FROM=`echo "$from" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + TARGET=`echo "$2" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + + sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ + -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$? + + # Check whether header files must be updated. + if test $first = no; then + if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then + echo "$2" is unchanged + rm -f "$target" + else + echo updating "$2" + mv -f "$target" "$realtarget" + fi + fi + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + ret=1 + fi + fi + shift + shift + first=no + done +else + ret=$? +fi + +# Remove the directory. +cd .. +rm -rf $dirname + +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/cfg.mk b/cfg.mk new file mode 100644 index 0000000..bee0fcb --- /dev/null +++ b/cfg.mk @@ -0,0 +1,42 @@ +# Customize maint.mk -*- makefile -*- +# Copyright (C) 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 . + +# 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 ftp.gnu.org for major releases. +gnu_ftp_host-alpha = alpha.gnu.org +gnu_ftp_host-beta = alpha.gnu.org +gnu_ftp_host-major = ftp.gnu.org +gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE)) + +url_dir_list = \ + ftp://$(gnu_rel_host)/gnu/bison + +# Tests not to run as part of "make distcheck". +# Exclude changelog-check here so that there's less churn in ChangeLog +# files -- otherwise, you'd need to have the upcoming version number +# at the top of the file for each `make distcheck' run. +local-checks-to-skip = changelog-check + +# The local directory containing the checked-out copy of gnulib used in +# this release. Used solely to get a date for the "announcement" target. +gnulib_dir = $(srcdir)/../../gnulib diff --git a/configure b/configure new file mode 100755 index 0000000..694e667 --- /dev/null +++ b/configure @@ -0,0 +1,25869 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.62 for GNU Bison 2.4.1. +# +# Report bugs to . +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='GNU Bison' +PACKAGE_TARNAME='bison' +PACKAGE_VERSION='2.4.1' +PACKAGE_STRING='GNU Bison 2.4.1' +PACKAGE_BUGREPORT='bug-bison@gnu.org' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_list= +ac_func_list= +gt_needs= +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +PACKAGE_COPYRIGHT_YEAR +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +am__isrc +CYGPATH_W +PACKAGE +VERSION +ACLOCAL +AUTOCONF +AUTOMAKE +AUTOHEADER +MAKEINFO +install_sh +STRIP +INSTALL_STRIP_PROGRAM +MKDIR_P +mkdir_p +AWK +SET_MAKE +am__leading_dot +AMTAR +am__tar +am__untar +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +DEPDIR +am__include +am__quote +AMDEP_TRUE +AMDEP_FALSE +AMDEPBACKSLASH +CCDEPMODE +am__fastdepCC_TRUE +am__fastdepCC_FALSE +RANLIB +CPP +GREP +EGREP +WERROR_CFLAGS +WARN_CXXFLAGS +WARN_CFLAGS +YACC_SCRIPT +YACC_LIBRARY +LEX +LEX_OUTPUT_ROOT +LEXLIB +YACC +YFLAGS +M4 +HELP2MAN +XSLTPROC +GL_COND_LIBTOOL_TRUE +GL_COND_LIBTOOL_FALSE +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +GNULIB_CHOWN +GNULIB_CLOSE +GNULIB_DUP2 +GNULIB_ENVIRON +GNULIB_EUIDACCESS +GNULIB_FCHDIR +GNULIB_FSYNC +GNULIB_FTRUNCATE +GNULIB_GETCWD +GNULIB_GETDOMAINNAME +GNULIB_GETDTABLESIZE +GNULIB_GETHOSTNAME +GNULIB_GETLOGIN_R +GNULIB_GETPAGESIZE +GNULIB_GETUSERSHELL +GNULIB_LCHOWN +GNULIB_LSEEK +GNULIB_READLINK +GNULIB_SLEEP +GNULIB_UNISTD_H_SIGPIPE +GNULIB_WRITE +HAVE_DUP2 +HAVE_EUIDACCESS +HAVE_FSYNC +HAVE_FTRUNCATE +HAVE_GETDOMAINNAME +HAVE_GETDTABLESIZE +HAVE_GETHOSTNAME +HAVE_GETPAGESIZE +HAVE_GETUSERSHELL +HAVE_READLINK +HAVE_SLEEP +HAVE_DECL_ENVIRON +HAVE_DECL_GETLOGIN_R +HAVE_OS_H +HAVE_SYS_PARAM_H +REPLACE_CHOWN +REPLACE_CLOSE +REPLACE_FCHDIR +REPLACE_GETCWD +REPLACE_GETPAGESIZE +REPLACE_LCHOWN +REPLACE_LSEEK +REPLACE_WRITE +UNISTD_H_HAVE_WINSOCK2_H +INCLUDE_NEXT +INCLUDE_NEXT_AS_FIRST_DIRECTIVE +PRAGMA_SYSTEM_HEADER +NEXT_ERRNO_H +ERRNO_H +EMULTIHOP_HIDDEN +EMULTIHOP_VALUE +ENOLINK_HIDDEN +ENOLINK_VALUE +EOVERFLOW_HIDDEN +EOVERFLOW_VALUE +GETOPT_H +LIBINTL +LTLIBINTL +STDBOOL_H +HAVE__BOOL +HAVE_LONG_LONG_INT +HAVE_UNSIGNED_LONG_LONG_INT +HAVE_INTTYPES_H +HAVE_SYS_TYPES_H +NEXT_STDINT_H +HAVE_STDINT_H +HAVE_SYS_INTTYPES_H +HAVE_SYS_BITYPES_H +BITSIZEOF_PTRDIFF_T +BITSIZEOF_SIG_ATOMIC_T +BITSIZEOF_SIZE_T +BITSIZEOF_WCHAR_T +BITSIZEOF_WINT_T +HAVE_SIGNED_SIG_ATOMIC_T +HAVE_SIGNED_WCHAR_T +HAVE_SIGNED_WINT_T +PTRDIFF_T_SUFFIX +SIG_ATOMIC_T_SUFFIX +SIZE_T_SUFFIX +WCHAR_T_SUFFIX +WINT_T_SUFFIX +STDINT_H +PRI_MACROS_BROKEN +GNULIB_IMAXABS +GNULIB_IMAXDIV +GNULIB_STRTOIMAX +GNULIB_STRTOUMAX +HAVE_DECL_IMAXABS +HAVE_DECL_IMAXDIV +HAVE_DECL_STRTOIMAX +HAVE_DECL_STRTOUMAX +NEXT_INTTYPES_H +PRIPTR_PREFIX +INT32_MAX_LT_INTMAX_MAX +INT64_MAX_EQ_LONG_MAX +UINT32_MAX_LT_UINTMAX_MAX +UINT64_MAX_EQ_ULONG_MAX +INTTYPES_H +GLIBC21 +LOCALCHARSET_TESTS_ENVIRONMENT +HAVE_MALLOC_POSIX +GNULIB_MALLOC_POSIX +GNULIB_REALLOC_POSIX +GNULIB_CALLOC_POSIX +GNULIB_ATOLL +GNULIB_GETLOADAVG +GNULIB_GETSUBOPT +GNULIB_MKDTEMP +GNULIB_MKSTEMP +GNULIB_PUTENV +GNULIB_RANDOM_R +GNULIB_RPMATCH +GNULIB_SETENV +GNULIB_STRTOD +GNULIB_STRTOLL +GNULIB_STRTOULL +GNULIB_UNSETENV +HAVE_ATOLL +HAVE_CALLOC_POSIX +HAVE_GETSUBOPT +HAVE_MKDTEMP +HAVE_REALLOC_POSIX +HAVE_RANDOM_R +HAVE_RPMATCH +HAVE_SETENV +HAVE_STRTOD +HAVE_STRTOLL +HAVE_STRTOULL +HAVE_STRUCT_RANDOM_DATA +HAVE_SYS_LOADAVG_H +HAVE_UNSETENV +HAVE_DECL_GETLOADAVG +REPLACE_MKSTEMP +REPLACE_PUTENV +REPLACE_STRTOD +VOID_UNSETENV +NEXT_STDLIB_H +GNULIB_MEMMEM +GNULIB_MEMPCPY +GNULIB_MEMRCHR +GNULIB_RAWMEMCHR +GNULIB_STPCPY +GNULIB_STPNCPY +GNULIB_STRCHRNUL +GNULIB_STRDUP +GNULIB_STRNDUP +GNULIB_STRNLEN +GNULIB_STRPBRK +GNULIB_STRSEP +GNULIB_STRSTR +GNULIB_STRCASESTR +GNULIB_STRTOK_R +GNULIB_MBSLEN +GNULIB_MBSNLEN +GNULIB_MBSCHR +GNULIB_MBSRCHR +GNULIB_MBSSTR +GNULIB_MBSCASECMP +GNULIB_MBSNCASECMP +GNULIB_MBSPCASECMP +GNULIB_MBSCASESTR +GNULIB_MBSCSPN +GNULIB_MBSPBRK +GNULIB_MBSSPN +GNULIB_MBSSEP +GNULIB_MBSTOK_R +GNULIB_STRERROR +GNULIB_STRSIGNAL +GNULIB_STRVERSCMP +HAVE_DECL_MEMMEM +HAVE_MEMPCPY +HAVE_DECL_MEMRCHR +HAVE_RAWMEMCHR +HAVE_STPCPY +HAVE_STPNCPY +HAVE_STRCHRNUL +HAVE_DECL_STRDUP +HAVE_STRNDUP +HAVE_DECL_STRNDUP +HAVE_DECL_STRNLEN +HAVE_STRPBRK +HAVE_STRSEP +HAVE_STRCASESTR +HAVE_DECL_STRTOK_R +HAVE_DECL_STRERROR +HAVE_DECL_STRSIGNAL +HAVE_STRVERSCMP +REPLACE_MEMMEM +REPLACE_STRDUP +REPLACE_STRSTR +REPLACE_STRCASESTR +REPLACE_STRERROR +REPLACE_STRSIGNAL +NEXT_STRING_H +NEXT_UNISTD_H +HAVE_UNISTD_H +GNULIB_WCWIDTH +HAVE_DECL_WCWIDTH +REPLACE_WCWIDTH +WCHAR_H +HAVE_WINT_T +HAVE_WCHAR_H +NEXT_WCHAR_H +HAVE_ISWCNTRL +NEXT_WCTYPE_H +HAVE_WCTYPE_H +WCTYPE_H +REPLACE_ISWCNTRL +LIBBISON_LIBDEPS +LIBBISON_LTLIBDEPS +USE_NLS +GETTEXT_MACRO_VERSION +MSGFMT +GMSGFMT +MSGFMT_015 +GMSGFMT_015 +XGETTEXT +XGETTEXT_015 +MSGMERGE +XGETTEXT_EXTRA_OPTIONS +INTL_MACOSX_LIBS +LIBICONV +LTLIBICONV +INTLLIBS +POSUB +BISON_LOCALEDIR +aclocaldir +VALGRIND +CXX +CXXFLAGS +ac_ct_CXX +CXXDEPMODE +am__fastdepCXX_TRUE +am__fastdepCXX_FALSE +BISON_CXX_WORKS +BISON_CXX_WORKS_TRUE +BISON_CXX_WORKS_FALSE +AUTOM4TE +GCC +O0CFLAGS +O0CXXFLAGS +HAVE_GIJ_IN_PATH +HAVE_JAVA_IN_PATH +HAVE_JRE_IN_PATH +HAVE_JVIEW_IN_PATH +CONF_JAVA +CLASSPATH +CLASSPATH_SEPARATOR +HAVE_JAVA_ENVVAR +HAVE_GIJ +HAVE_JAVA +HAVE_JRE +HAVE_JVIEW +HAVE_GCJ_IN_PATH +HAVE_JAVAC_IN_PATH +HAVE_JIKES_IN_PATH +CONF_JAVAC +HAVE_JAVAC_ENVVAR +HAVE_GCJ_C +HAVE_JAVAC +HAVE_JIKES +LIBOBJS +LTLIBOBJS +gl_LIBOBJS +gl_LTLIBOBJS +gltests_LIBOBJS +gltests_LTLIBOBJS' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +enable_gcc_warnings +enable_yacc +with_dmalloc +enable_nls +with_gnu_ld +enable_rpath +with_libiconv_prefix +with_libintl_prefix +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +YACC +YFLAGS +CXX +CXXFLAGS +CCC' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; + *) $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { $as_echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures GNU Bison 2.4.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/bison] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of GNU Bison 2.4.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-gcc-warnings turn on lots of GCC warnings (not recommended) + --disable-yacc do not build a yacc command or an -ly library + --disable-nls do not use Native Language Support + --disable-rpath do not hardcode runtime library paths + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-dmalloc use dmalloc, as in + http://www.dmalloc.com/dmalloc.tar.gz + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + YACC The `Yet Another C Compiler' implementation to use. Defaults to + the first program found out of: `bison -y', `byacc', `yacc'. + YFLAGS The list of arguments that will be passed by default to $YACC. + This script will default YFLAGS to the empty string to avoid a + default value of `-d' given by some make applications. + CXX C++ compiler command + CXXFLAGS C++ compiler flags + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +GNU Bison configure 2.4.1 +generated by GNU Autoconf 2.62 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by GNU Bison $as_me 2.4.1, which was +generated by GNU Autoconf 2.62. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + ac_site_file1=$CONFIG_SITE +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test -r "$ac_site_file"; then + { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +ac_header_list="$ac_header_list locale.h" +ac_header_list="$ac_header_list errno.h" +ac_header_list="$ac_header_list stdint.h" +ac_header_list="$ac_header_list wchar.h" +ac_header_list="$ac_header_list inttypes.h" +ac_func_list="$ac_func_list isascii" +ac_func_list="$ac_func_list mbsinit" +ac_header_list="$ac_header_list stdlib.h" +ac_header_list="$ac_header_list sys/socket.h" +ac_header_list="$ac_header_list string.h" +ac_header_list="$ac_header_list unistd.h" +ac_func_list="$ac_func_list pipe" +ac_func_list="$ac_func_list iswcntrl" +ac_header_list="$ac_header_list wctype.h" +ac_func_list="$ac_func_list wcwidth" +ac_func_list="$ac_func_list setlocale" +gt_needs="$gt_needs need-formatstring-macros" +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +cat >>confdefs.h <<\_ACEOF +#define PACKAGE_COPYRIGHT_YEAR 2008 +_ACEOF + +PACKAGE_COPYRIGHT_YEAR=2008 + + +ac_aux_dir= +for ac_dir in build-aux "$srcdir"/build-aux; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in build-aux \"$srcdir\"/build-aux" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in build-aux \"$srcdir\"/build-aux" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + + +# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later. +# We want gnits strictness only when rolling a formal release so that we can, +# for example, run make dist at other times without being required to add a +# bogus NEWS entry. +am__api_version='1.10' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + +done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +$as_echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:$LINENO: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='bison' + VERSION='2.4.1' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + +ac_config_headers="$ac_config_headers lib/config.h:lib/config.hin" + + +# Checks for the compiler. +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + case $ac_cv_prog_cc_stdc in + no) ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; + *) { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if test "${ac_cv_prog_cc_c99+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c99=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 +else + { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 +else + ac_cv_prog_cc_stdc=no +fi + + +fi + + ;; +esac + { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO Standard C" >&5 +$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } + if test "${ac_cv_prog_cc_stdc+set}" = set; then + $as_echo_n "(cached) " >&6 +fi + + case $ac_cv_prog_cc_stdc in + no) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + '') { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + *) { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; +esac + + + +# Gnulib (early checks). +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test "x$CC" != xcc; then + { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest2.$ac_objext && { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest2.$ac_objext && { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define NO_MINUS_C_MINUS_O 1 +_ACEOF + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + if test "${ac_cv_header_minix_config_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 +$as_echo_n "checking for minix/config.h... " >&6; } +if test "${ac_cv_header_minix_config_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +$as_echo "$ac_cv_header_minix_config_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5 +$as_echo_n "checking minix/config.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5 +$as_echo_n "checking minix/config.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 +$as_echo_n "checking for minix/config.h... " >&6; } +if test "${ac_cv_header_minix_config_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_minix_config_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +$as_echo "$ac_cv_header_minix_config_h" >&6; } + +fi +if test $ac_cv_header_minix_config_h = yes; then + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_SOURCE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_1_SOURCE 2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _MINIX 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_safe_to_define___extensions__=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_safe_to_define___extensions__=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + cat >>confdefs.h <<\_ACEOF +#define __EXTENSIONS__ 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _ALL_SOURCE 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _TANDEM_SOURCE 1 +_ACEOF + + + + + + + + + + +# Check whether --enable-gcc-warnings was given. +if test "${enable_gcc_warnings+set}" = set; then + enableval=$enable_gcc_warnings; case "${enableval}" in + yes|no) ;; + *) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for gcc-warnings option" >&5 +$as_echo "$as_me: error: bad value ${enableval} for gcc-warnings option" >&2;} + { (exit 1); exit 1; }; } ;; + esac +else + enableval=no +fi + +if test "${enableval}" = yes; then + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Werror" >&5 +$as_echo_n "checking whether compiler handles -Werror... " >&6; } +if test "${gl_cv_warn__Werror+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Werror=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Werror=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Werror" >&5 +$as_echo "$gl_cv_warn__Werror" >&6; } +if test x"$gl_cv_warn__Werror" = x""yes; then + WERROR_CFLAGS=$WERROR_CFLAGS" -Werror" +fi + + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wall" >&5 +$as_echo_n "checking whether compiler handles -Wall... " >&6; } +if test "${gl_cv_warn__Wall+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wall" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wall=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wall=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wall" >&5 +$as_echo "$gl_cv_warn__Wall" >&6; } +if test x"$gl_cv_warn__Wall" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wall" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wextra -Wno-sign-compare" >&5 +$as_echo_n "checking whether compiler handles -Wextra -Wno-sign-compare... " >&6; } +if test "${gl_cv_warn__Wextra__Wno_sign_compare+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wextra -Wno-sign-compare" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wextra__Wno_sign_compare=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wextra__Wno_sign_compare=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wextra__Wno_sign_compare" >&5 +$as_echo "$gl_cv_warn__Wextra__Wno_sign_compare" >&6; } +if test x"$gl_cv_warn__Wextra__Wno_sign_compare" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wextra -Wno-sign-compare" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wcast-align" >&5 +$as_echo_n "checking whether compiler handles -Wcast-align... " >&6; } +if test "${gl_cv_warn__Wcast_align+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wcast-align" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wcast_align=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wcast_align=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wcast_align" >&5 +$as_echo "$gl_cv_warn__Wcast_align" >&6; } +if test x"$gl_cv_warn__Wcast_align" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wcast-align" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wcast-qual" >&5 +$as_echo_n "checking whether compiler handles -Wcast-qual... " >&6; } +if test "${gl_cv_warn__Wcast_qual+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wcast-qual" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wcast_qual=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wcast_qual=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wcast_qual" >&5 +$as_echo "$gl_cv_warn__Wcast_qual" >&6; } +if test x"$gl_cv_warn__Wcast_qual" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wcast-qual" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wformat" >&5 +$as_echo_n "checking whether compiler handles -Wformat... " >&6; } +if test "${gl_cv_warn__Wformat+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wformat" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wformat=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wformat=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wformat" >&5 +$as_echo "$gl_cv_warn__Wformat" >&6; } +if test x"$gl_cv_warn__Wformat" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wformat" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wpointer-arith" >&5 +$as_echo_n "checking whether compiler handles -Wpointer-arith... " >&6; } +if test "${gl_cv_warn__Wpointer_arith+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wpointer-arith" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wpointer_arith=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wpointer_arith=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wpointer_arith" >&5 +$as_echo "$gl_cv_warn__Wpointer_arith" >&6; } +if test x"$gl_cv_warn__Wpointer_arith" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wpointer-arith" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wwrite-strings" >&5 +$as_echo_n "checking whether compiler handles -Wwrite-strings... " >&6; } +if test "${gl_cv_warn__Wwrite_strings+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wwrite-strings" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wwrite_strings=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wwrite_strings=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wwrite_strings" >&5 +$as_echo "$gl_cv_warn__Wwrite_strings" >&6; } +if test x"$gl_cv_warn__Wwrite_strings" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wwrite-strings" +fi + + + WARN_CXXFLAGS=$WARN_CFLAGS + + # The following warnings are not suitable for C++. + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wbad-function-cast" >&5 +$as_echo_n "checking whether compiler handles -Wbad-function-cast... " >&6; } +if test "${gl_cv_warn__Wbad_function_cast+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wbad-function-cast" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wbad_function_cast=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wbad_function_cast=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wbad_function_cast" >&5 +$as_echo "$gl_cv_warn__Wbad_function_cast" >&6; } +if test x"$gl_cv_warn__Wbad_function_cast" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wbad-function-cast" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wmissing-declarations" >&5 +$as_echo_n "checking whether compiler handles -Wmissing-declarations... " >&6; } +if test "${gl_cv_warn__Wmissing_declarations+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wmissing-declarations" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wmissing_declarations=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wmissing_declarations=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wmissing_declarations" >&5 +$as_echo "$gl_cv_warn__Wmissing_declarations" >&6; } +if test x"$gl_cv_warn__Wmissing_declarations" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wmissing-declarations" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wmissing-prototypes" >&5 +$as_echo_n "checking whether compiler handles -Wmissing-prototypes... " >&6; } +if test "${gl_cv_warn__Wmissing_prototypes+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wmissing-prototypes" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wmissing_prototypes=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wmissing_prototypes=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wmissing_prototypes" >&5 +$as_echo "$gl_cv_warn__Wmissing_prototypes" >&6; } +if test x"$gl_cv_warn__Wmissing_prototypes" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wmissing-prototypes" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wshadow" >&5 +$as_echo_n "checking whether compiler handles -Wshadow... " >&6; } +if test "${gl_cv_warn__Wshadow+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wshadow" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wshadow=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wshadow=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wshadow" >&5 +$as_echo "$gl_cv_warn__Wshadow" >&6; } +if test x"$gl_cv_warn__Wshadow" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wshadow" +fi + + + { $as_echo "$as_me:$LINENO: checking whether compiler handles -Wstrict-prototypes" >&5 +$as_echo_n "checking whether compiler handles -Wstrict-prototypes... " >&6; } +if test "${gl_cv_warn__Wstrict_prototypes+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wstrict-prototypes" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_warn__Wstrict_prototypes=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_warn__Wstrict_prototypes=no +fi + +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_warn__Wstrict_prototypes" >&5 +$as_echo "$gl_cv_warn__Wstrict_prototypes" >&6; } +if test x"$gl_cv_warn__Wstrict_prototypes" = x""yes; then + WARN_CFLAGS=$WARN_CFLAGS" -Wstrict-prototypes" +fi + + + + +cat >>confdefs.h <<\_ACEOF +#define lint 1 +_ACEOF + +fi + + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + int test_array[CHAR_BIT]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { $as_echo "$as_me:$LINENO: error: cannot compile a simple C program +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compile a simple C program +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +# Check whether --enable-yacc was given. +if test "${enable_yacc+set}" = set; then + enableval=$enable_yacc; +else + enable_yacc=yes +fi + +case $enable_yacc in +yes) + YACC_SCRIPT=yacc + YACC_LIBRARY=liby.a;; +*) + YACC_SCRIPT= + YACC_LIBRARY=;; +esac + + + +# Checks for programs. +for ac_prog in flex lex +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LEX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LEX="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +LEX=$ac_cv_prog_LEX +if test -n "$LEX"; then + { $as_echo "$as_me:$LINENO: result: $LEX" >&5 +$as_echo "$LEX" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + +if test "x$LEX" != "x:"; then + cat >conftest.l <<_ACEOF +%% +a { ECHO; } +b { REJECT; } +c { yymore (); } +d { yyless (1); } +e { yyless (input () != 0); } +f { unput (yytext[0]); } +. { BEGIN INITIAL; } +%% +#ifdef YYTEXT_POINTER +extern char *yytext; +#endif +int +main (void) +{ + return ! yylex () + ! yywrap (); +} +_ACEOF +{ (ac_try="$LEX conftest.l" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$LEX conftest.l") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ $as_echo "$as_me:$LINENO: checking lex output file root" >&5 +$as_echo_n "checking lex output file root... " >&6; } +if test "${ac_cv_prog_lex_root+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + { { $as_echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 +$as_echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} + { (exit 1); exit 1; }; } +fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 +$as_echo "$ac_cv_prog_lex_root" >&6; } +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +if test -z "${LEXLIB+set}"; then + { $as_echo "$as_me:$LINENO: checking lex library" >&5 +$as_echo_n "checking lex library... " >&6; } +if test "${ac_cv_lib_lex+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + ac_save_LIBS=$LIBS + ac_cv_lib_lex='none needed' + for ac_lib in '' -lfl -ll; do + LIBS="$ac_lib $ac_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_lex=$ac_lib +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + test "$ac_cv_lib_lex" != 'none needed' && break + done + LIBS=$ac_save_LIBS + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5 +$as_echo "$ac_cv_lib_lex" >&6; } + test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex +fi + + +{ $as_echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 +$as_echo_n "checking whether yytext is a pointer... " >&6; } +if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then + $as_echo_n "(cached) " >&6 +else + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +ac_save_LIBS=$LIBS +LIBS="$LEXLIB $ac_save_LIBS" +cat >conftest.$ac_ext <<_ACEOF +#define YYTEXT_POINTER 1 +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_prog_lex_yytext_pointer=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 +$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } +if test $ac_cv_prog_lex_yytext_pointer = yes; then + +cat >>confdefs.h <<\_ACEOF +#define YYTEXT_POINTER 1 +_ACEOF + +fi +rm -f conftest.l $LEX_OUTPUT_ROOT.c + +fi +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_YACC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_YACC="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + { $as_echo "$as_me:$LINENO: result: $YACC" >&5 +$as_echo "$YACC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +for ac_prog in gm4 gnum4 m4 +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_M4+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $M4 in + [\\/]* | ?:[\\/]*) + ac_cv_path_M4="$M4" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_M4="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +M4=$ac_cv_path_M4 +if test -n "$M4"; then + { $as_echo "$as_me:$LINENO: result: $M4" >&5 +$as_echo "$M4" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$M4" && break +done +test -n "$M4" || M4="m4" + +{ $as_echo "$as_me:$LINENO: checking whether m4 supports frozen files" >&5 +$as_echo_n "checking whether m4 supports frozen files... " >&6; } +if test "${ac_cv_prog_gnu_m4+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_gnu_m4=no +if test x"$M4" != x; then + case `$M4 --help < /dev/null 2>&1` in + *reload-state*) ac_cv_prog_gnu_m4=yes ;; + esac +fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_gnu_m4" >&5 +$as_echo "$ac_cv_prog_gnu_m4" >&6; } +if test x"$ac_cv_prog_gnu_m4" != xyes; then + { { $as_echo "$as_me:$LINENO: error: GNU M4 1.4 is required" >&5 +$as_echo "$as_me: error: GNU M4 1.4 is required" >&2;} + { (exit 1); exit 1; }; } +fi + +cat >>confdefs.h <<_ACEOF +#define M4 "$M4" +_ACEOF + + +HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} + +# Extract the first word of "xsltproc", so it can be a program name with args. +set dummy xsltproc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_XSLTPROC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $XSLTPROC in + [\\/]* | ?:[\\/]*) + ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +XSLTPROC=$ac_cv_path_XSLTPROC +if test -n "$XSLTPROC"; then + { $as_echo "$as_me:$LINENO: result: $XSLTPROC" >&5 +$as_echo "$XSLTPROC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + +# Checks for header files. + + + + +for ac_header in $ac_header_list +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + + +# Checks for compiler characteristics. +{ $as_echo "$as_me:$LINENO: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if test "${ac_cv_c_inline+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_inline=$ac_kw +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + +# Gnulib (later checks). Putting them here rather than right after +# gl_EARLY avoids some redundant checks. + + + + + + + + { $as_echo "$as_me:$LINENO: checking whether system is Windows or MSDOS" >&5 +$as_echo_n "checking whether system is Windows or MSDOS... " >&6; } +if test "${ac_cv_win_or_dos+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ +neither MSDOS nor Windows +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_win_or_dos=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_win_or_dos=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_win_or_dos" >&5 +$as_echo "$ac_cv_win_or_dos" >&6; } + + if test x"$ac_cv_win_or_dos" = xyes; then + ac_fs_accepts_drive_letter_prefix=1 + ac_fs_backslash_is_file_name_separator=1 + { $as_echo "$as_me:$LINENO: checking whether drive letter can start relative path" >&5 +$as_echo_n "checking whether drive letter can start relative path... " >&6; } +if test "${ac_cv_drive_letter_can_be_relative+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#if defined __CYGWIN__ +drive letters are always absolute +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_drive_letter_can_be_relative=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_drive_letter_can_be_relative=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_drive_letter_can_be_relative" >&5 +$as_echo "$ac_cv_drive_letter_can_be_relative" >&6; } + if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then + ac_fs_drive_letter_can_be_relative=1 + else + ac_fs_drive_letter_can_be_relative=0 + fi + else + ac_fs_accepts_drive_letter_prefix=0 + ac_fs_backslash_is_file_name_separator=0 + ac_fs_drive_letter_can_be_relative=0 + fi + + +cat >>confdefs.h <<_ACEOF +#define FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX $ac_fs_accepts_drive_letter_prefix +_ACEOF + + + + + + +cat >>confdefs.h <<_ACEOF +#define FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR $ac_fs_backslash_is_file_name_separator +_ACEOF + + + +cat >>confdefs.h <<_ACEOF +#define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE $ac_fs_drive_letter_can_be_relative +_ACEOF + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ $as_echo "$as_me:$LINENO: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +$as_echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:$LINENO: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +$as_echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + + + { $as_echo "$as_me:$LINENO: checking whether // is distinct from /" >&5 +$as_echo_n "checking whether // is distinct from /... " >&6; } +if test "${gl_cv_double_slash_root+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test x"$cross_compiling" = xyes ; then + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # . + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac + else + set x `ls -di / // 2>/dev/null` + if test "$2" = "$4" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_double_slash_root" >&5 +$as_echo "$gl_cv_double_slash_root" >&6; } + if test "$gl_cv_double_slash_root" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1 +_ACEOF + + fi + + + GNULIB_CHOWN=0; + GNULIB_CLOSE=0; + GNULIB_DUP2=0; + GNULIB_ENVIRON=0; + GNULIB_EUIDACCESS=0; + GNULIB_FCHDIR=0; + GNULIB_FSYNC=0; + GNULIB_FTRUNCATE=0; + GNULIB_GETCWD=0; + GNULIB_GETDOMAINNAME=0; + GNULIB_GETDTABLESIZE=0; + GNULIB_GETHOSTNAME=0; + GNULIB_GETLOGIN_R=0; + GNULIB_GETPAGESIZE=0; + GNULIB_GETUSERSHELL=0; + GNULIB_LCHOWN=0; + GNULIB_LSEEK=0; + GNULIB_READLINK=0; + GNULIB_SLEEP=0; + GNULIB_UNISTD_H_SIGPIPE=0; + GNULIB_WRITE=0; + HAVE_DUP2=1; + HAVE_EUIDACCESS=1; + HAVE_FSYNC=1; + HAVE_FTRUNCATE=1; + HAVE_GETDOMAINNAME=1; + HAVE_GETDTABLESIZE=1; + HAVE_GETHOSTNAME=1; + HAVE_GETPAGESIZE=1; + HAVE_GETUSERSHELL=1; + HAVE_READLINK=1; + HAVE_SLEEP=1; + HAVE_DECL_ENVIRON=1; + HAVE_DECL_GETLOGIN_R=1; + HAVE_OS_H=0; + HAVE_SYS_PARAM_H=0; + REPLACE_CHOWN=0; + REPLACE_CLOSE=0; + REPLACE_FCHDIR=0; + REPLACE_GETCWD=0; + REPLACE_GETPAGESIZE=0; + REPLACE_LCHOWN=0; + REPLACE_LSEEK=0; + REPLACE_WRITE=0; + UNISTD_H_HAVE_WINSOCK2_H=0; + + + + { $as_echo "$as_me:$LINENO: checking whether the preprocessor supports include_next" >&5 +$as_echo_n "checking whether the preprocessor supports include_next... " >&6; } +if test "${gl_cv_have_include_next+set}" = set; then + $as_echo_n "(cached) " >&6 +else + rm -rf conftestd1a conftestd1b conftestd2 + mkdir conftestd1a conftestd1b conftestd2 + cat < conftestd1a/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd1b/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd2/conftest.h +#ifndef DEFINED_IN_CONFTESTD1 +#error "include_next test doesn't work" +#endif +#define DEFINED_IN_CONFTESTD2 +EOF + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" + cat >conftest.$ac_ext <<_ACEOF +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_have_include_next=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" + cat >conftest.$ac_ext <<_ACEOF +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_have_include_next=buggy +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_have_include_next=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + rm -rf conftestd1a conftestd1b conftestd2 + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_have_include_next" >&5 +$as_echo "$gl_cv_have_include_next" >&6; } + PRAGMA_SYSTEM_HEADER= + if test $gl_cv_have_include_next = yes; then + INCLUDE_NEXT=include_next + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + if test -n "$GCC"; then + PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' + fi + else + if test $gl_cv_have_include_next = buggy; then + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + else + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include + fi + fi + + + + + + + + + { $as_echo "$as_me:$LINENO: checking for complete errno.h" >&5 +$as_echo_n "checking for complete errno.h... " >&6; } +if test "${gl_cv_header_errno_h_complete+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#if !defined ENOMSG +booboo +#endif +#if !defined EIDRM +booboo +#endif +#if !defined ENOLINK +booboo +#endif +#if !defined EPROTO +booboo +#endif +#if !defined EMULTIHOP +booboo +#endif +#if !defined EBADMSG +booboo +#endif +#if !defined EOVERFLOW +booboo +#endif +#if !defined ENOTSUP +booboo +#endif +#if !defined ECANCELED +booboo +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "booboo" >/dev/null 2>&1; then + gl_cv_header_errno_h_complete=no +else + gl_cv_header_errno_h_complete=yes +fi +rm -f conftest* + + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_errno_h_complete" >&5 +$as_echo "$gl_cv_header_errno_h_complete" >&6; } + if test $gl_cv_header_errno_h_complete = yes; then + ERRNO_H='' + else + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_errno_h='<'errno.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_errno_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_errno_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_errno_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/errno.h#{ + s#.*"\(.*/errno.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_errno_h='<'errno.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_errno_h" >&5 +$as_echo "$gl_cv_next_errno_h" >&6; } + fi + NEXT_ERRNO_H=$gl_cv_next_errno_h + + + + ERRNO_H='errno.h' + fi + + + if test -n "$ERRNO_H"; then + { $as_echo "$as_me:$LINENO: checking for EMULTIHOP value" >&5 +$as_echo_n "checking for EMULTIHOP value... " >&6; } +if test "${gl_cv_header_errno_h_EMULTIHOP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef EMULTIHOP +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + gl_cv_header_errno_h_EMULTIHOP=yes +else + gl_cv_header_errno_h_EMULTIHOP=no +fi +rm -f conftest* + + if test $gl_cv_header_errno_h_EMULTIHOP = no; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef EMULTIHOP +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + gl_cv_header_errno_h_EMULTIHOP=hidden +fi +rm -f conftest* + + if test $gl_cv_header_errno_h_EMULTIHOP = hidden; then + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EMULTIHOP) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EMULTIHOP) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EMULTIHOP) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EMULTIHOP) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EMULTIHOP) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) gl_cv_header_errno_h_EMULTIHOP=$ac_lo;; +'') ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +static long int longval () { return EMULTIHOP; } +static unsigned long int ulongval () { return EMULTIHOP; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((EMULTIHOP) < 0) + { + long int i = longval (); + if (i != (EMULTIHOP)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (EMULTIHOP)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_header_errno_h_EMULTIHOP=`cat conftest.val` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + fi + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_errno_h_EMULTIHOP" >&5 +$as_echo "$gl_cv_header_errno_h_EMULTIHOP" >&6; } + case $gl_cv_header_errno_h_EMULTIHOP in + yes | no) + EMULTIHOP_HIDDEN=0; EMULTIHOP_VALUE= + ;; + *) + EMULTIHOP_HIDDEN=1; EMULTIHOP_VALUE="$gl_cv_header_errno_h_EMULTIHOP" + ;; + esac + + + fi + + + if test -n "$ERRNO_H"; then + { $as_echo "$as_me:$LINENO: checking for ENOLINK value" >&5 +$as_echo_n "checking for ENOLINK value... " >&6; } +if test "${gl_cv_header_errno_h_ENOLINK+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef ENOLINK +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + gl_cv_header_errno_h_ENOLINK=yes +else + gl_cv_header_errno_h_ENOLINK=no +fi +rm -f conftest* + + if test $gl_cv_header_errno_h_ENOLINK = no; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef ENOLINK +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + gl_cv_header_errno_h_ENOLINK=hidden +fi +rm -f conftest* + + if test $gl_cv_header_errno_h_ENOLINK = hidden; then + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((ENOLINK) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((ENOLINK) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((ENOLINK) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((ENOLINK) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((ENOLINK) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) gl_cv_header_errno_h_ENOLINK=$ac_lo;; +'') ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +static long int longval () { return ENOLINK; } +static unsigned long int ulongval () { return ENOLINK; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((ENOLINK) < 0) + { + long int i = longval (); + if (i != (ENOLINK)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (ENOLINK)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_header_errno_h_ENOLINK=`cat conftest.val` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + fi + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_errno_h_ENOLINK" >&5 +$as_echo "$gl_cv_header_errno_h_ENOLINK" >&6; } + case $gl_cv_header_errno_h_ENOLINK in + yes | no) + ENOLINK_HIDDEN=0; ENOLINK_VALUE= + ;; + *) + ENOLINK_HIDDEN=1; ENOLINK_VALUE="$gl_cv_header_errno_h_ENOLINK" + ;; + esac + + + fi + + + if test -n "$ERRNO_H"; then + { $as_echo "$as_me:$LINENO: checking for EOVERFLOW value" >&5 +$as_echo_n "checking for EOVERFLOW value... " >&6; } +if test "${gl_cv_header_errno_h_EOVERFLOW+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef EOVERFLOW +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + gl_cv_header_errno_h_EOVERFLOW=yes +else + gl_cv_header_errno_h_EOVERFLOW=no +fi +rm -f conftest* + + if test $gl_cv_header_errno_h_EOVERFLOW = no; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef EOVERFLOW +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + gl_cv_header_errno_h_EOVERFLOW=hidden +fi +rm -f conftest* + + if test $gl_cv_header_errno_h_EOVERFLOW = hidden; then + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) gl_cv_header_errno_h_EOVERFLOW=$ac_lo;; +'') ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +static long int longval () { return EOVERFLOW; } +static unsigned long int ulongval () { return EOVERFLOW; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((EOVERFLOW) < 0) + { + long int i = longval (); + if (i != (EOVERFLOW)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (EOVERFLOW)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_header_errno_h_EOVERFLOW=`cat conftest.val` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + fi + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_errno_h_EOVERFLOW" >&5 +$as_echo "$gl_cv_header_errno_h_EOVERFLOW" >&6; } + case $gl_cv_header_errno_h_EOVERFLOW in + yes | no) + EOVERFLOW_HIDDEN=0; EOVERFLOW_VALUE= + ;; + *) + EOVERFLOW_HIDDEN=1; EOVERFLOW_VALUE="$gl_cv_header_errno_h_EOVERFLOW" + ;; + esac + + + fi + + +{ $as_echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 +$as_echo_n "checking whether strerror_r is declared... " >&6; } +if test "${ac_cv_have_decl_strerror_r+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strerror_r + (void) strerror_r; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_strerror_r=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strerror_r=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 +$as_echo "$ac_cv_have_decl_strerror_r" >&6; } +if test $ac_cv_have_decl_strerror_r = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 0 +_ACEOF + + +fi + + + +for ac_func in strerror_r +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +{ $as_echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5 +$as_echo_n "checking whether strerror_r returns char *... " >&6; } +if test "${ac_cv_func_strerror_r_char_p+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_func_strerror_r_char_p=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + # strerror_r is not declared. Choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + extern char *strerror_r (); +int +main () +{ +char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + return ! isalpha (x); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strerror_r_char_p=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5 +$as_echo "$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STRERROR_R_CHAR_P 1 +_ACEOF + +fi + + + XGETTEXT_EXTRA_OPTIONS= + + + if test -z "$GETOPT_H"; then + +for ac_header in getopt.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + GETOPT_H=getopt.h +fi + +done + + fi + + if test -z "$GETOPT_H"; then + +for ac_func in getopt_long_only +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + GETOPT_H=getopt.h +fi +done + + fi + + if test -z "$GETOPT_H"; then + { $as_echo "$as_me:$LINENO: checking whether optreset is declared" >&5 +$as_echo_n "checking whether optreset is declared... " >&6; } +if test "${ac_cv_have_decl_optreset+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef optreset + (void) optreset; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_optreset=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_optreset=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_optreset" >&5 +$as_echo "$ac_cv_have_decl_optreset" >&6; } +if test $ac_cv_have_decl_optreset = yes; then + GETOPT_H=getopt.h +fi + + fi + + if test -z "$GETOPT_H"; then + { $as_echo "$as_me:$LINENO: checking for working GNU getopt function" >&5 +$as_echo_n "checking for working GNU getopt function... " >&6; } +if test "${gl_cv_func_gnu_getopt+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + { $as_echo "$as_me:$LINENO: checking whether getopt_clip is declared" >&5 +$as_echo_n "checking whether getopt_clip is declared... " >&6; } +if test "${ac_cv_have_decl_getopt_clip+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef getopt_clip + (void) getopt_clip; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_getopt_clip=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_getopt_clip=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5 +$as_echo "$ac_cv_have_decl_getopt_clip" >&6; } +if test $ac_cv_have_decl_getopt_clip = yes; then + gl_cv_func_gnu_getopt=no +else + gl_cv_func_gnu_getopt=yes +fi + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + char *myargv[3]; + myargv[0] = "conftest"; + myargv[1] = "-+"; + myargv[2] = 0; + return getopt (2, myargv, "+a") != '?'; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_gnu_getopt=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_gnu_getopt=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_gnu_getopt" >&5 +$as_echo "$gl_cv_func_gnu_getopt" >&6; } + if test "$gl_cv_func_gnu_getopt" = "no"; then + GETOPT_H=getopt.h + fi + fi + +{ $as_echo "$as_me:$LINENO: checking whether getenv is declared" >&5 +$as_echo_n "checking whether getenv is declared... " >&6; } +if test "${ac_cv_have_decl_getenv+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getenv + (void) getenv; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_getenv=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_getenv=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 +$as_echo "$ac_cv_have_decl_getenv" >&6; } +if test $ac_cv_have_decl_getenv = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if test "${ac_cv_header_stdbool_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + #if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a run-time + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); + #endif + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + +int +main () +{ + + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdbool_h=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdbool_h=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } + { $as_echo "$as_me:$LINENO: checking for _Bool" >&5 +$as_echo_n "checking for _Bool... " >&6; } +if test "${ac_cv_type__Bool+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type__Bool=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (_Bool)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((_Bool))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type__Bool=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 +$as_echo "$ac_cv_type__Bool" >&6; } +if test $ac_cv_type__Bool = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF + + +fi + + if test $ac_cv_header_stdbool_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STDBOOL_H 1 +_ACEOF + + fi + + + + # Define two additional variables used in the Makefile substitution. + + if test "$ac_cv_header_stdbool_h" = yes; then + STDBOOL_H='' + else + STDBOOL_H='stdbool.h' + fi + + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi + + + + { $as_echo "$as_me:$LINENO: checking for long long int" >&5 +$as_echo_n "checking for long long int... " >&6; } +if test "${ac_cv_type_long_long_int+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63; +int +main () +{ +/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + if test "$cross_compiling" = yes; then + ac_cv_type_long_long_int=yes +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif +int +main () +{ +long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long_long_int=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_type_long_long_int=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_long_int=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5 +$as_echo "$ac_cv_type_long_long_int" >&6; } + if test $ac_cv_type_long_long_int = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_LONG_INT 1 +_ACEOF + + fi + + + { $as_echo "$as_me:$LINENO: checking for unsigned long long int" >&5 +$as_echo_n "checking for unsigned long long int... " >&6; } +if test "${ac_cv_type_unsigned_long_long_int+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63; +int +main () +{ +/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_type_unsigned_long_long_int=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_long_long_int=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long_int" >&5 +$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } + if test $ac_cv_type_unsigned_long_long_int = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UNSIGNED_LONG_LONG_INT 1 +_ACEOF + + fi + + + + + + + + + if test $ac_cv_type_long_long_int = yes; then + HAVE_LONG_LONG_INT=1 + else + HAVE_LONG_LONG_INT=0 + fi + + + if test $ac_cv_type_unsigned_long_long_int = yes; then + HAVE_UNSIGNED_LONG_LONG_INT=1 + else + HAVE_UNSIGNED_LONG_LONG_INT=0 + fi + + + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + + + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdint_h='<'stdint.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_stdint_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_stdint_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_stdint_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdint.h#{ + s#.*"\(.*/stdint.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdint_h='<'stdint.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_stdint_h" >&5 +$as_echo "$gl_cv_next_stdint_h" >&6; } + fi + NEXT_STDINT_H=$gl_cv_next_stdint_h + + + + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + + + if test $ac_cv_header_stdint_h = yes; then + { $as_echo "$as_me:$LINENO: checking whether stdint.h conforms to C99" >&5 +$as_echo_n "checking whether stdint.h conforms to C99... " >&6; } +if test "${gl_cv_header_working_stdint_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + gl_cv_header_working_stdint_h=no + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif + + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_header_working_stdint_h=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_working_stdint_h" >&5 +$as_echo "$gl_cv_header_working_stdint_h" >&6; } + fi + if test "$gl_cv_header_working_stdint_h" = yes; then + STDINT_H= + else + + +for ac_header in sys/inttypes.h sys/bitypes.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + else + HAVE_SYS_INTTYPES_H=0 + fi + + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + else + HAVE_SYS_BITYPES_H=0 + fi + + + + + + + + + + + + + + + + + + for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do + { $as_echo "$as_me:$LINENO: checking for bit size of $gltype" >&5 +$as_echo_n "checking for bit size of $gltype... " >&6; } +if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) result=$ac_lo;; +'') result=unknown ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +static long int longval () { return sizeof ($gltype) * CHAR_BIT; } +static unsigned long int ulongval () { return sizeof ($gltype) * CHAR_BIT; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((sizeof ($gltype) * CHAR_BIT) < 0) + { + long int i = longval (); + if (i != (sizeof ($gltype) * CHAR_BIT)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (sizeof ($gltype) * CHAR_BIT)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + result=`cat conftest.val` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +result=unknown +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +ac_res=`eval 'as_val=${'gl_cv_bitsizeof_${gltype}'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + cat >>confdefs.h <<_ACEOF +#define BITSIZEOF_${GLTYPE} $result +_ACEOF + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + + + + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { $as_echo "$as_me:$LINENO: checking whether $gltype is signed" >&5 +$as_echo_n "checking whether $gltype is signed... " >&6; } +if { as_var=gl_cv_type_${gltype}_signed; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + result=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + result=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval gl_cv_type_${gltype}_signed=\$result + +fi +ac_res=`eval 'as_val=${'gl_cv_type_${gltype}_signed'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNED_${GLTYPE} 1 +_ACEOF + + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + + + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + + + + + + + + for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do + { $as_echo "$as_me:$LINENO: checking for $gltype integer literal suffix" >&5 +$as_echo_n "checking for $gltype integer literal suffix... " >&6; } +if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval gl_cv_type_${gltype}_suffix=\$glsuf +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +ac_res=`eval 'as_val=${'gl_cv_type_${gltype}_suffix'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + cat >>confdefs.h <<_ACEOF +#define ${GLTYPE}_SUFFIX $result +_ACEOF + + done + + + + STDINT_H=stdint.h + fi + + + + +for ac_header in inttypes.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + if test $ac_cv_header_inttypes_h = yes; then + { $as_echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 +$as_echo_n "checking whether the inttypes.h PRIxNN macros are broken... " >&6; } +if test "${gt_cv_inttypes_pri_broken+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#ifdef PRId32 +char *p = PRId32; +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_inttypes_pri_broken=no +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_inttypes_pri_broken=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 +$as_echo "$gt_cv_inttypes_pri_broken" >&6; } + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + +cat >>confdefs.h <<_ACEOF +#define PRI_MACROS_BROKEN 1 +_ACEOF + + PRI_MACROS_BROKEN=1 + else + PRI_MACROS_BROKEN=0 + fi + + +{ $as_echo "$as_me:$LINENO: checking whether imaxabs is declared" >&5 +$as_echo_n "checking whether imaxabs is declared... " >&6; } +if test "${ac_cv_have_decl_imaxabs+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef imaxabs + (void) imaxabs; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_imaxabs=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_imaxabs=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_imaxabs" >&5 +$as_echo "$ac_cv_have_decl_imaxabs" >&6; } +if test $ac_cv_have_decl_imaxabs = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IMAXABS 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IMAXABS 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether imaxdiv is declared" >&5 +$as_echo_n "checking whether imaxdiv is declared... " >&6; } +if test "${ac_cv_have_decl_imaxdiv+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef imaxdiv + (void) imaxdiv; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_imaxdiv=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_imaxdiv=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_imaxdiv" >&5 +$as_echo "$ac_cv_have_decl_imaxdiv" >&6; } +if test $ac_cv_have_decl_imaxdiv = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IMAXDIV 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IMAXDIV 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether strtoimax is declared" >&5 +$as_echo_n "checking whether strtoimax is declared... " >&6; } +if test "${ac_cv_have_decl_strtoimax+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strtoimax + (void) strtoimax; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_strtoimax=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strtoimax=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strtoimax" >&5 +$as_echo "$ac_cv_have_decl_strtoimax" >&6; } +if test $ac_cv_have_decl_strtoimax = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOIMAX 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOIMAX 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether strtoumax is declared" >&5 +$as_echo_n "checking whether strtoumax is declared... " >&6; } +if test "${ac_cv_have_decl_strtoumax+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strtoumax + (void) strtoumax; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_strtoumax=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strtoumax=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strtoumax" >&5 +$as_echo "$ac_cv_have_decl_strtoumax" >&6; } +if test $ac_cv_have_decl_strtoumax = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOUMAX 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOUMAX 0 +_ACEOF + + +fi + + + + GNULIB_IMAXABS=0; + GNULIB_IMAXDIV=0; + GNULIB_STRTOIMAX=0; + GNULIB_STRTOUMAX=0; + HAVE_DECL_IMAXABS=1; + HAVE_DECL_IMAXDIV=1; + HAVE_DECL_STRTOIMAX=1; + HAVE_DECL_STRTOUMAX=1; + + + + + { $as_echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 +$as_echo_n "checking for nl_langinfo and CODESET... " >&6; } +if test "${am_cv_langinfo_codeset+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char* cs = nl_langinfo(CODESET); return !cs; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + am_cv_langinfo_codeset=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + am_cv_langinfo_codeset=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 +$as_echo "$am_cv_langinfo_codeset" >&6; } + if test $am_cv_langinfo_codeset = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LANGINFO_CODESET 1 +_ACEOF + + fi + +{ $as_echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 +$as_echo_n "checking whether getc_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getc_unlocked + (void) getc_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_getc_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_getc_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 +$as_echo "$ac_cv_have_decl_getc_unlocked" >&6; } +if test $ac_cv_have_decl_getc_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETC_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETC_UNLOCKED 0 +_ACEOF + + +fi + + + + { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 +$as_echo_n "checking whether we are using the GNU C Library 2.1 or newer... " >&6; } +if test "${ac_cv_gnu_library_2_1+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky GNU user" >/dev/null 2>&1; then + ac_cv_gnu_library_2_1=yes +else + ac_cv_gnu_library_2_1=no +fi +rm -f conftest* + + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 +$as_echo "$ac_cv_gnu_library_2_1" >&6; } + + GLIBC21="$ac_cv_gnu_library_2_1" + + + + { $as_echo "$as_me:$LINENO: checking whether malloc, realloc, calloc are POSIX compliant" >&5 +$as_echo_n "checking whether malloc, realloc, calloc are POSIX compliant... " >&6; } +if test "${gl_cv_func_malloc_posix+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + choke me + #endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_func_malloc_posix=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_malloc_posix=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_malloc_posix" >&5 +$as_echo "$gl_cv_func_malloc_posix" >&6; } + + + GNULIB_MALLOC_POSIX=0; + GNULIB_REALLOC_POSIX=0; + GNULIB_CALLOC_POSIX=0; + GNULIB_ATOLL=0; + GNULIB_GETLOADAVG=0; + GNULIB_GETSUBOPT=0; + GNULIB_MKDTEMP=0; + GNULIB_MKSTEMP=0; + GNULIB_PUTENV=0; + GNULIB_RANDOM_R=0; + GNULIB_RPMATCH=0; + GNULIB_SETENV=0; + GNULIB_STRTOD=0; + GNULIB_STRTOLL=0; + GNULIB_STRTOULL=0; + GNULIB_UNSETENV=0; + HAVE_ATOLL=1; + HAVE_CALLOC_POSIX=1; + HAVE_GETSUBOPT=1; + HAVE_MALLOC_POSIX=1; + HAVE_MKDTEMP=1; + HAVE_REALLOC_POSIX=1; + HAVE_RANDOM_R=1; + HAVE_RPMATCH=1; + HAVE_SETENV=1; + HAVE_STRTOD=1; + HAVE_STRTOLL=1; + HAVE_STRTOULL=1; + HAVE_STRUCT_RANDOM_DATA=1; + HAVE_SYS_LOADAVG_H=0; + HAVE_UNSETENV=1; + HAVE_DECL_GETLOADAVG=1; + REPLACE_MKSTEMP=0; + REPLACE_PUTENV=0; + REPLACE_STRTOD=0; + VOID_UNSETENV=0; + + + + + +for ac_func in $ac_func_list +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + +{ $as_echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5 +$as_echo_n "checking for C/C++ restrict keyword... " >&6; } +if test "${ac_cv_c_restrict+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_restrict=no + # The order here caters to the fact that C++ does not require restrict. + for ac_kw in __restrict __restrict__ _Restrict restrict; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + } +int +main () +{ +int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_restrict=$ac_kw +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break + done + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5 +$as_echo "$ac_cv_c_restrict" >&6; } + + + case $ac_cv_c_restrict in + restrict) ;; + no) cat >>confdefs.h <<\_ACEOF +#define restrict /**/ +_ACEOF + ;; + *) cat >>confdefs.h <<_ACEOF +#define restrict $ac_cv_c_restrict +_ACEOF + ;; + esac + + + GNULIB_MEMMEM=0; + GNULIB_MEMPCPY=0; + GNULIB_MEMRCHR=0; + GNULIB_RAWMEMCHR=0; + GNULIB_STPCPY=0; + GNULIB_STPNCPY=0; + GNULIB_STRCHRNUL=0; + GNULIB_STRDUP=0; + GNULIB_STRNDUP=0; + GNULIB_STRNLEN=0; + GNULIB_STRPBRK=0; + GNULIB_STRSEP=0; + GNULIB_STRSTR=0; + GNULIB_STRCASESTR=0; + GNULIB_STRTOK_R=0; + GNULIB_MBSLEN=0; + GNULIB_MBSNLEN=0; + GNULIB_MBSCHR=0; + GNULIB_MBSRCHR=0; + GNULIB_MBSSTR=0; + GNULIB_MBSCASECMP=0; + GNULIB_MBSNCASECMP=0; + GNULIB_MBSPCASECMP=0; + GNULIB_MBSCASESTR=0; + GNULIB_MBSCSPN=0; + GNULIB_MBSPBRK=0; + GNULIB_MBSSPN=0; + GNULIB_MBSSEP=0; + GNULIB_MBSTOK_R=0; + GNULIB_STRERROR=0; + GNULIB_STRSIGNAL=0; + GNULIB_STRVERSCMP=0; + HAVE_DECL_MEMMEM=1; + HAVE_MEMPCPY=1; + HAVE_DECL_MEMRCHR=1; + HAVE_RAWMEMCHR=1; + HAVE_STPCPY=1; + HAVE_STPNCPY=1; + HAVE_STRCHRNUL=1; + HAVE_DECL_STRDUP=1; + HAVE_STRNDUP=1; + HAVE_DECL_STRNDUP=1; + HAVE_DECL_STRNLEN=1; + HAVE_STRPBRK=1; + HAVE_STRSEP=1; + HAVE_STRCASESTR=1; + HAVE_DECL_STRTOK_R=1; + HAVE_DECL_STRERROR=1; + HAVE_DECL_STRSIGNAL=1; + HAVE_STRVERSCMP=1; + REPLACE_MEMMEM=0; + REPLACE_STRDUP=0; + REPLACE_STRSTR=0; + REPLACE_STRCASESTR=0; + REPLACE_STRERROR=0; + REPLACE_STRSIGNAL=0; + + + + + + + if test -z "$ERRNO_H"; then + { $as_echo "$as_me:$LINENO: checking for working strerror function" >&5 +$as_echo_n "checking for working strerror function... " >&6; } +if test "${gl_cv_func_working_strerror+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +return !*strerror (-2); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_func_working_strerror=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_working_strerror=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +return !*strerror (-2); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_working_strerror=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_working_strerror=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_working_strerror" >&5 +$as_echo "$gl_cv_func_working_strerror" >&6; } + if test $gl_cv_func_working_strerror = no; then + REPLACE_STRERROR=1 + fi + else + REPLACE_STRERROR=1 + fi + if test $REPLACE_STRERROR = 1; then + + { $as_echo "$as_me:$LINENO: checking whether strerror is declared" >&5 +$as_echo_n "checking whether strerror is declared... " >&6; } +if test "${ac_cv_have_decl_strerror+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strerror + (void) strerror; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_strerror=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strerror=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror" >&5 +$as_echo "$ac_cv_have_decl_strerror" >&6; } +if test $ac_cv_have_decl_strerror = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR 0 +_ACEOF + + +fi + + + + + + + + + if test $ac_cv_header_sys_socket_h != yes; then + +for ac_header in winsock2.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + fi + + fi + + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_string_h='<'string.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_string_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_string_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_string_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/string.h#{ + s#.*"\(.*/string.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_string_h='<'string.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_string_h" >&5 +$as_echo "$gl_cv_next_string_h" >&6; } + fi + NEXT_STRING_H=$gl_cv_next_string_h + + + + +{ $as_echo "$as_me:$LINENO: checking whether strndup is declared" >&5 +$as_echo_n "checking whether strndup is declared... " >&6; } +if test "${ac_cv_have_decl_strndup+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strndup + (void) strndup; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_strndup=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strndup=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strndup" >&5 +$as_echo "$ac_cv_have_decl_strndup" >&6; } +if test $ac_cv_have_decl_strndup = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNDUP 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNDUP 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether strnlen is declared" >&5 +$as_echo_n "checking whether strnlen is declared... " >&6; } +if test "${ac_cv_have_decl_strnlen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strnlen + (void) strnlen; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_strnlen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strnlen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strnlen" >&5 +$as_echo "$ac_cv_have_decl_strnlen" >&6; } +if test $ac_cv_have_decl_strnlen = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNLEN 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNLEN 0 +_ACEOF + + +fi + + + + + + +{ $as_echo "$as_me:$LINENO: checking whether clearerr_unlocked is declared" >&5 +$as_echo_n "checking whether clearerr_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_clearerr_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef clearerr_unlocked + (void) clearerr_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_clearerr_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_clearerr_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_clearerr_unlocked" >&5 +$as_echo "$ac_cv_have_decl_clearerr_unlocked" >&6; } +if test $ac_cv_have_decl_clearerr_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_CLEARERR_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_CLEARERR_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether feof_unlocked is declared" >&5 +$as_echo_n "checking whether feof_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_feof_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef feof_unlocked + (void) feof_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_feof_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_feof_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_feof_unlocked" >&5 +$as_echo "$ac_cv_have_decl_feof_unlocked" >&6; } +if test $ac_cv_have_decl_feof_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FEOF_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FEOF_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether ferror_unlocked is declared" >&5 +$as_echo_n "checking whether ferror_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_ferror_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef ferror_unlocked + (void) ferror_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_ferror_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_ferror_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_ferror_unlocked" >&5 +$as_echo "$ac_cv_have_decl_ferror_unlocked" >&6; } +if test $ac_cv_have_decl_ferror_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FERROR_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FERROR_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether fflush_unlocked is declared" >&5 +$as_echo_n "checking whether fflush_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_fflush_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fflush_unlocked + (void) fflush_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_fflush_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_fflush_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fflush_unlocked" >&5 +$as_echo "$ac_cv_have_decl_fflush_unlocked" >&6; } +if test $ac_cv_have_decl_fflush_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFLUSH_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFLUSH_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether fgets_unlocked is declared" >&5 +$as_echo_n "checking whether fgets_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_fgets_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fgets_unlocked + (void) fgets_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_fgets_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_fgets_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgets_unlocked" >&5 +$as_echo "$ac_cv_have_decl_fgets_unlocked" >&6; } +if test $ac_cv_have_decl_fgets_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FGETS_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FGETS_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether fputc_unlocked is declared" >&5 +$as_echo_n "checking whether fputc_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_fputc_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fputc_unlocked + (void) fputc_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_fputc_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_fputc_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputc_unlocked" >&5 +$as_echo "$ac_cv_have_decl_fputc_unlocked" >&6; } +if test $ac_cv_have_decl_fputc_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPUTC_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPUTC_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether fputs_unlocked is declared" >&5 +$as_echo_n "checking whether fputs_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_fputs_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fputs_unlocked + (void) fputs_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_fputs_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_fputs_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputs_unlocked" >&5 +$as_echo "$ac_cv_have_decl_fputs_unlocked" >&6; } +if test $ac_cv_have_decl_fputs_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPUTS_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPUTS_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether fread_unlocked is declared" >&5 +$as_echo_n "checking whether fread_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_fread_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fread_unlocked + (void) fread_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_fread_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_fread_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fread_unlocked" >&5 +$as_echo "$ac_cv_have_decl_fread_unlocked" >&6; } +if test $ac_cv_have_decl_fread_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREAD_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREAD_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether fwrite_unlocked is declared" >&5 +$as_echo_n "checking whether fwrite_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_fwrite_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fwrite_unlocked + (void) fwrite_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_fwrite_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_fwrite_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fwrite_unlocked" >&5 +$as_echo "$ac_cv_have_decl_fwrite_unlocked" >&6; } +if test $ac_cv_have_decl_fwrite_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FWRITE_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FWRITE_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether getchar_unlocked is declared" >&5 +$as_echo_n "checking whether getchar_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_getchar_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getchar_unlocked + (void) getchar_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_getchar_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_getchar_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getchar_unlocked" >&5 +$as_echo "$ac_cv_have_decl_getchar_unlocked" >&6; } +if test $ac_cv_have_decl_getchar_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETCHAR_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETCHAR_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether putc_unlocked is declared" >&5 +$as_echo_n "checking whether putc_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_putc_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef putc_unlocked + (void) putc_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_putc_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_putc_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_putc_unlocked" >&5 +$as_echo "$ac_cv_have_decl_putc_unlocked" >&6; } +if test $ac_cv_have_decl_putc_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PUTC_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PUTC_UNLOCKED 0 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether putchar_unlocked is declared" >&5 +$as_echo_n "checking whether putchar_unlocked is declared... " >&6; } +if test "${ac_cv_have_decl_putchar_unlocked+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef putchar_unlocked + (void) putchar_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_putchar_unlocked=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_putchar_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_putchar_unlocked" >&5 +$as_echo "$ac_cv_have_decl_putchar_unlocked" >&6; } +if test $ac_cv_have_decl_putchar_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PUTCHAR_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PUTCHAR_UNLOCKED 0 +_ACEOF + + +fi + + + + GNULIB_WCWIDTH=0; + HAVE_DECL_WCWIDTH=1; + REPLACE_WCWIDTH=0; + WCHAR_H=''; + + + { $as_echo "$as_me:$LINENO: checking for wint_t" >&5 +$as_echo_n "checking for wint_t... " >&6; } +if test "${gt_cv_c_wint_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include + wint_t foo = (wchar_t)'\0'; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_c_wint_t=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_c_wint_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 +$as_echo "$gt_cv_c_wint_t" >&6; } + if test $gt_cv_c_wint_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WINT_T 1 +_ACEOF + + fi + + + + + + + { $as_echo "$as_me:$LINENO: checking for wchar_t" >&5 +$as_echo_n "checking for wchar_t... " >&6; } +if test "${gt_cv_c_wchar_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + wchar_t foo = (wchar_t)'\0'; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_c_wchar_t=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_c_wchar_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 +$as_echo "$gt_cv_c_wchar_t" >&6; } + if test $gt_cv_c_wchar_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WCHAR_T 1 +_ACEOF + + fi + + + + + if false; then + GL_COND_LIBTOOL_TRUE= + GL_COND_LIBTOOL_FALSE='#' +else + GL_COND_LIBTOOL_TRUE='#' + GL_COND_LIBTOOL_FALSE= +fi + + gl_cond_libtool=false + gl_libdeps= + gl_ltlibdeps= + + + + + + + + + gl_source_base='lib' + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS argmatch.$ac_objext" + + + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS basename.$ac_objext" + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS dirname.$ac_objext" + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS stripslash.$ac_objext" + + + + + + + + + { $as_echo "$as_me:$LINENO: checking whether // is distinct from /" >&5 +$as_echo_n "checking whether // is distinct from /... " >&6; } +if test "${gl_cv_double_slash_root+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test x"$cross_compiling" = xyes ; then + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # . + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac + else + set x `ls -di / // 2>/dev/null` + if test "$2" = "$4" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_double_slash_root" >&5 +$as_echo "$gl_cv_double_slash_root" >&6; } + if test "$gl_cv_double_slash_root" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1 +_ACEOF + + fi + + + + + + + { $as_echo "$as_me:$LINENO: checking if environ is properly declared" >&5 +$as_echo_n "checking if environ is properly declared... " >&6; } + if test "${gt_cv_var_environ_declaration+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + extern struct { int foo; } environ; +int +main () +{ +environ.foo = 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_var_environ_declaration=no +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_var_environ_declaration=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + { $as_echo "$as_me:$LINENO: result: $gt_cv_var_environ_declaration" >&5 +$as_echo "$gt_cv_var_environ_declaration" >&6; } + if test $gt_cv_var_environ_declaration = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ENVIRON_DECL 1 +_ACEOF + + fi + + + if test $gt_cv_var_environ_declaration != yes; then + HAVE_DECL_ENVIRON=0 + fi + + + + GNULIB_ENVIRON=1 + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:$LINENO: checking for error_at_line" >&5 +$as_echo_n "checking for error_at_line... " >&6; } +if test "${ac_cv_lib_error_at_line+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +error_at_line (0, 0, "", 0, "an error occurred"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_error_at_line=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_error_at_line=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 +$as_echo "$ac_cv_lib_error_at_line" >&6; } +if test $ac_cv_lib_error_at_line = no; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS error.$ac_objext" + +fi + + + + : + + + + + XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=error:3:c-format" + + + + XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=error_at_line:5:c-format" + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS exitfail.$ac_objext" + + + : + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS fopen-safer.$ac_objext" + + + + +cat >>confdefs.h <<\_ACEOF +#define GNULIB_FOPEN_SAFER 1 +_ACEOF + + + + + if test -n "$GETOPT_H"; then + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext" + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext" + + + GETOPT_H=getopt.h + +cat >>confdefs.h <<\_ACEOF +#define __GETOPT_PREFIX rpl_ +_ACEOF + + + + + + + + + + +fi + + + + + + # Autoconf 2.61a.99 and earlier don't support linking a file only + # in VPATH builds. But since GNUmakefile is for maintainer use + # only, it does not matter if we skip the link with older autoconf. + # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH + # builds, so use a shell variable to bypass this. + GNUmakefile=GNUmakefile + ac_config_links="$ac_config_links $GNUmakefile:$GNUmakefile" + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS hash.$ac_objext" + + + + + + + { $as_echo "$as_me:$LINENO: checking whether the compiler generally respects inline" >&5 +$as_echo_n "checking whether the compiler generally respects inline... " >&6; } +if test "${gl_cv_c_inline_effective+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test $ac_cv_c_inline = no; then + gl_cv_c_inline_effective=no + else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifdef __NO_INLINE__ + #error "inline is not effective" + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_c_inline_effective=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_c_inline_effective=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_c_inline_effective" >&5 +$as_echo "$gl_cv_c_inline_effective" >&6; } + if test $gl_cv_c_inline_effective = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INLINE 1 +_ACEOF + + fi + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking whether inttypes.h conforms to C99" >&5 +$as_echo_n "checking whether inttypes.h conforms to C99... " >&6; } +if test "${gl_cv_header_working_inttypes_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + gl_cv_header_working_inttypes_h=no + if test "$gl_cv_header_working_stdint_h" = yes \ + && test $ac_cv_header_inttypes_h = yes \ + && test "$ac_cv_have_decl_imaxabs" = yes \ + && test "$ac_cv_have_decl_imaxdiv" = yes \ + && test "$ac_cv_have_decl_strtoimax" = yes \ + && test "$ac_cv_have_decl_strtoumax" = yes; then + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */ +#include + +/* No need to duplicate the tests of stdint.m4; they are subsumed by + $gl_cv_header_working_stdint_h = yes. */ + +/* Tests for macros supposed to be defined in inttypes.h. */ + +const char *k = /* implicit string concatenation */ +#ifdef INT8_MAX + PRId8 PRIi8 +#endif +#ifdef UINT8_MAX + PRIo8 PRIu8 PRIx8 PRIX8 +#endif +#ifdef INT16_MAX + PRId16 PRIi16 +#endif +#ifdef UINT16_MAX + PRIo16 PRIu16 PRIx16 PRIX16 +#endif +#ifdef INT32_MAX + PRId32 PRIi32 +#endif +#ifdef UINT32_MAX + PRIo32 PRIu32 PRIx32 PRIX32 +#endif +#ifdef INT64_MAX + PRId64 PRIi64 +#endif +#ifdef UINT64_MAX + PRIo64 PRIu64 PRIx64 PRIX64 +#endif + PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8 + PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16 + PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32 + PRIdLEAST64 PRIiLEAST64 + PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64 + PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8 + PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16 + PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32 + PRIdFAST64 PRIiFAST64 + PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64 + PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX +#ifdef INTPTR_MAX + PRIdPTR PRIiPTR +#endif +#ifdef UINTPTR_MAX + PRIoPTR PRIuPTR PRIxPTR PRIXPTR +#endif + ; +const char *l = /* implicit string concatenation */ +#ifdef INT8_MAX + SCNd8 SCNi8 +#endif +#ifdef UINT8_MAX + SCNo8 SCNu8 SCNx8 +#endif +#ifdef INT16_MAX + SCNd16 SCNi16 +#endif +#ifdef UINT16_MAX + SCNo16 SCNu16 SCNx16 +#endif +#ifdef INT32_MAX + SCNd32 SCNi32 +#endif +#ifdef UINT32_MAX + SCNo32 SCNu32 SCNx32 +#endif +#ifdef INT64_MAX + SCNd64 SCNi64 +#endif +#ifdef UINT64_MAX + SCNo64 SCNu64 SCNx64 +#endif + SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8 + SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16 + SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32 + SCNdLEAST64 SCNiLEAST64 + SCNoLEAST64 SCNuLEAST64 SCNxLEAST64 + SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8 + SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16 + SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32 + SCNdFAST64 SCNiFAST64 + SCNoFAST64 SCNuFAST64 SCNxFAST64 + SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX +#ifdef INTPTR_MAX + SCNdPTR SCNiPTR +#endif +#ifdef UINTPTR_MAX + SCNoPTR SCNuPTR SCNxPTR +#endif + ; + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_header_working_inttypes_h=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_working_inttypes_h" >&5 +$as_echo "$gl_cv_header_working_inttypes_h" >&6; } + + if false && test $gl_cv_header_working_inttypes_h = yes; then + INTTYPES_H='' + else + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_inttypes_h='<'inttypes.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_inttypes_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_inttypes_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_inttypes_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/inttypes.h#{ + s#.*"\(.*/inttypes.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_inttypes_h='<'inttypes.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_inttypes_h" >&5 +$as_echo "$gl_cv_next_inttypes_h" >&6; } + fi + NEXT_INTTYPES_H=$gl_cv_next_inttypes_h + + + + + +cat >>confdefs.h <<\_ACEOF +#define GL_TRIGGER_STDC_LIMIT_MACROS 1 +_ACEOF + + + + + PRIPTR_PREFIX= + if test -n "$STDINT_H"; then + PRIPTR_PREFIX='"l"' + else + for glpfx in '' l ll I64; do + case $glpfx in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + I64) gltype1='__int64';; + esac + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + extern intptr_t foo; + extern $gltype1 foo; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + PRIPTR_PREFIX='"'$glpfx'"' +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test -n "$PRIPTR_PREFIX" && break + done + fi + + + if test "$ac_cv_have_decl_imaxabs" = yes; then + HAVE_DECL_IMAXABS=1 + else + HAVE_DECL_IMAXABS=0 + fi + + if test "$ac_cv_have_decl_imaxdiv" = yes; then + HAVE_DECL_IMAXDIV=1 + else + HAVE_DECL_IMAXDIV=0 + fi + + if test "$ac_cv_have_decl_strtoimax" = yes; then + HAVE_DECL_STRTOIMAX=1 + else + HAVE_DECL_STRTOIMAX=0 + fi + + if test "$ac_cv_have_decl_strtoumax" = yes; then + HAVE_DECL_STRTOUMAX=1 + else + HAVE_DECL_STRTOUMAX=0 + fi + + + { $as_echo "$as_me:$LINENO: checking whether INT32_MAX < INTMAX_MAX" >&5 +$as_echo_n "checking whether INT32_MAX < INTMAX_MAX... " >&6; } +if test "${gl_cv_test_INT32_MAX_LT_INTMAX_MAX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if defined INT32_MAX && defined INTMAX_MAX + #define CONDITION (INT32_MAX < INTMAX_MAX) + #elif HAVE_LONG_LONG_INT + #define CONDITION (sizeof (int) < sizeof (long long int)) + #else + #define CONDITION 0 + #endif + int test[CONDITION ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_test_INT32_MAX_LT_INTMAX_MAX=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_test_INT32_MAX_LT_INTMAX_MAX=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_test_INT32_MAX_LT_INTMAX_MAX" >&5 +$as_echo "$gl_cv_test_INT32_MAX_LT_INTMAX_MAX" >&6; } + if test $gl_cv_test_INT32_MAX_LT_INTMAX_MAX = yes; then + INT32_MAX_LT_INTMAX_MAX=1; + else + INT32_MAX_LT_INTMAX_MAX=0; + fi + + + + { $as_echo "$as_me:$LINENO: checking whether INT64_MAX == LONG_MAX" >&5 +$as_echo_n "checking whether INT64_MAX == LONG_MAX... " >&6; } +if test "${gl_cv_test_INT64_MAX_EQ_LONG_MAX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if defined INT64_MAX + #define CONDITION (INT64_MAX == LONG_MAX) + #elif HAVE_LONG_LONG_INT + #define CONDITION (sizeof (long long int) == sizeof (long int)) + #else + #define CONDITION 0 + #endif + int test[CONDITION ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_test_INT64_MAX_EQ_LONG_MAX=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_test_INT64_MAX_EQ_LONG_MAX=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_test_INT64_MAX_EQ_LONG_MAX" >&5 +$as_echo "$gl_cv_test_INT64_MAX_EQ_LONG_MAX" >&6; } + if test $gl_cv_test_INT64_MAX_EQ_LONG_MAX = yes; then + INT64_MAX_EQ_LONG_MAX=1; + else + INT64_MAX_EQ_LONG_MAX=0; + fi + + + + { $as_echo "$as_me:$LINENO: checking whether UINT32_MAX < UINTMAX_MAX" >&5 +$as_echo_n "checking whether UINT32_MAX < UINTMAX_MAX... " >&6; } +if test "${gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if defined UINT32_MAX && defined UINTMAX_MAX + #define CONDITION (UINT32_MAX < UINTMAX_MAX) + #elif HAVE_LONG_LONG_INT + #define CONDITION (sizeof (unsigned int) < sizeof (unsigned long long int)) + #else + #define CONDITION 0 + #endif + int test[CONDITION ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX" >&5 +$as_echo "$gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX" >&6; } + if test $gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX = yes; then + UINT32_MAX_LT_UINTMAX_MAX=1; + else + UINT32_MAX_LT_UINTMAX_MAX=0; + fi + + + + { $as_echo "$as_me:$LINENO: checking whether UINT64_MAX == ULONG_MAX" >&5 +$as_echo_n "checking whether UINT64_MAX == ULONG_MAX... " >&6; } +if test "${gl_cv_test_UINT64_MAX_EQ_ULONG_MAX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if defined UINT64_MAX + #define CONDITION (UINT64_MAX == ULONG_MAX) + #elif HAVE_LONG_LONG_INT + #define CONDITION (sizeof (unsigned long long int) == sizeof (unsigned long int)) + #else + #define CONDITION 0 + #endif + int test[CONDITION ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_test_UINT64_MAX_EQ_ULONG_MAX=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_test_UINT64_MAX_EQ_ULONG_MAX=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_test_UINT64_MAX_EQ_ULONG_MAX" >&5 +$as_echo "$gl_cv_test_UINT64_MAX_EQ_ULONG_MAX" >&6; } + if test $gl_cv_test_UINT64_MAX_EQ_ULONG_MAX = yes; then + UINT64_MAX_EQ_ULONG_MAX=1; + else + UINT64_MAX_EQ_ULONG_MAX=0; + fi + + + + INTTYPES_H='inttypes.h' + fi + + + # You need to invoke gt_JAVACOMP yourself, possibly with arguments. + ac_config_files="$ac_config_files javacomp.sh:build-aux/javacomp.sh.in" + + # You need to invoke gt_JAVAEXEC yourself, possibly with arguments. + ac_config_files="$ac_config_files javaexec.sh:build-aux/javaexec.sh.in" + + + + + + + + + + + + LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" + + +for ac_header in stdlib.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 +$as_echo_n "checking for GNU libc compatible malloc... " >&6; } +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_0_nonnull=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +return ! malloc (0); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_malloc_0_nonnull=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_malloc_0_nonnull=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 0 +_ACEOF + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext" + + +cat >>confdefs.h <<\_ACEOF +#define malloc rpl_malloc +_ACEOF + +fi + + + + +cat >>confdefs.h <<\_ACEOF +#define GNULIB_MALLOC_GNU 1 +_ACEOF + + + + if test $gl_cv_func_malloc_posix = yes; then + HAVE_MALLOC_POSIX=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC_POSIX 1 +_ACEOF + + else + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext" + + HAVE_MALLOC_POSIX=0 + fi + + + + + GNULIB_MALLOC_POSIX=1 + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 +$as_echo_n "checking whether mbrtowc and mbstate_t are properly declared... " >&6; } +if test "${gl_cv_func_mbrtowc+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + gl_cv_func_mbrtowc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_mbrtowc=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_mbrtowc" >&5 +$as_echo "$gl_cv_func_mbrtowc" >&6; } + if test $gl_cv_func_mbrtowc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBRTOWC 1 +_ACEOF + + fi + + + { $as_echo "$as_me:$LINENO: checking whether mbswidth is declared in " >&5 +$as_echo_n "checking whether mbswidth is declared in ... " >&6; } +if test "${ac_cv_have_decl_mbswidth+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include + +int +main () +{ + + char *p = (char *) mbswidth; + return !p; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_mbswidth=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_mbswidth=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_mbswidth" >&5 +$as_echo "$ac_cv_have_decl_mbswidth" >&6; } + if test $ac_cv_have_decl_mbswidth = yes; then + ac_val=1 + else + ac_val=0 + fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MBSWIDTH_IN_WCHAR_H $ac_val +_ACEOF + + + { $as_echo "$as_me:$LINENO: checking for mbstate_t" >&5 +$as_echo_n "checking for mbstate_t... " >&6; } +if test "${ac_cv_type_mbstate_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +# include +int +main () +{ +mbstate_t x; return sizeof x; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_mbstate_t=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_mbstate_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5 +$as_echo "$ac_cv_type_mbstate_t" >&6; } + if test $ac_cv_type_mbstate_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBSTATE_T 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define mbstate_t int +_ACEOF + + fi + + + + + + + + + + + + + +{ $as_echo "$as_me:$LINENO: checking for obstacks" >&5 +$as_echo_n "checking for obstacks... " >&6; } +if test "${ac_cv_func_obstack+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + #include "obstack.h" +int +main () +{ +struct obstack mem; + #define obstack_chunk_alloc malloc + #define obstack_chunk_free free + obstack_init (&mem); + obstack_free (&mem, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_obstack=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_obstack=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_obstack" >&5 +$as_echo "$ac_cv_func_obstack" >&6; } +if test $ac_cv_func_obstack = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_OBSTACK 1 +_ACEOF + +else + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS obstack.$ac_objext" + +fi + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS quote.$ac_objext" + + + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS quotearg.$ac_objext" + + + + + + + + + { $as_echo "$as_me:$LINENO: checking for mbstate_t" >&5 +$as_echo_n "checking for mbstate_t... " >&6; } +if test "${ac_cv_type_mbstate_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +# include +int +main () +{ +mbstate_t x; return sizeof x; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_mbstate_t=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_mbstate_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5 +$as_echo "$ac_cv_type_mbstate_t" >&6; } + if test $ac_cv_type_mbstate_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBSTATE_T 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define mbstate_t int +_ACEOF + + fi + + { $as_echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 +$as_echo_n "checking whether mbrtowc and mbstate_t are properly declared... " >&6; } +if test "${gl_cv_func_mbrtowc+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + gl_cv_func_mbrtowc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_mbrtowc=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_mbrtowc" >&5 +$as_echo "$gl_cv_func_mbrtowc" >&6; } + if test $gl_cv_func_mbrtowc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBRTOWC 1 +_ACEOF + + fi + + + + + + # Define two additional variables used in the Makefile substitution. + + if test "$ac_cv_header_stdbool_h" = yes; then + STDBOOL_H='' + else + STDBOOL_H='stdbool.h' + fi + + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi + + + + + + if test $ac_cv_type_long_long_int = yes; then + HAVE_LONG_LONG_INT=1 + else + HAVE_LONG_LONG_INT=0 + fi + + + if test $ac_cv_type_unsigned_long_long_int = yes; then + HAVE_UNSIGNED_LONG_LONG_INT=1 + else + HAVE_UNSIGNED_LONG_LONG_INT=0 + fi + + + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + + + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdint_h='<'stdint.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_stdint_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_stdint_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_stdint_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdint.h#{ + s#.*"\(.*/stdint.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdint_h='<'stdint.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_stdint_h" >&5 +$as_echo "$gl_cv_next_stdint_h" >&6; } + fi + NEXT_STDINT_H=$gl_cv_next_stdint_h + + + + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + + + if test $ac_cv_header_stdint_h = yes; then + { $as_echo "$as_me:$LINENO: checking whether stdint.h conforms to C99" >&5 +$as_echo_n "checking whether stdint.h conforms to C99... " >&6; } +if test "${gl_cv_header_working_stdint_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + gl_cv_header_working_stdint_h=no + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif + + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_header_working_stdint_h=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_working_stdint_h" >&5 +$as_echo "$gl_cv_header_working_stdint_h" >&6; } + fi + if test "$gl_cv_header_working_stdint_h" = yes; then + STDINT_H= + else + + +for ac_header in sys/inttypes.h sys/bitypes.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + else + HAVE_SYS_INTTYPES_H=0 + fi + + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + else + HAVE_SYS_BITYPES_H=0 + fi + + + + + + + + + + + + + + + + + + for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do + { $as_echo "$as_me:$LINENO: checking for bit size of $gltype" >&5 +$as_echo_n "checking for bit size of $gltype... " >&6; } +if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) result=$ac_lo;; +'') result=unknown ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +static long int longval () { return sizeof ($gltype) * CHAR_BIT; } +static unsigned long int ulongval () { return sizeof ($gltype) * CHAR_BIT; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((sizeof ($gltype) * CHAR_BIT) < 0) + { + long int i = longval (); + if (i != (sizeof ($gltype) * CHAR_BIT)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (sizeof ($gltype) * CHAR_BIT)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + result=`cat conftest.val` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +result=unknown +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +ac_res=`eval 'as_val=${'gl_cv_bitsizeof_${gltype}'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + cat >>confdefs.h <<_ACEOF +#define BITSIZEOF_${GLTYPE} $result +_ACEOF + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + + + + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { $as_echo "$as_me:$LINENO: checking whether $gltype is signed" >&5 +$as_echo_n "checking whether $gltype is signed... " >&6; } +if { as_var=gl_cv_type_${gltype}_signed; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + result=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + result=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval gl_cv_type_${gltype}_signed=\$result + +fi +ac_res=`eval 'as_val=${'gl_cv_type_${gltype}_signed'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNED_${GLTYPE} 1 +_ACEOF + + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + + + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + + + + + + + + for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do + { $as_echo "$as_me:$LINENO: checking for $gltype integer literal suffix" >&5 +$as_echo_n "checking for $gltype integer literal suffix... " >&6; } +if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval gl_cv_type_${gltype}_suffix=\$glsuf +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +ac_res=`eval 'as_val=${'gl_cv_type_${gltype}_suffix'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + cat >>confdefs.h <<_ACEOF +#define ${GLTYPE}_SUFFIX $result +_ACEOF + + done + + + + STDINT_H=stdint.h + fi + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdlib_h='<'stdlib.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_stdlib_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_stdlib_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_stdlib_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdlib.h#{ + s#.*"\(.*/stdlib.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdlib_h='<'stdlib.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_stdlib_h" >&5 +$as_echo "$gl_cv_next_stdlib_h" >&6; } + fi + NEXT_STDLIB_H=$gl_cv_next_stdlib_h + + + + { $as_echo "$as_me:$LINENO: checking for struct random_data" >&5 +$as_echo_n "checking for struct random_data... " >&6; } +if test "${ac_cv_type_struct_random_data+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_struct_random_data=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +if (sizeof (struct random_data)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +if (sizeof ((struct random_data))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_struct_random_data=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_struct_random_data" >&5 +$as_echo "$ac_cv_type_struct_random_data" >&6; } +if test $ac_cv_type_struct_random_data = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_RANDOM_DATA 1 +_ACEOF + + +else + HAVE_STRUCT_RANDOM_DATA=0 +fi + + + + + + + + + + + + + + + + + +for ac_func in stpcpy +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + + gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext" + +fi +done + + + if test $ac_cv_func_stpcpy = no; then + HAVE_STPCPY=0 + + : + + fi + + + + GNULIB_STPCPY=1 + + + + if test $REPLACE_STRERROR = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS strerror.$ac_objext" + + +cat >>confdefs.h <<_ACEOF +#define REPLACE_STRERROR $REPLACE_STRERROR +_ACEOF + + fi + + + + GNULIB_STRERROR=1 + + + + + + + + + + + + + if test $ac_cv_have_decl_strndup = no; then + HAVE_DECL_STRNDUP=0 + fi + + # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. + { $as_echo "$as_me:$LINENO: checking for working strndup" >&5 +$as_echo_n "checking for working strndup... " >&6; } +if test "${gl_cv_func_strndup+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + { $as_echo "$as_me:$LINENO: checking for strndup" >&5 +$as_echo_n "checking for strndup... " >&6; } +if test "${ac_cv_func_strndup+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define strndup to an innocuous variant, in case declares strndup. + For example, HP-UX 11i declares gettimeofday. */ +#define strndup innocuous_strndup + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strndup (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef strndup + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char strndup (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_strndup || defined __stub___strndup +choke me +#endif + +int +main () +{ +return strndup (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_strndup=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_strndup=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strndup" >&5 +$as_echo "$ac_cv_func_strndup" >&6; } +if test $ac_cv_func_strndup = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef _AIX + too risky +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "too risky" >/dev/null 2>&1; then + gl_cv_func_strndup=no +else + gl_cv_func_strndup=yes +fi +rm -f conftest* + +else + gl_cv_func_strndup=no +fi + +else + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #include +int +main () +{ + +#ifndef HAVE_DECL_STRNDUP + extern char *strndup (const char *, size_t); +#endif + char *s; + s = strndup ("some longer string", 15); + free (s); + s = strndup ("shorter string", 13); + return s[13] != '\0'; + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_strndup=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_strndup=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_strndup" >&5 +$as_echo "$gl_cv_func_strndup" >&6; } + if test $gl_cv_func_strndup = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STRNDUP 1 +_ACEOF + + else + HAVE_STRNDUP=0 + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS strndup.$ac_objext" + + : + fi + + + + GNULIB_STRNDUP=1 + + + + + + + + + + if test $ac_cv_have_decl_strnlen = no; then + HAVE_DECL_STRNLEN=0 + fi + + { $as_echo "$as_me:$LINENO: checking for working strnlen" >&5 +$as_echo_n "checking for working strnlen... " >&6; } +if test "${ac_cv_func_strnlen_working+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_strnlen_working=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + +#define S "foobar" +#define S_LEN (sizeof S - 1) + + /* At least one implementation is buggy: that of AIX 4.3 would + give strnlen (S, 1) == 3. */ + + int i; + for (i = 0; i < S_LEN + 1; ++i) + { + int expected = i <= S_LEN ? i : S_LEN; + if (strnlen (S, i) != expected) + return 1; + } + return 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strnlen_working=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_strnlen_working=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strnlen_working" >&5 +$as_echo "$ac_cv_func_strnlen_working" >&6; } +test $ac_cv_func_strnlen_working = no && + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS strnlen.$ac_objext" + + + if test $ac_cv_func_strnlen_working = no; then + # This is necessary because automake-1.6.1 doesn't understand + # that the above use of AC_FUNC_STRNLEN means we may have to use + # lib/strnlen.c. + #AC_LIBOBJ(strnlen) + +cat >>confdefs.h <<\_ACEOF +#define strnlen rpl_strnlen +_ACEOF + + : + fi + + + + GNULIB_STRNLEN=1 + + + + + + + + + + + +for ac_func in strtol +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + + gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext" + +fi +done + + + + + + + + + + + + + +for ac_func in strtoul +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + + gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext" + +fi +done + + + + + + + + + + + + + + + + +for ac_func in strverscmp +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + + gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext" + +fi +done + + + if test $ac_cv_func_strverscmp = no; then + + : + + HAVE_STRVERSCMP=0 + fi + + + + GNULIB_STRVERSCMP=1 + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_unistd_h='<'unistd.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_unistd_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_unistd_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_unistd_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/unistd.h#{ + s#.*"\(.*/unistd.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_unistd_h='<'unistd.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_unistd_h" >&5 +$as_echo "$gl_cv_next_unistd_h" >&6; } + fi + NEXT_UNISTD_H=$gl_cv_next_unistd_h + + + + + + + + + + + if test $ac_cv_header_unistd_h = yes; then + HAVE_UNISTD_H=1 + else + HAVE_UNISTD_H=0 + fi + + + + + + + + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS dup-safer.$ac_objext" + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS fd-safer.$ac_objext" + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS pipe-safer.$ac_objext" + + + + +cat >>confdefs.h <<\_ACEOF +#define USE_UNLOCKED_IO 1 +_ACEOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +for ac_func in unsetenv +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + if test $ac_cv_func_unsetenv = no; then + HAVE_UNSETENV=0 + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS unsetenv.$ac_objext" + + + + + + + + + + + else + { $as_echo "$as_me:$LINENO: checking for unsetenv() return type" >&5 +$as_echo_n "checking for unsetenv() return type... " >&6; } +if test "${gt_cv_func_unsetenv_ret+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +int unsetenv (const char *name); +#else +int unsetenv(); +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_func_unsetenv_ret='int' +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_func_unsetenv_ret='void' +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gt_cv_func_unsetenv_ret" >&5 +$as_echo "$gt_cv_func_unsetenv_ret" >&6; } + if test $gt_cv_func_unsetenv_ret = 'void'; then + VOID_UNSETENV=1 + fi + fi + + + + GNULIB_UNSETENV=1 + + + + + { $as_echo "$as_me:$LINENO: checking whether is standalone" >&5 +$as_echo_n "checking whether is standalone... " >&6; } +if test "${gl_cv_header_wchar_h_standalone+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#include +wchar_t w; +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_header_wchar_h_standalone=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_header_wchar_h_standalone=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_wchar_h_standalone" >&5 +$as_echo "$gl_cv_header_wchar_h_standalone" >&6; } + + + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + + + if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then + WCHAR_H=wchar.h + fi + + + + + + + + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wchar_h='<'wchar.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_wchar_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_wchar_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_wchar_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/wchar.h#{ + s#.*"\(.*/wchar.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_wchar_h='<'wchar.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_wchar_h" >&5 +$as_echo "$gl_cv_next_wchar_h" >&6; } + fi + NEXT_WCHAR_H=$gl_cv_next_wchar_h + + + + + + + + + + + + + if test $ac_cv_func_iswcntrl = yes; then + HAVE_ISWCNTRL=1 + else + HAVE_ISWCNTRL=0 + fi + + + + + + + + + + + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + + + WCTYPE_H=wctype.h + if test $ac_cv_header_wctype_h = yes; then + if test $ac_cv_func_iswcntrl = yes; then + { $as_echo "$as_me:$LINENO: checking whether iswcntrl works" >&5 +$as_echo_n "checking whether iswcntrl works... " >&6; } +if test "${gl_cv_func_iswcntrl_works+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #if __GNU_LIBRARY__ == 1 + Linux libc5 i18n is broken. + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_func_iswcntrl_works=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_iswcntrl_works=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #include + #include + #include + #include + int main () { return iswprint ('x') == 0; } +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_iswcntrl_works=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_iswcntrl_works=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_iswcntrl_works" >&5 +$as_echo "$gl_cv_func_iswcntrl_works" >&6; } + if test $gl_cv_func_iswcntrl_works = yes; then + WCTYPE_H= + fi + fi + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wctype_h='<'wctype.h'>' + else + { $as_echo "$as_me:$LINENO: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_wctype_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_wctype_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_wctype_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/wctype.h#{ + s#.*"\(.*/wctype.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_wctype_h='<'wctype.h'>' + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_wctype_h" >&5 +$as_echo "$gl_cv_next_wctype_h" >&6; } + fi + NEXT_WCTYPE_H=$gl_cv_next_wctype_h + + + + HAVE_WCTYPE_H=1 + else + HAVE_WCTYPE_H=0 + fi + + + + if test "$gl_cv_func_iswcntrl_works" = no; then + REPLACE_ISWCNTRL=1 + else + REPLACE_ISWCNTRL=0 + fi + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking whether wcwidth is declared" >&5 +$as_echo_n "checking whether wcwidth is declared... " >&6; } +if test "${ac_cv_have_decl_wcwidth+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* AIX 3.2.5 declares wcwidth in . */ +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include + + +int +main () +{ +#ifndef wcwidth + (void) wcwidth; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_wcwidth=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_wcwidth=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_wcwidth" >&5 +$as_echo "$ac_cv_have_decl_wcwidth" >&6; } +if test $ac_cv_have_decl_wcwidth = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_WCWIDTH 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_WCWIDTH 0 +_ACEOF + + +fi + + + if test $ac_cv_have_decl_wcwidth != yes; then + HAVE_DECL_WCWIDTH=0 + fi + + if test $ac_cv_func_wcwidth = no; then + REPLACE_WCWIDTH=1 + else + { $as_echo "$as_me:$LINENO: checking whether wcwidth works reasonably in UTF-8 locales" >&5 +$as_echo_n "checking whether wcwidth works reasonably in UTF-8 locales... " >&6; } +if test "${gl_cv_func_wcwidth_works+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then + gl_cv_func_wcwidth_works="guessing no" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +/* AIX 3.2.5 declares wcwidth in . */ +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include +#if !HAVE_DECL_WCWIDTH +extern +# ifdef __cplusplus +"C" +# endif +int wcwidth (int); +#endif +int main () +{ + if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL) + if (wcwidth (0x0301) > 0 || wcwidth (0x200B) > 0) + return 1; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_wcwidth_works=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_wcwidth_works=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_wcwidth_works" >&5 +$as_echo "$gl_cv_func_wcwidth_works" >&6; } + case "$gl_cv_func_wcwidth_works" in + *yes) ;; + *no) REPLACE_WCWIDTH=1 ;; + esac + fi + if test $REPLACE_WCWIDTH = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS wcwidth.$ac_objext" + + fi + + if test $REPLACE_WCWIDTH = 1 || test $HAVE_DECL_WCWIDTH = 0; then + + + WCHAR_H=wchar.h + + fi + + + + GNULIB_WCWIDTH=1 + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS xmalloc.$ac_objext" + + + + + : + + + : + + + + + : + + + + + + + + + + + + gltests_libdeps= + gltests_ltlibdeps= + + + + + + + + + gl_source_base='tests' + + + + + + + + LIBBISON_LIBDEPS="$gl_libdeps" + + LIBBISON_LTLIBDEPS="$gl_ltlibdeps" + + + +# Checks for library functions. + + + + + + + + +{ $as_echo "$as_me:$LINENO: checking if malloc debugging is wanted" >&5 +$as_echo_n "checking if malloc debugging is wanted... " >&6; } + +# Check whether --with-dmalloc was given. +if test "${with_dmalloc+set}" = set; then + withval=$with_dmalloc; if test "$withval" = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define WITH_DMALLOC 1 +_ACEOF + + LIBS="$LIBS -ldmalloc" + LDFLAGS="$LDFLAGS -g" +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + { $as_echo "$as_me:$LINENO: checking for pid_t" >&5 +$as_echo_n "checking for pid_t... " >&6; } +if test "${ac_cv_type_pid_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_pid_t=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((pid_t))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_pid_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +$as_echo "$ac_cv_type_pid_t" >&6; } +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + + { $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 +$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if test "${ac_cv_header_sys_wait_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main () +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_sys_wait_h=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_sys_wait_h=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +$as_echo "$ac_cv_header_sys_wait_h" >&6; } +if test $ac_cv_header_sys_wait_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_WAIT_H 1 +_ACEOF + +fi + + + +for ac_func in dup2 waitpid +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_header in vfork.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_func in fork vfork +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "x$ac_cv_func_fork" = xyes; then + { $as_echo "$as_me:$LINENO: checking for working fork" >&5 +$as_echo_n "checking for working fork... " >&6; } +if test "${ac_cv_func_fork_works+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_fork_works=cross +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* By Ruediger Kuhlmann. */ + return fork () < 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_fork_works=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_fork_works=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 +$as_echo "$ac_cv_func_fork_works" >&6; } + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + { $as_echo "$as_me:$LINENO: checking for working vfork" >&5 +$as_echo_n "checking for working vfork... " >&6; } +if test "${ac_cv_func_vfork_works+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_vfork_works=cross +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Thanks to Paul Eggert for this test. */ +$ac_includes_default +#include +#ifdef HAVE_VFORK_H +# include +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main () +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_vfork_works=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_vfork_works=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 +$as_echo "$ac_cv_func_vfork_works" >&6; } + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_VFORK 1 +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF +#define vfork fork +_ACEOF + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_FORK 1 +_ACEOF + +fi + + + + +for ac_header in sys/time.h sys/times.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/resource.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#ifdef HAVE_SYS_TIMES_H +# include +#endif + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in times +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +{ $as_echo "$as_me:$LINENO: checking whether getrusage is declared" >&5 +$as_echo_n "checking whether getrusage is declared... " >&6; } +if test "${ac_cv_have_decl_getrusage+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif + + +int +main () +{ +#ifndef getrusage + (void) getrusage; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_getrusage=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_getrusage=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getrusage" >&5 +$as_echo "$ac_cv_have_decl_getrusage" >&6; } +if test $ac_cv_have_decl_getrusage = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETRUSAGE 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETRUSAGE 0 +_ACEOF + + +fi +{ $as_echo "$as_me:$LINENO: checking whether times is declared" >&5 +$as_echo_n "checking whether times is declared... " >&6; } +if test "${ac_cv_have_decl_times+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif + + +int +main () +{ +#ifndef times + (void) times; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_times=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_times=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_times" >&5 +$as_echo "$ac_cv_have_decl_times" >&6; } +if test $ac_cv_have_decl_times = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_TIMES 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_TIMES 0 +_ACEOF + + +fi +{ $as_echo "$as_me:$LINENO: checking whether clock is declared" >&5 +$as_echo_n "checking whether clock is declared... " >&6; } +if test "${ac_cv_have_decl_clock+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif + + +int +main () +{ +#ifndef clock + (void) clock; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_clock=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_clock=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_clock" >&5 +$as_echo "$ac_cv_have_decl_clock" >&6; } +if test $ac_cv_have_decl_clock = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_CLOCK 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_CLOCK 0 +_ACEOF + + +fi +{ $as_echo "$as_me:$LINENO: checking whether sysconf is declared" >&5 +$as_echo_n "checking whether sysconf is declared... " >&6; } +if test "${ac_cv_have_decl_sysconf+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif + + +int +main () +{ +#ifndef sysconf + (void) sysconf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_sysconf=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_sysconf=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_sysconf" >&5 +$as_echo "$ac_cv_have_decl_sysconf" >&6; } +if test $ac_cv_have_decl_sysconf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SYSCONF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SYSCONF 0 +_ACEOF + + +fi + + + +{ $as_echo "$as_me:$LINENO: checking for clock_t" >&5 +$as_echo_n "checking for clock_t... " >&6; } +if test "${ac_cv_type_clock_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_clock_t=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif + + +int +main () +{ +if (sizeof (clock_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif + + +int +main () +{ +if (sizeof ((clock_t))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_clock_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_clock_t" >&5 +$as_echo "$ac_cv_type_clock_t" >&6; } +if test $ac_cv_type_clock_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_CLOCK_T 1 +_ACEOF + + +fi +{ $as_echo "$as_me:$LINENO: checking for struct tms" >&5 +$as_echo_n "checking for struct tms... " >&6; } +if test "${ac_cv_type_struct_tms+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_struct_tms=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif + + +int +main () +{ +if (sizeof (struct tms)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif + + +int +main () +{ +if (sizeof ((struct tms))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_struct_tms=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_struct_tms" >&5 +$as_echo "$ac_cv_type_struct_tms" >&6; } +if test $ac_cv_type_struct_tms = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_TMS 1 +_ACEOF + + +fi + + + +# Gettext. +# We've never tested with gettext versions before 0.15, so play it safe. + + { $as_echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:$LINENO: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + + GETTEXT_MACRO_VERSION=0.17 + + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_MSGFMT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { $as_echo "$as_me:$LINENO: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_GMSGFMT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac + + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_XGETTEXT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { $as_echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + rm -f messages.po + + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_MSGMERGE+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + { $as_echo "$as_me:$LINENO: result: $MSGMERGE" >&5 +$as_echo "$MSGMERGE" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$localedir" || localedir='${datadir}/locale' + + + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + + + ac_config_commands="$ac_config_commands po-directories" + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +$as_echo_n "checking for ld used by GCC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test "${acl_cv_path_LD+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$acl_cv_path_LD" +if test -n "$LD"; then + { $as_echo "$as_me:$LINENO: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if test "${acl_cv_prog_gnu_ld+set}" = set; then + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$acl_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + + { $as_echo "$as_me:$LINENO: checking for shared library run path origin" >&5 +$as_echo_n "checking for shared library run path origin... " >&6; } +if test "${acl_cv_rpath+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +{ $as_echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 +$as_echo "$acl_cv_rpath" >&6; } + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval=$enable_rpath; : +else + enable_rpath=yes +fi + + + + + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + { $as_echo "$as_me:$LINENO: checking for 64-bit host" >&5 +$as_echo_n "checking for 64-bit host... " >&6; } +if test "${gl_cv_solaris_64bit+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef _LP64 +sixtyfour bits +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sixtyfour bits" >/dev/null 2>&1; then + gl_cv_solaris_64bit=yes +else + gl_cv_solaris_64bit=no +fi +rm -f conftest* + + +fi +{ $as_echo "$as_me:$LINENO: result: $gl_cv_solaris_64bit" >&5 +$as_echo "$gl_cv_solaris_64bit" >&6; } + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval=$with_libiconv_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBICONV= + LTLIBICONV= + INCICONV= + LIBICONV_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + LIBICONV_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + LIBICONV_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5 +$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } +if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +CFPreferencesCopyAppValue(NULL, NULL) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + gt_cv_func_CFPreferencesCopyAppValue=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_func_CFPreferencesCopyAppValue=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CFPREFERENCESCOPYAPPVALUE 1 +_ACEOF + + fi + { $as_echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5 +$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } +if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +CFLocaleCopyCurrent(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + gt_cv_func_CFLocaleCopyCurrent=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_func_CFLocaleCopyCurrent=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CFLOCALECOPYCURRENT 1 +_ACEOF + + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + + + + + + + LIBINTL= + LTLIBINTL= + POSUB= + + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + { $as_echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 +$as_echo_n "checking for GNU gettext in libc... " >&6; } +if { as_var=$gt_func_gnugettext_libc; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$gt_func_gnugettext_libc=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$gt_func_gnugettext_libc=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$gt_func_gnugettext_libc'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:$LINENO: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if test "${am_cv_func_iconv+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + am_cv_func_iconv=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ $as_echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:$LINENO: checking for working iconv" >&5 +$as_echo_n "checking for working iconv... " >&6; } +if test "${am_cv_func_iconv_works+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + if test "$cross_compiling" = yes; then + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_func_iconv_works=yes +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +am_cv_func_iconv_works=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + LIBS="$am_save_LIBS" + +fi +{ $as_echo "$as_me:$LINENO: result: $am_cv_func_iconv_works" >&5 +$as_echo "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ICONV 1 +_ACEOF + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:$LINENO: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:$LINENO: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then + withval=$with_libintl_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBINTL= + LTLIBINTL= + INCINTL= + LIBINTL_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + LIBINTL_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + LIBINTL_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + + + + + + { $as_echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 +$as_echo_n "checking for GNU gettext in libintl... " >&6; } +if { as_var=$gt_func_gnugettext_libintl; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$gt_func_gnugettext_libintl=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$gt_func_gnugettext_libintl=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +ac_res=`eval 'as_val=${'$gt_func_gnugettext_libintl'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + fi + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + else + USE_NLS=no + fi + fi + + { $as_echo "$as_me:$LINENO: checking whether to use NLS" >&5 +$as_echo_n "checking whether to use NLS... " >&6; } + { $as_echo "$as_me:$LINENO: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + if test "$USE_NLS" = "yes"; then + { $as_echo "$as_me:$LINENO: checking where the gettext function comes from" >&5 +$as_echo_n "checking where the gettext function comes from... " >&6; } + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + { $as_echo "$as_me:$LINENO: result: $gt_source" >&5 +$as_echo "$gt_source" >&6; } + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + { $as_echo "$as_me:$LINENO: checking how to link with libintl" >&5 +$as_echo_n "checking how to link with libintl... " >&6; } + { $as_echo "$as_me:$LINENO: result: $LIBINTL" >&5 +$as_echo "$LIBINTL" >&6; } + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETTEXT 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DCGETTEXT 1 +_ACEOF + + fi + + POSUB=po + fi + + + + INTLLIBS="$LIBINTL" + + + + + + + + + if test -z "$USE_NLS"; then + echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." 1>&2 + exit 1 + fi + BISON_LOCALEDIR= + BISON_USE_NLS=no + if test "$USE_NLS" = yes; then + if (${YACC-${BISON-:}} --print-localedir) >/dev/null 2>&1; then + BISON_LOCALEDIR=`${YACC-${BISON-:}} --print-localedir` + fi + + if test -n "$BISON_LOCALEDIR"; then + USER_LINGUAS="${LINGUAS-%UNSET%}" + if test -n "$USER_LINGUAS"; then + BISON_USE_NLS=yes + fi + fi + fi + if test $BISON_USE_NLS = yes; then + +cat >>confdefs.h <<\_ACEOF +#define YYENABLE_NLS 1 +_ACEOF + + fi + + +# Internationalized parsers. +ac_config_files="$ac_config_files runtime-po/Makefile.in" + +# Autoconf macros for packages using internationalized parsers. +aclocaldir='${datadir}/aclocal' + + +# Create the benchmark script. +ac_config_files="$ac_config_files etc/bench.pl" + + +# Initialize the test suite. +ac_config_commands="$ac_config_commands tests/atconfig" + + +ac_config_files="$ac_config_files tests/Makefile tests/atlocal" + +ac_config_files="$ac_config_files tests/bison" + +for ac_prog in valgrind +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_VALGRIND+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$VALGRIND"; then + ac_cv_prog_VALGRIND="$VALGRIND" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_VALGRIND="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +VALGRIND=$ac_cv_prog_VALGRIND +if test -n "$VALGRIND"; then + { $as_echo "$as_me:$LINENO: result: $VALGRIND" >&5 +$as_echo "$VALGRIND" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$VALGRIND" && break +done + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:$LINENO: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CXXFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + + + { $as_echo "$as_me:$LINENO: checking whether $CXX builds executables that work" >&5 +$as_echo_n "checking whether $CXX builds executables that work... " >&6; } +if test "${bison_cv_cxx_works+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + bison_cv_cxx_works=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #include + #include + #include + using namespace std; +int +main () +{ +std::cerr << ""; + cout << ""; + typedef std::pair uipair; + std::map m; + std::map::iterator i; + m.insert (uipair (4, -4)); + for (i = m.begin (); i != m.end (); ++i) + if (i->first != 4) + return 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if { ac_try='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_objext $LIBS >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if test "$cross_compiling" = yes; then + bison_cv_cxx_works=cross +else + if { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bison_cv_cxx_works=yes +fi + +fi + +fi + + rm -f conftest$ac_exeext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:$LINENO: result: $bison_cv_cxx_works" >&5 +$as_echo "$bison_cv_cxx_works" >&6; } + + case $bison_cv_cxx_works in + yes) + BISON_CXX_WORKS=':';; + no | cross) + BISON_CXX_WORKS='exit 77';; + esac + + + if test $bison_cv_cxx_works = yes; then + BISON_CXX_WORKS_TRUE= + BISON_CXX_WORKS_FALSE='#' +else + BISON_CXX_WORKS_TRUE='#' + BISON_CXX_WORKS_FALSE= +fi + + + +AUTOM4TE=${AUTOM4TE-"${am_missing_run}autom4te"} + +# Needed by tests/atlocal.in. + +O0CFLAGS=`echo $CFLAGS | sed 's/-O[0-9] *//'` + +O0CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[0-9] *//'` + + + + { $as_echo "$as_me:$LINENO: checking for Java virtual machine" >&5 +$as_echo_n "checking for Java virtual machine... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + CLASSPATH_SEPARATOR=';' +else + CLASSPATH_SEPARATOR=':' +fi +rm -f conftest* + + CONF_JAVA= + HAVE_JAVA_ENVVAR= + HAVE_GIJ= + HAVE_JAVA= + HAVE_JRE= + HAVE_JVIEW= + HAVE_JAVAEXEC=1 + if test -n "$JAVA"; then + HAVE_JAVA_ENVVAR=1 + CONF_JAVA="$JAVA" + else + # Extract the first word of "gij", so it can be a program name with args. +set dummy gij; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_GIJ_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_GIJ_IN_PATH"; then + ac_cv_prog_HAVE_GIJ_IN_PATH="$HAVE_GIJ_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_GIJ_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_GIJ_IN_PATH=$ac_cv_prog_HAVE_GIJ_IN_PATH +if test -n "$HAVE_GIJ_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "java", so it can be a program name with args. +set dummy java; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_JAVA_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_JAVA_IN_PATH"; then + ac_cv_prog_HAVE_JAVA_IN_PATH="$HAVE_JAVA_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_JAVA_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_JAVA_IN_PATH=$ac_cv_prog_HAVE_JAVA_IN_PATH +if test -n "$HAVE_JAVA_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "jre", so it can be a program name with args. +set dummy jre; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_JRE_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_JRE_IN_PATH"; then + ac_cv_prog_HAVE_JRE_IN_PATH="$HAVE_JRE_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_JRE_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_JRE_IN_PATH=$ac_cv_prog_HAVE_JRE_IN_PATH +if test -n "$HAVE_JRE_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "jview", so it can be a program name with args. +set dummy jview; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_JVIEW_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_JVIEW_IN_PATH"; then + ac_cv_prog_HAVE_JVIEW_IN_PATH="$HAVE_JVIEW_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_JVIEW_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_JVIEW_IN_PATH=$ac_cv_prog_HAVE_JVIEW_IN_PATH +if test -n "$HAVE_JVIEW_IN_PATH"; then + : +else + : +fi + + + + export CLASSPATH + if test -n "$HAVE_GIJ_IN_PATH" \ + && gij --version >/dev/null 2>/dev/null \ + ; then + HAVE_GIJ=1 + CONF_JAVA="gij" + else + if test -n "$HAVE_JAVA_IN_PATH" \ + && java -version >/dev/null 2>/dev/null \ + ; then + HAVE_JAVA=1 + CONF_JAVA="java" + else + if test -n "$HAVE_JRE_IN_PATH" \ + && (jre >/dev/null 2>/dev/null || test $? = 1) \ + ; then + HAVE_JRE=1 + CONF_JAVA="jre" + else + if test -n "$HAVE_JVIEW_IN_PATH" \ + && (jview -? >/dev/null 2>/dev/null || test $? = 1) \ + ; then + HAVE_JVIEW=1 + CONF_JAVA="jview" + else + HAVE_JAVAEXEC= + fi + fi + fi + fi + + fi + if test -n "$HAVE_JAVAEXEC"; then + ac_result="$CONF_JAVA" + else + ac_result="no" + fi + { $as_echo "$as_me:$LINENO: result: $ac_result" >&5 +$as_echo "$ac_result" >&6; } + + + + + + + + + + + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + CLASSPATH_SEPARATOR=';' +else + CLASSPATH_SEPARATOR=':' +fi +rm -f conftest* + + source_version=1.3 + test -n "$source_version" || { + { { $as_echo "$as_me:$LINENO: error: missing source-version argument to gt_JAVACOMP" >&5 +$as_echo "$as_me: error: missing source-version argument to gt_JAVACOMP" >&2;} + { (exit 1); exit 1; }; } + } + if test -n "$HAVE_JAVAEXEC"; then + cat > conftestver.java <?@ABCDEFGIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzH' '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\046\050\051\052\056\057\073\074\076\103\106\114\116\117\120\123\124\126\133\141\142\143\144\145\146\147\151\152\154\155\156\157\160\162\163\164\165\166\171\261\262\266\267\270\272\276\312\376\055' \ + > conftestver.class + target_version=`{ + unset JAVA_HOME + echo "$as_me:23420: CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver" >&5 + CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver 2>&5 + }` + case "$target_version" in + 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6) ;; + null) + target_version=1.1 ;; + *) { $as_echo "$as_me:$LINENO: WARNING: unknown target-version $target_version, please update gt_JAVACOMP macro" >&5 +$as_echo "$as_me: WARNING: unknown target-version $target_version, please update gt_JAVACOMP macro" >&2;} + target_version=1.1 ;; + esac + else + target_version="1.1" + fi + + case "$source_version" in + 1.3) goodcode='class conftest {}' + failcode='class conftestfail { static { assert(true); } }' ;; + 1.4) goodcode='class conftest { static { assert(true); } }' + failcode='class conftestfail { T foo() { return null; } }' ;; + 1.5) goodcode='class conftest { T foo() { return null; } }' + failcode='class conftestfail syntax error' ;; + *) { { $as_echo "$as_me:$LINENO: error: invalid source-version argument to gt_JAVACOMP: $source_version" >&5 +$as_echo "$as_me: error: invalid source-version argument to gt_JAVACOMP: $source_version" >&2;} + { (exit 1); exit 1; }; } ;; + esac + case "$target_version" in + 1.1) cfversion=45 ;; + 1.2) cfversion=46 ;; + 1.3) cfversion=47 ;; + 1.4) cfversion=48 ;; + 1.5) cfversion=49 ;; + 1.6) cfversion=50 ;; + *) { { $as_echo "$as_me:$LINENO: error: invalid target-version argument to gt_JAVACOMP: $target_version" >&5 +$as_echo "$as_me: error: invalid target-version argument to gt_JAVACOMP: $target_version" >&2;} + { (exit 1); exit 1; }; } ;; + esac + # Function to output the classfile version of a file (8th byte) in decimal. + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_classfile_version () + { + od -A n -t d1 -j 7 -N 1 "$1" + } + else + # Use BSD hexdump. + func_classfile_version () + { + dd if="$1" bs=1 count=1 skip=7 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi + { $as_echo "$as_me:$LINENO: checking for Java compiler" >&5 +$as_echo_n "checking for Java compiler... " >&6; } + CONF_JAVAC= + HAVE_JAVAC_ENVVAR= + HAVE_GCJ_C= + HAVE_JAVAC= + HAVE_JIKES= + HAVE_JAVACOMP= + cat > conftestlib.java < conftest.java + echo "$failcode" > conftestfail.java + if test -n "$JAVAC"; then + if $JAVAC --version 2>/dev/null | sed -e 1q | grep gcj > /dev/null; then + if $JAVAC --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null; then + rm -f conftest.class + if { echo "$as_me:23492: $JAVAC -d . conftest.java" >&5 + $JAVAC -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:23499: $JAVAC -fsource=$source_version -d . conftest.java" >&5 + $JAVAC -fsource="$source_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ + && { echo "$as_me:23504: $JAVAC -d . conftestfail.java" >&5 + $JAVAC -d . conftestfail.java >&5 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:23508: $JAVAC -fsource=$source_version -d . conftestfail.java" >&5 + $JAVAC -fsource="$source_version" -d . conftestfail.java >&5 2>&1 + }; then + CONF_JAVAC="$JAVAC -fsource=$source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="$JAVAC" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:23522: $JAVAC -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&5 + $JAVAC -fsource="$source_version" -ftarget="$target_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + CONF_JAVAC="$JAVAC -fsource=$source_version -ftarget=$target_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + fi + else + if test "$target_version" = 1.4 && test "$source_version" = 1.4; then + rm -f conftest.class + if { echo "$as_me:23535: $JAVAC -d . conftest.java" >&5 + $JAVAC -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class; then + CONF_JAVAC="$JAVAC" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + if test "$target_version" = 1.4 && test "$source_version" = 1.3; then + javac_works= + rm -f conftest.class + if { echo "$as_me:23547: $JAVAC -d . conftest.java" >&5 + $JAVAC -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class; then + javac_works=1 + fi + javac_noassert_works= + rm -f conftest.class + if { echo "$as_me:23555: $JAVAC -fno-assert -d . conftest.java" >&5 + $JAVAC -fno-assert -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class; then + javac_noassert_works=1 + fi + if test -n "$javac_works" && test -n "$javac_noassert_works"; then + rm -f conftestfail.class + if { echo "$as_me:23563: $JAVAC -d . conftestfail.java" >&5 + $JAVAC -d . conftestfail.java >&5 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:23567: $JAVAC -fno-assert -d . conftestfail.java" >&5 + $JAVAC -fno-assert -d . conftestfail.java >&5 2>&1 + }; then + javac_works= + fi + fi + if test -n "$javac_works"; then + CONF_JAVAC="$JAVAC" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + if test -n "$javac_noassert_works"; then + CONF_JAVAC="$JAVAC -fno-assert" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + fi + else + rm -f conftest.class + if { echo "$as_me:23589: $JAVAC -d . conftest.java" >&5 + $JAVAC -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:23596: $JAVAC -source $source_version -d . conftest.java" >&5 + $JAVAC -source "$source_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ + && { echo "$as_me:23601: $JAVAC -d . conftestfail.java" >&5 + $JAVAC -d . conftestfail.java >&5 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:23605: $JAVAC -source $source_version -d . conftestfail.java" >&5 + $JAVAC -source "$source_version" -d . conftestfail.java >&5 2>&1 + }; then + CONF_JAVAC="$JAVAC -source $source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="$JAVAC" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + rm -f conftest.class + if { echo "$as_me:23618: $JAVAC -target $target_version -d . conftest.java" >&5 + $JAVAC -target "$target_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:23625: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&5 + $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ + && { echo "$as_me:23630: $JAVAC -target $target_version -d . conftestfail.java" >&5 + $JAVAC -target "$target_version" -d . conftestfail.java >&5 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:23634: $JAVAC -target $target_version -source $source_version -d . conftestfail.java" >&5 + $JAVAC -target "$target_version" -source "$source_version" -d . conftestfail.java >&5 2>&1 + }; then + CONF_JAVAC="$JAVAC -target $target_version -source $source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="$JAVAC -target $target_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + rm -f conftest.class + if { echo "$as_me:23647: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&5 + $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + CONF_JAVAC="$JAVAC -target $target_version -source $source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + fi + if test -z "$HAVE_JAVACOMP"; then + # Extract the first word of "gcj", so it can be a program name with args. +set dummy gcj; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_GCJ_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_GCJ_IN_PATH"; then + ac_cv_prog_HAVE_GCJ_IN_PATH="$HAVE_GCJ_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_GCJ_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_GCJ_IN_PATH=$ac_cv_prog_HAVE_GCJ_IN_PATH +if test -n "$HAVE_GCJ_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "javac", so it can be a program name with args. +set dummy javac; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_JAVAC_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_JAVAC_IN_PATH"; then + ac_cv_prog_HAVE_JAVAC_IN_PATH="$HAVE_JAVAC_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_JAVAC_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_JAVAC_IN_PATH=$ac_cv_prog_HAVE_JAVAC_IN_PATH +if test -n "$HAVE_JAVAC_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "jikes", so it can be a program name with args. +set dummy jikes; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_JIKES_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_JIKES_IN_PATH"; then + ac_cv_prog_HAVE_JIKES_IN_PATH="$HAVE_JIKES_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_JIKES_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_JIKES_IN_PATH=$ac_cv_prog_HAVE_JIKES_IN_PATH +if test -n "$HAVE_JIKES_IN_PATH"; then + : +else + : +fi + + + if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_GCJ_IN_PATH"; then + if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^3\.[01]/d' | grep '^[3-9]' >/dev/null; then + if { echo "$as_me:23765: gcj -C -d . conftestlib.java" >&5 + gcj -C -d . conftestlib.java >&5 2>&1 + }; then + if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null; then + rm -f conftest.class + if { echo "$as_me:23770: gcj -C -d . conftest.java" >&5 + gcj -C -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:23777: gcj -C -fsource=$source_version -d . conftest.java" >&5 + gcj -C -fsource="$source_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ + && { echo "$as_me:23782: gcj -C -d . conftestfail.java" >&5 + gcj -C -d . conftestfail.java >&5 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:23786: gcj -C -fsource=$source_version -d . conftestfail.java" >&5 + gcj -C -fsource="$source_version" -d . conftestfail.java >&5 2>&1 + }; then + CONF_JAVAC="gcj -C -fsource=$source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="gcj -C" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:23800: gcj -C -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&5 + gcj -C -fsource="$source_version" -ftarget="$target_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + CONF_JAVAC="gcj -C -fsource=$source_version -ftarget=$target_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + fi + else + if test "$target_version" = 1.4 && test "$source_version" = 1.4; then + rm -f conftest.class + if { echo "$as_me:23813: gcj -C -d . conftest.java" >&5 + gcj -C -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class; then + CONF_JAVAC="gcj -C" + HAVE_GCJ_C=1 + HAVE_JAVACOMP=1 + fi + else + if test "$target_version" = 1.4 && test "$source_version" = 1.3; then + rm -f conftest.class + if { echo "$as_me:23824: gcj -C -fno-assert -d . conftest.java" >&5 + gcj -C -fno-assert -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class; then + CONF_JAVAC="gcj -C -fno-assert" + HAVE_GCJ_C=1 + HAVE_JAVACOMP=1 + else + rm -f conftest.class + if { echo "$as_me:23833: gcj -C -d . conftest.java" >&5 + gcj -C -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class; then + CONF_JAVAC="gcj -C" + HAVE_GCJ_C=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + fi + fi + fi + fi + if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JAVAC_IN_PATH"; then + if { javac -version >/dev/null 2>/dev/null || test $? -le 2; } \ + && ( if javac -help 2>&1 >/dev/null | grep at.dms.kjc.Main >/dev/null && javac -help 2>/dev/null | grep 'released.*2000' >/dev/null ; then exit 1; else exit 0; fi ); then + rm -f conftest.class + if { echo "$as_me:23852: javac -d . conftest.java" >&5 + javac -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:23859: javac -source $source_version -d . conftest.java" >&5 + javac -source "$source_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ + && { echo "$as_me:23864: javac -d . conftestfail.java" >&5 + javac -d . conftestfail.java >&5 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:23868: javac -source $source_version -d . conftestfail.java" >&5 + javac -source "$source_version" -d . conftestfail.java >&5 2>&1 + }; then + CONF_JAVAC="javac -source $source_version" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="javac" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + fi + else + rm -f conftest.class + if { echo "$as_me:23881: javac -target $target_version -d . conftest.java" >&5 + javac -target "$target_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:23888: javac -target $target_version -source $source_version -d . conftest.java" >&5 + javac -target "$target_version" -source "$source_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ + && { echo "$as_me:23893: javac -target $target_version -d . conftestfail.java" >&5 + javac -target "$target_version" -d . conftestfail.java >&5 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:23897: javac -target $target_version -source $source_version -d . conftestfail.java" >&5 + javac -target "$target_version" -source "$source_version" -d . conftestfail.java >&5 2>&1 + }; then + CONF_JAVAC="javac -target $target_version -source $source_version" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="javac -target $target_version" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + fi + else + rm -f conftest.class + if { echo "$as_me:23910: javac -target $target_version -source $source_version -d . conftest.java" >&5 + javac -target "$target_version" -source "$source_version" -d . conftest.java >&5 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then + CONF_JAVAC="javac -target $target_version -source $source_version" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + fi + if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JIKES_IN_PATH"; then + if { jikes >/dev/null 2>/dev/null || test $? = 1; } \ + && ( + # See if the existing CLASSPATH is sufficient to make jikes work. + unset JAVA_HOME + jikes conftestlib.java >&5 2>&1 + error=$? + rm -f conftestlib.class + exit $error + ); then + if test "$source_version" = 1.3; then + CONF_JAVAC="jikes" + HAVE_JIKES=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + rm -f conftest*.java conftest*.class + if test -n "$HAVE_JAVACOMP"; then + ac_result="$CONF_JAVAC" + else + ac_result="no" + fi + { $as_echo "$as_me:$LINENO: result: $ac_result" >&5 +$as_echo "$ac_result" >&6; } + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking for Java virtual machine" >&5 +$as_echo_n "checking for Java virtual machine... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + CLASSPATH_SEPARATOR=';' +else + CLASSPATH_SEPARATOR=':' +fi +rm -f conftest* + + CONF_JAVA= + HAVE_JAVA_ENVVAR= + HAVE_GIJ= + HAVE_JAVA= + HAVE_JRE= + HAVE_JVIEW= + HAVE_JAVAEXEC=1 + if test -n "$JAVA"; then + HAVE_JAVA_ENVVAR=1 + CONF_JAVA="$JAVA" + else + # Extract the first word of "gij", so it can be a program name with args. +set dummy gij; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_GIJ_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_GIJ_IN_PATH"; then + ac_cv_prog_HAVE_GIJ_IN_PATH="$HAVE_GIJ_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_GIJ_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_GIJ_IN_PATH=$ac_cv_prog_HAVE_GIJ_IN_PATH +if test -n "$HAVE_GIJ_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "java", so it can be a program name with args. +set dummy java; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_JAVA_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_JAVA_IN_PATH"; then + ac_cv_prog_HAVE_JAVA_IN_PATH="$HAVE_JAVA_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_JAVA_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_JAVA_IN_PATH=$ac_cv_prog_HAVE_JAVA_IN_PATH +if test -n "$HAVE_JAVA_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "jre", so it can be a program name with args. +set dummy jre; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_JRE_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_JRE_IN_PATH"; then + ac_cv_prog_HAVE_JRE_IN_PATH="$HAVE_JRE_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_JRE_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_JRE_IN_PATH=$ac_cv_prog_HAVE_JRE_IN_PATH +if test -n "$HAVE_JRE_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "jview", so it can be a program name with args. +set dummy jview; ac_word=$2 +: +if test "${ac_cv_prog_HAVE_JVIEW_IN_PATH+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_JVIEW_IN_PATH"; then + ac_cv_prog_HAVE_JVIEW_IN_PATH="$HAVE_JVIEW_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_JVIEW_IN_PATH="yes" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +HAVE_JVIEW_IN_PATH=$ac_cv_prog_HAVE_JVIEW_IN_PATH +if test -n "$HAVE_JVIEW_IN_PATH"; then + : +else + : +fi + + + + export CLASSPATH + if test -n "$HAVE_GIJ_IN_PATH" \ + && gij --version >/dev/null 2>/dev/null \ + ; then + HAVE_GIJ=1 + CONF_JAVA="gij" + else + if test -n "$HAVE_JAVA_IN_PATH" \ + && java -version >/dev/null 2>/dev/null \ + ; then + HAVE_JAVA=1 + CONF_JAVA="java" + else + if test -n "$HAVE_JRE_IN_PATH" \ + && (jre >/dev/null 2>/dev/null || test $? = 1) \ + ; then + HAVE_JRE=1 + CONF_JAVA="jre" + else + if test -n "$HAVE_JVIEW_IN_PATH" \ + && (jview -? >/dev/null 2>/dev/null || test $? = 1) \ + ; then + HAVE_JVIEW=1 + CONF_JAVA="jview" + else + HAVE_JAVAEXEC= + fi + fi + fi + fi + + fi + if test -n "$HAVE_JAVAEXEC"; then + ac_result="$CONF_JAVA" + else + ac_result="no" + fi + { $as_echo "$as_me:$LINENO: result: $ac_result" >&5 +$as_echo "$ac_result" >&6; } + + + + + + + + + + +ac_config_files="$ac_config_files Makefile build-aux/Makefile po/Makefile.in data/Makefile etc/Makefile examples/Makefile examples/calc++/Makefile lib/Makefile src/Makefile doc/Makefile doc/yacc.1" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${GL_COND_LIBTOOL_TRUE}" && test -z "${GL_COND_LIBTOOL_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"GL_COND_LIBTOOL\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"GL_COND_LIBTOOL\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +test "X$DEFS" = X-DHAVE_CONFIG_H && DEFS= + + gl_libobjs= + gl_ltlibobjs= + if test -n "$gl_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + gl_libobjs="$gl_libobjs $i.$ac_objext" + gl_ltlibobjs="$gl_ltlibobjs $i.lo" + done + fi + gl_LIBOBJS=$gl_libobjs + + gl_LTLIBOBJS=$gl_ltlibobjs + + + + gltests_libobjs= + gltests_ltlibobjs= + if test -n "$gltests_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + gltests_libobjs="$gltests_libobjs $i.$ac_objext" + gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" + done + fi + gltests_LIBOBJS=$gltests_libobjs + + gltests_LTLIBOBJS=$gltests_ltlibobjs + + +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${BISON_CXX_WORKS_TRUE}" && test -z "${BISON_CXX_WORKS_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"BISON_CXX_WORKS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"BISON_CXX_WORKS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by GNU Bison $as_me 2.4.1, which was +generated by GNU Autoconf 2.62. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_links="$ac_config_links" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration links: +$config_links + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_version="\\ +GNU Bison config.status 2.4.1 +configured by $0, generated by GNU Autoconf 2.62, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2008 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { $as_echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { $as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +GNUmakefile=$GNUmakefile +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "lib/config.h") CONFIG_HEADERS="$CONFIG_HEADERS lib/config.h:lib/config.hin" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "$GNUmakefile") CONFIG_LINKS="$CONFIG_LINKS $GNUmakefile:$GNUmakefile" ;; + "javacomp.sh") CONFIG_FILES="$CONFIG_FILES javacomp.sh:build-aux/javacomp.sh.in" ;; + "javaexec.sh") CONFIG_FILES="$CONFIG_FILES javaexec.sh:build-aux/javaexec.sh.in" ;; + "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; + "runtime-po/Makefile.in") CONFIG_FILES="$CONFIG_FILES runtime-po/Makefile.in" ;; + "etc/bench.pl") CONFIG_FILES="$CONFIG_FILES etc/bench.pl" ;; + "tests/atconfig") CONFIG_COMMANDS="$CONFIG_COMMANDS tests/atconfig" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/atlocal") CONFIG_FILES="$CONFIG_FILES tests/atlocal" ;; + "tests/bison") CONFIG_FILES="$CONFIG_FILES tests/bison" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "build-aux/Makefile") CONFIG_FILES="$CONFIG_FILES build-aux/Makefile" ;; + "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; + "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "examples/calc++/Makefile") CONFIG_FILES="$CONFIG_FILES examples/calc++/Makefile" ;; + "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/yacc.1") CONFIG_FILES="$CONFIG_FILES doc/yacc.1" ;; + + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + $as_echo "$as_me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=' ' +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\).*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\).*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + prefix = substr(line, 1, index(line, defundef) - 1) + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", line, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 +$as_echo "$as_me: error: could not setup config headers machinery" >&2;} + { (exit 1); exit 1; }; } +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + ac_file_inputs="$ac_file_inputs '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + :L) + # + # CONFIG_LINK + # + + if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then + { $as_echo "$as_me:$LINENO: WARNING: not linking $ac_source to itself" >&5 +$as_echo "$as_me: WARNING: not linking $ac_source to itself" >&2;} + else + # Prefer the file from the source tree if names are identical. + if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then + ac_source=$srcdir/$ac_source + fi + + { $as_echo "$as_me:$LINENO: linking $ac_source to $ac_file" >&5 +$as_echo "$as_me: linking $ac_source to $ac_file" >&6;} + + if test ! -r "$ac_source"; then + { { $as_echo "$as_me:$LINENO: error: $ac_source: file not found" >&5 +$as_echo "$as_me: error: $ac_source: file not found" >&2;} + { (exit 1); exit 1; }; } + fi + rm -f "$ac_file" + + # Try a relative symlink, then a hard link, then a copy. + case $srcdir in + [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; + *) ac_rel_source=$ac_top_build_prefix$ac_source ;; + esac + ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || + ln "$ac_source" "$ac_file" 2>/dev/null || + cp -p "$ac_source" "$ac_file" || + { { $as_echo "$as_me:$LINENO: error: cannot link or copy $ac_source to $ac_file" >&5 +$as_echo "$as_me: error: cannot link or copy $ac_source to $ac_file" >&2;} + { (exit 1); exit 1; }; } + fi + ;; + :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + "po-directories":C) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + "etc/bench.pl":F) chmod +x etc/bench.pl ;; + "tests/atconfig":C) cat >tests/atconfig <&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..f1ebd8d --- /dev/null +++ b/configure.ac @@ -0,0 +1,161 @@ +# Configure template for GNU Bison. -*-Autoconf-*- +# +# 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 +# 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 . + +# We have strange test case titles, so we need Autoconf 2.61 or better. +AC_PREREQ(2.61) + +AC_INIT([GNU Bison], + m4_esyscmd([build-aux/git-version-gen .tarball-version]), + [bug-bison@gnu.org]) +AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2008], + [The copyright year for this package]) +AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2008]) + +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) + +# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later. +# We want gnits strictness only when rolling a formal release so that we can, +# for example, run make dist at other times without being required to add a +# bogus NEWS entry. +AM_INIT_AUTOMAKE([1.8 dist-bzip2] + m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [-], [gnu], [gnits])) +AC_CONFIG_HEADERS([lib/config.h:lib/config.hin]) + +# Checks for the compiler. +AC_PROG_CC_STDC + +# Gnulib (early checks). +gl_EARLY + +AC_ARG_ENABLE(gcc-warnings, +[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)], +[case "${enableval}" in + yes|no) ;; + *) AC_MSG_ERROR([bad value ${enableval} for gcc-warnings option]) ;; + esac], + [enableval=no]) +if test "${enableval}" = yes; then + gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) + AC_SUBST([WERROR_CFLAGS]) + gl_WARN_ADD([-Wall]) + gl_WARN_ADD([-Wextra -Wno-sign-compare]) + gl_WARN_ADD([-Wcast-align]) + gl_WARN_ADD([-Wcast-qual]) + gl_WARN_ADD([-Wformat]) + gl_WARN_ADD([-Wpointer-arith]) + gl_WARN_ADD([-Wwrite-strings]) + AC_SUBST([WARN_CXXFLAGS], [$WARN_CFLAGS]) + # The following warnings are not suitable for C++. + gl_WARN_ADD([-Wbad-function-cast]) + gl_WARN_ADD([-Wmissing-declarations]) + gl_WARN_ADD([-Wmissing-prototypes]) + gl_WARN_ADD([-Wshadow]) + gl_WARN_ADD([-Wstrict-prototypes]) + AC_SUBST([WARN_CFLAGS]) + AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.]) +fi + +BISON_TEST_FOR_WORKING_C_COMPILER + +AC_ARG_ENABLE([yacc], + [AC_HELP_STRING([--disable-yacc], + [do not build a yacc command or an -ly library])], + , [enable_yacc=yes]) +case $enable_yacc in +yes) + YACC_SCRIPT=yacc + YACC_LIBRARY=liby.a;; +*) + YACC_SCRIPT= + YACC_LIBRARY=;; +esac +AC_SUBST([YACC_SCRIPT]) +AC_SUBST([YACC_LIBRARY]) + +# Checks for programs. +AC_PROG_LEX +AC_PROG_YACC +AC_PROG_RANLIB +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.]) +AM_MISSING_PROG([HELP2MAN], [help2man]) +AC_PATH_PROG([XSLTPROC], [xsltproc]) +AC_SUBST([XSLTPROC]) + +# Checks for header files. +AC_CHECK_HEADERS_ONCE([locale.h]) + +# Checks for compiler characteristics. +AC_C_INLINE + +# Gnulib (later checks). Putting them here rather than right after +# gl_EARLY avoids some redundant checks. +gl_INIT + +# Checks for library functions. +AC_CHECK_FUNCS_ONCE([setlocale]) +AM_WITH_DMALLOC +BISON_PREREQ_SUBPIPE +BISON_PREREQ_TIMEVAR + +# Gettext. +# We've never tested with gettext versions before 0.15, so play it safe. +AM_GNU_GETTEXT([external], [need-formatstring-macros]) +AM_GNU_GETTEXT_VERSION([0.15]) +BISON_I18N + +# Internationalized parsers. +AC_CONFIG_FILES([runtime-po/Makefile.in]) +# Autoconf macros for packages using internationalized parsers. +aclocaldir='${datadir}/aclocal' +AC_SUBST([aclocaldir]) + +# Create the benchmark script. +AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl]) + +# Initialize the test suite. +AC_CONFIG_TESTDIR(tests) +AC_CONFIG_FILES([tests/Makefile tests/atlocal]) +AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison]) +AC_CHECK_PROGS([VALGRIND], [valgrind]) +AC_PROG_CXX +BISON_TEST_FOR_WORKING_CXX_COMPILER +AM_MISSING_PROG([AUTOM4TE], [autom4te]) +# Needed by tests/atlocal.in. +AC_SUBST([GCC]) +AC_SUBST([O0CFLAGS], [`echo $CFLAGS | sed 's/-O[[0-9]] *//'`]) +AC_SUBST([O0CXXFLAGS], [`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`]) + +gt_JAVACOMP([1.3]) +gt_JAVAEXEC + +AC_CONFIG_FILES([Makefile + build-aux/Makefile + po/Makefile.in + data/Makefile + etc/Makefile + examples/Makefile + examples/calc++/Makefile + lib/Makefile src/Makefile + doc/Makefile + doc/yacc.1]) +AC_OUTPUT diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..ce15dac --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,29 @@ +## Copyright (C) 2002, 2005, 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 . + +dist_pkgdata_DATA = README bison.m4 \ + c-skel.m4 c.m4 yacc.c glr.c \ + c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc \ + java-skel.m4 java.m4 lalr1.java + +m4sugardir = $(pkgdatadir)/m4sugar +dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4 + +xsltdir = $(pkgdatadir)/xslt +dist_xslt_DATA = \ + xslt/bison.xsl \ + xslt/xml2dot.xsl \ + xslt/xml2text.xsl \ + xslt/xml2xhtml.xsl diff --git a/data/Makefile.in b/data/Makefile.in new file mode 100644 index 0000000..b15a34c --- /dev/null +++ b/data/Makefile.in @@ -0,0 +1,713 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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 . + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = data +DIST_COMMON = README $(dist_m4sugar_DATA) $(dist_pkgdata_DATA) \ + $(dist_xslt_DATA) $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(m4sugardir)" "$(DESTDIR)$(pkgdatadir)" \ + "$(DESTDIR)$(xsltdir)" +dist_m4sugarDATA_INSTALL = $(INSTALL_DATA) +dist_pkgdataDATA_INSTALL = $(INSTALL_DATA) +dist_xsltDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dist_m4sugar_DATA) $(dist_pkgdata_DATA) $(dist_xslt_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +dist_pkgdata_DATA = README bison.m4 \ + c-skel.m4 c.m4 yacc.c glr.c \ + c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc \ + java-skel.m4 java.m4 lalr1.java + +m4sugardir = $(pkgdatadir)/m4sugar +dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4 +xsltdir = $(pkgdatadir)/xslt +dist_xslt_DATA = \ + xslt/bison.xsl \ + xslt/xml2dot.xsl \ + xslt/xml2text.xsl \ + xslt/xml2xhtml.xsl + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits data/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits data/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-dist_m4sugarDATA: $(dist_m4sugar_DATA) + @$(NORMAL_INSTALL) + test -z "$(m4sugardir)" || $(MKDIR_P) "$(DESTDIR)$(m4sugardir)" + @list='$(dist_m4sugar_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_m4sugarDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(m4sugardir)/$$f'"; \ + $(dist_m4sugarDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(m4sugardir)/$$f"; \ + done + +uninstall-dist_m4sugarDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_m4sugar_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(m4sugardir)/$$f'"; \ + rm -f "$(DESTDIR)$(m4sugardir)/$$f"; \ + done +install-dist_pkgdataDATA: $(dist_pkgdata_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" + @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \ + $(dist_pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \ + done + +uninstall-dist_pkgdataDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ + done +install-dist_xsltDATA: $(dist_xslt_DATA) + @$(NORMAL_INSTALL) + test -z "$(xsltdir)" || $(MKDIR_P) "$(DESTDIR)$(xsltdir)" + @list='$(dist_xslt_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_xsltDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xsltdir)/$$f'"; \ + $(dist_xsltDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xsltdir)/$$f"; \ + done + +uninstall-dist_xsltDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_xslt_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(xsltdir)/$$f'"; \ + rm -f "$(DESTDIR)$(xsltdir)/$$f"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(m4sugardir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(xsltdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-dist_m4sugarDATA install-dist_pkgdataDATA \ + install-dist_xsltDATA + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_m4sugarDATA uninstall-dist_pkgdataDATA \ + uninstall-dist_xsltDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-dist_m4sugarDATA install-dist_pkgdataDATA \ + install-dist_xsltDATA install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am \ + uninstall-dist_m4sugarDATA uninstall-dist_pkgdataDATA \ + uninstall-dist_xsltDATA + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/data/README b/data/README new file mode 100644 index 0000000..18e025c --- /dev/null +++ b/data/README @@ -0,0 +1,70 @@ +-*- outline -*- + +This directory contains data needed by Bison. + +* 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 + It used to be named bison.simple: it corresponds to C Yacc + compatible LALR(1) parsers. + +- lalr1.cc + Produces a C++ parser class. + +- lalr1.java + Produces a Java parser class. + +- glr.c + 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. +Because the interface between skeletons and the bison program is not +finished, *we are not bound to it*. In particular, Bison is not +mature enough for us to consider that ``foreign skeletons'' are +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 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 . diff --git a/data/bison.m4 b/data/bison.m4 new file mode 100644 index 0000000..bad6296 --- /dev/null +++ b/data/bison.m4 @@ -0,0 +1,556 @@ + -*- Autoconf -*- + +# Language-independent M4 Macros for Bison. +# Copyright (C) 2002, 2004, 2005, 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 . + + +## ---------------- ## +## Identification. ## +## ---------------- ## + +# b4_copyright(TITLE, YEARS) +# -------------------------- +m4_define([b4_copyright], +[b4_comment([A Bison parser, made by GNU Bison b4_version.]) + +b4_comment([$1 + +m4_text_wrap([Copyright (C) $2 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 .]) + +b4_comment([As a special exception, you may create a larger work that contains +part or all of the Bison parser skeleton and distribute that work +under terms of your choice, so long as that work isn't itself a +parser generator using the skeleton or a modified version thereof +as a parser skeleton. Alternatively, if you modify or redistribute +the parser skeleton itself, you may (at your option) remove this +special exception, which will cause the skeleton and the resulting +Bison output files to be licensed under the GNU General Public +License without this special exception. + +This special exception was added by the Free Software Foundation in +version 2.2 of Bison.])]) + + +## ---------------- ## +## Error handling. ## +## ---------------- ## + +# The following error handling macros print error directives that should not +# become arguments of other macro invocations since they would likely then be +# mangled. Thus, they print to stdout directly. + +# b4_cat(TEXT) +# ------------ +# Write TEXT to stdout. Precede the final newline with an @ so that it's +# escaped. For example: +# +# b4_cat([[@complain(invalid input@)]]) +m4_define([b4_cat], +[m4_syscmd([cat <<'_m4eof' +]m4_bpatsubst(m4_dquote($1), [_m4eof], [_m4@`eof])[@ +_m4eof +])dnl +m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])]) + +# b4_error(KIND, FORMAT, [ARG1], [ARG2], ...) +# ------------------------------------------- +# Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to stdout. +# +# For example: +# +# b4_error([[warn]], [[invalid value for `%s': %s]], [[foo]], [[3]]) +m4_define([b4_error], +[b4_cat([[@]$1[(]$2[]]dnl +[m4_if([$#], [2], [], + [m4_foreach([b4_arg], + m4_dquote(m4_shift(m4_shift($@))), + [[@,]b4_arg])])[@)]])]) + +# b4_error_at(KIND, START, END, FORMAT, [ARG1], [ARG2], ...) +# ---------------------------------------------------------- +# Write @KIND_at(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout. +# +# For example: +# +# b4_error_at([[complain]], [[input.y:2.3]], [[input.y:5.4]], +# [[invalid %s]], [[foo]]) +m4_define([b4_error_at], +[b4_cat([[@]$1[_at(]$2[@,]$3[@,]$4[]]dnl +[m4_if([$#], [4], [], + [m4_foreach([b4_arg], + m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))), + [[@,]b4_arg])])[@)]])]) + +# b4_warn(FORMAT, [ARG1], [ARG2], ...) +# ------------------------------------ +# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to stdout. +# +# For example: +# +# b4_warn([[invalid value for `%s': %s]], [[foo]], [[3]]) +# +# As a simple test suite, this: +# +# m4_divert(-1) +# m4_define([asdf], [ASDF]) +# m4_define([fsa], [FSA]) +# m4_define([fdsa], [FDSA]) +# b4_warn([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]]) +# b4_warn([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]]) +# b4_warn() +# b4_warn(1) +# b4_warn(1, 2) +# +# Should produce this without newlines: +# +# @warn([asdf), asdf]@,[fsa), fsa]@,[fdsa), fdsa]@) +# @warn(asdf), asdf@,fsa), fsa@,fdsa), fdsa@) +# @warn(@) +# @warn(1@) +# @warn(1@,2@) +m4_define([b4_warn], +[b4_error([[warn]], $@)]) + +# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...) +# --------------------------------------------------- +# Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout. +# +# For example: +# +# b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]]) +m4_define([b4_warn_at], +[b4_error_at([[warn]], $@)]) + +# b4_complain(FORMAT, [ARG1], [ARG2], ...) +# ---------------------------------------- +# Write @complain(FORMAT@,ARG1@,ARG2@,...@) to stdout. +# +# See b4_warn example. +m4_define([b4_complain], +[b4_error([[complain]], $@)]) + +# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...) +# ------------------------------------------------------- +# Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout. +# +# See b4_warn_at example. +m4_define([b4_complain_at], +[b4_error_at([[complain]], $@)]) + +# b4_fatal(FORMAT, [ARG1], [ARG2], ...) +# ------------------------------------- +# Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to stdout and exit. +# +# See b4_warn example. +m4_define([b4_fatal], +[b4_error([[fatal]], $@)dnl +m4_exit(1)]) + +# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...) +# ---------------------------------------------------- +# Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout and exit. +# +# See b4_warn_at example. +m4_define([b4_fatal_at], +[b4_error_at([[fatal]], $@)dnl +m4_exit(1)]) + + +## ---------------- ## +## Default values. ## +## ---------------- ## + +# m4_define_default([b4_lex_param], []) dnl breaks other skeletons +m4_define_default([b4_pre_prologue], []) +m4_define_default([b4_post_prologue], []) +m4_define_default([b4_epilogue], []) +m4_define_default([b4_parse_param], []) + +# The initial column and line. +m4_define_default([b4_location_initial_column], [1]) +m4_define_default([b4_location_initial_line], [1]) + + +## ------------ ## +## Data Types. ## +## ------------ ## + +# b4_ints_in(INT1, INT2, LOW, HIGH) +# --------------------------------- +# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise. +m4_define([b4_ints_in], +[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])]) + + + +## ------------------ ## +## Decoding options. ## +## ------------------ ## + +# b4_flag_if(FLAG, IF-TRUE, IF-FALSE) +# ----------------------------------- +# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail. +m4_define([b4_flag_if], +[m4_case(b4_$1_flag, + [0], [$3], + [1], [$2], + [m4_fatal([invalid $1 value: ]$1)])]) + + +# b4_define_flag_if(FLAG) +# ----------------------- +# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the +# value of the Boolean FLAG. +m4_define([b4_define_flag_if], +[_b4_define_flag_if($[1], $[2], [$1])]) + +# _b4_define_flag_if($1, $2, FLAG) +# -------------------------------- +# This macro works around the impossibility to define macros +# inside macros, because issuing `[$1]' is not possible in M4 :(. +# This sucks hard, GNU M4 should really provide M5 like $$1. +m4_define([_b4_define_flag_if], +[m4_if([$1$2], $[1]$[2], [], + [m4_fatal([$0: Invalid arguments: $@])])dnl +m4_define([b4_$3_if], + [b4_flag_if([$3], [$1], [$2])])]) + + +# b4_FLAG_if(IF-TRUE, IF-FALSE) +# ----------------------------- +# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise. +b4_define_flag_if([defines]) # Whether headers are requested. +b4_define_flag_if([error_verbose]) # Whether error are verbose. +b4_define_flag_if([glr]) # Whether a GLR parser is requested. +b4_define_flag_if([locations]) # Whether locations are tracked. +b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled. +b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated. + + +## ------------------------- ## +## Assigning token numbers. ## +## ------------------------- ## + + +## ----------- ## +## Synclines. ## +## ----------- ## + +# b4_basename(NAME) +# ----------------- +# Similar to POSIX basename; the differences don't matter here. +# Beware that NAME is not evaluated. +m4_define([b4_basename], +[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])]) + + +# b4_syncline(LINE, FILE) +# ----------------------- +m4_define([b4_syncline], +[b4_flag_if([synclines], [ +b4_sync_end([__line__], [b4_basename(m4_quote(__file__))]) +b4_sync_start([$1], [$2])])]) + +m4_define([b4_sync_end], [b4_comment([Line $1 of $2])]) +m4_define([b4_sync_start], [b4_comment([Line $1 of $2])]) + +# b4_user_code(USER-CODE) +# ----------------------- +# Emit code from the user, ending it with synclines. +m4_define([b4_user_code], +[$1 +b4_syncline([@oline@], [@ofile@])]) + + +# b4_define_user_code(MACRO) +# -------------------------- +# From b4_MACRO, build b4_user_MACRO that includes the synclines. +m4_define([b4_define_user_code], +[m4_define([b4_user_$1], +[b4_user_code([b4_$1])])]) + + +# b4_user_actions +# b4_user_initial_action +# b4_user_post_prologue +# b4_user_pre_prologue +# b4_user_stype +# ---------------------- +# Macros that issue user code, ending with synclines. +b4_define_user_code([actions]) +b4_define_user_code([initial_action]) +b4_define_user_code([post_prologue]) +b4_define_user_code([pre_prologue]) +b4_define_user_code([stype]) + + +# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE) +# -------------------------------------------------------- +# Warn if any name of type WHAT is used by the user (as recorded in USER-LIST) +# but is not used by Bison (as recorded by macros in the namespace +# BISON-NAMESPACE). +# +# USER-LIST must expand to a list specifying all grammar occurrences of all +# 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 +# fine. An empty list is fine. +# +# For example, to define b4_foo_user_names to be used for USER-LIST with three +# name occurrences and with correct quoting: +# +# m4_define([b4_foo_user_names], +# [[[[[[bar]], [[parser.y:1.7]], [[parser.y:1.16]]]], +# [[[[bar]], [[parser.y:5.7]], [[parser.y:5.16]]]], +# [[[[baz]], [[parser.y:8.7]], [[parser.y:8.16]]]]]]) +# +# The macro BISON-NAMESPACE(bar) must be defined iff the name bar of type WHAT +# is used by Bison (in the front-end or in the skeleton). Empty string names +# are fine, but it would be ugly for Bison to actually use one. +# +# For example, to use b4_foo_bison_names for BISON-NAMESPACE and define that +# the names bar and baz are used by Bison: +# +# m4_define([b4_foo_bison_names(bar)]) +# m4_define([b4_foo_bison_names(baz)]) +# +# To invoke b4_check_user_names with TYPE foo, with USER-LIST +# b4_foo_user_names, with BISON-NAMESPACE b4_foo_bison_names, and with correct +# quoting: +# +# b4_check_user_names([[foo]], [b4_foo_user_names], +# [[b4_foo_bison_names]]) +m4_define([b4_check_user_names], +[m4_foreach([b4_occurrence], $2, +[m4_pushdef([b4_occurrence], b4_occurrence)dnl +m4_pushdef([b4_user_name], m4_car(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_ifndef($3[(]m4_quote(b4_user_name)[)], + [b4_warn_at([b4_start], [b4_end], + [[%s `%s' is not used]], + [$1], [b4_user_name])])[]dnl +m4_popdef([b4_occurrence])dnl +m4_popdef([b4_user_name])dnl +m4_popdef([b4_start])dnl +m4_popdef([b4_end])dnl +])]) + +# b4_percent_define_get(VARIABLE) +# ------------------------------- +# Mimic muscle_percent_define_get in ../src/muscle_tab.h exactly. That is, if +# the %define variable VARIABLE is defined, emit its value. Also, record +# Bison's usage of VARIABLE by defining +# b4_percent_define_bison_variables(VARIABLE). +# +# For example: +# +# b4_percent_define_get([[foo]]) +m4_define([b4_percent_define_get], +[m4_define([b4_percent_define_bison_variables(]$1[)])dnl +m4_ifdef([b4_percent_define(]$1[)], [m4_indir([b4_percent_define(]$1[)])])]) + +# b4_percent_define_get_loc(VARIABLE) +# ----------------------------------- +# 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 +# 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 +# b4_fatal_at. Don't record this as a Bison usage of VARIABLE as there's no +# reason to suspect that the user-supplied value has yet influenced the output. +# +# For example: +# +# b4_complain_at(b4_percent_define_get_loc([[foo]]), [[invalid foo]]) +m4_define([b4_percent_define_get_loc], +[m4_ifdef([b4_percent_define_loc(]$1[)], + [m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl +b4_loc[]dnl +m4_popdef([b4_loc])], + [b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_get_loc]], [$1])])]) + +# b4_percent_define_get_syncline(VARIABLE) +# ---------------------------------------- +# Mimic muscle_percent_define_get_syncline in ../src/muscle_tab.h exactly. +# That is, if the %define variable VARIABLE is undefined, complain fatally +# 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 +# VARIABLE as there's no reason to suspect that the user-supplied value has yet +# influenced the output. +# +# For example: +# +# b4_percent_define_get_syncline([[foo]]) +m4_define([b4_percent_define_get_syncline], +[m4_ifdef([b4_percent_define_syncline(]$1[)], + [m4_indir([b4_percent_define_syncline(]$1[)])], + [b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_get_syncline]], [$1])])]) + +# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE]) +# ------------------------------------------------------ +# 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-FALSE. Also, record Bison's usage of VARIABLE by defining +# b4_percent_define_bison_variables(VARIABLE). +# +# For example: +# +# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]]) +m4_define([b4_percent_define_ifdef], +[m4_ifdef([b4_percent_define(]$1[)], + [m4_define([b4_percent_define_bison_variables(]$1[)])$2], + [$3])]) + +# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE]) +# -------------------------------------------------------- +# 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 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 +# already) or defined to any other value (possibly a user error). Also, record +# Bison's usage of VARIABLE by defining +# b4_percent_define_bison_variables(VARIABLE). +# +# For example: +# +# b4_percent_define_flag_if([[foo]], [[it's true]], [[it's false]]) +m4_define([b4_percent_define_flag_if], +[b4_percent_define_ifdef([$1], + [m4_case(b4_percent_define_get([$1]), + [], [$2], [true], [$2], [false], [$3], + [m4_expand_once([b4_complain_at(b4_percent_define_get_loc([$1]), + [[invalid value for %%define Boolean variable `%s']], + [$1])], + [[b4_percent_define_flag_if($1)]])])], + [b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_flag_if]], [$1])])]) + +# b4_percent_define_default(VARIABLE, DEFAULT) +# -------------------------------------------- +# 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. +# 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. +# +# For example: +# +# b4_percent_define_default([[foo]], [[default value]]) +m4_define([b4_percent_define_default], +[m4_ifndef([b4_percent_define(]$1[)], + [m4_define([b4_percent_define(]$1[)], [$2])dnl + m4_define([b4_percent_define_loc(]$1[)], + [[[[[Bison:b4_percent_define_default]:1.0]], [[[Bison:b4_percent_define_default]:1.0]]]])dnl + m4_define([b4_percent_define_syncline(]$1[)], + [[]b4_syncline(1, [["[Bison:b4_percent_define_default]"]])[ +]])])]) + +# b4_percent_define_check_values(VALUES) +# -------------------------------------- +# 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 +# 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 +# valid values for that variable. Complain if such a variable is undefined (a +# Bison error since the default value should have been set already) or defined +# to any other value (possibly a user error). Don't record this as a Bison +# usage of the variable as there's no reason to suspect that the value has yet +# influenced the output. +# +# For example: +# +# b4_percent_define_check_values([[[[foo]], [[foo-value1]], [[foo-value2]]]], +# [[[[bar]], [[bar-value1]]]]) +m4_define([b4_percent_define_check_values], +[m4_foreach([b4_sublist], m4_quote($@), + [_b4_percent_define_check_values(b4_sublist)])]) + +m4_define([_b4_percent_define_check_values], +[m4_ifdef([b4_percent_define(]$1[)], + [m4_pushdef([b4_good_value], [0])dnl + m4_if($#, 1, [], + [m4_foreach([b4_value], m4_dquote(m4_shift($@)), + [m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value, + [m4_define([b4_good_value], [1])])])])dnl + m4_if(b4_good_value, [0], + [b4_complain_at(b4_percent_define_get_loc([$1]), + [[invalid value for %%define variable `%s': `%s']], + [$1], + m4_dquote(m4_indir([b4_percent_define(]$1[)])))])dnl + m4_popdef([b4_good_value])], + [b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_check_values]], [$1])])]) + +# b4_percent_code_get([QUALIFIER]) +# -------------------------------- +# If any %code blocks for QUALIFIER are defined, emit them beginning with a +# comment and ending with synclines and a newline. If QUALIFIER is not +# specified or empty, do this for the unqualified %code blocks. Also, record +# Bison's usage of QUALIFIER (if specified) by defining +# b4_percent_code_bison_qualifiers(QUALIFIER). +# +# For example, to emit any unqualified %code blocks followed by any %code +# blocks for the qualifier foo: +# +# b4_percent_code_get +# b4_percent_code_get([[foo]]) +m4_define([b4_percent_code_get], +[m4_pushdef([b4_macro_name], [[b4_percent_code(]$1[)]])dnl +m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl +m4_ifdef(b4_macro_name, +[b4_comment([m4_if([$#], [0], [[Unqualified %code]], + [["%code ]$1["]])[ blocks.]]) +b4_user_code([m4_indir(b4_macro_name)]) +])dnl +m4_popdef([b4_macro_name])]) + +# b4_percent_code_ifdef(QUALIFIER, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------- +# If any %code blocks for QUALIFIER (or unqualified %code blocks if +# QUALIFIER is empty) are defined, expand IF-TRUE, else expand IF-FALSE. +# Also, record Bison's usage of QUALIFIER (if specified) by defining +# b4_percent_code_bison_qualifiers(QUALIFIER). +m4_define([b4_percent_code_ifdef], +[m4_ifdef([b4_percent_code(]$1[)], + [m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2], + [$3])]) + + +## ----------------------------------------------------------- ## +## After processing the skeletons, check that all the user's ## +## %define variables and %code qualifiers were used by Bison. ## +## ----------------------------------------------------------- ## + +m4_define([b4_check_user_names_wrap], +[m4_ifdef([b4_percent_]$1[_user_]$2[s], + [b4_check_user_names([[%]$1 $2], + [b4_percent_]$1[_user_]$2[s], + [[b4_percent_]$1[_bison_]$2[s]])])]) + +m4_wrap_lifo([ +b4_check_user_names_wrap([[define]], [[variable]]) +b4_check_user_names_wrap([[code]], [[qualifier]]) +]) diff --git a/data/c++-skel.m4 b/data/c++-skel.m4 new file mode 100644 index 0000000..b8089ff --- /dev/null +++ b/data/c++-skel.m4 @@ -0,0 +1,25 @@ + -*- Autoconf -*- + +# C++ skeleton dispatching for Bison. +# Copyright (C) 2006, 2007 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 . + +b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])]) +b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])]) + +m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]]) +m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) + +m4_include(b4_used_skeleton) diff --git a/data/c++.m4 b/data/c++.m4 new file mode 100644 index 0000000..593390d --- /dev/null +++ b/data/c++.m4 @@ -0,0 +1,170 @@ + -*- Autoconf -*- + +# C++ skeleton for Bison + +# Copyright (C) 2002, 2003, 2004, 2005, 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 . + +m4_include(b4_pkgdatadir/[c.m4]) + +## ---------------- ## +## Default values. ## +## ---------------- ## + +# Default parser class name. +b4_percent_define_default([[parser_class_name]], [[parser]]) +b4_percent_define_default([[location_type]], [[location]]) +b4_percent_define_default([[filename_type]], [[std::string]]) +b4_percent_define_default([[namespace]], m4_defn([b4_prefix])) +b4_percent_define_default([[global_tokens_and_yystype]], [[false]]) +b4_percent_define_default([[define_location_comparison]], + [m4_if(b4_percent_define_get([[filename_type]]), + [std::string], [[true]], [[false]])]) + + +## ----------- ## +## Namespace. ## +## ----------- ## + +m4_define([b4_namespace_ref], [b4_percent_define_get([[namespace]])]) + +# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it +# would compile as an absolute reference with `parser' in the global namespace. +# b4_namespace_open would open an anonymous namespace and thus establish +# internal linkage. This would compile. However, it's cryptic, and internal +# linkage for the parser would be specified in all translation units that +# include the header, which is always generated. If we ever need to permit +# internal linkage somehow, surely we can find a cleaner approach. +m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [], +[b4_complain_at(b4_percent_define_get_loc([[namespace]]), + [[namespace reference is empty]])]) + +# Instead of assuming the C++ compiler will do it, Bison should reject any +# invalid b4_namepsace_ref that would be converted to a valid +# b4_namespace_open. The problem is that Bison doesn't always output +# b4_namespace_ref to uncommented code but should reserve the ability to do so +# in future releases without risking breaking any existing user grammars. +# Specifically, don't allow empty names as b4_namespace_open would just convert +# those into anonymous namespaces, and that might tempt some users. +m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [], +[b4_complain_at(b4_percent_define_get_loc([[namespace]]), + [[namespace reference has consecutive "::"]])]) +m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [], +[b4_complain_at(b4_percent_define_get_loc([[namespace]]), + [[namespace reference has a trailing "::"]])]) + +m4_define([b4_namespace_open], +[b4_user_code([b4_percent_define_get_syncline([[namespace]]) +[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref), + [^\(.\)[ ]*::], [\1])), + [::], [ { namespace ])[ {]])]) + +m4_define([b4_namespace_close], +[b4_user_code([b4_percent_define_get_syncline([[namespace]]) +m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref), + [^\(.\)[ ]*\(::\)?\([^][:]\|:[^][:]\)*], + [\1])), + [::\([^][:]\|:[^][:]\)*], [} ])[} // ]b4_namespace_ref])]) + + +# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ----------------------------------------------------- +# Output the definition of the tokens as enums. +m4_define([b4_token_enums], +[/* Tokens. */ + enum yytokentype { +m4_map_sep([ b4_token_enum], [, +], + [$@]) + }; +]) + + +## ----------------- ## +## Semantic Values. ## +## ----------------- ## + + +# b4_lhs_value([TYPE]) +# -------------------- +# Expansion of $$. +m4_define([b4_lhs_value], +[(yyval[]m4_ifval([$1], [.$1]))]) + + +# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) +# -------------------------------------- +# Expansion of $NUM, where the current rule has RULE-LENGTH +# symbols on RHS. +m4_define([b4_rhs_value], +[(yysemantic_stack_@{($1) - ($2)@}m4_ifval([$3], [.$3]))]) + +# b4_lhs_location() +# ----------------- +# Expansion of @$. +m4_define([b4_lhs_location], +[(yyloc)]) + + +# b4_rhs_location(RULE-LENGTH, NUM) +# --------------------------------- +# Expansion of @NUM, where the current rule has RULE-LENGTH symbols +# on RHS. +m4_define([b4_rhs_location], +[(yylocation_stack_@{($1) - ($2)@})]) + + +# b4_parse_param_decl +# ------------------- +# Extra formal arguments of the constructor. +# Change the parameter names from "foo" into "foo_yyarg", so that +# there is no collision bw the user chosen attribute name, and the +# argument name in the constructor. +m4_define([b4_parse_param_decl], +[m4_ifset([b4_parse_param], + [m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])]) + +m4_define([b4_parse_param_decl_1], +[$1_yyarg]) + + + +# b4_parse_param_cons +# ------------------- +# Extra initialisations of the constructor. +m4_define([b4_parse_param_cons], + [m4_ifset([b4_parse_param], + [ + b4_cc_constructor_calls(b4_parse_param)])]) +m4_define([b4_cc_constructor_calls], + [m4_map_sep([b4_cc_constructor_call], [, + ], [$@])]) +m4_define([b4_cc_constructor_call], + [$2 ($2_yyarg)]) + +# b4_parse_param_vars +# ------------------- +# Extra instance variables. +m4_define([b4_parse_param_vars], + [m4_ifset([b4_parse_param], + [ + /* User arguments. */ +b4_cc_var_decls(b4_parse_param)])]) +m4_define([b4_cc_var_decls], + [m4_map_sep([b4_cc_var_decl], [ +], [$@])]) +m4_define([b4_cc_var_decl], + [ $1;]) diff --git a/data/c-skel.m4 b/data/c-skel.m4 new file mode 100644 index 0000000..91f3c20 --- /dev/null +++ b/data/c-skel.m4 @@ -0,0 +1,25 @@ + -*- Autoconf -*- + +# C skeleton dispatching for Bison. +# Copyright (C) 2006, 2007 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 . + +b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])]) +b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])]) + +m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[yacc.c]]) +m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) + +m4_include(b4_used_skeleton) diff --git a/data/c.m4 b/data/c.m4 new file mode 100644 index 0000000..1fe4bc5 --- /dev/null +++ b/data/c.m4 @@ -0,0 +1,477 @@ + -*- Autoconf -*- + +# C M4 Macros for Bison. +# Copyright (C) 2002, 2004, 2005, 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 . + +## ---------------- ## +## Identification. ## +## ---------------- ## + +# b4_comment(TEXT) +# ---------------- +m4_define([b4_comment], [/* m4_bpatsubst([$1], [ +], [ + ]) */]) + +# b4_identification +# ----------------- +# 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 +# api.push_pull. +m4_define([b4_identification], +[[/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "]b4_version[" + +/* Skeleton name. */ +#define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[ + +/* Pure parsers. */ +#define YYPURE ]b4_pure_flag])[]m4_ifdef([b4_push_flag], [[ + +/* Push parsers. */ +#define YYPUSH ]b4_push_flag])[]m4_ifdef([b4_pull_flag], [[ + +/* Pull parsers. */ +#define YYPULL ]b4_pull_flag])[ + +/* Using locations. */ +#define YYLSP_NEEDED ]b4_locations_flag[ +]]) + + +## ---------------- ## +## Default values. ## +## ---------------- ## + +# If the %union is not named, its name is YYSTYPE. +m4_define_default([b4_union_name], [YYSTYPE]) + +# If the %name-prefix is not given, it is yy. +m4_define_default([b4_prefix], [yy]) + +## ------------------------ ## +## Pure/impure interfaces. ## +## ------------------------ ## + +# b4_user_args +# ------------ +m4_define([b4_user_args], +[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])]) + + +# b4_parse_param +# -------------- +# If defined, b4_parse_param arrives double quoted, but below we prefer +# it to be single quoted. +m4_define([b4_parse_param], +b4_parse_param) + + +# b4_parse_param_for(DECL, FORMAL, BODY) +# --------------------------------------- +# Iterate over the user parameters, binding the declaration to DECL, +# the formal name to FORMAL, and evaluating the BODY. +m4_define([b4_parse_param_for], +[m4_foreach([$1_$2], m4_defn([b4_parse_param]), +[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl +m4_pushdef([$2], m4_shift($1_$2))dnl +$3[]dnl +m4_popdef([$2])dnl +m4_popdef([$1])dnl +])]) + +# b4_parse_param_use +# ------------------ +# `YYUSE' all the parse-params. +m4_define([b4_parse_param_use], +[b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal); +])dnl +]) + + +## ------------ ## +## Data Types. ## +## ------------ ## + +# b4_int_type(MIN, MAX) +# --------------------- +# Return the smallest int type able to handle numbers ranging from +# MIN to MAX (included). +m4_define([b4_int_type], +[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char], + b4_ints_in($@, [-128], [127]), [1], [signed char], + + b4_ints_in($@, [0], [65535]), [1], [unsigned short int], + b4_ints_in($@, [-32768], [32767]), [1], [short int], + + m4_eval([0 <= $1]), [1], [unsigned int], + + [int])]) + + +# b4_int_type_for(NAME) +# --------------------- +# Return the smallest int type able to handle numbers ranging from +# `NAME_min' to `NAME_max' (included). +m4_define([b4_int_type_for], +[b4_int_type($1_min, $1_max)]) + + + +## ---------## +## Values. ## +## ---------## + +# b4_null +--------- +# Return a null pointer constant. NULL infringes on the user name +# space in C, so use 0 rather than NULL. +m4_define([b4_null], [0]) + + + + +## ------------------------- ## +## Assigning token numbers. ## +## ------------------------- ## + +# b4_token_define(TOKEN-NAME, TOKEN-NUMBER) +# ----------------------------------------- +# Output the definition of this token as #define. +m4_define([b4_token_define], +[#define $1 $2 +]) + + +# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ------------------------------------------------------- +# Output the definition of the tokens (if there are) as #defines. +m4_define([b4_token_defines], +[m4_if([$#$1], [1], [], +[/* Tokens. */ +m4_map([b4_token_define], [$@])]) +]) + + +# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER) +# --------------------------------------- +# Output the definition of this token as an enum. +m4_define([b4_token_enum], +[$1 = $2]) + + +# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ----------------------------------------------------- +# Output the definition of the tokens (if there are) as enums. +m4_define([b4_token_enums], +[m4_if([$#$1], [1], [], +[/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { +m4_map_sep([ b4_token_enum], [, +], + [$@]) + }; +#endif +])]) + + +# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ------------------------------------------------------------- +# Output the definition of the tokens (if there are any) as enums and, if POSIX +# Yacc is enabled, as #defines. +m4_define([b4_token_enums_defines], +[b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], []) +]) + + + +## --------------------------------------------- ## +## Defining C functions in both K&R and ANSI-C. ## +## --------------------------------------------- ## + + +# b4_modern_c +# ----------- +# A predicate useful in #if to determine whether C is ancient or modern. +# +# If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run +# as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic +# reasons, but it defines __C99__FUNC__ so check that as well. +# Microsoft C normally doesn't define these macros, but it defines _MSC_VER. +# Consider a C++ compiler to be modern if it defines __cplusplus. +# +m4_define([b4_c_modern], + [[(defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER)]]) + +# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...) +# ---------------------------------------------------------- +# Declare the function NAME. +m4_define([b4_c_function_def], +[#if b4_c_modern +b4_c_ansi_function_def($@) +#else +$2 +$1 (b4_c_knr_formal_names(m4_shift2($@))) +b4_c_knr_formal_decls(m4_shift2($@)) +#endif[]dnl +]) + + +# b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...) +# --------------------------------------------------------------- +# Declare the function NAME in ANSI. +m4_define([b4_c_ansi_function_def], +[$2 +$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl +]) + + +# b4_c_ansi_formals([DECL1, NAME1], ...) +# -------------------------------------- +# Output the arguments ANSI-C definition. +m4_define([b4_c_ansi_formals], +[m4_if([$#], [0], [void], + [$#$1], [1], [void], + [m4_map_sep([b4_c_ansi_formal], [, ], [$@])])]) + +m4_define([b4_c_ansi_formal], +[$1]) + + +# b4_c_knr_formal_names([DECL1, NAME1], ...) +# ------------------------------------------ +# Output the argument names. +m4_define([b4_c_knr_formal_names], +[m4_map_sep([b4_c_knr_formal_name], [, ], [$@])]) + +m4_define([b4_c_knr_formal_name], +[$2]) + + +# b4_c_knr_formal_decls([DECL1, NAME1], ...) +# ------------------------------------------ +# Output the K&R argument declarations. +m4_define([b4_c_knr_formal_decls], +[m4_map_sep([b4_c_knr_formal_decl], + [ +], + [$@])]) + +m4_define([b4_c_knr_formal_decl], +[ $1;]) + + + +## ------------------------------------------------------------ ## +## Declaring (prototyping) C functions in both K&R and ANSI-C. ## +## ------------------------------------------------------------ ## + + +# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...) +# ----------------------------------------------------------- +# Declare the function NAME. +m4_define([b4_c_function_decl], +[#if defined __STDC__ || defined __cplusplus +b4_c_ansi_function_decl($@) +#else +$2 $1 (); +#endif[]dnl +]) + + +# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...) +# ---------------------------------------------------------------- +# Declare the function NAME. +m4_define([b4_c_ansi_function_decl], +[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl +]) + + + + +## --------------------- ## +## Calling C functions. ## +## --------------------- ## + + +# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...) +# ----------------------------------------------------------- +# Call the function NAME with arguments NAME1, NAME2 etc. +m4_define([b4_c_function_call], +[$1 (b4_c_args(m4_shift2($@)))[]dnl +]) + + +# b4_c_args([DECL1, NAME1], ...) +# ------------------------------ +# Output the arguments NAME1, NAME2... +m4_define([b4_c_args], +[m4_map_sep([b4_c_arg], [, ], [$@])]) + +m4_define([b4_c_arg], +[$2]) + + +## ----------- ## +## Synclines. ## +## ----------- ## + +# b4_sync_start(LINE, FILE) +# ----------------------- +m4_define([b4_sync_start], [[#]line $1 $2]) + + +## -------------- ## +## User actions. ## +## -------------- ## + +# b4_case(LABEL, STATEMENTS) +# -------------------------- +m4_define([b4_case], +[ case $1: +$2 + break;]) + +# b4_symbol_actions(FILENAME, LINENO, +# SYMBOL-TAG, SYMBOL-NUM, +# SYMBOL-ACTION, SYMBOL-TYPENAME) +# ------------------------------------------------- +m4_define([b4_symbol_actions], +[m4_pushdef([b4_dollar_dollar], + [m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl +m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl + case $4: /* $3 */ +b4_syncline([$2], [$1]) + $5; +b4_syncline([@oline@], [@ofile@]) + break; +m4_popdef([b4_at_dollar])dnl +m4_popdef([b4_dollar_dollar])dnl +]) + + +# b4_yydestruct_generate(FUNCTION-DECLARATOR) +# ------------------------------------------- +# Generate the "yydestruct" function, which declaration is issued using +# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C +# or "b4_c_function_def" for K&R. +m4_define_default([b4_yydestruct_generate], +[[/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +]$1([yydestruct], + [static void], + [[const char *yymsg], [yymsg]], + [[int yytype], [yytype]], + [[YYSTYPE *yyvaluep], [yyvaluep]][]dnl +b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl +m4_ifset([b4_parse_param], [, b4_parse_param]))[ +{ + YYUSE (yyvaluep); +]b4_locations_if([ YYUSE (yylocationp); +])dnl +b4_parse_param_use[]dnl +[ + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { +]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[ + default: + break; + } +}]dnl +]) + + +# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR) +# ------------------------------------------------ +# Generate the "yy_symbol_print" function, which declaration is issued using +# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C +# or "b4_c_function_def" for K&R. +m4_define_default([b4_yy_symbol_print_generate], +[[ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +]$1([yy_symbol_value_print], + [static void], + [[FILE *yyoutput], [yyoutput]], + [[int yytype], [yytype]], + [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl +b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl +m4_ifset([b4_parse_param], [, b4_parse_param]))[ +{ + if (!yyvaluep) + return; +]b4_locations_if([ YYUSE (yylocationp); +])dnl +b4_parse_param_use[]dnl +[# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { +]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl +[ default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +]$1([yy_symbol_print], + [static void], + [[FILE *yyoutput], [yyoutput]], + [[int yytype], [yytype]], + [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl +b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl +m4_ifset([b4_parse_param], [, b4_parse_param]))[ +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + +]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); +])dnl +[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl +b4_locations_if([, yylocationp])[]b4_user_args[); + YYFPRINTF (yyoutput, ")"); +}]dnl +]) diff --git a/data/glr.c b/data/glr.c new file mode 100644 index 0000000..84637e0 --- /dev/null +++ b/data/glr.c @@ -0,0 +1,2653 @@ + -*- C -*- + +# GLR skeleton for Bison +# Copyright (C) 2002, 2003, 2004, 2005, 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 . + + +m4_include(b4_pkgdatadir/[c.m4]) + +## ---------------- ## +## Default values. ## +## ---------------- ## + +# Stack parameters. +m4_define_default([b4_stack_depth_max], [10000]) +m4_define_default([b4_stack_depth_init], [200]) + + + +## ------------------------ ## +## Pure/impure interfaces. ## +## ------------------------ ## + +b4_define_flag_if([pure]) +# If glr.cc is including this file and thus has already set b4_pure_flag, don't +# change the value of b4_pure_flag, and don't record a use of api.pure. +m4_ifndef([b4_pure_flag], +[b4_percent_define_default([[api.pure]], [[false]]) + m4_define([b4_pure_flag], + [b4_percent_define_flag_if([[api.pure]], [[1]], [[0]])])]) + +# b4_user_formals +# --------------- +# The possible parse-params formal arguments preceded by a comma. +# +# This is not shared with yacc.c in c.m4 because GLR relies on ISO C +# formal argument declarations. +m4_define([b4_user_formals], +[m4_ifset([b4_parse_param], [, b4_c_ansi_formals(b4_parse_param)])]) + + +# b4_lex_param +# ------------ +# Accumule in b4_lex_param all the yylex arguments. +# Yes, this is quite ugly... +m4_define([b4_lex_param], +m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl +b4_locations_if([, [[YYLTYPE *], [&yylloc]]])])dnl +m4_ifdef([b4_lex_param], [, ]b4_lex_param))) + + +# b4_yyerror_args +# --------------- +# Optional effective arguments passed to yyerror: user args plus yylloc, and +# a trailing comma. +m4_define([b4_yyerror_args], +[b4_pure_if([b4_locations_if([yylocp, ])])dnl +m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) + + +# b4_lyyerror_args +# ---------------- +# Same as above, but on the lookahead, hence &yylloc instead of yylocp. +m4_define([b4_lyyerror_args], +[b4_pure_if([b4_locations_if([&yylloc, ])])dnl +m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) + + +# b4_pure_args +# ------------ +# Same as b4_yyerror_args, but with a leading comma. +m4_define([b4_pure_args], +[b4_pure_if([b4_locations_if([, yylocp])])[]b4_user_args]) + + +# b4_lpure_args +# ------------- +# Same as above, but on the lookahead, hence &yylloc instead of yylocp. +m4_define([b4_lpure_args], +[b4_pure_if([b4_locations_if([, &yylloc])])[]b4_user_args]) + + +# b4_pure_formals +# --------------- +# Arguments passed to yyerror: user formals plus yylocp. +m4_define([b4_pure_formals], +[b4_pure_if([b4_locations_if([, YYLTYPE *yylocp])])[]b4_user_formals]) + + +## ----------------- ## +## Semantic Values. ## +## ----------------- ## + + +# b4_lhs_value([TYPE]) +# -------------------- +# Expansion of $$. +m4_define([b4_lhs_value], +[((*yyvalp)[]m4_ifval([$1], [.$1]))]) + + +# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) +# -------------------------------------- +# Expansion of $NUM, where the current rule has RULE-LENGTH +# symbols on RHS. +m4_define([b4_rhs_value], +[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))]) + + + +## ----------- ## +## Locations. ## +## ----------- ## + +# b4_lhs_location() +# ----------------- +# Expansion of @$. +m4_define([b4_lhs_location], +[(*yylocp)]) + + +# b4_rhs_location(RULE-LENGTH, NUM) +# --------------------------------- +# Expansion of @NUM, where the current rule has RULE-LENGTH symbols +# on RHS. +m4_define([b4_rhs_location], +[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yyloc)]) + + + +## -------------- ## +## Output files. ## +## -------------- ## + +# We do want M4 expansion after # for CPP macros. +m4_changecom() +m4_divert_push(0)dnl +@output(b4_parser_file_name@) +b4_copyright([Skeleton implementation for Bison GLR parsers in C], + [2002, 2003, 2004, 2005, 2006]) +[ +/* C GLR parser skeleton written by Paul Hilfinger. */ + +]b4_identification + +b4_percent_code_get([[top]])[]dnl +m4_if(b4_prefix, [yy], [], +[/* Substitute the variable and function names. */ +#define yyparse b4_prefix[]parse +#define yylex b4_prefix[]lex +#define yyerror b4_prefix[]error +#define yylval b4_prefix[]lval +#define yychar b4_prefix[]char +#define yydebug b4_prefix[]debug +#define yynerrs b4_prefix[]nerrs +#define yylloc b4_prefix[]lloc])[ + +/* Copy the first part of user declarations. */ +]b4_user_pre_prologue + +dnl # b4_shared_declarations +dnl # ---------------------- +dnl # Declaration that might either go into the header (if --defines) +dnl # or open coded in the parser body. +m4_define([b4_shared_declarations], +[b4_percent_code_get([[requires]])[]dnl + +b4_token_enums(b4_tokens) + +[#ifndef YYSTYPE +]m4_ifdef([b4_stype], +[[typedef union ]b4_union_name[ +{ +]b4_user_stype[ +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1]], +[m4_if(b4_tag_seen_flag, 0, +[[typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1]])])[ +#endif + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ +]b4_locations_if([ + int first_line; + int first_column; + int last_line; + int last_column; +],[ + char yydummy; +])[ +} YYLTYPE; +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + +]b4_percent_code_get([[provides]])[]dnl +]) + +b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]], + [b4_shared_declarations])[ + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG ]b4_debug_flag[ +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE ]b4_error_verbose_flag[ +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE ]b4_token_table[ +#endif + +/* Default (constant) value used for initialization for null + right-hand sides. Unlike the standard yacc.c template, + here we set the default value of $$ to a zeroed-out value. + Since the default value is undefined, this behavior is + technically correct. */ +static YYSTYPE yyval_default; + +/* Copy the second part of user declarations. */ +]b4_user_post_prologue +b4_percent_code_get[]dnl + +[#include +#include +#include + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +]b4_c_function_def([YYID], [static int], [[int i], [i]])[ +{ + return i; +} +#endif + +#ifndef YYFREE +# define YYFREE free +#endif +#ifndef YYMALLOC +# define YYMALLOC malloc +#endif +#ifndef YYREALLOC +# define YYREALLOC realloc +#endif + +#define YYSIZEMAX ((size_t) -1) + +#ifdef __cplusplus + typedef bool yybool; +#else + typedef unsigned char yybool; +#endif +#define yytrue 1 +#define yyfalse 0 + +#ifndef YYSETJMP +# include +# define YYJMP_BUF jmp_buf +# define YYSETJMP(env) setjmp (env) +# define YYLONGJMP(env, val) longjmp (env, val) +#endif + +/*-----------------. +| GCC extensions. | +`-----------------*/ + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__) +# define __attribute__(Spec) /* empty */ +# endif +#endif + +]b4_locations_if([#define YYOPTIONAL_LOC(Name) Name],[ +#ifdef __cplusplus +# define YYOPTIONAL_LOC(Name) /* empty */ +#else +# define YYOPTIONAL_LOC(Name) Name __attribute__ ((__unused__)) +#endif])[ + +#ifndef YYASSERT +# define YYASSERT(condition) ((void) ((condition) || (abort (), 0))) +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL ]b4_final_state_number[ +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST ]b4_last[ + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS ]b4_tokens_number[ +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS ]b4_nterms_number[ +/* YYNRULES -- Number of rules. */ +#define YYNRULES ]b4_rules_number[ +/* YYNRULES -- Number of states. */ +#define YYNSTATES ]b4_states_number[ +/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */ +#define YYMAXRHS ]b4_r2_max[ +/* YYMAXLEFT -- Maximum number of symbols to the left of a handle + accessed by $0, $-1, etc., in any rule. */ +#define YYMAXLEFT ]b4_max_left_semantic_context[ + +/* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */ +#define YYUNDEFTOK ]b4_undef_token_number[ +#define YYMAXUTOK ]b4_user_token_number_max[ + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const ]b4_int_type_for([b4_translate])[ yytranslate[] = +{ + ]b4_translate[ +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const ]b4_int_type_for([b4_prhs])[ yyprhs[] = +{ + ]b4_prhs[ +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const ]b4_int_type_for([b4_rhs])[ yyrhs[] = +{ + ]b4_rhs[ +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const ]b4_int_type_for([b4_rline])[ yyrline[] = +{ + ]b4_rline[ +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + ]b4_tname[ +}; +#endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const ]b4_int_type_for([b4_r1])[ yyr1[] = +{ + ]b4_r1[ +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const ]b4_int_type_for([b4_r2])[ yyr2[] = +{ + ]b4_r2[ +}; + +/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */ +static const ]b4_int_type_for([b4_dprec])[ yydprec[] = +{ + ]b4_dprec[ +}; + +/* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */ +static const ]b4_int_type_for([b4_merger])[ yymerger[] = +{ + ]b4_merger[ +}; + +/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ +static const ]b4_int_type_for([b4_defact])[ yydefact[] = +{ + ]b4_defact[ +}; + +/* YYPDEFGOTO[NTERM-NUM]. */ +static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] = +{ + ]b4_defgoto[ +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF ]b4_pact_ninf[ +static const ]b4_int_type_for([b4_pact])[ yypact[] = +{ + ]b4_pact[ +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] = +{ + ]b4_pgoto[ +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF ]b4_table_ninf[ +static const ]b4_int_type_for([b4_table])[ yytable[] = +{ + ]b4_table[ +}; + +/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of + list of conflicting reductions corresponding to action entry for + state STATE-NUM in yytable. 0 means no conflicts. The list in + yyconfl is terminated by a rule number of 0. */ +static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] = +{ + ]b4_conflict_list_heads[ +}; + +/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by + 0, pointed into by YYCONFLP. */ +]dnl Do not use b4_int_type_for here, since there are places where +dnl pointers onto yyconfl are taken, which type is "short int *". +dnl We probably ought to introduce a type for confl. +[static const short int yyconfl[] = +{ + ]b4_conflicting_rules[ +}; + +static const ]b4_int_type_for([b4_check])[ yycheck[] = +{ + ]b4_check[ +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const ]b4_int_type_for([b4_stos])[ yystos[] = +{ + ]b4_stos[ +}; + + +/* Prevent warning if -Wmissing-prototypes. */ +]b4_c_ansi_function_decl([yyparse], [int], b4_parse_param)[ + +/* Error token number */ +#define YYTERROR 1 + +/* 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). */ + +]b4_locations_if([[ +#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +#endif +]],[ +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0) +#endif +])[ + +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ +#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ + +]b4_pure_if( +[ +#undef yynerrs +#define yynerrs (yystackp->yyerrcnt) +#undef yychar +#define yychar (yystackp->yyrawchar) +#undef yylval +#define yylval (yystackp->yyval) +#undef yylloc +#define yylloc (yystackp->yyloc) +m4_if(b4_prefix[], [yy], [], +[#define b4_prefix[]nerrs yynerrs +#define b4_prefix[]char yychar +#define b4_prefix[]lval yylval +#define b4_prefix[]lloc yylloc])], +[YYSTYPE yylval; + +YYLTYPE yylloc; + +int yynerrs; +int yychar;])[ + +static const int YYEOF = 0; +static const int YYEMPTY = -2; + +typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG; + +#define YYCHK(YYE) \ + do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \ + while (YYID (0)) + +#if YYDEBUG + +# ifndef YYFPRINTF +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +]b4_yy_symbol_print_generate([b4_c_ansi_function_def])[ + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, Type, \ + Value]b4_locations_if([, Location])[]b4_user_args[); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; + +#else /* !YYDEBUG */ + +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) + +#endif /* !YYDEBUG */ + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH ]b4_stack_depth_init[ +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH ]b4_stack_depth_max[ +#endif + +/* Minimum number of free items on the stack allowed after an + allocation. This is to allow allocation and initialization + to be completed by functions that call yyexpandGLRStack before the + stack is expanded, thus insuring that all necessary pointers get + properly redirected to new data. */ +#define YYHEADROOM 2 + +#ifndef YYSTACKEXPANDABLE +# if (! defined __cplusplus \ + || (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)) +# define YYSTACKEXPANDABLE 1 +# else +# define YYSTACKEXPANDABLE 0 +# endif +#endif + +#if YYSTACKEXPANDABLE +# define YY_RESERVE_GLRSTACK(Yystack) \ + do { \ + if (Yystack->yyspaceLeft < YYHEADROOM) \ + yyexpandGLRStack (Yystack); \ + } while (YYID (0)) +#else +# define YY_RESERVE_GLRSTACK(Yystack) \ + do { \ + if (Yystack->yyspaceLeft < YYHEADROOM) \ + yyMemoryExhausted (Yystack); \ + } while (YYID (0)) +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static size_t +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return strlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* !YYERROR_VERBOSE */ + +/** State numbers, as in LALR(1) machine */ +typedef int yyStateNum; + +/** Rule numbers, as in LALR(1) machine */ +typedef int yyRuleNum; + +/** Grammar symbol */ +typedef short int yySymbol; + +/** Item references, as in LALR(1) machine */ +typedef short int yyItemNum; + +typedef struct yyGLRState yyGLRState; +typedef struct yyGLRStateSet yyGLRStateSet; +typedef struct yySemanticOption yySemanticOption; +typedef union yyGLRStackItem yyGLRStackItem; +typedef struct yyGLRStack yyGLRStack; + +struct yyGLRState { + /** Type tag: always true. */ + yybool yyisState; + /** Type tag for yysemantics. If true, yysval applies, otherwise + * yyfirstVal applies. */ + yybool yyresolved; + /** Number of corresponding LALR(1) machine state. */ + yyStateNum yylrState; + /** Preceding state in this stack */ + yyGLRState* yypred; + /** Source position of the first token produced by my symbol */ + size_t yyposn; + union { + /** First in a chain of alternative reductions producing the + * non-terminal corresponding to this state, threaded through + * yynext. */ + yySemanticOption* yyfirstVal; + /** Semantic value for this state. */ + YYSTYPE yysval; + } yysemantics; + /** Source location for this state. */ + YYLTYPE yyloc; +}; + +struct yyGLRStateSet { + yyGLRState** yystates; + /** During nondeterministic operation, yylookaheadNeeds tracks which + * stacks have actually needed the current lookahead. During deterministic + * operation, yylookaheadNeeds[0] is not maintained since it would merely + * duplicate yychar != YYEMPTY. */ + yybool* yylookaheadNeeds; + size_t yysize, yycapacity; +}; + +struct yySemanticOption { + /** Type tag: always false. */ + yybool yyisState; + /** Rule number for this reduction */ + yyRuleNum yyrule; + /** The last RHS state in the list of states to be reduced. */ + yyGLRState* yystate; + /** The lookahead for this reduction. */ + int yyrawchar; + YYSTYPE yyval; + YYLTYPE yyloc; + /** Next sibling in chain of options. To facilitate merging, + * options are chained in decreasing order by address. */ + yySemanticOption* yynext; +}; + +/** Type of the items in the GLR stack. The yyisState field + * indicates which item of the union is valid. */ +union yyGLRStackItem { + yyGLRState yystate; + yySemanticOption yyoption; +}; + +struct yyGLRStack { + int yyerrState; +]b4_locations_if([[ /* To compute the location of the error token. */ + yyGLRStackItem yyerror_range[3];]])[ +]b4_pure_if( +[ + int yyerrcnt; + int yyrawchar; + YYSTYPE yyval; + YYLTYPE yyloc; +])[ + YYJMP_BUF yyexception_buffer; + yyGLRStackItem* yyitems; + yyGLRStackItem* yynextFree; + size_t yyspaceLeft; + yyGLRState* yysplitPoint; + yyGLRState* yylastDeleted; + yyGLRStateSet yytops; +}; + +#if YYSTACKEXPANDABLE +static void yyexpandGLRStack (yyGLRStack* yystackp); +#endif + +static void yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg) + __attribute__ ((__noreturn__)); +static void +yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg) +{ + if (yymsg != NULL) + yyerror (]b4_yyerror_args[yymsg); + YYLONGJMP (yystackp->yyexception_buffer, 1); +} + +static void yyMemoryExhausted (yyGLRStack* yystackp) + __attribute__ ((__noreturn__)); +static void +yyMemoryExhausted (yyGLRStack* yystackp) +{ + YYLONGJMP (yystackp->yyexception_buffer, 2); +} + +#if YYDEBUG || YYERROR_VERBOSE +/** A printable representation of TOKEN. */ +static inline const char* +yytokenName (yySymbol yytoken) +{ + if (yytoken == YYEMPTY) + return ""; + + return yytname[yytoken]; +} +#endif + +/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting + * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred + * containing the pointer to the next state in the chain. */ +static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__)); +static void +yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) +{ + yyGLRState* s; + int i; + s = yyvsp[yylow0].yystate.yypred; + for (i = yylow0-1; i >= yylow1; i -= 1) + { + YYASSERT (s->yyresolved); + yyvsp[i].yystate.yyresolved = yytrue; + yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; + yyvsp[i].yystate.yyloc = s->yyloc; + s = yyvsp[i].yystate.yypred = s->yypred; + } +} + +/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in + * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. + * For convenience, always return YYLOW1. */ +static inline int yyfill (yyGLRStackItem *, int *, int, yybool) + __attribute__ ((__unused__)); +static inline int +yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) +{ + if (!yynormal && yylow1 < *yylow) + { + yyfillin (yyvsp, *yylow, yylow1); + *yylow = yylow1; + } + return yylow1; +} + +/** Perform user action for rule number YYN, with RHS length YYRHSLEN, + * and top stack item YYVSP. YYLVALP points to place to put semantic + * value ($$), and yylocp points to place for location information + * (@@$). Returns yyok for normal return, yyaccept for YYACCEPT, + * yyerr for YYERROR, yyabort for YYABORT. */ +/*ARGSUSED*/ static YYRESULTTAG +yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, + YYSTYPE* yyvalp, + YYLTYPE* YYOPTIONAL_LOC (yylocp), + yyGLRStack* yystackp + ]b4_user_formals[) +{ + yybool yynormal __attribute__ ((__unused__)) = + (yystackp->yysplitPoint == NULL); + int yylow; +]b4_parse_param_use[]dnl +[# undef yyerrok +# define yyerrok (yystackp->yyerrState = 0) +# undef YYACCEPT +# define YYACCEPT return yyaccept +# undef YYABORT +# define YYABORT return yyabort +# undef YYERROR +# define YYERROR return yyerrok, yyerr +# undef YYRECOVERING +# define YYRECOVERING() (yystackp->yyerrState != 0) +# undef yyclearin +# define yyclearin (yychar = YYEMPTY) +# undef YYFILL +# define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal) +# undef YYBACKUP +# define YYBACKUP(Token, Value) \ + return yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")), \ + yyerrok, yyerr + + yylow = 1; + if (yyrhslen == 0) + *yyvalp = yyval_default; + else + *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval; + YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen); +]b4_locations_if([[ yystackp->yyerror_range[1].yystate.yyloc = *yylocp; +]])[ + switch (yyn) + { + ]b4_user_actions[ + default: break; + } + + return yyok; +# undef yyerrok +# undef YYABORT +# undef YYACCEPT +# undef YYERROR +# undef YYBACKUP +# undef yyclearin +# undef YYRECOVERING +} + + +/*ARGSUSED*/ static void +yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) +{ + YYUSE (yy0); + YYUSE (yy1); + + switch (yyn) + { + ]b4_mergers[ + default: break; + } +} + + /* Bison grammar-table manipulation. */ + +]b4_yydestruct_generate([b4_c_ansi_function_def])[ + +/** Number of symbols composing the right hand side of rule #RULE. */ +static inline int +yyrhsLength (yyRuleNum yyrule) +{ + return yyr2[yyrule]; +} + +static void +yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[) +{ + if (yys->yyresolved) + yydestruct (yymsg, yystos[yys->yylrState], + &yys->yysemantics.yysval]b4_locations_if([, &yys->yyloc])[]b4_user_args[); + else + { +#if YYDEBUG + if (yydebug) + { + if (yys->yysemantics.yyfirstVal) + YYFPRINTF (stderr, "%s unresolved ", yymsg); + else + YYFPRINTF (stderr, "%s incomplete ", yymsg); + yy_symbol_print (stderr, yystos[yys->yylrState], + NULL]b4_locations_if([, &yys->yyloc])[]b4_user_args[); + YYFPRINTF (stderr, "\n"); + } +#endif + + if (yys->yysemantics.yyfirstVal) + { + yySemanticOption *yyoption = yys->yysemantics.yyfirstVal; + yyGLRState *yyrh; + int yyn; + for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule); + yyn > 0; + yyrh = yyrh->yypred, yyn -= 1) + yydestroyGLRState (yymsg, yyrh]b4_user_args[); + } + } +} + +/** Left-hand-side symbol for rule #RULE. */ +static inline yySymbol +yylhsNonterm (yyRuleNum yyrule) +{ + return yyr1[yyrule]; +} + +#define yyis_pact_ninf(yystate) \ + ]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 + * of token). */ +static inline yybool +yyisDefaultedState (yyStateNum yystate) +{ + return yyis_pact_ninf (yypact[yystate]); +} + +/** The default reduction for STATE, assuming it has one. */ +static inline yyRuleNum +yydefaultAction (yyStateNum yystate) +{ + return yydefact[yystate]; +} + +#define yyis_table_ninf(yytable_value) \ + ]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. + * Result R means + * R < 0: Reduce on rule -R. + * R = 0: Error. + * R > 0: Shift to state R. + * Set *CONFLICTS to a pointer into yyconfl to 0-terminated list of + * conflicting reductions. + */ +static inline void +yygetLRActions (yyStateNum yystate, int yytoken, + int* yyaction, const short int** yyconflicts) +{ + int yyindex = yypact[yystate] + yytoken; + if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) + { + *yyaction = -yydefact[yystate]; + *yyconflicts = yyconfl; + } + else if (! yyis_table_ninf (yytable[yyindex])) + { + *yyaction = yytable[yyindex]; + *yyconflicts = yyconfl + yyconflp[yyindex]; + } + else + { + *yyaction = 0; + *yyconflicts = yyconfl + yyconflp[yyindex]; + } +} + +static inline yyStateNum +yyLRgotoState (yyStateNum yystate, yySymbol yylhs) +{ + int yyr; + yyr = yypgoto[yylhs - YYNTOKENS] + yystate; + if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) + return yytable[yyr]; + else + return yydefgoto[yylhs - YYNTOKENS]; +} + +static inline yybool +yyisShiftAction (int yyaction) +{ + return 0 < yyaction; +} + +static inline yybool +yyisErrorAction (int yyaction) +{ + return yyaction == 0; +} + + /* GLRStates */ + +/** Return a fresh GLRStackItem. Callers should call + * YY_RESERVE_GLRSTACK afterwards to make sure there is sufficient + * headroom. */ + +static inline yyGLRStackItem* +yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState) +{ + yyGLRStackItem* yynewItem = yystackp->yynextFree; + yystackp->yyspaceLeft -= 1; + yystackp->yynextFree += 1; + yynewItem->yystate.yyisState = yyisState; + return yynewItem; +} + +/** Add a new semantic action that will execute the action for rule + * RULENUM on the semantic values in RHS to the list of + * alternative actions for STATE. Assumes that RHS comes from + * stack #K of *STACKP. */ +static void +yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, + yyGLRState* rhs, yyRuleNum yyrule) +{ + yySemanticOption* yynewOption = + &yynewGLRStackItem (yystackp, yyfalse)->yyoption; + yynewOption->yystate = rhs; + yynewOption->yyrule = yyrule; + if (yystackp->yytops.yylookaheadNeeds[yyk]) + { + yynewOption->yyrawchar = yychar; + yynewOption->yyval = yylval; + yynewOption->yyloc = yylloc; + } + else + yynewOption->yyrawchar = YYEMPTY; + yynewOption->yynext = yystate->yysemantics.yyfirstVal; + yystate->yysemantics.yyfirstVal = yynewOption; + + YY_RESERVE_GLRSTACK (yystackp); +} + + /* GLRStacks */ + +/** Initialize SET to a singleton set containing an empty stack. */ +static yybool +yyinitStateSet (yyGLRStateSet* yyset) +{ + yyset->yysize = 1; + yyset->yycapacity = 16; + yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]); + if (! yyset->yystates) + return yyfalse; + yyset->yystates[0] = NULL; + yyset->yylookaheadNeeds = + (yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]); + if (! yyset->yylookaheadNeeds) + { + YYFREE (yyset->yystates); + return yyfalse; + } + return yytrue; +} + +static void yyfreeStateSet (yyGLRStateSet* yyset) +{ + YYFREE (yyset->yystates); + YYFREE (yyset->yylookaheadNeeds); +} + +/** Initialize STACK to a single empty stack, with total maximum + * capacity for all stacks of SIZE. */ +static yybool +yyinitGLRStack (yyGLRStack* yystackp, size_t yysize) +{ + yystackp->yyerrState = 0; + yynerrs = 0; + yystackp->yyspaceLeft = yysize; + yystackp->yyitems = + (yyGLRStackItem*) YYMALLOC (yysize * sizeof yystackp->yynextFree[0]); + if (!yystackp->yyitems) + return yyfalse; + yystackp->yynextFree = yystackp->yyitems; + yystackp->yysplitPoint = NULL; + yystackp->yylastDeleted = NULL; + return yyinitStateSet (&yystackp->yytops); +} + + +#if YYSTACKEXPANDABLE +# define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \ + &((YYTOITEMS) - ((YYFROMITEMS) - (yyGLRStackItem*) (YYX)))->YYTYPE + +/** If STACK is expandable, extend it. WARNING: Pointers into the + stack from outside should be considered invalid after this call. + We always expand when there are 1 or fewer items left AFTER an + allocation, so that we can avoid having external pointers exist + across an allocation. */ +static void +yyexpandGLRStack (yyGLRStack* yystackp) +{ + yyGLRStackItem* yynewItems; + yyGLRStackItem* yyp0, *yyp1; + size_t yysize, yynewSize; + size_t yyn; + yysize = yystackp->yynextFree - yystackp->yyitems; + if (YYMAXDEPTH - YYHEADROOM < yysize) + yyMemoryExhausted (yystackp); + yynewSize = 2*yysize; + if (YYMAXDEPTH < yynewSize) + yynewSize = YYMAXDEPTH; + yynewItems = (yyGLRStackItem*) YYMALLOC (yynewSize * sizeof yynewItems[0]); + if (! yynewItems) + yyMemoryExhausted (yystackp); + for (yyp0 = yystackp->yyitems, yyp1 = yynewItems, yyn = yysize; + 0 < yyn; + yyn -= 1, yyp0 += 1, yyp1 += 1) + { + *yyp1 = *yyp0; + if (*(yybool *) yyp0) + { + yyGLRState* yys0 = &yyp0->yystate; + yyGLRState* yys1 = &yyp1->yystate; + if (yys0->yypred != NULL) + yys1->yypred = + YYRELOC (yyp0, yyp1, yys0->yypred, yystate); + if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != NULL) + yys1->yysemantics.yyfirstVal = + YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); + } + else + { + yySemanticOption* yyv0 = &yyp0->yyoption; + yySemanticOption* yyv1 = &yyp1->yyoption; + if (yyv0->yystate != NULL) + yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate); + if (yyv0->yynext != NULL) + yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption); + } + } + if (yystackp->yysplitPoint != NULL) + yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems, + yystackp->yysplitPoint, yystate); + + for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1) + if (yystackp->yytops.yystates[yyn] != NULL) + yystackp->yytops.yystates[yyn] = + YYRELOC (yystackp->yyitems, yynewItems, + yystackp->yytops.yystates[yyn], yystate); + YYFREE (yystackp->yyitems); + yystackp->yyitems = yynewItems; + yystackp->yynextFree = yynewItems + yysize; + yystackp->yyspaceLeft = yynewSize - yysize; +} +#endif + +static void +yyfreeGLRStack (yyGLRStack* yystackp) +{ + YYFREE (yystackp->yyitems); + yyfreeStateSet (&yystackp->yytops); +} + +/** Assuming that S is a GLRState somewhere on STACK, update the + * splitpoint of STACK, if needed, so that it is at least as deep as + * S. */ +static inline void +yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys) +{ + if (yystackp->yysplitPoint != NULL && yystackp->yysplitPoint > yys) + yystackp->yysplitPoint = yys; +} + +/** Invalidate stack #K in STACK. */ +static inline void +yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk) +{ + if (yystackp->yytops.yystates[yyk] != NULL) + yystackp->yylastDeleted = yystackp->yytops.yystates[yyk]; + yystackp->yytops.yystates[yyk] = NULL; +} + +/** Undelete the last stack that was marked as deleted. Can only be + done once after a deletion, and only when all other stacks have + been deleted. */ +static void +yyundeleteLastStack (yyGLRStack* yystackp) +{ + if (yystackp->yylastDeleted == NULL || yystackp->yytops.yysize != 0) + return; + yystackp->yytops.yystates[0] = yystackp->yylastDeleted; + yystackp->yytops.yysize = 1; + YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n")); + yystackp->yylastDeleted = NULL; +} + +static inline void +yyremoveDeletes (yyGLRStack* yystackp) +{ + size_t yyi, yyj; + yyi = yyj = 0; + while (yyj < yystackp->yytops.yysize) + { + if (yystackp->yytops.yystates[yyi] == NULL) + { + if (yyi == yyj) + { + YYDPRINTF ((stderr, "Removing dead stacks.\n")); + } + yystackp->yytops.yysize -= 1; + } + else + { + yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi]; + /* In the current implementation, it's unnecessary to copy + yystackp->yytops.yylookaheadNeeds[yyi] since, after + yyremoveDeletes returns, the parser immediately either enters + deterministic operation or shifts a token. However, it doesn't + hurt, and the code might evolve to need it. */ + yystackp->yytops.yylookaheadNeeds[yyj] = + yystackp->yytops.yylookaheadNeeds[yyi]; + if (yyj != yyi) + { + YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n", + (unsigned long int) yyi, (unsigned long int) yyj)); + } + yyj += 1; + } + yyi += 1; + } +} + +/** Shift to a new state on stack #K of STACK, corresponding to LR state + * LRSTATE, at input position POSN, with (resolved) semantic value SVAL. */ +static inline void +yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, + size_t yyposn, + YYSTYPE* yyvalp, YYLTYPE* yylocp) +{ + yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; + + yynewState->yylrState = yylrState; + yynewState->yyposn = yyposn; + yynewState->yyresolved = yytrue; + yynewState->yypred = yystackp->yytops.yystates[yyk]; + yynewState->yysemantics.yysval = *yyvalp; + yynewState->yyloc = *yylocp; + yystackp->yytops.yystates[yyk] = yynewState; + + YY_RESERVE_GLRSTACK (yystackp); +} + +/** Shift stack #K of YYSTACK, to a new state corresponding to LR + * state YYLRSTATE, at input position YYPOSN, with the (unresolved) + * semantic value of YYRHS under the action for YYRULE. */ +static inline void +yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, + size_t yyposn, yyGLRState* rhs, yyRuleNum yyrule) +{ + yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; + + yynewState->yylrState = yylrState; + yynewState->yyposn = yyposn; + yynewState->yyresolved = yyfalse; + yynewState->yypred = yystackp->yytops.yystates[yyk]; + yynewState->yysemantics.yyfirstVal = NULL; + yystackp->yytops.yystates[yyk] = yynewState; + + /* Invokes YY_RESERVE_GLRSTACK. */ + yyaddDeferredAction (yystackp, yyk, yynewState, rhs, yyrule); +} + +/** Pop the symbols consumed by reduction #RULE from the top of stack + * #K of STACK, and perform the appropriate semantic action on their + * semantic values. Assumes that all ambiguities in semantic values + * have been previously resolved. Set *VALP to the resulting value, + * and *LOCP to the computed location (if any). Return value is as + * for userAction. */ +static inline YYRESULTTAG +yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, + YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) +{ + int yynrhs = yyrhsLength (yyrule); + + if (yystackp->yysplitPoint == NULL) + { + /* Standard special case: single stack. */ + yyGLRStackItem* rhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; + YYASSERT (yyk == 0); + yystackp->yynextFree -= yynrhs; + yystackp->yyspaceLeft += yynrhs; + yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate; + return yyuserAction (yyrule, yynrhs, rhs, + yyvalp, yylocp, yystackp]b4_user_args[); + } + else + { + /* At present, doAction is never called in nondeterministic + * mode, so this branch is never taken. It is here in + * anticipation of a future feature that will allow immediate + * evaluation of selected actions in nondeterministic mode. */ + int yyi; + yyGLRState* yys; + yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; + yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred + = yystackp->yytops.yystates[yyk];]b4_locations_if([[ + if (yynrhs == 0) + /* Set default location. */ + yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;]])[ + for (yyi = 0; yyi < yynrhs; yyi += 1) + { + yys = yys->yypred; + YYASSERT (yys); + } + yyupdateSplit (yystackp, yys); + yystackp->yytops.yystates[yyk] = yys; + return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, + yyvalp, yylocp, yystackp]b4_user_args[); + } +} + +#if !YYDEBUG +# define YY_REDUCE_PRINT(Args) +#else +# define YY_REDUCE_PRINT(Args) \ +do { \ + if (yydebug) \ + yy_reduce_print Args; \ +} while (YYID (0)) + +/*----------------------------------------------------------. +| Report that the RULE is going to be reduced on stack #K. | +`----------------------------------------------------------*/ + +/*ARGSUSED*/ static inline void +yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, + YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) +{ + int yynrhs = yyrhsLength (yyrule); + yybool yynormal __attribute__ ((__unused__)) = + (yystackp->yysplitPoint == NULL); + yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; + int yylow = 1; + int yyi; + YYUSE (yyvalp); + YYUSE (yylocp); +]b4_parse_param_use[]dnl +[ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n", + (unsigned long int) yyk, yyrule - 1, + (unsigned long int) yyrline[yyrule]); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &]b4_rhs_value(yynrhs, yyi + 1)[ + ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl + b4_user_args[); + YYFPRINTF (stderr, "\n"); + } +} +#endif + +/** Pop items off stack #K of STACK according to grammar rule RULE, + * and push back on the resulting nonterminal symbol. Perform the + * semantic action associated with RULE and store its value with the + * newly pushed state, if FORCEEVAL or if STACK is currently + * unambiguous. Otherwise, store the deferred semantic action with + * the new state. If the new state would have an identical input + * position, LR state, and predecessor to an existing state on the stack, + * it is identified with that existing state, eliminating stack #K from + * the STACK. In this case, the (necessarily deferred) semantic value is + * added to the options for the existing state's semantic value. + */ +static inline YYRESULTTAG +yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, + yybool yyforceEval]b4_user_formals[) +{ + size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn; + + if (yyforceEval || yystackp->yysplitPoint == NULL) + { + YYSTYPE yysval; + YYLTYPE yyloc; + + YY_REDUCE_PRINT ((yystackp, yyk, yyrule, &yysval, &yyloc]b4_user_args[)); + YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval, + &yyloc]b4_user_args[)); + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc); + yyglrShift (yystackp, yyk, + yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState, + yylhsNonterm (yyrule)), + yyposn, &yysval, &yyloc); + } + else + { + size_t yyi; + int yyn; + yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk]; + yyStateNum yynewLRState; + + for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength (yyrule); + 0 < yyn; yyn -= 1) + { + yys = yys->yypred; + YYASSERT (yys); + } + yyupdateSplit (yystackp, yys); + yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule)); + YYDPRINTF ((stderr, + "Reduced stack %lu by rule #%d; action deferred. Now in state %d.\n", + (unsigned long int) yyk, yyrule - 1, yynewLRState)); + for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) + if (yyi != yyk && yystackp->yytops.yystates[yyi] != NULL) + { + yyGLRState* yyp, *yysplit = yystackp->yysplitPoint; + yyp = yystackp->yytops.yystates[yyi]; + while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn) + { + if (yyp->yylrState == yynewLRState && yyp->yypred == yys) + { + yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule); + yymarkStackDeleted (yystackp, yyk); + YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n", + (unsigned long int) yyk, + (unsigned long int) yyi)); + return yyok; + } + yyp = yyp->yypred; + } + } + yystackp->yytops.yystates[yyk] = yys; + yyglrShiftDefer (yystackp, yyk, yynewLRState, yyposn, yys0, yyrule); + } + return yyok; +} + +static size_t +yysplitStack (yyGLRStack* yystackp, size_t yyk) +{ + if (yystackp->yysplitPoint == NULL) + { + YYASSERT (yyk == 0); + yystackp->yysplitPoint = yystackp->yytops.yystates[yyk]; + } + if (yystackp->yytops.yysize >= yystackp->yytops.yycapacity) + { + yyGLRState** yynewStates; + yybool* yynewLookaheadNeeds; + + yynewStates = NULL; + + if (yystackp->yytops.yycapacity + > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) + yyMemoryExhausted (yystackp); + yystackp->yytops.yycapacity *= 2; + + yynewStates = + (yyGLRState**) YYREALLOC (yystackp->yytops.yystates, + (yystackp->yytops.yycapacity + * sizeof yynewStates[0])); + if (yynewStates == NULL) + yyMemoryExhausted (yystackp); + yystackp->yytops.yystates = yynewStates; + + yynewLookaheadNeeds = + (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, + (yystackp->yytops.yycapacity + * sizeof yynewLookaheadNeeds[0])); + if (yynewLookaheadNeeds == NULL) + yyMemoryExhausted (yystackp); + yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds; + } + yystackp->yytops.yystates[yystackp->yytops.yysize] + = yystackp->yytops.yystates[yyk]; + yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize] + = yystackp->yytops.yylookaheadNeeds[yyk]; + yystackp->yytops.yysize += 1; + return yystackp->yytops.yysize-1; +} + +/** True iff Y0 and Y1 represent identical options at the top level. + * That is, they represent the same rule applied to RHS symbols + * that produce the same terminal symbols. */ +static yybool +yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1) +{ + if (yyy0->yyrule == yyy1->yyrule) + { + yyGLRState *yys0, *yys1; + int yyn; + for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, + yyn = yyrhsLength (yyy0->yyrule); + yyn > 0; + yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) + if (yys0->yyposn != yys1->yyposn) + return yyfalse; + return yytrue; + } + else + return yyfalse; +} + +/** Assuming identicalOptions (Y0,Y1), destructively merge the + * alternative semantic values for the RHS-symbols of Y1 and Y0. */ +static void +yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1) +{ + yyGLRState *yys0, *yys1; + int yyn; + for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, + yyn = yyrhsLength (yyy0->yyrule); + yyn > 0; + yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) + { + if (yys0 == yys1) + break; + else if (yys0->yyresolved) + { + yys1->yyresolved = yytrue; + yys1->yysemantics.yysval = yys0->yysemantics.yysval; + } + else if (yys1->yyresolved) + { + yys0->yyresolved = yytrue; + yys0->yysemantics.yysval = yys1->yysemantics.yysval; + } + else + { + yySemanticOption** yyz0p; + yySemanticOption* yyz1; + yyz0p = &yys0->yysemantics.yyfirstVal; + yyz1 = yys1->yysemantics.yyfirstVal; + while (YYID (yytrue)) + { + if (yyz1 == *yyz0p || yyz1 == NULL) + break; + else if (*yyz0p == NULL) + { + *yyz0p = yyz1; + break; + } + else if (*yyz0p < yyz1) + { + yySemanticOption* yyz = *yyz0p; + *yyz0p = yyz1; + yyz1 = yyz1->yynext; + (*yyz0p)->yynext = yyz; + } + yyz0p = &(*yyz0p)->yynext; + } + yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal; + } + } +} + +/** Y0 and Y1 represent two possible actions to take in a given + * parsing state; return 0 if no combination is possible, + * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */ +static int +yypreference (yySemanticOption* y0, yySemanticOption* y1) +{ + yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule; + int p0 = yydprec[r0], p1 = yydprec[r1]; + + if (p0 == p1) + { + if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1]) + return 0; + else + return 1; + } + if (p0 == 0 || p1 == 0) + return 0; + if (p0 < p1) + return 3; + if (p1 < p0) + return 2; + return 0; +} + +static YYRESULTTAG yyresolveValue (yyGLRState* yys, + yyGLRStack* yystackp]b4_user_formals[); + + +/** Resolve the previous N states starting at and including state S. If result + * != yyok, some states may have been left unresolved possibly with empty + * semantic option chains. Regardless of whether result = yyok, each state + * has been left with consistent data so that yydestroyGLRState can be invoked + * if necessary. */ +static YYRESULTTAG +yyresolveStates (yyGLRState* yys, int yyn, + yyGLRStack* yystackp]b4_user_formals[) +{ + if (0 < yyn) + { + YYASSERT (yys->yypred); + YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp]b4_user_args[)); + if (! yys->yyresolved) + YYCHK (yyresolveValue (yys, yystackp]b4_user_args[)); + } + return yyok; +} + +/** Resolve the states for the RHS of OPT, perform its user action, and return + * the semantic value and location. Regardless of whether result = yyok, all + * RHS states have been destroyed (assuming the user action destroys all RHS + * semantic values if invoked). */ +static YYRESULTTAG +yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp, + YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) +{ + yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; + int yynrhs; + int yychar_current; + YYSTYPE yylval_current; + YYLTYPE yylloc_current; + YYRESULTTAG yyflag; + + yynrhs = yyrhsLength (yyopt->yyrule); + yyflag = yyresolveStates (yyopt->yystate, yynrhs, yystackp]b4_user_args[); + if (yyflag != yyok) + { + yyGLRState *yys; + for (yys = yyopt->yystate; yynrhs > 0; yys = yys->yypred, yynrhs -= 1) + yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); + return yyflag; + } + + yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;]b4_locations_if([[ + if (yynrhs == 0) + /* Set default location. */ + yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[ + yychar_current = yychar; + yylval_current = yylval; + yylloc_current = yylloc; + yychar = yyopt->yyrawchar; + yylval = yyopt->yyval; + yylloc = yyopt->yyloc; + yyflag = yyuserAction (yyopt->yyrule, yynrhs, + yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, + yyvalp, yylocp, yystackp]b4_user_args[); + yychar = yychar_current; + yylval = yylval_current; + yylloc = yylloc_current; + return yyflag; +} + +#if YYDEBUG +static void +yyreportTree (yySemanticOption* yyx, int yyindent) +{ + int yynrhs = yyrhsLength (yyx->yyrule); + int yyi; + yyGLRState* yys; + yyGLRState* yystates[1 + YYMAXRHS]; + yyGLRState yyleftmost_state; + + for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred) + yystates[yyi] = yys; + if (yys == NULL) + { + yyleftmost_state.yyposn = 0; + yystates[0] = &yyleftmost_state; + } + else + yystates[0] = yys; + + if (yyx->yystate->yyposn < yys->yyposn + 1) + YYFPRINTF (stderr, "%*s%s -> \n", + yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), + yyx->yyrule - 1); + else + YYFPRINTF (stderr, "%*s%s -> \n", + yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), + yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1), + (unsigned long int) yyx->yystate->yyposn); + for (yyi = 1; yyi <= yynrhs; yyi += 1) + { + if (yystates[yyi]->yyresolved) + { + if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn) + YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", + yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1])); + else + YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", + yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]), + (unsigned long int) (yystates[yyi - 1]->yyposn + 1), + (unsigned long int) yystates[yyi]->yyposn); + } + else + yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2); + } +} +#endif + +/*ARGSUSED*/ static YYRESULTTAG +yyreportAmbiguity (yySemanticOption* yyx0, + yySemanticOption* yyx1]b4_pure_formals[) +{ + YYUSE (yyx0); + YYUSE (yyx1); + +#if YYDEBUG + YYFPRINTF (stderr, "Ambiguity detected.\n"); + YYFPRINTF (stderr, "Option 1,\n"); + yyreportTree (yyx0, 2); + YYFPRINTF (stderr, "\nOption 2,\n"); + yyreportTree (yyx1, 2); + YYFPRINTF (stderr, "\n"); +#endif + + yyerror (]b4_yyerror_args[YY_("syntax is ambiguous")); + return yyabort; +} + +/** 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 + * is always chosen. */ +static void +yyresolveLocations (yyGLRState* yys1, int yyn1, + yyGLRStack *yystackp]b4_user_formals[) +{ + if (0 < yyn1) + { + yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[); + if (!yys1->yyresolved) + { + yySemanticOption *yyoption; + yyGLRStackItem yyrhsloc[1 + YYMAXRHS]; + int yynrhs; + int yychar_current; + YYSTYPE yylval_current; + YYLTYPE yylloc_current; + yyoption = yys1->yysemantics.yyfirstVal; + YYASSERT (yyoption != NULL); + yynrhs = yyrhsLength (yyoption->yyrule); + if (yynrhs > 0) + { + yyGLRState *yys; + int yyn; + yyresolveLocations (yyoption->yystate, yynrhs, + yystackp]b4_user_args[); + for (yys = yyoption->yystate, yyn = yynrhs; + yyn > 0; + yys = yys->yypred, yyn -= 1) + yyrhsloc[yyn].yystate.yyloc = yys->yyloc; + } + else + { + /* Both yyresolveAction and yyresolveLocations traverse the GSS + in reverse rightmost order. It is only necessary to invoke + yyresolveLocations on a subforest for which yyresolveAction + would have been invoked next had an ambiguity not been + detected. Thus the location of the previous state (but not + necessarily the previous state itself) is guaranteed to be + resolved already. */ + yyGLRState *yyprevious = yyoption->yystate; + yyrhsloc[0].yystate.yyloc = yyprevious->yyloc; + } + yychar_current = yychar; + yylval_current = yylval; + yylloc_current = yylloc; + yychar = yyoption->yyrawchar; + yylval = yyoption->yyval; + yylloc = yyoption->yyloc; + YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs); + yychar = yychar_current; + yylval = yylval_current; + yylloc = yylloc_current; + } + } +} + +/** Resolve the ambiguity represented in state S, perform the indicated + * actions, and set the semantic value of S. If result != yyok, the chain of + * semantic options in S has been cleared instead or it has been left + * unmodified except that redundant options may have been removed. Regardless + * of whether result = yyok, S has been left with consistent data so that + * yydestroyGLRState can be invoked if necessary. */ +static YYRESULTTAG +yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[) +{ + yySemanticOption* yyoptionList = yys->yysemantics.yyfirstVal; + yySemanticOption* yybest; + yySemanticOption** yypp; + yybool yymerge; + YYSTYPE yysval; + YYRESULTTAG yyflag; + YYLTYPE *yylocp = &yys->yyloc; + + yybest = yyoptionList; + yymerge = yyfalse; + for (yypp = &yyoptionList->yynext; *yypp != NULL; ) + { + yySemanticOption* yyp = *yypp; + + if (yyidenticalOptions (yybest, yyp)) + { + yymergeOptionSets (yybest, yyp); + *yypp = yyp->yynext; + } + else + { + switch (yypreference (yybest, yyp)) + { + case 0: + yyresolveLocations (yys, 1, yystackp]b4_user_args[); + return yyreportAmbiguity (yybest, yyp]b4_pure_args[); + break; + case 1: + yymerge = yytrue; + break; + case 2: + break; + case 3: + yybest = yyp; + yymerge = yyfalse; + break; + default: + /* This cannot happen so it is not worth a YYASSERT (yyfalse), + but some compilers complain if the default case is + omitted. */ + break; + } + yypp = &yyp->yynext; + } + } + + if (yymerge) + { + yySemanticOption* yyp; + int yyprec = yydprec[yybest->yyrule]; + yyflag = yyresolveAction (yybest, yystackp, &yysval, + yylocp]b4_user_args[); + if (yyflag == yyok) + for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext) + { + if (yyprec == yydprec[yyp->yyrule]) + { + YYSTYPE yysval_other; + YYLTYPE yydummy; + yyflag = yyresolveAction (yyp, yystackp, &yysval_other, + &yydummy]b4_user_args[); + if (yyflag != yyok) + { + yydestruct ("Cleanup: discarding incompletely merged value for", + yystos[yys->yylrState], + &yysval]b4_locations_if([, yylocp])[]b4_user_args[); + break; + } + yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other); + } + } + } + else + yyflag = yyresolveAction (yybest, yystackp, &yysval, yylocp]b4_user_args[); + + if (yyflag == yyok) + { + yys->yyresolved = yytrue; + yys->yysemantics.yysval = yysval; + } + else + yys->yysemantics.yyfirstVal = NULL; + return yyflag; +} + +static YYRESULTTAG +yyresolveStack (yyGLRStack* yystackp]b4_user_formals[) +{ + if (yystackp->yysplitPoint != NULL) + { + yyGLRState* yys; + int yyn; + + for (yyn = 0, yys = yystackp->yytops.yystates[0]; + yys != yystackp->yysplitPoint; + yys = yys->yypred, yyn += 1) + continue; + YYCHK (yyresolveStates (yystackp->yytops.yystates[0], yyn, yystackp + ]b4_user_args[)); + } + return yyok; +} + +static void +yycompressStack (yyGLRStack* yystackp) +{ + yyGLRState* yyp, *yyq, *yyr; + + if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == NULL) + return; + + for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = NULL; + yyp != yystackp->yysplitPoint; + yyr = yyp, yyp = yyq, yyq = yyp->yypred) + yyp->yypred = yyr; + + yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems; + yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1; + yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems; + yystackp->yysplitPoint = NULL; + yystackp->yylastDeleted = NULL; + + while (yyr != NULL) + { + yystackp->yynextFree->yystate = *yyr; + yyr = yyr->yypred; + yystackp->yynextFree->yystate.yypred = &yystackp->yynextFree[-1].yystate; + yystackp->yytops.yystates[0] = &yystackp->yynextFree->yystate; + yystackp->yynextFree += 1; + yystackp->yyspaceLeft -= 1; + } +} + +static YYRESULTTAG +yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, + size_t yyposn]b4_pure_formals[) +{ + int yyaction; + const short int* yyconflicts; + yyRuleNum yyrule; + + while (yystackp->yytops.yystates[yyk] != NULL) + { + yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; + YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", + (unsigned long int) yyk, yystate)); + + YYASSERT (yystate != YYFINAL); + + if (yyisDefaultedState (yystate)) + { + yyrule = yydefaultAction (yystate); + if (yyrule == 0) + { + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + return yyok; + } + YYCHK (yyglrReduce (yystackp, yyk, yyrule, yyfalse]b4_user_args[)); + } + else + { + yySymbol yytoken; + yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); + + while (*yyconflicts != 0) + { + size_t yynewStack = yysplitStack (yystackp, yyk); + YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n", + (unsigned long int) yynewStack, + (unsigned long int) yyk)); + YYCHK (yyglrReduce (yystackp, yynewStack, + *yyconflicts, yyfalse]b4_user_args[)); + YYCHK (yyprocessOneStack (yystackp, yynewStack, + yyposn]b4_pure_args[)); + yyconflicts += 1; + } + + if (yyisShiftAction (yyaction)) + break; + else if (yyisErrorAction (yyaction)) + { + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + break; + } + else + YYCHK (yyglrReduce (yystackp, yyk, -yyaction, + yyfalse]b4_user_args[)); + } + } + return yyok; +} + +/*ARGSUSED*/ static void +yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) +{ + if (yystackp->yyerrState == 0) + { +#if YYERROR_VERBOSE + int yyn; + yyn = yypact[yystackp->yytops.yystates[0]->yylrState]; + if (YYPACT_NINF < yyn && yyn <= YYLAST) + { + yySymbol yytoken = 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 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + 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; + int yycount = 1; + + yyarg[0] = yytokenName (yytoken); + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytokenName (yyx); + yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx)); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + strlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + 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 */ + yyerror (]b4_lyyerror_args[YY_("syntax error")); + yynerrs += 1; + } +} + +/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP, + yylval, and yylloc are the syntactic category, semantic value, and location + of the lookahead. */ +/*ARGSUSED*/ static void +yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) +{ + size_t yyk; + int yyj; + + if (yystackp->yyerrState == 3) + /* We just shifted the error token and (perhaps) took some + reductions. Skip tokens until we can proceed. */ + while (YYID (yytrue)) + { + yySymbol yytoken; + if (yychar == YYEOF) + yyFail (yystackp][]b4_lpure_args[, NULL); + if (yychar != YYEMPTY) + {]b4_locations_if([[ + /* We throw away the lookahead, but the error range + of the shifted error token must take it into account. */ + yyGLRState *yys = yystackp->yytops.yystates[0]; + yyGLRStackItem yyerror_range[3]; + yyerror_range[1].yystate.yyloc = yys->yyloc; + yyerror_range[2].yystate.yyloc = yylloc; + YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Error: discarding", + yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); + } + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + yyj = yypact[yystackp->yytops.yystates[0]->yylrState]; + if (yyis_pact_ninf (yyj)) + return; + yyj += yytoken; + if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken) + { + if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0) + return; + } + else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj])) + return; + } + + /* Reduce to one stack. */ + for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1) + if (yystackp->yytops.yystates[yyk] != NULL) + break; + if (yyk >= yystackp->yytops.yysize) + yyFail (yystackp][]b4_lpure_args[, NULL); + for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1) + yymarkStackDeleted (yystackp, yyk); + yyremoveDeletes (yystackp); + yycompressStack (yystackp); + + /* Now pop stack until we find a state that shifts the error token. */ + yystackp->yyerrState = 3; + while (yystackp->yytops.yystates[0] != NULL) + { + yyGLRState *yys = yystackp->yytops.yystates[0]; + yyj = yypact[yys->yylrState]; + if (! yyis_pact_ninf (yyj)) + { + yyj += YYTERROR; + if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR + && yyisShiftAction (yytable[yyj])) + { + /* Shift the error token having adjusted its location. */ + YYLTYPE yyerrloc;]b4_locations_if([[ + yystackp->yyerror_range[2].yystate.yyloc = yylloc; + YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[ + YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]], + &yylval, &yyerrloc); + yyglrShift (yystackp, 0, yytable[yyj], + yys->yyposn, &yylval, &yyerrloc); + yys = yystackp->yytops.yystates[0]; + break; + } + } +]b4_locations_if([[ yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[ + if (yys->yypred != NULL) + yydestroyGLRState ("Error: popping", yys]b4_user_args[); + yystackp->yytops.yystates[0] = yys->yypred; + yystackp->yynextFree -= 1; + yystackp->yyspaceLeft += 1; + } + if (yystackp->yytops.yystates[0] == NULL) + yyFail (yystackp][]b4_lpure_args[, NULL); +} + +#define YYCHK1(YYE) \ + do { \ + switch (YYE) { \ + case yyok: \ + break; \ + case yyabort: \ + goto yyabortlab; \ + case yyaccept: \ + goto yyacceptlab; \ + case yyerr: \ + goto yyuser_error; \ + default: \ + goto yybuglab; \ + } \ + } while (YYID (0)) + + +/*----------. +| yyparse. | +`----------*/ + +]b4_c_ansi_function_def([yyparse], [int], b4_parse_param)[ +{ + int yyresult; + yyGLRStack yystack; + yyGLRStack* const yystackp = &yystack; + size_t yyposn; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yychar = YYEMPTY; + yylval = yyval_default; +]b4_locations_if([ +#if YYLTYPE_IS_TRIVIAL + yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[; + yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; +#endif +]) +m4_ifdef([b4_initial_action], [ +m4_pushdef([b4_at_dollar], [yylloc])dnl +m4_pushdef([b4_dollar_dollar], [yylval])dnl + /* User initialization code. */ + b4_user_initial_action +m4_popdef([b4_dollar_dollar])dnl +m4_popdef([b4_at_dollar])])dnl +[ + if (! yyinitGLRStack (yystackp, YYINITDEPTH)) + goto yyexhaustedlab; + switch (YYSETJMP (yystack.yyexception_buffer)) + { + case 0: break; + case 1: goto yyabortlab; + case 2: goto yyexhaustedlab; + default: goto yybuglab; + } + yyglrShift (&yystack, 0, 0, 0, &yylval, &yylloc); + yyposn = 0; + + while (YYID (yytrue)) + { + /* For efficiency, we have two loops, the first of which is + specialized to deterministic operation (single stack, no + potential ambiguity). */ + /* Standard mode */ + while (YYID (yytrue)) + { + yyRuleNum yyrule; + int yyaction; + const short int* yyconflicts; + + yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + goto yyacceptlab; + if (yyisDefaultedState (yystate)) + { + yyrule = yydefaultAction (yystate); + if (yyrule == 0) + { +]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ + yyreportSyntaxError (&yystack]b4_user_args[); + goto yyuser_error; + } + YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue]b4_user_args[)); + } + else + { + yySymbol yytoken; + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); + if (*yyconflicts != 0) + break; + if (yyisShiftAction (yyaction)) + { + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yychar = YYEMPTY; + yyposn += 1; + yyglrShift (&yystack, 0, yyaction, yyposn, &yylval, &yylloc); + if (0 < yystack.yyerrState) + yystack.yyerrState -= 1; + } + else if (yyisErrorAction (yyaction)) + { +]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ + yyreportSyntaxError (&yystack]b4_user_args[); + goto yyuser_error; + } + else + YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue]b4_user_args[)); + } + } + + while (YYID (yytrue)) + { + yySymbol yytoken_to_shift; + size_t yys; + + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY; + + /* yyprocessOneStack returns one of three things: + + - An error flag. If the caller is yyprocessOneStack, it + immediately returns as well. When the caller is finally + yyparse, it jumps to an error label via YYCHK1. + + - yyok, but yyprocessOneStack has invoked yymarkStackDeleted + (&yystack, yys), which sets the top state of yys to NULL. Thus, + yyparse's following invocation of yyremoveDeletes will remove + the stack. + + - yyok, when ready to shift a token. + + Except in the first case, yyparse will invoke yyremoveDeletes and + then shift the next token onto all remaining stacks. This + synchronization of the shift (that is, after all preceding + reductions on all stacks) helps prevent double destructor calls + on yylval in the event of memory exhaustion. */ + + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn]b4_lpure_args[)); + yyremoveDeletes (&yystack); + if (yystack.yytops.yysize == 0) + { + yyundeleteLastStack (&yystack); + if (yystack.yytops.yysize == 0) + yyFail (&yystack][]b4_lpure_args[, YY_("syntax error")); + YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); + YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); +]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ + yyreportSyntaxError (&yystack]b4_user_args[); + goto yyuser_error; + } + + /* If any yyglrShift call fails, it will fail after shifting. Thus, + a copy of yylval will already be on stack 0 in the event of a + failure in the following loop. Thus, yychar is set to YYEMPTY + before the loop to make sure the user destructor for yylval isn't + called twice. */ + yytoken_to_shift = YYTRANSLATE (yychar); + yychar = YYEMPTY; + yyposn += 1; + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + { + int yyaction; + const short int* yyconflicts; + yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState; + yygetLRActions (yystate, yytoken_to_shift, &yyaction, + &yyconflicts); + /* Note that yyconflicts were handled by yyprocessOneStack. */ + YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys)); + YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); + yyglrShift (&yystack, yys, yyaction, yyposn, + &yylval, &yylloc); + YYDPRINTF ((stderr, "Stack %lu now in state #%d\n", + (unsigned long int) yys, + yystack.yytops.yystates[yys]->yylrState)); + } + + if (yystack.yytops.yysize == 1) + { + YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); + YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); + yycompressStack (&yystack); + break; + } + } + continue; + yyuser_error: + yyrecoverSyntaxError (&yystack]b4_user_args[); + yyposn = yystack.yytops.yystates[0]->yyposn; + } + + yyacceptlab: + yyresult = 0; + goto yyreturn; + + yybuglab: + YYASSERT (yyfalse); + goto yyabortlab; + + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyexhaustedlab: + yyerror (]b4_lyyerror_args[YY_("memory exhausted")); + yyresult = 2; + goto yyreturn; + + yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + YYTRANSLATE (yychar), + &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); + + /* If the stack is well-formed, pop the stack until it is empty, + destroying its entries as we go. But free the stack regardless + of whether it is well-formed. */ + if (yystack.yyitems) + { + yyGLRState** yystates = yystack.yytops.yystates; + if (yystates) + { + size_t yysize = yystack.yytops.yysize; + size_t yyk; + for (yyk = 0; yyk < yysize; yyk += 1) + if (yystates[yyk]) + { + while (yystates[yyk]) + { + yyGLRState *yys = yystates[yyk]; +]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]] +)[ if (yys->yypred != NULL) + yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); + yystates[yyk] = yys->yypred; + yystack.yynextFree -= 1; + yystack.yyspaceLeft += 1; + } + break; + } + } + yyfreeGLRStack (&yystack); + } + + /* Make sure YYID is used. */ + return YYID (yyresult); +} + +/* DEBUGGING ONLY */ +#if YYDEBUG +static void yypstack (yyGLRStack* yystackp, size_t yyk) + __attribute__ ((__unused__)); +static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__)); + +static void +yy_yypstack (yyGLRState* yys) +{ + if (yys->yypred) + { + yy_yypstack (yys->yypred); + YYFPRINTF (stderr, " -> "); + } + YYFPRINTF (stderr, "%d@@%lu", yys->yylrState, + (unsigned long int) yys->yyposn); +} + +static void +yypstates (yyGLRState* yyst) +{ + if (yyst == NULL) + YYFPRINTF (stderr, ""); + else + yy_yypstack (yyst); + YYFPRINTF (stderr, "\n"); +} + +static void +yypstack (yyGLRStack* yystackp, size_t yyk) +{ + yypstates (yystackp->yytops.yystates[yyk]); +} + +#define YYINDEX(YYX) \ + ((YYX) == NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems) + + +static void +yypdumpstack (yyGLRStack* yystackp) +{ + yyGLRStackItem* yyp; + size_t yyi; + for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1) + { + YYFPRINTF (stderr, "%3lu. ", + (unsigned long int) (yyp - yystackp->yyitems)); + if (*(yybool *) yyp) + { + YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", + yyp->yystate.yyresolved, yyp->yystate.yylrState, + (unsigned long int) yyp->yystate.yyposn, + (long int) YYINDEX (yyp->yystate.yypred)); + if (! yyp->yystate.yyresolved) + YYFPRINTF (stderr, ", firstVal: %ld", + (long int) YYINDEX (yyp->yystate + .yysemantics.yyfirstVal)); + } + else + { + YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", + yyp->yyoption.yyrule - 1, + (long int) YYINDEX (yyp->yyoption.yystate), + (long int) YYINDEX (yyp->yyoption.yynext)); + } + YYFPRINTF (stderr, "\n"); + } + YYFPRINTF (stderr, "Tops:"); + for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) + YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi, + (long int) YYINDEX (yystackp->yytops.yystates[yyi])); + YYFPRINTF (stderr, "\n"); +} +#endif +] + +b4_epilogue +dnl +dnl glr.cc produces its own header. +dnl +m4_if(b4_skeleton, ["glr.c"], +[b4_defines_if( +[@output(b4_spec_defines_file@) +b4_copyright([Skeleton interface for Bison GLR parsers in C], + [2002, 2003, 2004, 2005, 2006]) + +b4_shared_declarations + +b4_pure_if([], +[[extern YYSTYPE ]b4_prefix[lval;]]) + +b4_locations_if([b4_pure_if([], +[extern YYLTYPE ]b4_prefix[lloc;]) +]) +])]) +m4_divert_pop(0) diff --git a/data/glr.cc b/data/glr.cc new file mode 100644 index 0000000..ea04b28 --- /dev/null +++ b/data/glr.cc @@ -0,0 +1,377 @@ + -*- C -*- + +# C++ GLR skeleton for Bison +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 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 . + + +# This skeleton produces a C++ class that encapsulates a C glr parser. +# This is in order to reduce the maintenance burden. The glr.c +# skeleton is clean and pure enough so that there are no real +# problems. The C++ interface is the same as that of lalr1.cc. In +# fact, glr.c can replace yacc.c without the user noticing any +# difference, and similarly for glr.cc replacing lalr1.cc. +# +# The passing of parse-params +# +# The additional arguments are stored as members of the parser +# object, yyparser. The C routines need to carry yyparser +# throughout the C parser; that easy: just let yyparser become an +# additional parse-param. But because the C++ skeleton needs to +# know the "real" original parse-param, we save them +# (b4_parse_param_orig). Note that b4_parse_param is overquoted +# (and c.m4 strips one level of quotes). This is a PITA, and +# explains why there are so many levels of quotes. +# +# The locations +# +# We use location.cc just like lalr1.cc, but because glr.c stores +# the locations in a (C++) union, the position and location classes +# must not have a constructor. Therefore, contrary to lalr1.cc, we +# must not define "b4_location_constructors". As a consequence the +# user must initialize the first positions (in particular the +# filename member). + +# We require a pure interface using locations. +m4_define([b4_locations_flag], [1]) +m4_define([b4_pure_flag], [1]) + +# The header is mandatory. +b4_defines_if([], + [b4_fatal([b4_skeleton[: using %%defines is mandatory]])]) + +m4_include(b4_pkgdatadir/[c++.m4]) +m4_include(b4_pkgdatadir/[location.cc]) + +m4_define([b4_parser_class_name], + [b4_percent_define_get([[parser_class_name]])]) + +# Save the parse parameters. +m4_define([b4_parse_param_orig], m4_defn([b4_parse_param])) + + +# b4_yy_symbol_print_generate +# --------------------------- +# Bypass the default implementation to generate the "yy_symbol_print" +# and "yy_symbol_value_print" functions. +m4_define([b4_yy_symbol_print_generate], +[[ +/*--------------------. +| Print this symbol. | +`--------------------*/ + +]b4_c_ansi_function_def([yy_symbol_print], + [static void], + [[FILE *], []], + [[int yytype], [yytype]], + [[const b4_namespace_ref::b4_parser_class_name::semantic_type *yyvaluep], + [yyvaluep]], + [[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], + [yylocationp]], + b4_parse_param)[ +{ +]b4_parse_param_use[]dnl +[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[); +} +]]) + + +# Declare yyerror. +m4_append([b4_post_prologue], +[b4_syncline([@oline@], [@ofile@]) + +b4_c_ansi_function_decl([yyerror], + [static void], + [[b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], [yylocationp]], + b4_parse_param, + [[const char* msg], [msg]])]) + + +# Define yyerror. +m4_append([b4_epilogue], +[b4_syncline([@oline@], [@ofile@])[ +/*------------------. +| Report an error. | +`------------------*/ + +]b4_c_ansi_function_def([yyerror], + [static void], + [[b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], [yylocationp]], + b4_parse_param, + [[const char* msg], [msg]])[ +{ +]b4_parse_param_use[]dnl +[ yyparser.error (*yylocationp, msg); +} + + +]b4_namespace_open[ +]dnl In this section, the parse param are the original parse_params. +m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl +[ /// Build a parser object. + ]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [ + :])[ +#if YYDEBUG + ]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false), + yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[ +#endif]b4_parse_param_cons[ + { + } + + ]b4_parser_class_name::~b4_parser_class_name[ () + { + } + + int + ]b4_parser_class_name[::parse () + { + return ::yyparse (*this]b4_user_args[); + } + +#if YYDEBUG + /*--------------------. + | Print this symbol. | + `--------------------*/ + + inline void + ]b4_parser_class_name[::yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + /* Pacify ``unused variable'' warnings. */ + YYUSE (yyvaluep); + YYUSE (yylocationp); + switch (yytype) + { + ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl +[ default: + break; + } + } + + + void + ]b4_parser_class_name[::yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + *yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm") + << ' ' << yytname[yytype] << " (" + << *yylocationp << ": "; + yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); + *yycdebug_ << ')'; + } + + std::ostream& + ]b4_parser_class_name[::debug_stream () const + { + return *yycdebug_; + } + + void + ]b4_parser_class_name[::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + ]b4_parser_class_name[::debug_level_type + ]b4_parser_class_name[::debug_level () const + { + return yydebug_; + } + + void + ]b4_parser_class_name[::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } + +#endif +]m4_popdef([b4_parse_param])dnl +b4_namespace_close[ + +]]) + + +# Let glr.c believe that the user arguments include the parser itself. +m4_ifset([b4_parse_param], +[m4_pushdef([b4_parse_param], + m4_dquote([[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]],] +m4_defn([b4_parse_param])))], +[m4_pushdef([b4_parse_param], + [[[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]]]]) +]) +m4_include(b4_pkgdatadir/[glr.c]) +m4_popdef([b4_parse_param]) + +m4_divert_push(0) +@output(b4_spec_defines_file@) +b4_copyright([Skeleton interface for Bison GLR parsers in C++], + [2002, 2003, 2004, 2005, 2006])[ + +/* C++ GLR parser skeleton written by Akim Demaille. */ + +#ifndef PARSER_HEADER_H +# define PARSER_HEADER_H + +]b4_percent_code_get([[requires]])[ + +#include +#include + +/* Using locations. */ +#define YYLSP_NEEDED ]b4_locations_flag[ + +]b4_namespace_open[ + class position; + class location; +]b4_namespace_close[ + +#include "location.hh" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG ]b4_debug_flag[ +#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 = YYRHSLOC (Rhs, 1).begin; \ + (Current).end = YYRHSLOC (Rhs, N).end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ + } \ + while (/*CONSTCOND*/ 0) +#endif + +]b4_namespace_open[ + /// A Bison parser. + class ]b4_parser_class_name[ + { + public: + /// Symbol semantic values. +#ifndef YYSTYPE +]m4_ifdef([b4_stype], +[ union semantic_type + { +b4_user_stype + };], +[m4_if(b4_tag_seen_flag, 0, +[[ typedef int semantic_type;]], +[[ typedef YYSTYPE semantic_type;]])])[ +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef ]b4_percent_define_get([[location_type]])[ location_type; + /// Tokens. + struct token + { + ]b4_token_enums(b4_tokens)[ + }; + /// Token type. + typedef token::yytokentype token_type; + + /// Build a parser object. + ]b4_parser_class_name[ (]b4_parse_param_decl[); + virtual ~]b4_parser_class_name[ (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + + /// The current debugging stream. + std::ostream& debug_stream () const; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); + + private: + + public: + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + private: + +#if YYDEBUG + public: + /// \brief Report a symbol value on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); + /// \brief Report a symbol on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); + private: + /* Debugging. */ + int yydebug_; + std::ostream* yycdebug_; +#endif + + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// \param yytype The symbol type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + inline void yydestruct_ (const char* yymsg, + int yytype, + semantic_type* yyvaluep, + location_type* yylocationp); + +]b4_parse_param_vars[ + }; + +]dnl Redirections for glr.c. +b4_percent_define_flag_if([[global_tokens_and_yystype]], +[b4_token_defines(b4_tokens)]) +[ +#ifndef YYSTYPE +# define YYSTYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type +#endif +#ifndef YYLTYPE +# define YYLTYPE ]b4_namespace_ref[::]b4_parser_class_name[::location_type +#endif + +]b4_namespace_close[ + +]b4_percent_code_get([[provides]])[]dnl + +[#endif /* ! defined PARSER_HEADER_H */] +m4_divert_pop(0) diff --git a/data/java-skel.m4 b/data/java-skel.m4 new file mode 100644 index 0000000..7c4aa10 --- /dev/null +++ b/data/java-skel.m4 @@ -0,0 +1,25 @@ + -*- Autoconf -*- + +# Java skeleton dispatching for Bison. +# Copyright (C) 2007 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 . + +b4_glr_if( [b4_complain([%%glr-parser not supported for Java])]) +b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])]) + +m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.java]]) +m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) + +m4_include(b4_used_skeleton) diff --git a/data/java.m4 b/data/java.m4 new file mode 100644 index 0000000..b3dbd3b --- /dev/null +++ b/data/java.m4 @@ -0,0 +1,303 @@ + -*- Autoconf -*- + +# Java language support for Bison + +# Copyright (C) 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 . + + +# b4_comment(TEXT) +# ---------------- +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) +# --------------------------- +m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])]) + + +# b4_public_if(TRUE, FALSE) +# ------------------------- +b4_percent_define_default([[public]], [[false]]) +m4_define([b4_public_if], +[b4_percent_define_flag_if([public], [$1], [$2])]) + + +# b4_abstract_if(TRUE, FALSE) +# --------------------------- +b4_percent_define_default([[abstract]], [[false]]) +m4_define([b4_abstract_if], +[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) +# ------------------------ +m4_define([b4_lexer_if], +[b4_percent_code_ifdef([[lexer]], [$1], [$2])]) + + +# b4_identification +# ----------------- +m4_define([b4_identification], +[ /** Version number for the Bison executable that generated this parser. */ + public static final String bisonVersion = "b4_version"; + + /** Name of the skeleton that generated this parser. */ + public static final String bisonSkeleton = b4_skeleton; +]) + + +## ------------ ## +## Data types. ## +## ------------ ## + +# b4_int_type(MIN, MAX) +# --------------------- +# Return the smallest int type able to handle numbers ranging from +# MIN to MAX (included). +m4_define([b4_int_type], +[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte], + b4_ints_in($@, [-32768], [32767]), [1], [short], + [int])]) + +# b4_int_type_for(NAME) +# --------------------- +# Return the smallest int type able to handle numbers ranging from +# `NAME_min' to `NAME_max' (included). +m4_define([b4_int_type_for], +[b4_int_type($1_min, $1_max)]) + +# b4_null +# ------- +m4_define([b4_null], [null]) + + +## ------------------------- ## +## Assigning token numbers. ## +## ------------------------- ## + +# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER) +# --------------------------------------- +# Output the definition of this token as an enum. +m4_define([b4_token_enum], +[ /** Token number, to be returned by the scanner. */ + public static final int $1 = $2; +]) + + +# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ----------------------------------------------------- +# Output the definition of the tokens (if there are) as enums. +m4_define([b4_token_enums], +[m4_if([$#$1], [1], [], +[/* Tokens. */ +m4_map([b4_token_enum], [$@])]) +]) + +# b4-case(ID, CODE) +# ----------------- +# We need to fool Java's stupid unreachable code detection. +m4_define([b4_case], [ case $1: + if (yyn == $1) + $2; + break; + ]) + + +## ---------------- ## +## Default values. ## +## ---------------- ## + +m4_define([b4_yystype], [b4_percent_define_get([[stype]])]) +b4_percent_define_default([[stype]], [[Object]])]) + +# %name-prefix +m4_define_default([b4_prefix], [[YY]]) + +b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])]) +m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])]) + +b4_percent_define_default([[lex_throws]], [[java.io.IOException]])]) +m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])]) + +b4_percent_define_default([[throws]], [])]) +m4_define([b4_throws], [b4_percent_define_get([[throws]])]) + +b4_percent_define_default([[location_type]], [Location])]) +m4_define([b4_location_type], [b4_percent_define_get([[location_type]])]) + +b4_percent_define_default([[position_type]], [Position])]) +m4_define([b4_position_type], [b4_percent_define_get([[position_type]])]) + + +## ----------------- ## +## Semantic Values. ## +## ----------------- ## + + +# b4_lhs_value([TYPE]) +# -------------------- +# Expansion of $$. +m4_define([b4_lhs_value], [yyval]) + + +# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) +# -------------------------------------- +# Expansion of $NUM, where the current rule has RULE-LENGTH +# symbols on RHS. +# +# In this simple implementation, %token and %type have class names +# between the angle brackets. +m4_define([b4_rhs_value], +[(m4_ifval($3, [($3)])[](yystack.valueAt ($1-($2))))]) + +# b4_lhs_location() +# ----------------- +# Expansion of @$. +m4_define([b4_lhs_location], +[(yyloc)]) + + +# b4_rhs_location(RULE-LENGTH, NUM) +# --------------------------------- +# Expansion of @NUM, where the current rule has RULE-LENGTH symbols +# on RHS. +m4_define([b4_rhs_location], +[yystack.locationAt ($1-($2))]) + + +# b4_lex_param +# b4_parse_param +# -------------- +# If defined, b4_lex_param arrives double quoted, but below we prefer +# it to be single quoted. Same for b4_parse_param. + +# TODO: should be in bison.m4 +m4_define_default([b4_lex_param], [[]])) +m4_define([b4_lex_param], b4_lex_param)) +m4_define([b4_parse_param], b4_parse_param)) + +# b4_lex_param_decl +# ------------------- +# Extra formal arguments of the constructor. +m4_define([b4_lex_param_decl], +[m4_ifset([b4_lex_param], + [b4_remove_comma([$1], + b4_param_decls(b4_lex_param))], + [$1])]) + +m4_define([b4_param_decls], + [m4_map([b4_param_decl], [$@])]) +m4_define([b4_param_decl], [, $1]) + +m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)]) + + + +# b4_parse_param_decl +# ------------------- +# Extra formal arguments of the constructor. +m4_define([b4_parse_param_decl], +[m4_ifset([b4_parse_param], + [b4_remove_comma([$1], + b4_param_decls(b4_parse_param))], + [$1])]) + + + +# b4_lex_param_call +# ------------------- +# Delegating the lexer parameters to the lexer constructor. +m4_define([b4_lex_param_call], + [m4_ifset([b4_lex_param], + [b4_remove_comma([$1], + b4_param_calls(b4_lex_param))], + [$1])]) +m4_define([b4_param_calls], + [m4_map([b4_param_call], [$@])]) +m4_define([b4_param_call], [, $2]) + + + +# b4_parse_param_cons +# ------------------- +# Extra initialisations of the constructor. +m4_define([b4_parse_param_cons], + [m4_ifset([b4_parse_param], + [b4_constructor_calls(b4_parse_param)])]) + +m4_define([b4_constructor_calls], + [m4_map([b4_constructor_call], [$@])]) +m4_define([b4_constructor_call], + [this.$2 = $2; + ]) + + + +# b4_parse_param_vars +# ------------------- +# Extra instance variables. +m4_define([b4_parse_param_vars], + [m4_ifset([b4_parse_param], + [ + /* User arguments. */ +b4_var_decls(b4_parse_param)])]) + +m4_define([b4_var_decls], + [m4_map_sep([b4_var_decl], [ +], [$@])]) +m4_define([b4_var_decl], + [ protected final $1;]) + + + +# b4_maybe_throws(THROWS) +# ----------------------- +# Expand to either an empty string or "throws THROWS". +m4_define([b4_maybe_throws], + [m4_ifval($1, [throws $1])]) diff --git a/data/lalr1.cc b/data/lalr1.cc new file mode 100644 index 0000000..ca1dfcc --- /dev/null +++ b/data/lalr1.cc @@ -0,0 +1,1157 @@ +# C++ skeleton for Bison + +# Copyright (C) 2002, 2003, 2004, 2005, 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 . + +m4_include(b4_pkgdatadir/[c++.m4]) + +m4_define([b4_parser_class_name], + [b4_percent_define_get([[parser_class_name]])]) + +# The header is mandatory. +b4_defines_if([], + [b4_fatal([b4_skeleton[: using %%defines is mandatory]])]) + +# Backward compatibility. +m4_define([b4_location_constructors]) +m4_include(b4_pkgdatadir/[location.cc]) + +# We do want M4 expansion after # for CPP macros. +m4_changecom() +m4_divert_push(0)dnl +b4_defines_if( +[@output(b4_spec_defines_file@) +b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++], + [2002, 2003, 2004, 2005, 2006, 2007, 2008]) +dnl FIXME: This is wrong, we want computed header guards. +[ +/* C++ LALR(1) parser skeleton written by Akim Demaille. */ + +#ifndef PARSER_HEADER_H +# define PARSER_HEADER_H + +]b4_percent_code_get([[requires]])[ + +#include +#include +#include "stack.hh" + +]b4_namespace_open[ + class position; + class location; +]b4_namespace_close[ + +#include "location.hh" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG ]b4_debug_flag[ +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE ]b4_error_verbose_flag[ +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE ]b4_token_table[ +#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[ + + /// A Bison parser. + class ]b4_parser_class_name[ + { + public: + /// Symbol semantic values. +#ifndef YYSTYPE +]m4_ifdef([b4_stype], +[ union semantic_type + { +b4_user_stype + };], +[m4_if(b4_tag_seen_flag, 0, +[[ typedef int semantic_type;]], +[[ typedef YYSTYPE semantic_type;]])])[ +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef ]b4_percent_define_get([[location_type]])[ location_type; + /// Tokens. + struct token + { + ]b4_token_enums(b4_tokens)[ + }; + /// Token type. + typedef token::yytokentype token_type; + + /// Build a parser object. + ]b4_parser_class_name[ (]b4_parse_param_decl[); + virtual ~]b4_parser_class_name[ (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if YYDEBUG + /// The current debugging stream. + std::ostream& debug_stream () const; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + private: + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Generate an error message. + /// \param state the state where the error occurred. + /// \param tok the lookahead token. + virtual std::string yysyntax_error_ (int yystate]dnl +b4_error_verbose_if([, int tok])[); + +#if YYDEBUG + /// \brief Report a symbol value on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); + /// \brief Report a symbol on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); +#endif + + + /// State numbers. + typedef int state_type; + /// State stack type. + typedef stack state_stack_type; + /// Semantic value stack type. + typedef stack semantic_stack_type; + /// location stack type. + typedef stack location_stack_type; + + /// The state stack. + state_stack_type yystate_stack_; + /// The semantic value stack. + semantic_stack_type yysemantic_stack_; + /// The location stack. + location_stack_type yylocation_stack_; + + /// Internal symbol numbers. + typedef ]b4_int_type_for([b4_translate])[ token_number_type; + /* Tables. */ + /// For a state, the index in \a yytable_ of its portion. + static const ]b4_int_type_for([b4_pact])[ yypact_[]; + static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_; + + /// For a state, default rule to reduce. + /// Unless\a yytable_ specifies something else to do. + /// Zero means the default is an error. + static const ]b4_int_type_for([b4_defact])[ yydefact_[]; + + static const ]b4_int_type_for([b4_pgoto])[ yypgoto_[]; + static const ]b4_int_type_for([b4_defgoto])[ yydefgoto_[]; + + /// What to do in a state. + /// \a yytable_[yypact_[s]]: what to do in state \a s. + /// - if positive, shift that token. + /// - if negative, reduce the rule which number is the opposite. + /// - if zero, do what YYDEFACT says. + static const ]b4_int_type_for([b4_table])[ yytable_[]; + static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_; + + static const ]b4_int_type_for([b4_check])[ yycheck_[]; + + /// For a state, its accessing symbol. + static const ]b4_int_type_for([b4_stos])[ yystos_[]; + + /// For a rule, its LHS. + static const ]b4_int_type_for([b4_r1])[ yyr1_[]; + /// For a rule, its RHS length. + static const ]b4_int_type_for([b4_r2])[ yyr2_[]; + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#endif + +#if YYERROR_VERBOSE + /// Convert the symbol name \a n to a form suitable for a diagnostic. + virtual std::string yytnamerr_ (const char *n); +#endif + +#if YYDEBUG + /// A type to store symbol numbers and -1. + typedef ]b4_int_type_for([b4_rhs])[ rhs_number_type; + /// A `-1'-separated list of the rules' RHS. + static const rhs_number_type yyrhs_[]; + /// For each rule, the index of the first RHS symbol in \a yyrhs_. + static const ]b4_int_type_for([b4_prhs])[ yyprhs_[]; + /// For each rule, its source line number. + static const ]b4_int_type_for([b4_rline])[ yyrline_[]; + /// For each scanner token number, its symbol number. + static const ]b4_int_type_for([b4_toknum])[ yytoken_number_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); + + /* Debugging. */ + int yydebug_; + std::ostream* yycdebug_; +#endif + + /// Convert a scanner token number \a t to a symbol number. + token_number_type yytranslate_ (int t); + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// \param yytype The symbol type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + inline void yydestruct_ (const char* yymsg, + int yytype, + semantic_type* yyvaluep, + location_type* yylocationp); + + /// Pop \a n symbols the three stacks. + inline void yypop_ (unsigned int n = 1); + + /* Constants. */ + static const int yyeof_; + /* LAST_ -- Last index in TABLE_. */ + static const int yylast_; + static const int yynnts_; + static const int yyempty_; + static const int yyfinal_; + static const int yyterror_; + static const int yyerrcode_; + static const int yyntokens_; + static const unsigned int yyuser_token_number_max_; + static const token_number_type yyundef_token_; +]b4_parse_param_vars[ + }; +]b4_namespace_close[ + +]b4_percent_define_flag_if([[global_tokens_and_yystype]], +[b4_token_defines(b4_tokens) + +#ifndef YYSTYPE + /* Redirection for backward compatibility. */ +# define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type +#endif +]) +b4_percent_code_get([[provides]])[]dnl + +[#endif /* ! defined PARSER_HEADER_H */] +])dnl +@output(b4_parser_file_name@) +b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++], + [2002, 2003, 2004, 2005, 2006, 2007, 2008]) +b4_percent_code_get([[top]])[]dnl +m4_if(b4_prefix, [yy], [], +[ +// Take the name prefix into account. +#define yylex b4_prefix[]lex])[ + +/* First part of user declarations. */ +]b4_user_pre_prologue + +b4_defines_if([[ +#include "@basename(]b4_spec_defines_file[@)"]])[ + +/* User implementation prologue. */ +]b4_user_post_prologue +b4_percent_code_get[]dnl + +[#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* FIXME: INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#define YYUSE(e) ((void) (e)) + +/* Enable debugging if requested. */ +#if YYDEBUG + +/* A pseudo ostream that takes yydebug_ into account. */ +# define YYCDEBUG if (yydebug_) (*yycdebug_) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug_) \ + { \ + *yycdebug_ << Title << ' '; \ + yy_symbol_print_ ((Type), (Value), (Location)); \ + *yycdebug_ << std::endl; \ + } \ +} while (false) + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug_) \ + yy_reduce_print_ (Rule); \ +} while (false) + +# define YY_STACK_PRINT() \ +do { \ + if (yydebug_) \ + yystack_print_ (); \ +} while (false) + +#else /* !YYDEBUG */ + +# define YYCDEBUG if (false) std::cerr +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_REDUCE_PRINT(Rule) +# define YY_STACK_PRINT() + +#endif /* !YYDEBUG */ + +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yychar = yyempty_) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) + +]b4_namespace_open[ +#if YYERROR_VERBOSE + + /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + std::string + ]b4_parser_class_name[::yytnamerr_ (const char *yystr) + { + if (*yystr == '"') + { + std::string yyr = ""; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; + } + +#endif + + /// Build a parser object. + ]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [ + :])[ +#if YYDEBUG + ]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false), + yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[ +#endif]b4_parse_param_cons[ + { + } + + ]b4_parser_class_name::~b4_parser_class_name[ () + { + } + +#if YYDEBUG + /*--------------------------------. + | Print this symbol on YYOUTPUT. | + `--------------------------------*/ + + inline void + ]b4_parser_class_name[::yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + YYUSE (yylocationp); + YYUSE (yyvaluep); + switch (yytype) + { + ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl +[ default: + break; + } + } + + + void + ]b4_parser_class_name[::yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << *yylocationp << ": "; + yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); + *yycdebug_ << ')'; + } +#endif + + void + ]b4_parser_class_name[::yydestruct_ (const char* yymsg, + int yytype, semantic_type* yyvaluep, location_type* yylocationp) + { + YYUSE (yylocationp); + YYUSE (yymsg); + YYUSE (yyvaluep); + + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[ + default: + break; + } + } + + void + ]b4_parser_class_name[::yypop_ (unsigned int n) + { + yystate_stack_.pop (n); + yysemantic_stack_.pop (n); + yylocation_stack_.pop (n); + } + +#if YYDEBUG + std::ostream& + ]b4_parser_class_name[::debug_stream () const + { + return *yycdebug_; + } + + void + ]b4_parser_class_name[::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + ]b4_parser_class_name[::debug_level_type + ]b4_parser_class_name[::debug_level () const + { + return yydebug_; + } + + void + ]b4_parser_class_name[::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } +#endif + + int + ]b4_parser_class_name[::parse () + { + /// Lookahead and lookahead in internal form. + int yychar = yyempty_; + int yytoken = 0; + + /* State. */ + int yyn; + int yylen = 0; + int yystate = 0; + + /* Error handling. */ + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// Semantic value of the lookahead. + semantic_type yylval; + /// Location of the lookahead. + location_type yylloc; + /// The locations where the error started and ended. + location_type yyerror_range[2]; + + /// $$. + semantic_type yyval; + /// @@$. + location_type yyloc; + + int yyresult; + + YYCDEBUG << "Starting parse" << std::endl; + +]m4_ifdef([b4_initial_action], [ +m4_pushdef([b4_at_dollar], [yylloc])dnl +m4_pushdef([b4_dollar_dollar], [yylval])dnl + /* User initialization code. */ + b4_user_initial_action +m4_popdef([b4_dollar_dollar])dnl +m4_popdef([b4_at_dollar])])dnl + + [ /* Initialize the stacks. The initial state will be pushed in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystate_stack_ = state_stack_type (0); + yysemantic_stack_ = semantic_stack_type (0); + yylocation_stack_ = location_stack_type (0); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); + + /* New state. */ + yynewstate: + yystate_stack_.push (yystate); + YYCDEBUG << "Entering state " << yystate << std::endl; + + /* Accept? */ + if (yystate == yyfinal_) + goto yyacceptlab; + + goto yybackup; + + /* Backup. */ + yybackup: + + /* Try to take a decision without lookahead. */ + yyn = yypact_[yystate]; + if (yyn == yypact_ninf_) + goto yydefault; + + /* Read a lookahead token. */ + if (yychar == yyempty_) + { + YYCDEBUG << "Reading a token: "; + yychar = ]b4_c_function_call([yylex], [int], + [[YYSTYPE*], [&yylval]][]dnl +b4_locations_if([, [[location*], [&yylloc]]])dnl +m4_ifdef([b4_lex_param], [, ]b4_lex_param))[; + } + + + /* Convert token to internal form. */ + if (yychar <= yyeof_) + { + yychar = yytoken = yyeof_; + YYCDEBUG << "Now at end of input." << std::endl; + } + else + { + yytoken = yytranslate_ (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) + goto yydefault; + + /* Reduce or error. */ + yyn = yytable_[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == yytable_ninf_) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the token being shifted. */ + yychar = yyempty_; + + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus_) + --yyerrstatus_; + + yystate = yyn; + goto yynewstate; + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + /*-----------------------------. + | yyreduce -- Do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. Otherwise, use the top of the stack. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. */ + if (yylen) + yyval = yysemantic_stack_[yylen - 1]; + else + yyval = yysemantic_stack_[0]; + + { + slice slice (yylocation_stack_, yylen); + YYLLOC_DEFAULT (yyloc, slice, yylen); + } + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + ]b4_user_actions[ + default: + break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); + + yypop_ (yylen); + yylen = 0; + YY_STACK_PRINT (); + + yysemantic_stack_.push (yyval); + yylocation_stack_.push (yyloc); + + /* Shift the result of the reduction. */ + yyn = yyr1_[yyn]; + yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0]; + if (0 <= yystate && yystate <= yylast_ + && yycheck_[yystate] == yystate_stack_[0]) + yystate = yytable_[yystate]; + else + yystate = yydefgoto_[yyn - yyntokens_]; + goto yynewstate; + + /*------------------------------------. + | yyerrlab -- here on detecting error | + `------------------------------------*/ + yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus_) + { + ++yynerrs_; + error (yylloc, yysyntax_error_ (yystate]dnl +b4_error_verbose_if([, yytoken])[)); + } + + yyerror_range[0] = yylloc; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= yyeof_) + { + /* Return failure if at end of input. */ + if (yychar == yyeof_) + YYABORT; + } + else + { + yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc); + yychar = yyempty_; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (false) + goto yyerrorlab; + + yyerror_range[0] = yylocation_stack_[yylen - 1]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + yypop_ (yylen); + yylen = 0; + yystate = yystate_stack_[0]; + goto yyerrlab1; + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact_[yystate]; + if (yyn != yypact_ninf_) + { + yyn += yyterror_; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yystate_stack_.height () == 1) + YYABORT; + + yyerror_range[0] = yylocation_stack_[0]; + yydestruct_ ("Error: popping", + yystos_[yystate], + &yysemantic_stack_[0], &yylocation_stack_[0]); + yypop_ (); + yystate = yystate_stack_[0]; + YY_STACK_PRINT (); + } + + yyerror_range[1] = yylloc; + // Using YYLLOC is tempting, but would change the location of + // the lookahead. YYLOC is available though. + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yyloc); + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos_[yyn], + &yysemantic_stack_[0], &yylocation_stack_[0]); + + yystate = yyn; + goto yynewstate; + + /* Accept. */ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + /* Abort. */ + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyreturn: + if (yychar != yyempty_) + yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); + + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + yypop_ (yylen); + while (yystate_stack_.height () != 1) + { + yydestruct_ ("Cleanup: popping", + yystos_[yystate_stack_[0]], + &yysemantic_stack_[0], + &yylocation_stack_[0]); + yypop_ (); + } + + return yyresult; + } + + // Generate an error message. + std::string + ]b4_parser_class_name[::yysyntax_error_ (int yystate]dnl +b4_error_verbose_if([, int tok])[) + { + std::string res; + YYUSE (yystate); +#if YYERROR_VERBOSE + int yyn = yypact_[yystate]; + if (yypact_ninf_ < yyn && yyn <= yylast_) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + 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_; + int count = 0; + for (int x = yyxbegin; x < yyxend; ++x) + if (yycheck_[x + yyn] == x && x != yyterror_) + ++count; + + // FIXME: This method of building the message is not compatible + // with internationalization. It should work like yacc.c does it. + // That is, first build a string that looks like this: + // "syntax error, unexpected %s or %s or %s" + // Then, invoke YY_ on this string. + // Finally, use the string as a format to output + // yytname_[tok], etc. + // Until this gets fixed, this message appears in English only. + res = "syntax error, unexpected "; + res += yytnamerr_ (yytname_[tok]); + if (count < 5) + { + 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; + } + + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_class_name::yypact_ninf_ = b4_pact_ninf[; + const ]b4_int_type_for([b4_pact])[ + ]b4_parser_class_name[::yypact_[] = + { + ]b4_pact[ + }; + + /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ + const ]b4_int_type_for([b4_defact])[ + ]b4_parser_class_name[::yydefact_[] = + { + ]b4_defact[ + }; + + /* YYPGOTO[NTERM-NUM]. */ + const ]b4_int_type_for([b4_pgoto])[ + ]b4_parser_class_name[::yypgoto_[] = + { + ]b4_pgoto[ + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + const ]b4_int_type_for([b4_defgoto])[ + ]b4_parser_class_name[::yydefgoto_[] = + { + ]b4_defgoto[ + }; + + /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + 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_for([b4_table])[ + ]b4_parser_class_name[::yytable_[] = + { + ]b4_table[ + }; + + /* YYCHECK. */ + const ]b4_int_type_for([b4_check])[ + ]b4_parser_class_name[::yycheck_[] = + { + ]b4_check[ + }; + + /* STOS_[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + const ]b4_int_type_for([b4_stos])[ + ]b4_parser_class_name[::yystos_[] = + { + ]b4_stos[ + }; + +#if YYDEBUG + /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding + to YYLEX-NUM. */ + const ]b4_int_type_for([b4_toknum])[ + ]b4_parser_class_name[::yytoken_number_[] = + { + ]b4_toknum[ + }; +#endif + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + const ]b4_int_type_for([b4_r1])[ + ]b4_parser_class_name[::yyr1_[] = + { + ]b4_r1[ + }; + + /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ + const ]b4_int_type_for([b4_r2])[ + ]b4_parser_class_name[::yyr2_[] = + { + ]b4_r2[ + }; + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at \a yyntokens_, nonterminals. */ + const char* + const ]b4_parser_class_name[::yytname_[] = + { + ]b4_tname[ + }; +#endif + +#if YYDEBUG + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ + const ]b4_parser_class_name[::rhs_number_type + ]b4_parser_class_name[::yyrhs_[] = + { + ]b4_rhs[ + }; + + /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ + const ]b4_int_type_for([b4_prhs])[ + ]b4_parser_class_name[::yyprhs_[] = + { + ]b4_prhs[ + }; + + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + const ]b4_int_type_for([b4_rline])[ + ]b4_parser_class_name[::yyrline_[] = + { + ]b4_rline[ + }; + + // Print the state stack on the debug stream. + void + ]b4_parser_class_name[::yystack_print_ () + { + *yycdebug_ << "Stack now"; + for (state_stack_type::const_iterator i = yystate_stack_.begin (); + i != yystate_stack_.end (); ++i) + *yycdebug_ << ' ' << *i; + *yycdebug_ << std::endl; + } + + // Report on the debug stream that the rule \a yyrule is going to be reduced. + void + ]b4_parser_class_name[::yy_reduce_print_ (int yyrule) + { + unsigned int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + /* Print the symbols being reduced, and their result. */ + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 + << " (line " << yylno << "):" << std::endl; + /* The symbols being reduced. */ + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", + yyrhs_[yyprhs_[yyrule] + yyi], + &]b4_rhs_value(yynrhs, yyi + 1)[, + &]b4_rhs_location(yynrhs, yyi + 1)[); + } +#endif // YYDEBUG + + /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ + ]b4_parser_class_name[::token_number_type + ]b4_parser_class_name[::yytranslate_ (int t) + { + static + const token_number_type + translate_table[] = + { + ]b4_translate[ + }; + if ((unsigned int) t <= yyuser_token_number_max_) + return translate_table[t]; + else + return yyundef_token_; + } + + const int ]b4_parser_class_name[::yyeof_ = 0; + const int ]b4_parser_class_name[::yylast_ = ]b4_last[; + const int ]b4_parser_class_name[::yynnts_ = ]b4_nterms_number[; + const int ]b4_parser_class_name[::yyempty_ = -2; + const int ]b4_parser_class_name[::yyfinal_ = ]b4_final_state_number[; + const int ]b4_parser_class_name[::yyterror_ = 1; + const int ]b4_parser_class_name[::yyerrcode_ = 256; + const int ]b4_parser_class_name[::yyntokens_ = ]b4_tokens_number[; + + const unsigned int ]b4_parser_class_name[::yyuser_token_number_max_ = ]b4_user_token_number_max[; + const ]b4_parser_class_name[::token_number_type ]b4_parser_class_name[::yyundef_token_ = ]b4_undef_token_number[; + +]b4_namespace_close[ + +]b4_epilogue +dnl +@output(b4_dir_prefix[]stack.hh@) +b4_copyright([Stack handling for Bison parsers in C++], + [2002, 2003, 2004, 2005, 2006, 2007, 2008])[ + +#ifndef BISON_STACK_HH +# define BISON_STACK_HH + +#include + +]b4_namespace_open[ + template > + class stack + { + public: + + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + + stack () : seq_ () + { + } + + stack (unsigned int n) : seq_ (n) + { + } + + inline + T& + operator [] (unsigned int i) + { + return seq_[i]; + } + + inline + const T& + operator [] (unsigned int i) const + { + return seq_[i]; + } + + inline + void + push (const T& t) + { + seq_.push_front (t); + } + + inline + void + pop (unsigned int n = 1) + { + for (; n; --n) + seq_.pop_front (); + } + + inline + unsigned int + height () const + { + return seq_.size (); + } + + inline const_iterator begin () const { return seq_.rbegin (); } + inline const_iterator end () const { return seq_.rend (); } + + private: + + S seq_; + }; + + /// Present a slice of the top of a stack. + template > + class slice + { + public: + + slice (const S& stack, + unsigned int range) : stack_ (stack), + range_ (range) + { + } + + inline + const T& + operator [] (unsigned int i) const + { + return stack_[range_ - i]; + } + + private: + + const S& stack_; + unsigned int range_; + }; +]b4_namespace_close[ + +#endif // not BISON_STACK_HH[]dnl +] +m4_divert_pop(0) diff --git a/data/lalr1.java b/data/lalr1.java new file mode 100644 index 0000000..7e220d9 --- /dev/null +++ b/data/lalr1.java @@ -0,0 +1,880 @@ +# Java skeleton for Bison -*- autoconf -*- + +# Copyright (C) 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 . + +m4_include(b4_pkgdatadir/[java.m4]) + +b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java], [b4_skeleton])]) +m4_ifval(m4_defn([b4_symbol_destructors]), + [b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])], + []) + +m4_divert_push(0)dnl +@output(b4_parser_file_name@) +b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java], + [2007, 2008]) + +b4_percent_define_ifdef([package], [package b4_percent_define_get([package]); +])[/* First part of user declarations. */ +]b4_pre_prologue +b4_percent_code_get([[imports]]) +[/** + * A Bison parser, automatically generated from ]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[. + * + * @@author LALR (1) parser skeleton written by Paolo Bonzini. + */ +]b4_public_if([public ])dnl +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[ + + /** True if verbose error messages are enabled. */ + public boolean errorVerbose = ]b4_flag_value([error_verbose]); + +b4_locations_if([[ + /** + * A class defining a pair of positions. Positions, defined by the + * ]b4_position_type[ class, denote a point in the input. + * Locations represent a part of the input through the beginning + * and ending positions. */ + public class ]b4_location_type[ { + /** The first, inclusive, position in the range. */ + public ]b4_position_type[ begin; + + /** The first position beyond the range. */ + public ]b4_position_type[ end; + + /** + * Create a ]b4_location_type[ denoting an empty range located at + * a given point. + * @@param loc The position at which the range is anchored. */ + public ]b4_location_type[ (]b4_position_type[ loc) { + this.begin = this.end = loc; + } + + /** + * Create a ]b4_location_type[ from the endpoints of the range. + * @@param begin The first position included in the range. + * @@param end The first position beyond the range. */ + public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) { + this.begin = begin; + this.end = end; + } + + /** + * Print a representation of the location. For this to be correct, + * ]b4_position_type[ should override the equals + * method. */ + public String toString () { + if (begin.equals (end)) + return begin.toString (); + else + return begin.toString () + "-" + end.toString (); + } + } + +]]) + +[ /** Token returned by the scanner to signal the end of its input. */ + public static final int EOF = 0;] + +b4_token_enums(b4_tokens) + + b4_locations_if([[ + private ]b4_location_type[ yylloc (YYStack rhs, int n) + { + if (n > 0) + return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end); + else + return new ]b4_location_type[ (rhs.locationAt (0).end); + }]])[ + + /** + * Communication interface between the scanner and the Bison-generated + * parser ]b4_parser_class_name[. + */ + public interface Lexer { + ]b4_locations_if([[/** + * Method to retrieve the beginning position of the last scanned token. + * @@return the position at which the last scanned token starts. */ + ]b4_position_type[ getStartPos (); + + /** + * Method to retrieve the ending position of the last scanned token. + * @@return the first position beyond the last scanned token. */ + ]b4_position_type[ getEndPos ();]])[ + + /** + * Method to retrieve the semantic value of the last scanned token. + * @@return the semantic value of the last scanned token. */ + ]b4_yystype[ getLVal (); + + /** + * Entry point for the scanner. Returns the token identifier corresponding + * to the next token and prepares to return the semantic value + * ]b4_locations_if([and beginning/ending positions ])[of the token. + * @@return the token identifier corresponding to the next token. */ + int yylex () ]b4_maybe_throws([b4_lex_throws])[; + + /** + * Entry point for error reporting. Emits an error + * ]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 + * error message is related]])[ + * @@param s The string for the error message. */ + void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);] + } + + b4_lexer_if([[private class YYLexer implements Lexer { +]b4_percent_code_get([[lexer]])[ + } + + ]])[/** The object doing lexical analysis for us. */ + private Lexer yylexer; + ] + b4_parse_param_vars + +b4_lexer_if([[ + /** + * Instantiates the Bison-generated parser. + */ + public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) { + this.yylexer = new YYLexer(]b4_lex_param_call[); + ]b4_parse_param_cons[ + } +]]) + + /** + * Instantiates the Bison-generated parser. + * @@param yylexer The scanner that will supply tokens to the parser. + */ + b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) { + this.yylexer = yylexer; + ]b4_parse_param_cons[ + } + + private java.io.PrintStream yyDebugStream = System.err; + + /** + * Return the PrintStream on which the debugging output is + * printed. + */ + public final java.io.PrintStream getDebugStream () { return yyDebugStream; } + + /** + * Set the PrintStream on which the debug output is printed. + * @@param s The stream that is used for debugging output. + */ + public final void setDebugStream(java.io.PrintStream s) { yyDebugStream = s; } + + private int yydebug = 0; + + /** + * Answer the verbosity of the debugging output; 0 means that all kinds of + * output from the parser are suppressed. + */ + public final int getDebugLevel() { return yydebug; } + + /** + * Set the verbosity of the debugging output; 0 means that all kinds of + * output from the parser are suppressed. + * @@param level The verbosity level for debugging output. + */ + public final void setDebugLevel(int level) { yydebug = level; } + + private final int yylex () ]b4_maybe_throws([b4_lex_throws]) [{ + return yylexer.yylex (); + } + protected final void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s) { + yylexer.yyerror (]b4_locations_if([loc, ])[s); + } + + ]b4_locations_if([ + protected final void yyerror (String s) { + yylexer.yyerror ((]b4_location_type[)null, s); + } + protected final void yyerror (]b4_position_type[ loc, String s) { + yylexer.yyerror (new ]b4_location_type[ (loc), s); + }]) + + [protected final void yycdebug (String s) { + if (yydebug > 0) + yyDebugStream.println (s); + } + + private final class YYStack { + private int[] stateStack = new int[16]; + ]b4_locations_if([[private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[ + private ]b4_yystype[[] valueStack = new ]b4_yystype[[16]; + + public int size = 16; + public int height = -1; + + public final void push (int state, ]b4_yystype[ value]dnl + b4_locations_if([, ]b4_location_type[ loc])[) { + height++; + if (size == height) + { + int[] newStateStack = new int[size * 2]; + System.arraycopy (stateStack, 0, newStateStack, 0, height); + stateStack = newStateStack; + ]b4_locations_if([[ + ]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2]; + System.arraycopy (locStack, 0, newLocStack, 0, height); + locStack = newLocStack;]]) + + b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2]; + System.arraycopy (valueStack, 0, newValueStack, 0, height); + valueStack = newValueStack; + + size *= 2; + } + + stateStack[height] = state; + ]b4_locations_if([[locStack[height] = loc;]])[ + valueStack[height] = value; + } + + public final void pop () { + height--; + } + + public final void pop (int num) { + // Avoid memory leaks... garbage collection is a white lie! + if (num > 0) { + java.util.Arrays.fill (valueStack, height - num + 1, height, null); + ]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[ + } + height -= num; + } + + public final int stateAt (int i) { + return stateStack[height - i]; + } + + ]b4_locations_if([[public final ]b4_location_type[ locationAt (int i) { + return locStack[height - i]; + } + + ]])[public final ]b4_yystype[ valueAt (int i) { + return valueStack[height - i]; + } + + // Print the state stack on the debug stream. + public void print (java.io.PrintStream out) + { + out.print ("Stack now"); + + for (int i = 0; i < height; i++) + { + out.print (' '); + out.print (stateStack[i]); + } + out.println (); + } + } + + /** + * Returned by a Bison action in order to stop the parsing process and + * return success (true). */ + public static final int YYACCEPT = 0; + + /** + * Returned by a Bison action in order to stop the parsing process and + * return failure (false). */ + public static final int YYABORT = 1; + + /** + * Returned by a Bison action in order to start error recovery without + * printing an error message. */ + public static final int YYERROR = 2; + + /** + * Returned by a Bison action in order to print an error message and start + * error recovery. */ + public static final int YYFAIL = 3; + + private static final int YYNEWSTATE = 4; + private static final int YYDEFAULT = 5; + private static final int YYREDUCE = 6; + private static final int YYERRLAB1 = 7; + private static final int YYRETURN = 8; + + private int yyerrstatus_ = 0; + + /** + * Return whether error recovery is being done. In this state, the parser + * reads token until it reaches a known state, and then restarts normal + * operation. */ + public final boolean recovering () + { + return yyerrstatus_ == 0; + } + + private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[ + { + ]b4_yystype[ yyval; + ]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[ + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. Otherwise, use the top of the stack. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. */ + if (yylen > 0) + yyval = yystack.valueAt (yylen - 1); + else + yyval = yystack.valueAt (0); + + yy_reduce_print (yyn, yystack); + + switch (yyn) + { + ]b4_user_actions[ + default: break; + } + + yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[); + + yystack.pop (yylen); + yylen = 0; + + /* Shift the result of the reduction. */ + yyn = yyr1_[yyn]; + int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0); + if (0 <= yystate && yystate <= yylast_ + && yycheck_[yystate] == yystack.stateAt (0)) + yystate = yytable_[yystate]; + else + yystate = yydefgoto_[yyn - yyntokens_]; + + yystack.push (yystate, yyval]b4_locations_if([, yyloc])[); + return YYNEWSTATE; + } + + /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + private final String yytnamerr_ (String yystr) + { + if (yystr.charAt (0) == '"') + { + StringBuffer yyr = new StringBuffer (); + strip_quotes: for (int i = 1; i < yystr.length (); i++) + switch (yystr.charAt (i)) + { + case '\'': + case ',': + break strip_quotes; + + case '\\': + if (yystr.charAt(++i) != '\\') + break strip_quotes; + /* Fall through. */ + default: + yyr.append (yystr.charAt (i)); + break; + + case '"': + return yyr.toString (); + } + } + else if (yystr.equals ("$end")) + return "end of input"; + + return yystr; + } + + /*--------------------------------. + | Print this symbol on YYOUTPUT. | + `--------------------------------*/ + + private void yy_symbol_print (String s, int yytype, + ]b4_yystype[ yyvaluep]dnl + b4_locations_if([, Object yylocationp])[) + { + if (yydebug > 0) + yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ") + + yytname_[yytype] + " ("]b4_locations_if([ + + yylocationp + ": "])[ + + (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")"); + } + + /** + * Parse input from the scanner that was specified at object construction + * time. Return whether the end of the input was reached successfully. + * + * @@return true if the parsing succeeds. Note that this does not + * imply that there were no syntax errors. + */ + public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ + { + /// Lookahead and lookahead in internal form. + int yychar = yyempty_; + int yytoken = 0; + + /* State. */ + int yyn = 0; + int yylen = 0; + int yystate = 0; + + YYStack yystack = new YYStack (); + + /* Error handling. */ + int yynerrs_ = 0; + ]b4_locations_if([/// The location where the error started. + ]b4_location_type[ yyerrloc = null; + + /// ]b4_location_type[ of the lookahead. + ]b4_location_type[ yylloc = new ]b4_location_type[ (null, null); + + /// @@$. + ]b4_location_type[ yyloc;]) + + /// Semantic value of the lookahead. + b4_yystype[ yylval = null; + + int yyresult; + + yycdebug ("Starting parse\n"); + yyerrstatus_ = 0; + +]m4_ifdef([b4_initial_action], [ +m4_pushdef([b4_at_dollar], [yylloc])dnl +m4_pushdef([b4_dollar_dollar], [yylval])dnl + /* User initialization code. */ + b4_user_initial_action +m4_popdef([b4_dollar_dollar])dnl +m4_popdef([b4_at_dollar])])dnl + + [ /* Initialize the stack. */ + yystack.push (yystate, yylval]b4_locations_if([, yylloc])[); + + int label = YYNEWSTATE; + for (;;) + switch (label) + { + /* New state. Unlike in the C/C++ skeletons, the state is already + pushed when we come here. */ + case YYNEWSTATE: + yycdebug ("Entering state " + yystate + "\n"); + if (yydebug > 0) + yystack.print (yyDebugStream); + + /* Accept? */ + if (yystate == yyfinal_) + return true; + + /* Take a decision. First try without lookahead. */ + yyn = yypact_[yystate]; + if (yyn == yypact_ninf_) + { + label = YYDEFAULT; + break; + } + + /* Read a lookahead token. */ + if (yychar == yyempty_) + { + yycdebug ("Reading a token: "); + yychar = yylex ();] + b4_locations_if([[ + yylloc = new ]b4_location_type[(yylexer.getStartPos (), + yylexer.getEndPos ());]]) + yylval = yylexer.getLVal ();[ + } + + /* Convert token to internal form. */ + if (yychar <= EOF) + { + yychar = yytoken = EOF; + yycdebug ("Now at end of input.\n"); + } + else + { + yytoken = yytranslate_ (yychar); + yy_symbol_print ("Next token is", yytoken, + yylval]b4_locations_if([, yylloc])[); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) + label = YYDEFAULT; + + /* <= 0 means reduce or error. */ + else if ((yyn = yytable_[yyn]) <= 0) + { + if (yyn == 0 || yyn == yytable_ninf_) + label = YYFAIL; + else + { + yyn = -yyn; + label = YYREDUCE; + } + } + + else + { + /* Shift the lookahead token. */ + yy_symbol_print ("Shifting", yytoken, + yylval]b4_locations_if([, yylloc])[); + + /* Discard the token being shifted. */ + yychar = yyempty_; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus_ > 0) + --yyerrstatus_; + + yystate = yyn; + yystack.push (yystate, yylval]b4_locations_if([, yylloc])[); + label = YYNEWSTATE; + } + break; + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + case YYDEFAULT: + yyn = yydefact_[yystate]; + if (yyn == 0) + label = YYFAIL; + else + label = YYREDUCE; + break; + + /*-----------------------------. + | yyreduce -- Do a reduction. | + `-----------------------------*/ + case YYREDUCE: + yylen = yyr2_[yyn]; + label = yyaction (yyn, yystack, yylen); + yystate = yystack.stateAt (0); + break; + + /*------------------------------------. + | yyerrlab -- here on detecting error | + `------------------------------------*/ + case YYFAIL: + /* If not already recovering from an error, report this error. */ + if (yyerrstatus_ == 0) + { + ++yynerrs_; + yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken)); + } + + ]b4_locations_if([yyerrloc = yylloc;])[ + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= EOF) + { + /* Return failure if at end of input. */ + if (yychar == EOF) + return false; + } + else + yychar = yyempty_; + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + label = YYERRLAB1; + break; + + /*---------------------------------------------------. + | errorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + case YYERROR: + + ]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[ + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + yystack.pop (yylen); + yylen = 0; + yystate = yystack.stateAt (0); + label = YYERRLAB1; + break; + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + case YYERRLAB1: + yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact_[yystate]; + if (yyn != yypact_ninf_) + { + yyn += yyterror_; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yystack.height == 1) + return false; + + ]b4_locations_if([yyerrloc = yystack.locationAt (0);])[ + yystack.pop (); + yystate = yystack.stateAt (0); + if (yydebug > 0) + yystack.print (yyDebugStream); + } + + ]b4_locations_if([ + /* Muck with the stack to setup for yylloc. */ + yystack.push (0, null, yylloc); + yystack.push (0, null, yyerrloc); + yyloc = yylloc (yystack, 2); + yystack.pop (2);])[ + + /* Shift the error token. */ + yy_symbol_print ("Shifting", yystos_[yyn], + yylval]b4_locations_if([, yyloc])[); + + yystate = yyn; + yystack.push (yyn, yylval]b4_locations_if([, yyloc])[); + label = YYNEWSTATE; + break; + + /* Accept. */ + case YYACCEPT: + return true; + + /* Abort. */ + case YYABORT: + return false; + } + } + + // Generate an error message. + private String yysyntax_error (int yystate, int tok) + { + if (errorVerbose) + { + int yyn = yypact_[yystate]; + if (yypact_ninf_ < yyn && yyn <= yylast_) + { + StringBuffer res; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + 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_; + int count = 0; + for (int x = yyxbegin; x < yyxend; ++x) + if (yycheck_[x + yyn] == x && x != yyterror_) + ++count; + + // FIXME: This method of building the message is not compatible + // with internationalization. + res = new StringBuffer ("syntax error, unexpected "); + res.append (yytnamerr_ (yytname_[tok])); + if (count < 5) + { + count = 0; + for (int x = yyxbegin; x < yyxend; ++x) + if (yycheck_[x + yyn] == x && x != yyterror_) + { + res.append (count++ == 0 ? ", expecting " : " or "); + res.append (yytnamerr_ (yytname_[x])); + } + } + return res.toString (); + } + } + + return "syntax error"; + } + + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[; + private static final ]b4_int_type_for([b4_pact])[ yypact_[] = + { + ]b4_pact[ + }; + + /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ + private static final ]b4_int_type_for([b4_defact])[ yydefact_[] = + { + ]b4_defact[ + }; + + /* YYPGOTO[NTERM-NUM]. */ + private static final ]b4_int_type_for([b4_pgoto])[ yypgoto_[] = + { + ]b4_pgoto[ + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + private static final ]b4_int_type_for([b4_defgoto])[ + yydefgoto_[] = + { + ]b4_defgoto[ + }; + + /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + 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_[] = + { + ]b4_table[ + }; + + /* YYCHECK. */ + private static final ]b4_int_type_for([b4_check])[ + yycheck_[] = + { + ]b4_check[ + }; + + /* STOS_[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + private static final ]b4_int_type_for([b4_stos])[ + yystos_[] = + { + ]b4_stos[ + }; + + /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding + to YYLEX-NUM. */ + private static final ]b4_int_type_for([b4_toknum])[ + yytoken_number_[] = + { + ]b4_toknum[ + }; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + private static final ]b4_int_type_for([b4_r1])[ + yyr1_[] = + { + ]b4_r1[ + }; + + /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ + private static final ]b4_int_type_for([b4_r2])[ + yyr2_[] = + { + ]b4_r2[ + }; + + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at \a yyntokens_, nonterminals. */ + private static final String yytname_[] = + { + ]b4_tname[ + }; + + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ + private static final ]b4_int_type_for([b4_rhs])[ yyrhs_[] = + { + ]b4_rhs[ + }; + + /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ + private static final ]b4_int_type_for([b4_prhs])[ yyprhs_[] = + { + ]b4_prhs[ + }; + + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + private static final ]b4_int_type_for([b4_rline])[ yyrline_[] = + { + ]b4_rline[ + }; + + // Report on the debug stream that the rule yyrule is going to be reduced. + private void yy_reduce_print (int yyrule, YYStack yystack) + { + if (yydebug == 0) + return; + + int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + /* Print the symbols being reduced, and their result. */ + yycdebug ("Reducing stack by rule " + (yyrule - 1) + + " (line " + yylno + "), "); + + /* The symbols being reduced. */ + for (int yyi = 0; yyi < yynrhs; yyi++) + yy_symbol_print (" $" + (yyi + 1) + " =", + yyrhs_[yyprhs_[yyrule] + yyi], + ]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([, + b4_rhs_location(yynrhs, yyi + 1)])[); + } + + /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ + private static final ]b4_int_type_for([b4_translate])[ yytranslate_table_[] = + { + ]b4_translate[ + }; + + private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t) + { + if (t >= 0 && t <= yyuser_token_number_max_) + return yytranslate_table_[t]; + else + return yyundef_token_; + } + + private static final int yylast_ = ]b4_last[; + private static final int yynnts_ = ]b4_nterms_number[; + private static final int yyempty_ = -2; + private static final int yyfinal_ = ]b4_final_state_number[; + private static final int yyterror_ = 1; + private static final int yyerrcode_ = 256; + private static final int yyntokens_ = ]b4_tokens_number[; + + private static final int yyuser_token_number_max_ = ]b4_user_token_number_max[; + private static final int yyundef_token_ = ]b4_undef_token_number[; + +]/* User implementation code. */ +b4_percent_code_get[]dnl + +} + +b4_epilogue +m4_divert_pop(0)dnl diff --git a/data/location.cc b/data/location.cc new file mode 100644 index 0000000..4b79069 --- /dev/null +++ b/data/location.cc @@ -0,0 +1,275 @@ +# C++ skeleton for Bison + +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 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 . + +# We do want M4 expansion after # for CPP macros. +m4_changecom() +m4_divert_push(0)dnl +@output(b4_dir_prefix[]position.hh@) +b4_copyright([Positions for Bison parsers in C++], + [2002, 2003, 2004, 2005, 2006])[ + +/** + ** \file position.hh + ** Define the ]b4_namespace_ref[::position class. + */ + +#ifndef BISON_POSITION_HH +# define BISON_POSITION_HH + +# include +# include +# include + +]b4_namespace_open[ + /// Abstract a position. + class position + { + public: +]m4_ifdef([b4_location_constructors], [ + /// Construct a position. + position () + : filename (0), line (]b4_location_initial_line[), column (]b4_location_initial_column[) + { + } + +])[ + /// Initialization. + inline void initialize (]b4_percent_define_get([[filename_type]])[* fn) + { + filename = fn; + line = ]b4_location_initial_line[; + column = ]b4_location_initial_column[; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// (line related) Advance to the COUNT next lines. + inline void lines (int count = 1) + { + column = ]b4_location_initial_column[; + line += count; + } + + /// (column related) Advance to the COUNT next columns. + inline void columns (int count = 1) + { + column = std::max (]b4_location_initial_column[u, column + count); + } + /** \} */ + + public: + /// File name to which this position refers. + ]b4_percent_define_get([[filename_type]])[* filename; + /// Current line number. + unsigned int line; + /// Current column number. + unsigned int column; + }; + + /// Add and assign a position. + inline const position& + operator+= (position& res, const int width) + { + res.columns (width); + return res; + } + + /// Add two position objects. + inline const position + operator+ (const position& begin, const int width) + { + position res = begin; + return res += width; + } + + /// Add and assign a position. + inline const position& + operator-= (position& res, const int width) + { + return res += -width; + } + + /// Add two position objects. + inline const position + operator- (const position& begin, const int width) + { + return begin + -width; + } +]b4_percent_define_flag_if([[define_location_comparison]], [[ + /// Compare two position objects. + inline bool + operator== (const position& pos1, const position& pos2) + { + return + (pos1.filename == pos2.filename + || pos1.filename && pos2.filename && *pos1.filename == *pos2.filename) + && pos1.line == pos2.line && pos1.column == pos2.column; + } + + /// Compare two position objects. + inline bool + operator!= (const position& pos1, const position& pos2) + { + return !(pos1 == pos2); + } +]])[ + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + inline std::ostream& + operator<< (std::ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + +]b4_namespace_close[ +#endif // not BISON_POSITION_HH] +@output(b4_dir_prefix[]location.hh@) +b4_copyright([Locations for Bison parsers in C++], + [2002, 2003, 2004, 2005, 2006])[ + +/** + ** \file location.hh + ** Define the ]b4_namespace_ref[::location class. + */ + +#ifndef BISON_LOCATION_HH +# define BISON_LOCATION_HH + +# include +# include +# include "position.hh" + +]b4_namespace_open[ + + /// Abstract a location. + class location + { + public: +]m4_ifdef([b4_location_constructors], [ + /// Construct a location. + location () + : begin (), end () + { + } + +])[ + /// Initialization. + inline void initialize (]b4_percent_define_get([[filename_type]])[* fn) + { + begin.initialize (fn); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + inline void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + inline void columns (unsigned int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + inline void lines (unsigned int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two location objects to create a location. + inline const location operator+ (const location& begin, const location& end) + { + location res = begin; + res.end = end.end; + return res; + } + + /// Add two location objects. + inline const location operator+ (const location& begin, unsigned int width) + { + location res = begin; + res.columns (width); + return res; + } + + /// Add and assign a location. + inline location& operator+= (location& res, unsigned int width) + { + res.columns (width); + return res; + } +]b4_percent_define_flag_if([[define_location_comparison]], [[ + /// Compare two location objects. + inline bool + operator== (const location& loc1, const location& loc2) + { + return loc1.begin == loc2.begin && loc1.end == loc2.end; + } + + /// Compare two location objects. + inline bool + operator!= (const location& loc1, const location& loc2) + { + return !(loc1 == loc2); + } +]])[ + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + inline std::ostream& operator<< (std::ostream& ostr, const location& loc) + { + position last = loc.end - 1; + ostr << loc.begin; + if (last.filename + && (!loc.begin.filename + || *loc.begin.filename != *last.filename)) + ostr << '-' << last; + else if (loc.begin.line != last.line) + ostr << '-' << last.line << '.' << last.column; + else if (loc.begin.column != last.column) + ostr << '-' << last.column; + return ostr; + } + +]b4_namespace_close[ + +#endif // not BISON_LOCATION_HH] +m4_divert_pop(0) +m4_changecom([#]) diff --git a/data/m4sugar/foreach.m4 b/data/m4sugar/foreach.m4 new file mode 100644 index 0000000..cd4d1fc --- /dev/null +++ b/data/m4sugar/foreach.m4 @@ -0,0 +1,400 @@ +# -*- Autoconf -*- +# This file is part of Autoconf. +# foreach-based replacements for recursive functions. +# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes +# GNU M4 1.6 by requiring more memory and macro expansions. +# +# Copyright (C) 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 . + +# As a special exception, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by Eric Blake. +# + +# In M4 1.4.x, every byte of $@ is rescanned. This means that an +# algorithm on n arguments that recurses with one less argument each +# iteration will scan n * (n + 1) / 2 arguments, for O(n^2) time. In +# M4 1.6, this was fixed so that $@ is only scanned once, then +# back-references are made to information stored about the scan. +# Thus, n iterations need only scan n arguments, for O(n) time. +# Additionally, in M4 1.4.x, recursive algorithms did not clean up +# memory very well, requiring O(n^2) memory rather than O(n) for n +# iterations. +# +# This file is designed to overcome the quadratic nature of $@ +# recursion by writing a variant of m4_foreach that uses m4_for rather +# than $@ recursion to operate on the list. This involves more macro +# expansions, but avoids the need to rescan a quadratic number of +# arguments, making these replacements very attractive for M4 1.4.x. +# On the other hand, in any version of M4, expanding additional macros +# costs additional time; therefore, in M4 1.6, where $@ recursion uses +# fewer macros, these replacements actually pessimize performance. +# Additionally, the use of $10 to mean the tenth argument violates +# POSIX; although all versions of m4 1.4.x support this meaning, a +# future m4 version may switch to take it as the first argument +# concatenated with a literal 0, so the implementations in this file +# are not future-proof. Thus, this file is conditionally included as +# part of m4_init(), only when it is detected that M4 probably has +# quadratic behavior (ie. it lacks the macro __m4_version__). +# +# Please keep this file in sync with m4sugar.m4. + +# m4_foreach(VARIABLE, LIST, EXPRESSION) +# -------------------------------------- +# Expand EXPRESSION assigning each value of the LIST to VARIABLE. +# LIST should have the form `item_1, item_2, ..., item_n', i.e. the +# whole list must *quoted*. Quote members too if you don't want them +# to be expanded. +# +# This version minimizes the number of times that $@ is evaluated by +# using m4_for to generate a boilerplate into VARIABLE then passing $@ +# to that temporary macro. Thus, the recursion is done in m4_for +# without reparsing any user input, and is not quadratic. For an idea +# of how this works, note that m4_foreach(i,[1,2],[i]) defines i to be +# m4_define([$1],[$3])$2[]m4_define([$1],[$4])$2[]m4_popdef([i]) +# then calls i([i],[i],[1],[2]). +m4_define([m4_foreach], +[m4_if([$2], [], [], [_$0([$1], [$3], $2)])]) + +m4_define([_m4_foreach], +[m4_define([$1], m4_pushdef([$1])_m4_for([$1], [3], [$#], [1], + [$0_([1], [2], _m4_defn([$1]))])[m4_popdef([$1])])m4_indir([$1], $@)]) + +m4_define([_m4_foreach_], +[[m4_define([$$1], [$$3])$$2[]]]) + +# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT) +# ----------------------------------------------------------- +# Find the first VAL that SWITCH matches, and expand the corresponding +# IF-VAL. If there are no matches, expand DEFAULT. +# +# Use m4_for to create a temporary macro in terms of a boilerplate +# m4_if with final cleanup. If $# is even, we have DEFAULT; if it is +# odd, then rounding the last $# up in the temporary macro is +# harmless. For example, both m4_case(1,2,3,4,5) and +# m4_case(1,2,3,4,5,6) result in the intermediate _m4_case being +# m4_if([$1],[$2],[$3],[$1],[$4],[$5],_m4_popdef([_m4_case])[$6]) +m4_define([m4_case], +[m4_if(m4_eval([$# <= 2]), [1], [$2], +[m4_pushdef([_$0], [m4_if(]m4_for([_m4_count], [2], m4_decr([$#]), [2], + [_$0_([1], _m4_count, m4_incr(_m4_count))])[_m4_popdef( + [_$0])]m4_dquote($m4_eval([($# + 1) & ~1]))[)])_$0($@)])]) + +m4_define([_m4_case_], +[[[$$1],[$$2],[$$3],]]) + +# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT) +# ----------------------------------------------------- +# m4 equivalent of +# +# if (SWITCH =~ RE1) +# VAL1; +# elif (SWITCH =~ RE2) +# VAL2; +# elif ... +# ... +# else +# DEFAULT +# +# We build the temporary macro _m4_b: +# m4_define([_m4_b], _m4_defn([_m4_bmatch]))_m4_b([$1], [$2], [$3])... +# _m4_b([$1], [$m-1], [$m])_m4_b([], [], [$m+1]_m4_popdef([_m4_b])) +# then invoke m4_unquote(_m4_b($@)), for concatenation with later text. +m4_define([m4_bmatch], +[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [$2], + [m4_define([_m4_b], m4_pushdef([_m4_b])[m4_define([_m4_b], + _m4_defn([_$0]))]_m4_for([_m4_b], [3], m4_eval([($# + 1) / 2 * 2 - 1]), + [2], [_$0_([1], m4_decr(_m4_b), _m4_b)])[_m4_b([], [],]m4_dquote( + [$]m4_incr(_m4_b))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])]) + +m4_define([_m4_bmatch], +[m4_if(m4_bregexp([$1], [$2]), [-1], [], [[$3]m4_define([$0])])]) + +m4_define([_m4_bmatch_], +[[_m4_b([$$1], [$$2], [$$3])]]) + + +# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT]) +# ------------------------------------------------------------------- +# Similar to m4_if, except that each TEST is expanded when encountered. +# If the expansion of TESTn matches the string VALn, the result is IF-VALn. +# The result is DEFAULT if no tests passed. This macro allows +# short-circuiting of expensive tests, where it pays to arrange quick +# filter tests to run first. +# +# m4_cond already guarantees either 3*n or 3*n + 1 arguments, 1 <= n. +# We only have to speed up _m4_cond, by building the temporary _m4_c: +# m4_define([_m4_c], _m4_defn([m4_unquote]))_m4_c([m4_if(($1), [($2)], +# [[$3]m4_define([_m4_c])])])_m4_c([m4_if(($4), [($5)], +# [[$6]m4_define([_m4_c])])])..._m4_c([m4_if(($m-2), [($m-1)], +# [[$m]m4_define([_m4_c])])])_m4_c([[$m+1]]_m4_popdef([_m4_c])) +# We invoke m4_unquote(_m4_c($@)), for concatenation with later text. +m4_define([_m4_cond], +[m4_define([_m4_c], m4_pushdef([_m4_c])[m4_define([_m4_c], + _m4_defn([m4_unquote]))]_m4_for([_m4_c], [2], m4_eval([$# / 3 * 3 - 1]), [3], + [$0_(m4_decr(_m4_c), _m4_c, m4_incr(_m4_c))])[_m4_c(]m4_dquote(m4_dquote( + [$]m4_eval([$# / 3 * 3 + 1])))[_m4_popdef([_m4_c]))])m4_unquote(_m4_c($@))]) + +m4_define([_m4_cond_], +[[_m4_c([m4_if(($$1), [($$2)], [[$$3]m4_define([_m4_c])])])]]) + +# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...) +# ---------------------------------------------------- +# m4 equivalent of +# +# $_ = STRING; +# s/RE1/SUBST1/g; +# s/RE2/SUBST2/g; +# ... +# +# m4_bpatsubsts already validated an odd number of arguments; we only +# need to speed up _m4_bpatsubsts. To avoid nesting, we build the +# temporary _m4_p: +# m4_define([_m4_p], [$1])m4_define([_m4_p], +# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$2], [$3]))m4_define([_m4_p], +# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$4], [$5]))m4_define([_m4_p],... +# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$m-1], [$m]))m4_unquote( +# _m4_defn([_m4_p])_m4_popdef([_m4_p])) +m4_define([_m4_bpatsubsts], +[m4_define([_m4_p], m4_pushdef([_m4_p])[m4_define([_m4_p], + ]m4_dquote([$]1)[)]_m4_for([_m4_p], [3], [$#], [2], [$0_(m4_decr(_m4_p), + _m4_p)])[m4_unquote(_m4_defn([_m4_p])_m4_popdef([_m4_p]))])_m4_p($@)]) + +m4_define([_m4_bpatsubsts_], +[[m4_define([_m4_p], +m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$$1], [$$2]))]]) + +# m4_shiftn(N, ...) +# ----------------- +# Returns ... shifted N times. Useful for recursive "varargs" constructs. +# +# m4_shiftn already validated arguments; we only need to speed up +# _m4_shiftn. If N is 3, then we build the temporary _m4_s, defined as +# ,[$5],[$6],...,[$m]_m4_popdef([_m4_s]) +# before calling m4_shift(_m4_s($@)). +m4_define([_m4_shiftn], +[m4_if(m4_incr([$1]), [$#], [], [m4_define([_m4_s], + m4_pushdef([_m4_s])_m4_for([_m4_s], m4_eval([$1 + 2]), [$#], [1], + [[,]m4_dquote([$]_m4_s)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])]) + +# m4_do(STRING, ...) +# ------------------ +# This macro invokes all its arguments (in sequence, of course). It is +# useful for making your macros more structured and readable by dropping +# unnecessary dnl's and have the macros indented properly. +# +# Here, we use the temporary macro _m4_do, defined as +# $1[]$2[]...[]$n[]_m4_popdef([_m4_do]) +m4_define([m4_do], +[m4_if([$#], [0], [], + [m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [1], [$#], [1], + [$_$0[[]]])[_m4_popdef([_$0])])_$0($@)])]) + +# m4_dquote_elt(ARGS) +# ------------------- +# Return ARGS as an unquoted list of double-quoted arguments. +# +# m4_foreach to the rescue. It's easier to shift off the leading comma. +m4_define([m4_dquote_elt], +[m4_shift(m4_foreach([_m4_elt], [$@], [,m4_dquote(_m4_defn([_m4_elt]))]))]) + +# m4_reverse(ARGS) +# ---------------- +# Output ARGS in reverse order. +# +# Invoke _m4_r($@) with the temporary _m4_r built as +# [$m], [$m-1], ..., [$2], [$1]_m4_popdef([_m4_r]) +m4_define([m4_reverse], +[m4_if([$#], [0], [], [$#], [1], [[$1]], +[m4_define([_m4_r], m4_dquote([$$#])m4_pushdef([_m4_r])_m4_for([_m4_r], + m4_decr([$#]), [1], [-1], + [[, ]m4_dquote([$]_m4_r)])[_m4_popdef([_m4_r])])_m4_r($@)])]) + + +# m4_map(MACRO, LIST) +# ------------------- +# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements +# of LIST. $1, $2... must in turn be lists, appropriate for m4_apply. +# +# m4_map/m4_map_sep only execute once; the speedup comes in fixing +# _m4_map. The mismatch in () is intentional, since $1 supplies the +# opening `(' (but it sure looks odd!). Build the temporary _m4_m: +# $1, [$3])$1, [$4])...$1, [$m])_m4_popdef([_m4_m]) +m4_define([_m4_map], +[m4_if([$#], [2], [], + [m4_define([_m4_m], m4_pushdef([_m4_m])_m4_for([_m4_m], [3], [$#], [1], + [$0_([1], _m4_m)])[_m4_popdef([_m4_m])])_m4_m($@)])]) + +m4_define([_m4_map_], +[[$$1, [$$2])]]) + +# m4_transform(EXPRESSION, ARG...) +# -------------------------------- +# Expand EXPRESSION([ARG]) for each argument. More efficient than +# m4_foreach([var], [ARG...], [EXPRESSION(m4_defn([var]))]) +# +# Invoke the temporary macro _m4_transform, defined as: +# $1([$2])[]$1([$3])[]...$1([$m])[]_m4_popdef([_m4_transform]) +m4_define([m4_transform], +[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [], + [m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [2], [$#], [1], + [_$0_([1], _$0)])[_m4_popdef([_$0])])_$0($@)])]) + +m4_define([_m4_transform_], +[[$$1([$$2])[]]]) + +# m4_transform_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...) +# -------------------------------------------------------------- +# Perform a pairwise grouping of consecutive ARGs, by expanding +# EXPRESSION([ARG1], [ARG2]). If there are an odd number of ARGs, the +# final argument is expanded with END-EXPR([ARGn]). +# +# Build the temporary macro _m4_transform_pair, with the $2([$m+1]) +# only output if $# is odd: +# $1([$3], [$4])[]$1([$5], [$6])[]...$1([$m-1], +# [$m])[]m4_default([$2], [$1])([$m+1])[]_m4_popdef([_m4_transform_pair]) +m4_define([m4_transform_pair], +[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [m4_fatal([$0: too few arguments: $#: $1])], + [$#], [2], [], + [$#], [3], [m4_default([$2], [$1])([$3])[]], + [m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [3], + m4_eval([$# / 2 * 2 - 1]), [2], [_$0_([1], _$0, m4_incr(_$0))])_$0_end( + [1], [2], [$#])[_m4_popdef([_$0])])_$0($@)])]) + +m4_define([_m4_transform_pair_], +[[$$1([$$2], [$$3])[]]]) + +m4_define([_m4_transform_pair_end], +[m4_if(m4_eval([$3 & 1]), [1], [[m4_default([$$2], [$$1])([$$3])[]]])]) + +# m4_join(SEP, ARG1, ARG2...) +# --------------------------- +# Produce ARG1SEPARG2...SEPARGn. Avoid back-to-back SEP when a given ARG +# is the empty string. No expansion is performed on SEP or ARGs. +# +# Use a self-modifying separator, since we don't know how many +# arguments might be skipped before a separator is first printed, but +# be careful if the separator contains $. m4_foreach to the rescue. +m4_define([m4_join], +[m4_pushdef([_m4_sep], [m4_define([_m4_sep], _m4_defn([m4_echo]))])]dnl +[m4_foreach([_m4_arg], [m4_shift($@)], + [m4_ifset([_m4_arg], [_m4_sep([$1])_m4_defn([_m4_arg])])])]dnl +[_m4_popdef([_m4_sep])]) + +# m4_joinall(SEP, ARG1, ARG2...) +# ------------------------------ +# Produce ARG1SEPARG2...SEPARGn. An empty ARG results in back-to-back SEP. +# No expansion is performed on SEP or ARGs. +# +# A bit easier than m4_join. m4_foreach to the rescue. +m4_define([m4_joinall], +[[$2]m4_if(m4_eval([$# <= 2]), [1], [], + [m4_foreach([_m4_arg], [m4_shift2($@)], + [[$1]_m4_defn([_m4_arg])])])]) + +# m4_list_cmp(A, B) +# ----------------- +# Compare the two lists of integer expressions A and B. +# +# m4_list_cmp takes care of any side effects; we only override +# _m4_list_cmp_raw, where we can safely expand lists multiple times. +# First, insert padding so that both lists are the same length; the +# trailing +0 is necessary to handle a missing list. Next, create a +# temporary macro to perform pairwise comparisons until an inequality +# is found. For example, m4_list_cmp([1], [1,2]) creates _m4_cmp as +# m4_if(m4_eval([($1) != ($3)]), [1], [m4_cmp([$1], [$3])], +# m4_eval([($2) != ($4)]), [1], [m4_cmp([$2], [$4])], +# [0]_m4_popdef([_m4_cmp], [_m4_size])) +# then calls _m4_cmp([1+0], [0], [1], [2+0]) +m4_define([_m4_list_cmp_raw], +[m4_if([$1], [$2], 0, [m4_pushdef( + [_m4_size])_m4_list_cmp($1+0_m4_list_pad(m4_count($1), m4_count($2)), + $2+0_m4_list_pad(m4_count($2), m4_count($1)))])]) + +m4_define([_m4_list_pad], +[m4_if(m4_eval($1 < $2), [1], + [_m4_for([_m4_size], m4_incr([$1]), [$2], [1], [,0])])]) + +m4_define([_m4_list_cmp], +[m4_define([_m4_size], m4_eval([$# >> 1]))]dnl +[m4_define([_m4_cmp], m4_pushdef([_m4_cmp])[m4_if(]_m4_for([_m4_cmp], + [1], _m4_size, [1], [$0_(_m4_cmp, m4_eval(_m4_cmp + _m4_size))])[ + [0]_m4_popdef([_m4_cmp], [_m4_size]))])_m4_cmp($@)]) + +m4_define([_m4_list_cmp_], +[[m4_eval([($$1) != ($$2)]), [1], [m4_cmp([$$1], [$$2])], +]]) + +# m4_max(EXPR, ...) +# m4_min(EXPR, ...) +# ----------------- +# Return the decimal value of the maximum (or minimum) in a series of +# integer expressions. +# +# m4_foreach to the rescue; we only need to replace _m4_minmax. Here, +# we need a temporary macro to track the best answer so far, so that +# the foreach expression is tractable. +m4_define([_m4_minmax], +[m4_pushdef([_m4_best], m4_eval([$2]))m4_foreach([_m4_arg], [m4_shift2($@)], + [m4_define([_m4_best], $1(_m4_best, _m4_defn([_m4_arg])))])]dnl +[_m4_best[]_m4_popdef([_m4_best])]) + +# m4_set_add_all(SET, VALUE...) +# ----------------------------- +# Add each VALUE into SET. This is O(n) in the number of VALUEs, and +# can be faster than calling m4_set_add for each VALUE. +# +# m4_foreach to the rescue. If no deletions have occurred, then avoid +# the speed penalty of m4_set_add. +m4_define([m4_set_add_all], +[m4_if([$#], [0], [], [$#], [1], [], + [m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1]) + + m4_len(m4_foreach([_m4_arg], [m4_shift($@)], + m4_ifdef([_m4_set_cleanup($1)], + [[m4_set_add([$1], _m4_defn([_m4_arg]))]], + [[m4_ifdef([_m4_set([$1],]_m4_defn([_m4_arg])[)], [], + [m4_define([_m4_set([$1],]_m4_defn([_m4_arg])[)], + [1])m4_pushdef([_m4_set([$1])], + _m4_defn([_m4_arg]))-])]])))))])]) diff --git a/data/m4sugar/m4sugar.m4 b/data/m4sugar/m4sugar.m4 new file mode 100644 index 0000000..6fbd343 --- /dev/null +++ b/data/m4sugar/m4sugar.m4 @@ -0,0 +1,2789 @@ +divert(-1)# -*- Autoconf -*- +# This file is part of Autoconf. +# Base M4 layer. +# Requires GNU M4. +# +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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 . + +# As a special exception, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by Akim Demaille. +# + +# Set the quotes, whatever the current quoting system. +changequote() +changequote([, ]) + +# Some old m4's don't support m4exit. But they provide +# equivalent functionality by core dumping because of the +# long macros we define. +ifdef([__gnu__], , +[errprint(M4sugar requires GNU M4. Install it before installing M4sugar or +set the M4 environment variable to its absolute file name.) +m4exit(2)]) + + +## ------------------------------- ## +## 1. Simulate --prefix-builtins. ## +## ------------------------------- ## + +# m4_define +# m4_defn +# m4_undefine +define([m4_define], defn([define])) +define([m4_defn], defn([defn])) +define([m4_undefine], defn([undefine])) + +m4_undefine([define]) +m4_undefine([defn]) +m4_undefine([undefine]) + + +# m4_copy(SRC, DST) +# ----------------- +# Define DST as the definition of SRC. +# What's the difference between: +# 1. m4_copy([from], [to]) +# 2. m4_define([to], [from($@)]) +# Well, obviously 1 is more expensive in space. Maybe 2 is more expensive +# in time, but because of the space cost of 1, it's not that obvious. +# Nevertheless, one huge difference is the handling of `$0'. If `from' +# uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2. +# The user would certainly prefer to see `to'. +m4_define([m4_copy], +[m4_define([$2], m4_defn([$1]))]) + + +# m4_rename(SRC, DST) +# ------------------- +# Rename the macro SRC to DST. +m4_define([m4_rename], +[m4_copy([$1], [$2])m4_undefine([$1])]) + + +# m4_rename_m4(MACRO-NAME) +# ------------------------ +# Rename MACRO-NAME to m4_MACRO-NAME. +m4_define([m4_rename_m4], +[m4_rename([$1], [m4_$1])]) + + +# m4_copy_unm4(m4_MACRO-NAME) +# --------------------------- +# Copy m4_MACRO-NAME to MACRO-NAME. +m4_define([m4_copy_unm4], +[m4_copy([$1], m4_bpatsubst([$1], [^m4_\(.*\)], [[\1]]))]) + + +# Some m4 internals have names colliding with tokens we might use. +# Rename them a` la `m4 --prefix-builtins'. Conditionals first, since +# some subsequent renames are conditional. +m4_rename_m4([ifdef]) +m4_rename([ifelse], [m4_if]) + +m4_rename_m4([builtin]) +m4_rename_m4([changecom]) +m4_rename_m4([changequote]) +m4_ifdef([changeword],dnl conditionally available in 1.4.x +[m4_undefine([changeword])]) +m4_rename_m4([debugfile]) +m4_rename_m4([debugmode]) +m4_rename_m4([decr]) +m4_undefine([divert]) +m4_rename_m4([divnum]) +m4_rename_m4([dumpdef]) +m4_rename_m4([errprint]) +m4_rename_m4([esyscmd]) +m4_rename_m4([eval]) +m4_rename_m4([format]) +m4_undefine([include]) +m4_rename_m4([incr]) +m4_rename_m4([index]) +m4_rename_m4([indir]) +m4_rename_m4([len]) +m4_rename([m4exit], [m4_exit]) +m4_undefine([m4wrap]) +m4_ifdef([mkstemp],dnl added in M4 1.4.8 +[m4_rename_m4([mkstemp]) +m4_copy([m4_mkstemp], [m4_maketemp]) +m4_undefine([maketemp])], +[m4_rename_m4([maketemp]) +m4_copy([m4_maketemp], [m4_mkstemp])]) +m4_rename([patsubst], [m4_bpatsubst]) +m4_rename_m4([popdef]) +m4_rename_m4([pushdef]) +m4_rename([regexp], [m4_bregexp]) +m4_rename_m4([shift]) +m4_undefine([sinclude]) +m4_rename_m4([substr]) +m4_ifdef([symbols],dnl present only in alpha-quality 1.4o +[m4_rename_m4([symbols])]) +m4_rename_m4([syscmd]) +m4_rename_m4([sysval]) +m4_rename_m4([traceoff]) +m4_rename_m4([traceon]) +m4_rename_m4([translit]) +m4_undefine([undivert]) + + +## ------------------- ## +## 2. Error messages. ## +## ------------------- ## + + +# m4_location +# ----------- +m4_define([m4_location], +[__file__:__line__]) + + +# m4_errprintn(MSG) +# ----------------- +# Same as `errprint', but with the missing end of line. +m4_define([m4_errprintn], +[m4_errprint([$1 +])]) + + +# m4_warning(MSG) +# --------------- +# Warn the user. +m4_define([m4_warning], +[m4_errprintn(m4_location[: warning: $1])]) + + +# m4_fatal(MSG, [EXIT-STATUS]) +# ---------------------------- +# Fatal the user. :) +m4_define([m4_fatal], +[m4_errprintn(m4_location[: error: $1])dnl +m4_expansion_stack_dump()dnl +m4_exit(m4_if([$2],, 1, [$2]))]) + + +# m4_assert(EXPRESSION, [EXIT-STATUS = 1]) +# ---------------------------------------- +# This macro ensures that EXPRESSION evaluates to true, and exits if +# EXPRESSION evaluates to false. +m4_define([m4_assert], +[m4_if(m4_eval([$1]), 0, + [m4_fatal([assert failed: $1], [$2])])]) + + + +## ------------- ## +## 3. Warnings. ## +## ------------- ## + + +# _m4_warn(CATEGORY, MESSAGE, STACK-TRACE) +# ---------------------------------------- +# Report a MESSAGE to the user if the CATEGORY of warnings is enabled. +# This is for traces only. +# The STACK-TRACE is a \n-separated list of "LOCATION: MESSAGE". +# +# Within m4, the macro is a no-op. This macro really matters +# when autom4te post-processes the trace output. +m4_define([_m4_warn], []) + + +# m4_warn(CATEGORY, MESSAGE) +# -------------------------- +# Report a MESSAGE to the user if the CATEGORY of warnings is enabled. +m4_define([m4_warn], +[_m4_warn([$1], [$2], +m4_ifdef([m4_expansion_stack], + [_m4_defn([m4_expansion_stack]) +m4_location[: the top level]]))dnl +]) + + + +## ------------------- ## +## 4. File inclusion. ## +## ------------------- ## + + +# We also want to neutralize include (and sinclude for symmetry), +# but we want to extend them slightly: warn when a file is included +# several times. This is, in general, a dangerous operation, because +# too many people forget to quote the first argument of m4_define. +# +# For instance in the following case: +# m4_define(foo, [bar]) +# then a second reading will turn into +# m4_define(bar, [bar]) +# which is certainly not what was meant. + +# m4_include_unique(FILE) +# ----------------------- +# Declare that the FILE was loading; and warn if it has already +# been included. +m4_define([m4_include_unique], +[m4_ifdef([m4_include($1)], + [m4_warn([syntax], [file `$1' included several times])])dnl +m4_define([m4_include($1)])]) + + +# m4_include(FILE) +# ---------------- +# Like the builtin include, but warns against multiple inclusions. +m4_define([m4_include], +[m4_include_unique([$1])dnl +m4_builtin([include], [$1])]) + + +# m4_sinclude(FILE) +# ----------------- +# Like the builtin sinclude, but warns against multiple inclusions. +m4_define([m4_sinclude], +[m4_include_unique([$1])dnl +m4_builtin([sinclude], [$1])]) + + + +## ------------------------------------ ## +## 5. Additional branching constructs. ## +## ------------------------------------ ## + +# Both `m4_ifval' and `m4_ifset' tests against the empty string. The +# difference is that `m4_ifset' is specialized on macros. +# +# In case of arguments of macros, eg. $1, it makes little difference. +# In the case of a macro `FOO', you don't want to check `m4_ifval(FOO, +# TRUE)', because if `FOO' expands with commas, there is a shifting of +# the arguments. So you want to run `m4_ifval([FOO])', but then you just +# compare the *string* `FOO' against `', which, of course fails. +# +# So you want the variation `m4_ifset' that expects a macro name as $1. +# If this macro is both defined and defined to a non empty value, then +# it runs TRUE, etc. + + +# m4_ifval(COND, [IF-TRUE], [IF-FALSE]) +# ------------------------------------- +# If COND is not the empty string, expand IF-TRUE, otherwise IF-FALSE. +# Comparable to m4_ifdef. +m4_define([m4_ifval], +[m4_if([$1], [], [$3], [$2])]) + + +# m4_n(TEXT) +# ---------- +# If TEXT is not empty, return TEXT and a new line, otherwise nothing. +m4_define([m4_n], +[m4_if([$1], + [], [], + [$1 +])]) + + +# m4_ifvaln(COND, [IF-TRUE], [IF-FALSE]) +# -------------------------------------- +# Same as `m4_ifval', but add an extra newline to IF-TRUE or IF-FALSE +# unless that argument is empty. +m4_define([m4_ifvaln], +[m4_if([$1], + [], [m4_n([$3])], + [m4_n([$2])])]) + + +# m4_ifset(MACRO, [IF-TRUE], [IF-FALSE]) +# -------------------------------------- +# If MACRO has no definition, or of its definition is the empty string, +# expand IF-FALSE, otherwise IF-TRUE. +m4_define([m4_ifset], +[m4_ifdef([$1], + [m4_ifval(_m4_defn([$1]), [$2], [$3])], + [$3])]) + + +# m4_ifndef(NAME, [IF-NOT-DEFINED], [IF-DEFINED]) +# ----------------------------------------------- +m4_define([m4_ifndef], +[m4_ifdef([$1], [$3], [$2])]) + + +# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT) +# ----------------------------------------------------------- +# m4 equivalent of +# switch (SWITCH) +# { +# case VAL1: +# IF-VAL1; +# break; +# case VAL2: +# IF-VAL2; +# break; +# ... +# default: +# DEFAULT; +# break; +# }. +# All the values are optional, and the macro is robust to active +# symbols properly quoted. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_case], +[m4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + [$1], [$2], [$3], + [$0([$1], m4_shift3($@))])]) + + +# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT) +# ----------------------------------------------------- +# m4 equivalent of +# +# if (SWITCH =~ RE1) +# VAL1; +# elif (SWITCH =~ RE2) +# VAL2; +# elif ... +# ... +# else +# DEFAULT +# +# All the values are optional, and the macro is robust to active symbols +# properly quoted. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_bmatch], +[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [$2], + [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shift3($@))], + [$3])])]) + + +# m4_car(LIST) +# m4_cdr(LIST) +# ------------ +# Manipulate m4 lists. +m4_define([m4_car], [[$1]]) +m4_define([m4_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) + +# _m4_cdr(LIST) +# ------------- +# Like m4_cdr, except include a leading comma unless only one element +# remains. Why? Because comparing a large list against [] is more +# expensive in expansion time than comparing the number of arguments; so +# _m4_cdr can be used to reduce the number of arguments when it is time +# to end recursion. +m4_define([_m4_cdr], +[m4_if([$#], 1, [], + [, m4_dquote(m4_shift($@))])]) + + + +# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT]) +# ------------------------------------------------------------------- +# Similar to m4_if, except that each TEST is expanded when encountered. +# If the expansion of TESTn matches the string VALn, the result is IF-VALn. +# The result is DEFAULT if no tests passed. This macro allows +# short-circuiting of expensive tests, where it pays to arrange quick +# filter tests to run first. +# +# For an example, consider a previous implementation of _AS_QUOTE_IFELSE: +# +# m4_if(m4_index([$1], [\]), [-1], [$2], +# m4_eval(m4_index([$1], [\\]) >= 0), [1], [$2], +# m4_eval(m4_index([$1], [\$]) >= 0), [1], [$2], +# m4_eval(m4_index([$1], [\`]) >= 0), [1], [$3], +# m4_eval(m4_index([$1], [\"]) >= 0), [1], [$3], +# [$2]) +# +# Here, m4_index is computed 5 times, and m4_eval 4, even if $1 contains +# no backslash. It is more efficient to do: +# +# m4_cond([m4_index([$1], [\])], [-1], [$2], +# [m4_eval(m4_index([$1], [\\]) >= 0)], [1], [$2], +# [m4_eval(m4_index([$1], [\$]) >= 0)], [1], [$2], +# [m4_eval(m4_index([$1], [\`]) >= 0)], [1], [$3], +# [m4_eval(m4_index([$1], [\"]) >= 0)], [1], [$3], +# [$2]) +# +# In the common case of $1 with no backslash, only one m4_index expansion +# occurs, and m4_eval is avoided altogether. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_cond], +[m4_if([$#], [0], [m4_fatal([$0: cannot be called without arguments])], + [$#], [1], [$1], + m4_eval([$# % 3]), [2], [m4_fatal([$0: missing an argument])], + [_$0($@)])]) + +m4_define([_m4_cond], +[m4_if(($1), [($2)], [$3], + [$#], [3], [], + [$#], [4], [$4], + [$0(m4_shift3($@))])]) + + +## ---------------------------------------- ## +## 6. Enhanced version of some primitives. ## +## ---------------------------------------- ## + +# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...) +# ---------------------------------------------------- +# m4 equivalent of +# +# $_ = STRING; +# s/RE1/SUBST1/g; +# s/RE2/SUBST2/g; +# ... +# +# All the values are optional, and the macro is robust to active symbols +# properly quoted. +# +# I would have liked to name this macro `m4_bpatsubst', unfortunately, +# due to quotation problems, I need to double quote $1 below, therefore +# the anchors are broken :( I can't let users be trapped by that. +# +# Recall that m4_shift3 always results in an argument. Hence, we need +# to distinguish between a final deletion vs. ending recursion. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_bpatsubsts], +[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2]))], + [$#], 3, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2], [$3]))], + [_$0($@m4_if(m4_eval($# & 1), 0, [,]))])]) +m4_define([_m4_bpatsubsts], +[m4_if([$#], 2, [$1], + [$0(m4_builtin([patsubst], [[$1]], [$2], [$3]), + m4_shift3($@))])]) + + +# m4_define_default(MACRO, VALUE) +# ------------------------------- +# If MACRO is undefined, set it to VALUE. +m4_define([m4_define_default], +[m4_ifndef([$1], [m4_define($@)])]) + + +# m4_default(EXP1, EXP2) +# ---------------------- +# Returns EXP1 if non empty, otherwise EXP2. +# +# This macro is called on hot paths, so inline the contents of m4_ifval, +# for one less round of expansion. +m4_define([m4_default], +[m4_if([$1], [], [$2], [$1])]) + + +# m4_defn(NAME) +# ------------- +# Like the original, except guarantee a warning when using something which is +# undefined (unlike M4 1.4.x). This replacement is not a full-featured +# replacement: if any of the defined macros contain unbalanced quoting, but +# when pasted together result in a well-quoted string, then only native m4 +# support is able to get it correct. But that's where quadrigraphs come in +# handy, if you really need unbalanced quotes inside your macros. +# +# This macro is called frequently, so minimize the amount of additional +# expansions by skipping m4_ifndef. Better yet, if __m4_version__ exists, +# (added in M4 1.6), then let m4 do the job for us (see m4_init). +# +# _m4_defn is for internal use only - it bypasses the wrapper, so it +# must only be used on one argument at a time, and only on macros +# known to be defined. Make sure this still works if the user renames +# m4_defn but not _m4_defn. +m4_copy([m4_defn], [_m4_defn]) +m4_define([m4_defn], +[m4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_defn([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_foreach([_m4_macro], [$@], [$0(_m4_defn([_m4_macro]))])])]) + + +# _m4_dumpdefs_up(NAME) +# --------------------- +m4_define([_m4_dumpdefs_up], +[m4_ifdef([$1], + [m4_pushdef([_m4_dumpdefs], _m4_defn([$1]))dnl +m4_dumpdef([$1])dnl +_m4_popdef([$1])dnl +_m4_dumpdefs_up([$1])])]) + + +# _m4_dumpdefs_down(NAME) +# ----------------------- +m4_define([_m4_dumpdefs_down], +[m4_ifdef([_m4_dumpdefs], + [m4_pushdef([$1], _m4_defn([_m4_dumpdefs]))dnl +_m4_popdef([_m4_dumpdefs])dnl +_m4_dumpdefs_down([$1])])]) + + +# m4_dumpdefs(NAME) +# ----------------- +# Similar to `m4_dumpdef(NAME)', but if NAME was m4_pushdef'ed, display its +# value stack (most recent displayed first). +m4_define([m4_dumpdefs], +[_m4_dumpdefs_up([$1])dnl +_m4_dumpdefs_down([$1])]) + + +# m4_popdef(NAME) +# --------------- +# Like the original, except guarantee a warning when using something which is +# undefined (unlike M4 1.4.x). +# +# This macro is called frequently, so minimize the amount of additional +# expansions by skipping m4_ifndef. Better yet, if __m4_version__ exists, +# (added in M4 1.6), then let m4 do the job for us (see m4_init). +# +# _m4_popdef is for internal use only - it bypasses the wrapper, so it +# must only be used on macros known to be defined. Make sure this +# still works if the user renames m4_popdef but not _m4_popdef. +m4_copy([m4_popdef], [_m4_popdef]) +m4_define([m4_popdef], +[m4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_popdef([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_foreach([_m4_macro], [$@], [$0(_m4_defn([_m4_macro]))])])]) + + +# m4_shiftn(N, ...) +# ----------------- +# Returns ... shifted N times. Useful for recursive "varargs" constructs. +# +# Autoconf does not use this macro, because it is inherently slower than +# calling the common cases of m4_shift2 or m4_shift3 directly. But it +# might as well be fast for other clients, such as Libtool. One way to +# do this is to expand $@ only once in _m4_shiftn (otherwise, for long +# lists, the expansion of m4_if takes twice as much memory as what the +# list itself occupies, only to throw away the unused branch). The end +# result is strictly equivalent to +# m4_if([$1], 1, [m4_shift(,m4_shift(m4_shift($@)))], +# [_m4_shiftn(m4_decr([$1]), m4_shift(m4_shift($@)))]) +# but with the final `m4_shift(m4_shift($@)))' shared between the two +# paths. The first leg uses a no-op m4_shift(,$@) to balance out the (). +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_shiftn], +[m4_assert(0 < $1 && $1 < $#)_$0($@)]) + +m4_define([_m4_shiftn], +[m4_if([$1], 1, [m4_shift(], + [$0(m4_decr([$1])]), m4_shift(m4_shift($@)))]) + +# m4_shift2(...) +# m4_shift3(...) +# ----------------- +# Returns ... shifted twice, and three times. Faster than m4_shiftn. +m4_define([m4_shift2], [m4_shift(m4_shift($@))]) +m4_define([m4_shift3], [m4_shift(m4_shift(m4_shift($@)))]) + +# _m4_shift2(...) +# _m4_shift3(...) +# --------------- +# Like m4_shift2 or m4_shift3, except include a leading comma unless shifting +# consumes all arguments. Why? Because in recursion, it is nice to +# distinguish between 1 element left and 0 elements left, based on how many +# arguments this shift expands to. +m4_define([_m4_shift2], +[m4_if([$#], [2], [], + [, m4_shift(m4_shift($@))])]) +m4_define([_m4_shift3], +[m4_if([$#], [3], [], + [, m4_shift(m4_shift(m4_shift($@)))])]) + + +# m4_undefine(NAME) +# ----------------- +# Like the original, except guarantee a warning when using something which is +# undefined (unlike M4 1.4.x). +# +# This macro is called frequently, so minimize the amount of additional +# expansions by skipping m4_ifndef. Better yet, if __m4_version__ exists, +# (added in M4 1.6), then let m4 do the job for us (see m4_init). +# +# _m4_undefine is for internal use only - it bypasses the wrapper, so +# it must only be used on macros known to be defined. Make sure this +# still works if the user renames m4_undefine but not _m4_undefine. +m4_copy([m4_undefine], [_m4_undefine]) +m4_define([m4_undefine], +[m4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_undefine([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_foreach([_m4_macro], [$@], [$0(_m4_defn([_m4_macro]))])])]) + +# _m4_wrap(PRE, POST) +# ------------------- +# Helper macro for m4_wrap and m4_wrap_lifo. Allows nested calls to +# m4_wrap within wrapped text. Use _m4_defn and _m4_popdef for speed. +m4_define([_m4_wrap], +[m4_ifdef([$0_text], + [m4_define([$0_text], [$1]_m4_defn([$0_text])[$2])], + [m4_builtin([m4wrap], [m4_unquote( + _m4_defn([$0_text])_m4_popdef([$0_text]))])m4_define([$0_text], [$1$2])])]) + +# m4_wrap(TEXT) +# ------------- +# Append TEXT to the list of hooks to be executed at the end of input. +# Whereas the order of the original may be LIFO in the underlying m4, +# this version is always FIFO. +m4_define([m4_wrap], +[_m4_wrap([], [$1[]])]) + +# m4_wrap_lifo(TEXT) +# ------------------ +# Prepend TEXT to the list of hooks to be executed at the end of input. +# Whereas the order of m4_wrap may be FIFO in the underlying m4, this +# version is always LIFO. +m4_define([m4_wrap_lifo], +[_m4_wrap([$1[]])]) + +## ------------------------- ## +## 7. Quoting manipulation. ## +## ------------------------- ## + + +# m4_apply(MACRO, LIST) +# --------------------- +# Invoke MACRO, with arguments provided from the quoted list of +# comma-separated quoted arguments. If LIST is empty, invoke MACRO +# without arguments. The expansion will not be concatenated with +# subsequent text. +m4_define([m4_apply], +[m4_if([$2], [], [$1], [$1($2)])[]]) + +# _m4_apply(MACRO, LIST) +# ---------------------- +# Like m4_apply, except do nothing if LIST is empty. +m4_define([_m4_apply], +[m4_if([$2], [], [], [$1($2)[]])]) + + +# m4_count(ARGS) +# -------------- +# Return a count of how many ARGS are present. +m4_define([m4_count], [$#]) + + +# m4_do(STRING, ...) +# ------------------ +# This macro invokes all its arguments (in sequence, of course). It is +# useful for making your macros more structured and readable by dropping +# unnecessary dnl's and have the macros indented properly. No concatenation +# occurs after a STRING; use m4_unquote(m4_join(,STRING)) for that. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_do], +[m4_if([$#], 0, [], + [$#], 1, [$1[]], + [$1[]$0(m4_shift($@))])]) + + +# m4_dquote(ARGS) +# --------------- +# Return ARGS as a quoted list of quoted arguments. +m4_define([m4_dquote], [[$@]]) + + +# m4_dquote_elt(ARGS) +# ------------------- +# Return ARGS as an unquoted list of double-quoted arguments. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_dquote_elt], +[m4_if([$#], [0], [], + [$#], [1], [[[$1]]], + [[[$1]],$0(m4_shift($@))])]) + + +# m4_echo(ARGS) +# ------------- +# Return the ARGS, with the same level of quoting. Whitespace after +# unquoted commas are consumed. +m4_define([m4_echo], [$@]) + + +# m4_expand(ARG) +# -------------- +# Return the expansion of ARG as a single string. Unlike m4_quote($1), this +# correctly preserves whitespace following single-quoted commas that appeared +# within ARG. +# +# m4_define([active], [ACT, IVE]) +# m4_define([active2], [[ACT, IVE]]) +# m4_quote(active, active2) +# => ACT,IVE,ACT, IVE +# m4_expand([active, active2]) +# => ACT, IVE, ACT, IVE +# +# Unfortunately, due to limitations in m4, ARG must expand to something +# with balanced quotes (use quadrigraphs to get around this). The input +# is not likely to have unbalanced -=<{(/)}>=- quotes, and it is possible +# to have unbalanced (), provided it was specified with proper [] quotes. +# +# Exploit that extra () will group unquoted commas and the following +# whitespace, then convert () to []. m4_bpatsubst can't handle newlines +# inside $1, and m4_substr strips quoting. So we (ab)use m4_changequote. +m4_define([m4_expand], [_$0(-=<{($1)}>=-)]) +m4_define([_m4_expand], +[m4_changequote([-=<{(], [)}>=-])$1m4_changequote([, ])]) + + +# m4_ignore(ARGS) +# --------------- +# Expands to nothing. Useful for conditionally ignoring an arbitrary +# number of arguments (see _m4_list_cmp for an example). +m4_define([m4_ignore]) + + +# m4_make_list(ARGS) +# ------------------ +# Similar to m4_dquote, this creates a quoted list of quoted ARGS. This +# version is less efficient than m4_dquote, but separates each argument +# with a comma and newline, rather than just comma, for readability. +# When developing an m4sugar algorithm, you could temporarily use +# m4_pushdef([m4_dquote],m4_defn([m4_make_list])) +# around your code to make debugging easier. +m4_define([m4_make_list], [m4_join([, +], m4_dquote_elt($@))]) + + +# m4_noquote(STRING) +# ------------------ +# Return the result of ignoring all quotes in STRING and invoking the +# macros it contains. Amongst other things, this is useful for enabling +# macro invocations inside strings with [] blocks (for instance regexps +# and help-strings). On the other hand, since all quotes are disabled, +# any macro expanded during this time that relies on nested [] quoting +# will likely crash and burn. This macro is seldom useful; consider +# m4_unquote or m4_expand instead. +m4_define([m4_noquote], +[m4_changequote([-=<{(],[)}>=-])$1-=<{()}>=-m4_changequote([,])]) + + +# m4_quote(ARGS) +# -------------- +# Return ARGS as a single argument. Any whitespace after unquoted commas +# is stripped. There is always output, even when there were no arguments. +# +# It is important to realize the difference between `m4_quote(exp)' and +# `[exp]': in the first case you obtain the quoted *result* of the +# expansion of EXP, while in the latter you just obtain the string +# `exp'. +m4_define([m4_quote], [[$*]]) + + +# _m4_quote(ARGS) +# --------------- +# Like m4_quote, except that when there are no arguments, there is no +# output. For conditional scenarios (such as passing _m4_quote as the +# macro name in m4_mapall), this feature can be used to distinguish between +# one argument of the empty string vs. no arguments. However, in the +# normal case with arguments present, this is less efficient than m4_quote. +m4_define([_m4_quote], +[m4_if([$#], [0], [], [[$*]])]) + + +# m4_reverse(ARGS) +# ---------------- +# Output ARGS in reverse order. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_reverse], +[m4_if([$#], [0], [], [$#], [1], [[$1]], + [$0(m4_shift($@)), [$1]])]) + + +# m4_unquote(ARGS) +# ---------------- +# Remove one layer of quotes from each ARG, performing one level of +# expansion. For one argument, m4_unquote([arg]) is more efficient than +# m4_do([arg]), but for multiple arguments, the difference is that +# m4_unquote separates arguments with commas while m4_do concatenates. +# Follow this macro with [] if concatenation with subsequent text is +# undesired. +m4_define([m4_unquote], [$*]) + + +## -------------------------- ## +## 8. Implementing m4 loops. ## +## -------------------------- ## + + +# m4_for(VARIABLE, FIRST, LAST, [STEP = +/-1], EXPRESSION) +# -------------------------------------------------------- +# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO with +# increments of STEP. Both limits are included, and bounds are +# checked for consistency. The algorithm is robust to indirect +# VARIABLE names. Changing VARIABLE inside EXPRESSION will not impact +# the number of iterations. +# +# Uses _m4_defn for speed, and avoid dnl in the macro body. +m4_define([m4_for], +[m4_pushdef([$1], m4_eval([$2]))]dnl +[m4_cond([m4_eval(([$3]) > ([$2]))], 1, + [m4_pushdef([_m4_step], m4_eval(m4_default([$4], + 1)))m4_assert(_m4_step > 0)_$0([$1], _m4_defn([$1]), + m4_eval((([$3]) - ([$2])) / _m4_step * _m4_step + ([$2])), + _m4_step, [$5])], + [m4_eval(([$3]) < ([$2]))], 1, + [m4_pushdef([_m4_step], m4_eval(m4_default([$4], + -1)))m4_assert(_m4_step < 0)_$0([$1], _m4_defn([$1]), + m4_eval((([$2]) - ([$3])) / -(_m4_step) * _m4_step + ([$2])), + _m4_step, [$5])], + [m4_pushdef([_m4_step])$5])[]]dnl +[m4_popdef([_m4_step], [$1])]) + + +# _m4_for(VARIABLE, COUNT, LAST, STEP, EXPRESSION) +# ------------------------------------------------ +# Core of the loop, no consistency checks, all arguments are plain +# numbers. Define VARIABLE to COUNT, expand EXPRESSION, then alter +# COUNT by STEP and iterate if COUNT is not LAST. +m4_define([_m4_for], +[m4_define([$1], [$2])$5[]m4_if([$2], [$3], [], + [$0([$1], m4_eval([$2 + $4]), [$3], [$4], [$5])])]) + + +# Implementing `foreach' loops in m4 is much more tricky than it may +# seem. For example, the old M4 1.4.4 manual had an incorrect example, +# which looked like this (when translated to m4sugar): +# +# | # foreach(VAR, (LIST), STMT) +# | m4_define([foreach], +# | [m4_pushdef([$1])_foreach([$1], [$2], [$3])m4_popdef([$1])]) +# | m4_define([_arg1], [$1]) +# | m4_define([_foreach], +# | [m4_if([$2], [()], , +# | [m4_define([$1], _arg1$2)$3[]_foreach([$1], (m4_shift$2), [$3])])]) +# +# But then if you run +# +# | m4_define(a, 1) +# | m4_define(b, 2) +# | m4_define(c, 3) +# | foreach([f], [([a], [(b], [c)])], [echo f +# | ]) +# +# it gives +# +# => echo 1 +# => echo (2,3) +# +# which is not what is expected. +# +# Of course the problem is that many quotes are missing. So you add +# plenty of quotes at random places, until you reach the expected +# result. Alternatively, if you are a quoting wizard, you directly +# reach the following implementation (but if you really did, then +# apply to the maintenance of m4sugar!). +# +# | # foreach(VAR, (LIST), STMT) +# | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])]) +# | m4_define([_arg1], [[$1]]) +# | m4_define([_foreach], +# | [m4_if($2, [()], , +# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1], [(m4_shift$2)], [$3])])]) +# +# which this time answers +# +# => echo a +# => echo (b +# => echo c) +# +# Bingo! +# +# Well, not quite. +# +# With a better look, you realize that the parens are more a pain than +# a help: since anyway you need to quote properly the list, you end up +# with always using an outermost pair of parens and an outermost pair +# of quotes. Rejecting the parens both eases the implementation, and +# simplifies the use: +# +# | # foreach(VAR, (LIST), STMT) +# | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])]) +# | m4_define([_arg1], [$1]) +# | m4_define([_foreach], +# | [m4_if($2, [], , +# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], [m4_shift($2)], [$3])])]) +# +# +# Now, just replace the `$2' with `m4_quote($2)' in the outer `m4_if' +# to improve robustness, and you come up with a nice implementation +# that doesn't require extra parentheses in the user's LIST. +# +# But wait - now the algorithm is quadratic, because every recursion of +# the algorithm keeps the entire LIST and merely adds another m4_shift to +# the quoted text. If the user has a lot of elements in LIST, you can +# bring the system to its knees with the memory m4 then requires, or trip +# the m4 --nesting-limit recursion factor. The only way to avoid +# quadratic growth is ensure m4_shift is expanded prior to the recursion. +# Hence the design below. +# +# The M4 manual now includes a chapter devoted to this issue, with +# the lessons learned from m4sugar. And still, this design is only +# optimal for M4 1.6; see foreach.m4 for yet more comments on why +# M4 1.4.x uses yet another implementation. + + +# m4_foreach(VARIABLE, LIST, EXPRESSION) +# -------------------------------------- +# +# Expand EXPRESSION assigning each value of the LIST to VARIABLE. +# LIST should have the form `item_1, item_2, ..., item_n', i.e. the +# whole list must *quoted*. Quote members too if you don't want them +# to be expanded. +# +# This macro is robust to active symbols: +# | m4_define(active, [ACT, IVE]) +# | m4_foreach(Var, [active, active], [-Var-]) +# => -ACT--IVE--ACT--IVE- +# +# | m4_foreach(Var, [[active], [active]], [-Var-]) +# => -ACT, IVE--ACT, IVE- +# +# | m4_foreach(Var, [[[active]], [[active]]], [-Var-]) +# => -active--active- +# +# This macro is called frequently, so avoid extra expansions such as +# m4_ifval and dnl. Also, since $2 might be quite large, try to use it +# as little as possible in _m4_foreach; each extra use requires that much +# more memory for expansion. So, rather than directly compare $2 against +# [] and use m4_car/m4_cdr for recursion, we instead unbox the list (which +# requires swapping the argument order in the helper), insert an ignored +# third argument, and use m4_shift3 to detect when recursion is complete. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_foreach], +[m4_if([$2], [], [], + [m4_pushdef([$1])_$0([$1], [$3], [], $2)m4_popdef([$1])])]) + +m4_define([_m4_foreach], +[m4_if([$#], [3], [], + [m4_define([$1], [$4])$2[]$0([$1], [$2], m4_shift3($@))])]) + + +# m4_foreach_w(VARIABLE, LIST, EXPRESSION) +# ---------------------------------------- +# +# Like m4_foreach, but the list is whitespace separated. +# +# This macro is robust to active symbols: +# m4_foreach_w([Var], [ active +# b act\ +# ive ], [-Var-])end +# => -active--b--active-end +# +m4_define([m4_foreach_w], +[m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])]) + + +# m4_map(MACRO, LIST) +# m4_mapall(MACRO, LIST) +# ---------------------- +# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements of +# LIST. $1, $2... must in turn be lists, appropriate for m4_apply. +# If LIST contains an empty sublist, m4_map skips the expansion of +# MACRO, while m4_mapall expands MACRO with no arguments. +# +# Since LIST may be quite large, we want to minimize how often it +# appears in the expansion. Rather than use m4_car/m4_cdr iteration, +# we unbox the list, ignore the second argument, and use m4_shift2 to +# detect the end of recursion. The mismatch in () is intentional; see +# _m4_map. For m4_map, an empty list behaves like an empty sublist +# and gets ignored; for m4_mapall, we must special-case the empty +# list. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_map], +[_m4_map([_m4_apply([$1]], [], $2)]) + +m4_define([m4_mapall], +[m4_if([$2], [], [], + [_m4_map([m4_apply([$1]], [], $2)])]) + + +# m4_map_sep(MACRO, SEPARATOR, LIST) +# m4_mapall_sep(MACRO, SEPARATOR, LIST) +# ------------------------------------- +# Invoke MACRO($1), SEPARATOR, MACRO($2), ..., MACRO($N) where $1, +# $2... $N are the elements of LIST, and are in turn lists appropriate +# for m4_apply. SEPARATOR is expanded, in order to allow the creation +# of a list of arguments by using a single-quoted comma as the +# separator. For each empty sublist, m4_map_sep skips the expansion +# of MACRO and SEPARATOR, while m4_mapall_sep expands MACRO with no +# arguments. +# +# For m4_mapall_sep, merely expand the first iteration without the +# separator, then include separator as part of subsequent recursion; +# but avoid extra expansion of LIST's side-effects via a helper macro. +# For m4_map_sep, things are trickier - we don't know if the first +# list element is an empty sublist, so we must define a self-modifying +# helper macro and use that as the separator instead. +m4_define([m4_map_sep], +[m4_pushdef([m4_Sep], [m4_define([m4_Sep], _m4_defn([m4_unquote]))])]dnl +[_m4_map([_m4_apply([m4_Sep([$2])[]$1]], [], $3)m4_popdef([m4_Sep])]) + +m4_define([m4_mapall_sep], +[m4_if([$3], [], [], [_$0([$1], [$2], $3)])]) + +m4_define([_m4_mapall_sep], +[m4_apply([$1], [$3])_m4_map([m4_apply([$2[]$1]], m4_shift2($@))]) + +# _m4_map(PREFIX, IGNORED, SUBLIST, ...) +# -------------------------------------- +# Common implementation for all four m4_map variants. The mismatch in +# the number of () is intentional. PREFIX must supply a form of +# m4_apply, the open `(', and the MACRO to be applied. Each iteration +# then appends `,', the current SUBLIST and the closing `)', then +# recurses to the next SUBLIST. IGNORED is an aid to ending recursion +# efficiently. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([_m4_map], +[m4_if([$#], [2], [], + [$1, [$3])$0([$1], m4_shift2($@))])]) + +# m4_transform(EXPRESSION, ARG...) +# -------------------------------- +# Expand EXPRESSION([ARG]) for each argument. More efficient than +# m4_foreach([var], [ARG...], [EXPRESSION(m4_defn([var]))]) +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_transform], +[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [], + [$#], [2], [$1([$2])[]], + [$1([$2])[]$0([$1], m4_shift2($@))])]) + + +# m4_transform_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...) +# -------------------------------------------------------------- +# Perform a pairwise grouping of consecutive ARGs, by expanding +# EXPRESSION([ARG1], [ARG2]). If there are an odd number of ARGs, the +# final argument is expanded with END-EXPR([ARGn]). +# +# For example: +# m4_define([show], [($*)m4_newline])dnl +# m4_transform_pair([show], [], [a], [b], [c], [d], [e])dnl +# => (a,b) +# => (c,d) +# => (e) +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_transform_pair], +[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [m4_fatal([$0: too few arguments: $#: $1])], + [$#], [2], [], + [$#], [3], [m4_default([$2], [$1])([$3])[]], + [$#], [4], [$1([$3], [$4])[]], + [$1([$3], [$4])[]$0([$1], [$2], m4_shift(m4_shift3($@)))])]) + + +## --------------------------- ## +## 9. More diversion support. ## +## --------------------------- ## + + +# _m4_divert(DIVERSION-NAME or NUMBER) +# ------------------------------------ +# If DIVERSION-NAME is the name of a diversion, return its number, +# otherwise if it is a NUMBER return it. +m4_define([_m4_divert], +[m4_ifdef([_m4_divert($1)], + [m4_indir([_m4_divert($1)])], + [$1])]) + +# KILL is only used to suppress output. +m4_define([_m4_divert(KILL)], -1) + +# The empty diversion name is a synonym for 0. +m4_define([_m4_divert()], 0) + + +# _m4_divert_n_stack +# ------------------ +# Print m4_divert_stack with newline prepended, if it's nonempty. +m4_define([_m4_divert_n_stack], +[m4_ifdef([m4_divert_stack], [ +_m4_defn([m4_divert_stack])])]) + + +# m4_divert(DIVERSION-NAME) +# ------------------------- +# Change the diversion stream to DIVERSION-NAME. +m4_define([m4_divert], +[m4_define([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)]dnl +[m4_builtin([divert], _m4_divert([$1]))]) + + +# m4_divert_push(DIVERSION-NAME) +# ------------------------------ +# Change the diversion stream to DIVERSION-NAME, while stacking old values. +m4_define([m4_divert_push], +[m4_pushdef([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)]dnl +[m4_pushdef([_m4_divert_diversion], [$1])]dnl +[m4_builtin([divert], _m4_divert([$1]))]) + + +# m4_divert_pop([DIVERSION-NAME]) +# ------------------------------- +# Change the diversion stream to its previous value, unstacking it. +# If specified, verify we left DIVERSION-NAME. +# When we pop the last value from the stack, we divert to -1. +m4_define([m4_divert_pop], +[m4_ifndef([_m4_divert_diversion], + [m4_fatal([too many m4_divert_pop])])]dnl +[m4_if([$1], [], [], + [$1], _m4_defn([_m4_divert_diversion]), [], + [m4_fatal([$0($1): diversion mismatch: ]_m4_divert_n_stack)])]dnl +[_m4_popdef([m4_divert_stack], [_m4_divert_diversion])]dnl +[m4_builtin([divert], + m4_ifdef([_m4_divert_diversion], + [_m4_divert(_m4_defn([_m4_divert_diversion]))], + -1))]) + + +# m4_divert_text(DIVERSION-NAME, CONTENT) +# --------------------------------------- +# Output CONTENT into DIVERSION-NAME (which may be a number actually). +# An end of line is appended for free to CONTENT. +m4_define([m4_divert_text], +[m4_divert_push([$1])$2 +m4_divert_pop([$1])]) + + +# m4_divert_once(DIVERSION-NAME, CONTENT) +# --------------------------------------- +# Output CONTENT into DIVERSION-NAME once, if not already there. +# An end of line is appended for free to CONTENT. +m4_define([m4_divert_once], +[m4_expand_once([m4_divert_text([$1], [$2])])]) + + +# m4_undivert(DIVERSION-NAME) +# --------------------------- +# Undivert DIVERSION-NAME. Unlike the M4 version, this only takes a single +# diversion identifier, and should not be used to undivert files. +m4_define([m4_undivert], +[m4_builtin([undivert], _m4_divert([$1]))]) + + +## --------------------------------------------- ## +## 10. Defining macros with bells and whistles. ## +## --------------------------------------------- ## + +# `m4_defun' is basically `m4_define' but it equips the macro with the +# needed machinery for `m4_require'. A macro must be m4_defun'd if +# either it is m4_require'd, or it m4_require's. +# +# Two things deserve attention and are detailed below: +# 1. Implementation of m4_require +# 2. Keeping track of the expansion stack +# +# 1. Implementation of m4_require +# =============================== +# +# Of course m4_defun AC_PROVIDE's the macro, so that a macro which has +# been expanded is not expanded again when m4_require'd, but the +# difficult part is the proper expansion of macros when they are +# m4_require'd. +# +# The implementation is based on two ideas, (i) using diversions to +# prepare the expansion of the macro and its dependencies (by Franc,ois +# Pinard), and (ii) expand the most recently m4_require'd macros _after_ +# the previous macros (by Axel Thimm). +# +# +# The first idea: why use diversions? +# ----------------------------------- +# +# When a macro requires another, the other macro is expanded in new +# diversion, GROW. When the outer macro is fully expanded, we first +# undivert the most nested diversions (GROW - 1...), and finally +# undivert GROW. To understand why we need several diversions, +# consider the following example: +# +# | m4_defun([TEST1], [Test...REQUIRE([TEST2])1]) +# | m4_defun([TEST2], [Test...REQUIRE([TEST3])2]) +# | m4_defun([TEST3], [Test...3]) +# +# Because m4_require is not required to be first in the outer macros, we +# must keep the expansions of the various levels of m4_require separated. +# Right before executing the epilogue of TEST1, we have: +# +# GROW - 2: Test...3 +# GROW - 1: Test...2 +# GROW: Test...1 +# BODY: +# +# Finally the epilogue of TEST1 undiverts GROW - 2, GROW - 1, and +# GROW into the regular flow, BODY. +# +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: Test...3; Test...2; Test...1 +# +# (The semicolons are here for clarification, but of course are not +# emitted.) This is what Autoconf 2.0 (I think) to 2.13 (I'm sure) +# implement. +# +# +# The second idea: first required first out +# ----------------------------------------- +# +# The natural implementation of the idea above is buggy and produces +# very surprising results in some situations. Let's consider the +# following example to explain the bug: +# +# | m4_defun([TEST1], [REQUIRE([TEST2a])REQUIRE([TEST2b])]) +# | m4_defun([TEST2a], []) +# | m4_defun([TEST2b], [REQUIRE([TEST3])]) +# | m4_defun([TEST3], [REQUIRE([TEST2a])]) +# | +# | AC_INIT +# | TEST1 +# +# The dependencies between the macros are: +# +# 3 --- 2b +# / \ is m4_require'd by +# / \ left -------------------- right +# 2a ------------ 1 +# +# If you strictly apply the rules given in the previous section you get: +# +# GROW - 2: TEST3 +# GROW - 1: TEST2a; TEST2b +# GROW: TEST1 +# BODY: +# +# (TEST2a, although required by TEST3 is not expanded in GROW - 3 +# because is has already been expanded before in GROW - 1, so it has +# been AC_PROVIDE'd, so it is not expanded again) so when you undivert +# the stack of diversions, you get: +# +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: TEST3; TEST2a; TEST2b; TEST1 +# +# i.e., TEST2a is expanded after TEST3 although the latter required the +# former. +# +# Starting from 2.50, we use an implementation provided by Axel Thimm. +# The idea is simple: the order in which macros are emitted must be the +# same as the one in which macros are expanded. (The bug above can +# indeed be described as: a macro has been AC_PROVIDE'd before its +# dependent, but it is emitted after: the lack of correlation between +# emission and expansion order is guilty). +# +# How to do that? You keep the stack of diversions to elaborate the +# macros, but each time a macro is fully expanded, emit it immediately. +# +# In the example above, when TEST2a is expanded, but it's epilogue is +# not run yet, you have: +# +# GROW - 2: +# GROW - 1: TEST2a +# GROW: Elaboration of TEST1 +# BODY: +# +# The epilogue of TEST2a emits it immediately: +# +# GROW - 2: +# GROW - 1: +# GROW: Elaboration of TEST1 +# BODY: TEST2a +# +# TEST2b then requires TEST3, so right before the epilogue of TEST3, you +# have: +# +# GROW - 2: TEST3 +# GROW - 1: Elaboration of TEST2b +# GROW: Elaboration of TEST1 +# BODY: TEST2a +# +# The epilogue of TEST3 emits it: +# +# GROW - 2: +# GROW - 1: Elaboration of TEST2b +# GROW: Elaboration of TEST1 +# BODY: TEST2a; TEST3 +# +# TEST2b is now completely expanded, and emitted: +# +# GROW - 2: +# GROW - 1: +# GROW: Elaboration of TEST1 +# BODY: TEST2a; TEST3; TEST2b +# +# and finally, TEST1 is finished and emitted: +# +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: TEST2a; TEST3; TEST2b: TEST1 +# +# The idea is simple, but the implementation is a bit evolved. If you +# are like me, you will want to see the actual functioning of this +# implementation to be convinced. The next section gives the full +# details. +# +# +# The Axel Thimm implementation at work +# ------------------------------------- +# +# We consider the macros above, and this configure.ac: +# +# AC_INIT +# TEST1 +# +# You should keep the definitions of _m4_defun_pro, _m4_defun_epi, and +# m4_require at hand to follow the steps. +# +# This implements tries not to assume that the current diversion is +# BODY, so as soon as a macro (m4_defun'd) is expanded, we first +# record the current diversion under the name _m4_divert_dump (denoted +# DUMP below for short). This introduces an important difference with +# the previous versions of Autoconf: you cannot use m4_require if you +# are not inside an m4_defun'd macro, and especially, you cannot +# m4_require directly from the top level. +# +# We have not tried to simulate the old behavior (better yet, we +# diagnose it), because it is too dangerous: a macro m4_require'd from +# the top level is expanded before the body of `configure', i.e., before +# any other test was run. I let you imagine the result of requiring +# AC_STDC_HEADERS for instance, before AC_PROG_CC was actually run.... +# +# After AC_INIT was run, the current diversion is BODY. +# * AC_INIT was run +# DUMP: undefined +# diversion stack: BODY |- +# +# * TEST1 is expanded +# The prologue of TEST1 sets _m4_divert_dump, which is the diversion +# where the current elaboration will be dumped, to the current +# diversion. It also m4_divert_push to GROW, where the full +# expansion of TEST1 and its dependencies will be elaborated. +# DUMP: BODY +# BODY: empty +# diversions: GROW, BODY |- +# +# * TEST1 requires TEST2a +# _m4_require_call m4_divert_pushes another temporary diversion, +# GROW - 1, and expands TEST2a in there. +# DUMP: BODY +# BODY: empty +# GROW - 1: TEST2a +# diversions: GROW - 1, GROW, BODY |- +# Than the content of the temporary diversion is moved to DUMP and the +# temporary diversion is popped. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW, BODY |- +# +# * TEST1 requires TEST2b +# Again, _m4_require_call pushes GROW - 1 and heads to expand TEST2b. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW - 1, GROW, BODY |- +# +# * TEST2b requires TEST3 +# _m4_require_call pushes GROW - 2 and expands TEST3 here. +# (TEST3 requires TEST2a, but TEST2a has already been m4_provide'd, so +# nothing happens.) +# DUMP: BODY +# BODY: TEST2a +# GROW - 2: TEST3 +# diversions: GROW - 2, GROW - 1, GROW, BODY |- +# Than the diversion is appended to DUMP, and popped. +# DUMP: BODY +# BODY: TEST2a; TEST3 +# diversions: GROW - 1, GROW, BODY |- +# +# * TEST1 requires TEST2b (contd.) +# The content of TEST2b is expanded... +# DUMP: BODY +# BODY: TEST2a; TEST3 +# GROW - 1: TEST2b, +# diversions: GROW - 1, GROW, BODY |- +# ... and moved to DUMP. +# DUMP: BODY +# BODY: TEST2a; TEST3; TEST2b +# diversions: GROW, BODY |- +# +# * TEST1 is expanded: epilogue +# TEST1's own content is in GROW... +# DUMP: BODY +# BODY: TEST2a; TEST3; TEST2b +# GROW: TEST1 +# diversions: BODY |- +# ... and it's epilogue moves it to DUMP and then undefines DUMP. +# DUMP: undefined +# BODY: TEST2a; TEST3; TEST2b; TEST1 +# diversions: BODY |- +# +# +# 2. Keeping track of the expansion stack +# ======================================= +# +# When M4 expansion goes wrong it is often extremely hard to find the +# path amongst macros that drove to the failure. What is needed is +# the stack of macro `calls'. One could imagine that GNU M4 would +# maintain a stack of macro expansions, unfortunately it doesn't, so +# we do it by hand. This is of course extremely costly, but the help +# this stack provides is worth it. Nevertheless to limit the +# performance penalty this is implemented only for m4_defun'd macros, +# not for define'd macros. +# +# The scheme is simplistic: each time we enter an m4_defun'd macros, +# we prepend its name in m4_expansion_stack, and when we exit the +# macro, we remove it (thanks to pushdef/popdef). +# +# In addition, we want to detect circular m4_require dependencies. +# Each time we expand a macro FOO we define _m4_expanding(FOO); and +# m4_require(BAR) simply checks whether _m4_expanding(BAR) is defined. + + +# m4_expansion_stack_push(TEXT) +# ----------------------------- +m4_define([m4_expansion_stack_push], +[m4_pushdef([m4_expansion_stack], + [$1]m4_ifdef([m4_expansion_stack], [ +_m4_defn([m4_expansion_stack])]))]) + + +# m4_expansion_stack_pop +# ---------------------- +m4_define([m4_expansion_stack_pop], +[m4_popdef([m4_expansion_stack])]) + + +# m4_expansion_stack_dump +# ----------------------- +# Dump the expansion stack. +m4_define([m4_expansion_stack_dump], +[m4_ifdef([m4_expansion_stack], + [m4_errprintn(_m4_defn([m4_expansion_stack]))])dnl +m4_errprintn(m4_location[: the top level])]) + + +# _m4_divert(GROW) +# ---------------- +# This diversion is used by the m4_defun/m4_require machinery. It is +# important to keep room before GROW because for each nested +# AC_REQUIRE we use an additional diversion (i.e., two m4_require's +# will use GROW - 2. More than 3 levels has never seemed to be +# needed.) +# +# ... +# - GROW - 2 +# m4_require'd code, 2 level deep +# - GROW - 1 +# m4_require'd code, 1 level deep +# - GROW +# m4_defun'd macros are elaborated here. + +m4_define([_m4_divert(GROW)], 10000) + + +# _m4_defun_pro(MACRO-NAME) +# ------------------------- +# The prologue for Autoconf macros. +# +# This is called frequently, so minimize the number of macro invocations +# by avoiding dnl and m4_defn overhead. +m4_define([_m4_defun_pro], +m4_do([[m4_ifdef([m4_expansion_stack], [], [_m4_defun_pro_outer[]])]], + [[m4_expansion_stack_push(_m4_defn( + [m4_location($1)])[: $1 is expanded from...])]], + [[m4_pushdef([_m4_expanding($1)])]])) + +m4_define([_m4_defun_pro_outer], +[m4_copy([_m4_divert_diversion], [_m4_divert_dump])m4_divert_push([GROW])]) + +# _m4_defun_epi(MACRO-NAME) +# ------------------------- +# The Epilogue for Autoconf macros. MACRO-NAME only helps tracing +# the PRO/EPI pairs. +# +# This is called frequently, so minimize the number of macro invocations +# by avoiding dnl and m4_popdef overhead. +m4_define([_m4_defun_epi], +m4_do([[_m4_popdef([_m4_expanding($1)])]], + [[m4_expansion_stack_pop()]], + [[m4_ifdef([m4_expansion_stack], [], [_m4_defun_epi_outer[]])]], + [[m4_provide([$1])]])) + +m4_define([_m4_defun_epi_outer], +[_m4_undefine([_m4_divert_dump])m4_divert_pop([GROW])m4_undivert([GROW])]) + + +# m4_defun(NAME, EXPANSION) +# ------------------------- +# Define a macro which automatically provides itself. Add machinery +# so the macro automatically switches expansion to the diversion +# stack if it is not already using it. In this case, once finished, +# it will bring back all the code accumulated in the diversion stack. +# This, combined with m4_require, achieves the topological ordering of +# macros. We don't use this macro to define some frequently called +# macros that are not involved in ordering constraints, to save m4 +# processing. +m4_define([m4_defun], +[m4_define([m4_location($1)], m4_location)dnl +m4_define([$1], + [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])]) + + +# m4_defun_once(NAME, EXPANSION) +# ------------------------------ +# As m4_defun, but issues the EXPANSION only once, and warns if used +# several times. +m4_define([m4_defun_once], +[m4_define([m4_location($1)], m4_location)dnl +m4_define([$1], + [m4_provide_if([$1], + [m4_warn([syntax], [$1 invoked multiple times])], + [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])]) + + +# m4_pattern_forbid(ERE, [WHY]) +# ----------------------------- +# Declare that no token matching the forbidden extended regular +# expression ERE should be seen in the output unless... +m4_define([m4_pattern_forbid], []) + + +# m4_pattern_allow(ERE) +# --------------------- +# ... that token also matches the allowed extended regular expression ERE. +# Both used via traces. +m4_define([m4_pattern_allow], []) + + +## --------------------------------- ## +## 11. Dependencies between macros. ## +## --------------------------------- ## + + +# m4_before(THIS-MACRO-NAME, CALLED-MACRO-NAME) +# --------------------------------------------- +# Issue a warning if CALLED-MACRO-NAME was called before THIS-MACRO-NAME. +m4_define([m4_before], +[m4_provide_if([$2], + [m4_warn([syntax], [$2 was called before $1])])]) + + +# m4_require(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK]) +# ----------------------------------------------------------- +# If NAME-TO-CHECK has never been expanded (actually, if it is not +# m4_provide'd), expand BODY-TO-EXPAND *before* the current macro +# expansion. Once expanded, emit it in _m4_divert_dump. Keep track +# of the m4_require chain in m4_expansion_stack. +# +# The normal cases are: +# +# - NAME-TO-CHECK == BODY-TO-EXPAND +# Which you can use for regular macros with or without arguments, e.g., +# m4_require([AC_PROG_CC], [AC_PROG_CC]) +# m4_require([AC_CHECK_HEADERS(limits.h)], [AC_CHECK_HEADERS(limits.h)]) +# which is just the same as +# m4_require([AC_PROG_CC]) +# m4_require([AC_CHECK_HEADERS(limits.h)]) +# +# - BODY-TO-EXPAND == m4_indir([NAME-TO-CHECK]) +# In the case of macros with irregular names. For instance: +# m4_require([AC_LANG_COMPILER(C)], [indir([AC_LANG_COMPILER(C)])]) +# which means `if the macro named `AC_LANG_COMPILER(C)' (the parens are +# part of the name, it is not an argument) has not been run, then +# call it.' +# Had you used +# m4_require([AC_LANG_COMPILER(C)], [AC_LANG_COMPILER(C)]) +# then m4_require would have tried to expand `AC_LANG_COMPILER(C)', i.e., +# call the macro `AC_LANG_COMPILER' with `C' as argument. +# +# You could argue that `AC_LANG_COMPILER', when it receives an argument +# such as `C' should dispatch the call to `AC_LANG_COMPILER(C)'. But this +# `extension' prevents `AC_LANG_COMPILER' from having actual arguments that +# it passes to `AC_LANG_COMPILER(C)'. +# +# This is called frequently, so minimize the number of macro invocations +# by avoiding dnl and other overhead on the common path. +m4_define([m4_require], +m4_do([[m4_ifdef([_m4_expanding($1)], + [m4_fatal([$0: circular dependency of $1])])]], + [[m4_ifdef([_m4_divert_dump], [], + [m4_fatal([$0($1): cannot be used outside of an ]dnl +m4_bmatch([$0], [^AC_], [[AC_DEFUN]], [[m4_defun]])['d macro])])]], + [[m4_provide_if([$1], + [], + [_m4_require_call([$1], [$2])])]])) + + +# _m4_require_call(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK]) +# ----------------------------------------------------------------- +# If m4_require decides to expand the body, it calls this macro. +# +# This is called frequently, so minimize the number of macro invocations +# by avoiding dnl and other overhead on the common path. +m4_define([_m4_require_call], +m4_do([[m4_define([_m4_divert_grow], m4_decr(_m4_divert_grow))]], + [[m4_divert_push(_m4_divert_grow)]], + [[m4_default([$2], [$1]) +m4_provide_if([$1], + [], + [m4_warn([syntax], + [$1 is m4_require'd but not m4_defun'd])])]], + [[m4_divert(_m4_defn([_m4_divert_dump]))]], + [[m4_undivert(_m4_divert_grow)]], + [[m4_divert_pop(_m4_divert_grow)]], + [[m4_define([_m4_divert_grow], m4_incr(_m4_divert_grow))]])) + + +# _m4_divert_grow +# --------------- +# The counter for _m4_require_call. +m4_define([_m4_divert_grow], _m4_divert([GROW])) + + +# m4_expand_once(TEXT, [WITNESS = TEXT]) +# -------------------------------------- +# If TEXT has never been expanded, expand it *here*. Use WITNESS as +# as a memory that TEXT has already been expanded. +m4_define([m4_expand_once], +[m4_provide_if(m4_ifval([$2], [[$2]], [[$1]]), + [], + [m4_provide(m4_ifval([$2], [[$2]], [[$1]]))[]$1])]) + + +# m4_provide(MACRO-NAME) +# ---------------------- +m4_define([m4_provide], +[m4_define([m4_provide($1)])]) + + +# m4_provide_if(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ------------------------------------------------------- +# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. +# The purpose of this macro is to provide the user with a means to +# check macros which are provided without letting her know how the +# information is coded. +m4_define([m4_provide_if], +[m4_ifdef([m4_provide($1)], + [$2], [$3])]) + + +## --------------------- ## +## 12. Text processing. ## +## --------------------- ## + + +# m4_cr_letters +# m4_cr_LETTERS +# m4_cr_Letters +# ------------- +m4_define([m4_cr_letters], [abcdefghijklmnopqrstuvwxyz]) +m4_define([m4_cr_LETTERS], [ABCDEFGHIJKLMNOPQRSTUVWXYZ]) +m4_define([m4_cr_Letters], +m4_defn([m4_cr_letters])dnl +m4_defn([m4_cr_LETTERS])dnl +) + + +# m4_cr_digits +# ------------ +m4_define([m4_cr_digits], [0123456789]) + + +# m4_cr_alnum +# ----------- +m4_define([m4_cr_alnum], +m4_defn([m4_cr_Letters])dnl +m4_defn([m4_cr_digits])dnl +) + + +# m4_cr_symbols1 +# m4_cr_symbols2 +# ------------------------------- +m4_define([m4_cr_symbols1], +m4_defn([m4_cr_Letters])dnl +_) + +m4_define([m4_cr_symbols2], +m4_defn([m4_cr_symbols1])dnl +m4_defn([m4_cr_digits])dnl +) + +# m4_cr_all +# --------- +# The character range representing everything, with `-' as the last +# character, since it is special to m4_translit. Use with care, because +# it contains characters special to M4 (fortunately, both ASCII and EBCDIC +# have [] in order, so m4_defn([m4_cr_all]) remains a valid string). It +# also contains characters special to terminals, so it should never be +# displayed in an error message. Also, attempts to map [ and ] to other +# characters via m4_translit must deal with the fact that m4_translit does +# not add quotes to the output. +# +# It is mainly useful in generating inverted character range maps, for use +# in places where m4_translit is faster than an equivalent m4_bpatsubst; +# the regex `[^a-z]' is equivalent to: +# m4_translit(m4_dquote(m4_defn([m4_cr_all])), [a-z]) +m4_define([m4_cr_all], +m4_translit(m4_dquote(m4_format(m4_dquote(m4_for( + ,1,255,,[[%c]]))m4_for([i],1,255,,[,i]))), [-])-) + + +# _m4_define_cr_not(CATEGORY) +# --------------------------- +# Define m4_cr_not_CATEGORY as the inverse of m4_cr_CATEGORY. +m4_define([_m4_define_cr_not], +[m4_define([m4_cr_not_$1], + m4_translit(m4_dquote(m4_defn([m4_cr_all])), + m4_defn([m4_cr_$1])))]) + + +# m4_cr_not_letters +# m4_cr_not_LETTERS +# m4_cr_not_Letters +# m4_cr_not_digits +# m4_cr_not_alnum +# m4_cr_not_symbols1 +# m4_cr_not_symbols2 +# ------------------ +# Inverse character sets +_m4_define_cr_not([letters]) +_m4_define_cr_not([LETTERS]) +_m4_define_cr_not([Letters]) +_m4_define_cr_not([digits]) +_m4_define_cr_not([alnum]) +_m4_define_cr_not([symbols1]) +_m4_define_cr_not([symbols2]) + + +# m4_newline +# ---------- +# Expands to a newline. Exists for formatting reasons. +m4_define([m4_newline], [ +]) + + +# m4_re_escape(STRING) +# -------------------- +# Escape RE active characters in STRING. +m4_define([m4_re_escape], +[m4_bpatsubst([$1], + [[][*+.?\^$]], [\\\&])]) + + +# m4_re_string +# ------------ +# Regexp for `[a-zA-Z_0-9]*' +# m4_dquote provides literal [] for the character class. +m4_define([m4_re_string], +m4_dquote(m4_defn([m4_cr_symbols2]))dnl +[*]dnl +) + + +# m4_re_word +# ---------- +# Regexp for `[a-zA-Z_][a-zA-Z_0-9]*' +m4_define([m4_re_word], +m4_dquote(m4_defn([m4_cr_symbols1]))dnl +m4_defn([m4_re_string])dnl +) + + +# m4_tolower(STRING) +# m4_toupper(STRING) +# ------------------ +# These macros convert STRING to lowercase or uppercase. +# +# Rather than expand the m4_defn each time, we inline them up front. +m4_define([m4_tolower], +[m4_translit([$1], ]m4_dquote(m4_defn([m4_cr_LETTERS]))[, + ]m4_dquote(m4_defn([m4_cr_letters]))[)]) +m4_define([m4_toupper], +[m4_translit([$1], ]m4_dquote(m4_defn([m4_cr_letters]))[, + ]m4_dquote(m4_defn([m4_cr_LETTERS]))[)]) + + +# m4_split(STRING, [REGEXP]) +# -------------------------- +# +# Split STRING into an m4 list of quoted elements. The elements are +# quoted with [ and ]. Beginning spaces and end spaces *are kept*. +# Use m4_strip to remove them. +# +# REGEXP specifies where to split. Default is [\t ]+. +# +# If STRING is empty, the result is an empty list. +# +# Pay attention to the m4_changequotes. When m4 reads the definition of +# m4_split, it still has quotes set to [ and ]. Luckily, these are matched +# in the macro body, so the definition is stored correctly. Use the same +# alternate quotes as m4_noquote; it must be unlikely to appear in $1. +# +# Also, notice that $1 is quoted twice, since we want the result to +# be quoted. Then you should understand that the argument of +# patsubst is -=<{(STRING)}>=- (i.e., with additional -=<{( and )}>=-). +# +# This macro is safe on active symbols, i.e.: +# m4_define(active, ACTIVE) +# m4_split([active active ])end +# => [active], [active], []end +# +# Optimize on regex of ` ' (space), since m4_foreach_w already guarantees +# that the list contains single space separators, and a common case is +# splitting a single-element list. This macro is called frequently, +# so avoid unnecessary dnl inside the definition. +m4_define([m4_split], +[m4_if([$1], [], [], + [$2], [ ], [m4_if(m4_index([$1], [ ]), [-1], [[[$1]]], [_$0($@)])], + [$2], [], [_$0([$1], [[ ]+])], + [_$0($@)])]) + +m4_define([_m4_split], +[m4_changequote([-=<{(],[)}>=-])]dnl +[[m4_bpatsubst(-=<{(-=<{($1)}>=-)}>=-, -=<{($2)}>=-, + -=<{(], [)}>=-)]m4_changequote([, ])]) + + + +# m4_flatten(STRING) +# ------------------ +# If STRING contains end of lines, replace them with spaces. If there +# are backslashed end of lines, remove them. This macro is safe with +# active symbols. +# m4_define(active, ACTIVE) +# m4_flatten([active +# act\ +# ive])end +# => active activeend +# +# In m4, m4_bpatsubst is expensive, so first check for a newline. +m4_define([m4_flatten], +[m4_if(m4_index([$1], [ +]), [-1], [[$1]], + [m4_translit(m4_bpatsubst([[[$1]]], [\\ +]), [ +], [ ])])]) + + +# m4_strip(STRING) +# ---------------- +# Expands into STRING with tabs and spaces singled out into a single +# space, and removing leading and trailing spaces. +# +# This macro is robust to active symbols. +# m4_define(active, ACTIVE) +# m4_strip([ active active ])end +# => active activeend +# +# First, notice that we guarantee trailing space. Why? Because regular +# expressions are greedy, and `.* ?' would always group the space into the +# .* portion. The algorithm is simpler by avoiding `?' at the end. The +# algorithm correctly strips everything if STRING is just ` '. +# +# Then notice the second pattern: it is in charge of removing the +# leading/trailing spaces. Why not just `[^ ]'? Because they are +# applied to over-quoted strings, i.e. more or less [STRING], due +# to the limitations of m4_bpatsubsts. So the leading space in STRING +# is the *second* character; equally for the trailing space. +m4_define([m4_strip], +[m4_bpatsubsts([$1 ], + [[ ]+], [ ], + [^. ?\(.*\) .$], [[[\1]]])]) + + +# m4_normalize(STRING) +# -------------------- +# Apply m4_flatten and m4_strip to STRING. +# +# The argument is quoted, so that the macro is robust to active symbols: +# +# m4_define(active, ACTIVE) +# m4_normalize([ act\ +# ive +# active ])end +# => active activeend + +m4_define([m4_normalize], +[m4_strip(m4_flatten([$1]))]) + + + +# m4_join(SEP, ARG1, ARG2...) +# --------------------------- +# Produce ARG1SEPARG2...SEPARGn. Avoid back-to-back SEP when a given ARG +# is the empty string. No expansion is performed on SEP or ARGs. +# +# Since the number of arguments to join can be arbitrarily long, we +# want to avoid having more than one $@ in the macro definition; +# otherwise, the expansion would require twice the memory of the already +# long list. Hence, m4_join merely looks for the first non-empty element, +# and outputs just that element; while _m4_join looks for all non-empty +# elements, and outputs them following a separator. The final trick to +# note is that we decide between recursing with $0 or _$0 based on the +# nested m4_if ending with `_'. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift2($@))])]) +m4_define([_m4_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift2($@))])]) + +# m4_joinall(SEP, ARG1, ARG2...) +# ------------------------------ +# Produce ARG1SEPARG2...SEPARGn. An empty ARG results in back-to-back SEP. +# No expansion is performed on SEP or ARGs. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_joinall], [[$2]_$0([$1], m4_shift($@))]) +m4_define([_m4_joinall], +[m4_if([$#], [2], [], [[$1$3]$0([$1], m4_shift2($@))])]) + +# m4_combine([SEPARATOR], PREFIX-LIST, [INFIX], SUFFIX...) +# -------------------------------------------------------- +# Produce the pairwise combination of every element in the quoted, +# comma-separated PREFIX-LIST with every element from the SUFFIX arguments. +# Each pair is joined with INFIX, and pairs are separated by SEPARATOR. +# No expansion occurs on SEPARATOR, INFIX, or elements of either list. +# +# For example: +# m4_combine([, ], [[a], [b], [c]], [-], [1], [2], [3]) +# => a-1, a-2, a-3, b-1, b-2, b-3, c-1, c-2, c-3 +# +# In order to have the correct number of SEPARATORs, we use a temporary +# variable that redefines itself after the first use. We must use defn +# rather than overquoting in case PREFIX or SUFFIX contains $1, but use +# _m4_defn for speed. Likewise, we compute the m4_shift3 only once, +# rather than in each iteration of the outer m4_foreach. +m4_define([m4_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([m4_Separator], [m4_define([m4_Separator], + _m4_defn([m4_echo]))])]]dnl +[[m4_foreach([m4_Prefix], [$2], + [m4_foreach([m4_Suffix], ]m4_dquote(m4_dquote(m4_shift3($@)))[, + [m4_Separator([$1])[]_m4_defn([m4_Prefix])[$3]_m4_defn( + [m4_Suffix])])])]]dnl +[[_m4_popdef([m4_Separator])])]) + + +# m4_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR`'STRING' +# at the end. It is valid to use this macro with MACRO-NAME undefined, +# in which case no SEPARATOR is added. Be aware that the criterion is +# `not being defined', and not `not being empty'. +# +# Note that neither STRING nor SEPARATOR are expanded here; rather, when +# you expand MACRO-NAME, they will be expanded at that point in time. +# +# This macro is robust to active symbols. It can be used to grow +# strings. +# +# | m4_define(active, ACTIVE)dnl +# | m4_append([sentence], [This is an])dnl +# | m4_append([sentence], [ active ])dnl +# | m4_append([sentence], [symbol.])dnl +# | sentence +# | m4_undefine([active])dnl +# | sentence +# => This is an ACTIVE symbol. +# => This is an active symbol. +# +# It can be used to define hooks. +# +# | m4_define(active, ACTIVE)dnl +# | m4_append([hooks], [m4_define([act1], [act2])])dnl +# | m4_append([hooks], [m4_define([act2], [active])])dnl +# | m4_undefine([active])dnl +# | act1 +# | hooks +# | act1 +# => act1 +# => +# => active +# +# It can also be used to create lists, although this particular usage was +# broken prior to autoconf 2.62. +# | m4_append([list], [one], [, ])dnl +# | m4_append([list], [two], [, ])dnl +# | m4_append([list], [three], [, ])dnl +# | list +# | m4_dquote(list) +# => one, two, three +# => [one],[two],[three] +# +# Note that m4_append can benefit from amortized O(n) m4 behavior, if +# the underlying m4 implementation is smart enough to avoid copying existing +# contents when enlarging a macro's definition into any pre-allocated storage +# (m4 1.4.x unfortunately does not implement this optimization). We do +# not implement m4_prepend, since it is inherently O(n^2) (pre-allocated +# storage only occurs at the end of a macro, so the existing contents must +# always be moved). +# +# Use _m4_defn for speed. +m4_define([m4_append], +[m4_define([$1], m4_ifdef([$1], [_m4_defn([$1])[$3]])[$2])]) + + +# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR], [IF-UNIQ], [IF-DUP]) +# -------------------------------------------------------------------- +# Like `m4_append', but append only if not yet present. Additionally, +# expand IF-UNIQ if STRING was appended, or IF-DUP if STRING was already +# present. Also, warn if SEPARATOR is not empty and occurs within STRING, +# as the algorithm no longer guarantees uniqueness. +# +# Note that while m4_append can be O(n) (depending on the quality of the +# underlying M4 implementation), m4_append_uniq is inherently O(n^2) +# because each append operation searches the entire string. +m4_define([m4_append_uniq], +[m4_ifval([$3], [m4_if(m4_index([$2], [$3]), [-1], [], + [m4_warn([syntax], + [$0: `$2' contains `$3'])])])_$0($@)]) +m4_define([_m4_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]_m4_defn([$1])[$3], [$3$2$3]), [-1], + [m4_append([$1], [$2], [$3])$4], [$5])], + [m4_define([$1], [$2])$4])]) + +# m4_append_uniq_w(MACRO-NAME, STRINGS) +# ------------------------------------- +# For each of the words in the whitespace separated list STRINGS, append +# only the unique strings to the definition of MACRO-NAME. +# +# Use _m4_defn for speed. +m4_define([m4_append_uniq_w], +[m4_foreach_w([m4_Word], [$2], + [_m4_append_uniq([$1], _m4_defn([m4_Word]), [ ])])]) + + +# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) +# ------------------------------------------------------- +# Expands into STRING wrapped to hold in WIDTH columns (default = 79). +# If PREFIX is given, each line is prefixed with it. If FIRST-PREFIX is +# specified, then the first line is prefixed with it. As a special case, +# if the length of FIRST-PREFIX is greater than that of PREFIX, then +# FIRST-PREFIX will be left alone on the first line. +# +# No expansion occurs on the contents STRING, PREFIX, or FIRST-PREFIX, +# although quadrigraphs are correctly recognized. +# +# Typical outputs are: +# +# m4_text_wrap([Short string */], [ ], [/* ], 20) +# => /* Short string */ +# +# m4_text_wrap([Much longer string */], [ ], [/* ], 20) +# => /* Much longer +# => string */ +# +# m4_text_wrap([Short doc.], [ ], [ --short ], 30) +# => --short Short doc. +# +# m4_text_wrap([Short doc.], [ ], [ --too-wide ], 30) +# => --too-wide +# => Short doc. +# +# m4_text_wrap([Super long documentation.], [ ], [ --too-wide ], 30) +# => --too-wide +# => Super long +# => documentation. +# +# FIXME: there is no checking of a longer PREFIX than WIDTH, but do +# we really want to bother with people trying each single corner +# of a software? +# +# This macro does not leave a trailing space behind the last word of a line, +# which complicates it a bit. The algorithm is otherwise stupid and simple: +# all the words are preceded by m4_Separator which is defined to empty for +# the first word, and then ` ' (single space) for all the others. +# +# The algorithm uses a helper that uses $2 through $4 directly, rather than +# using local variables, to avoid m4_defn overhead, or expansion swallowing +# any $. It also bypasses m4_popdef overhead with _m4_popdef since no user +# macro expansion occurs in the meantime. Also, the definition is written +# with m4_do, to avoid time wasted on dnl during expansion (since this is +# already a time-consuming macro). +m4_define([m4_text_wrap], +[_$0([$1], [$2], m4_if([$3], [], [[$2]], [[$3]]), + m4_if([$4], [], [79], [[$4]]))]) +m4_define([_m4_text_wrap], +m4_do(dnl set up local variables, to avoid repeated calculations +[[m4_pushdef([m4_Indent], m4_qlen([$2]))]], +[[m4_pushdef([m4_Cursor], m4_qlen([$3]))]], +[[m4_pushdef([m4_Separator], [m4_define([m4_Separator], [ ])])]], +dnl expand the first prefix, then check its length vs. regular prefix +dnl same length: nothing special +dnl prefix1 longer: output on line by itself, and reset cursor +dnl prefix1 shorter: pad to length of prefix, and reset cursor +[[[$3]m4_cond([m4_Cursor], m4_Indent, [], + [m4_eval(m4_Cursor > m4_Indent)], [1], [ +[$2]m4_define([m4_Cursor], m4_Indent)], + [m4_format([%*s], m4_max([0], + m4_eval(m4_Indent - m4_Cursor)), [])m4_define([m4_Cursor], m4_Indent)])]], +dnl now, for each word, compute the curser after the word is output, then +dnl check if the cursor would exceed the wrap column +dnl if so, reset cursor, and insert newline and prefix +dnl if not, insert the separator (usually a space) +dnl either way, insert the word +[[m4_foreach_w([m4_Word], [$1], + [m4_define([m4_Cursor], + m4_eval(m4_Cursor + m4_qlen(_m4_defn([m4_Word])) + + 1))m4_if(m4_eval(m4_Cursor > ([$4])), + [1], [m4_define([m4_Cursor], + m4_eval(m4_Indent + m4_qlen(_m4_defn([m4_Word])) + 1)) +[$2]], + [m4_Separator[]])_m4_defn([m4_Word])])]], +dnl finally, clean up the local variabls +[[_m4_popdef([m4_Separator], [m4_Cursor], [m4_Indent])]])) + + +# m4_text_box(MESSAGE, [FRAME-CHARACTER = `-']) +# --------------------------------------------- +# Turn MESSAGE into: +# ## ------- ## +# ## MESSAGE ## +# ## ------- ## +# using FRAME-CHARACTER in the border. +m4_define([m4_text_box], +[m4_pushdef([m4_Border], + m4_translit(m4_format([%*s], m4_qlen(m4_expand([$1])), []), + [ ], m4_if([$2], [], [[-]], [[$2]])))dnl +@%:@@%:@ m4_Border @%:@@%:@ +@%:@@%:@ $1 @%:@@%:@ +@%:@@%:@ m4_Border @%:@@%:@_m4_popdef([m4_Border])dnl +]) + + +# m4_qlen(STRING) +# --------------- +# Expands to the length of STRING after autom4te converts all quadrigraphs. +# +# Avoid bpatsubsts for the common case of no quadrigraphs. +m4_define([m4_qlen], +[m4_if(m4_index([$1], [@]), [-1], [m4_len([$1])], + [m4_len(m4_bpatsubst([[$1]], + [@\(\(<:\|:>\|S|\|%:\|\{:\|:\}\)\(@\)\|&t@\)], + [\3]))])]) + + +# m4_qdelta(STRING) +# ----------------- +# Expands to the net change in the length of STRING from autom4te converting the +# quadrigraphs in STRING. This number is always negative or zero. +m4_define([m4_qdelta], +[m4_eval(m4_qlen([$1]) - m4_len([$1]))]) + + + +## ----------------------- ## +## 13. Number processing. ## +## ----------------------- ## + +# m4_cmp(A, B) +# ------------ +# Compare two integer expressions. +# A < B -> -1 +# A = B -> 0 +# A > B -> 1 +m4_define([m4_cmp], +[m4_eval((([$1]) > ([$2])) - (([$1]) < ([$2])))]) + + +# m4_list_cmp(A, B) +# ----------------- +# +# Compare the two lists of integer expressions A and B. For instance: +# m4_list_cmp([1, 0], [1]) -> 0 +# m4_list_cmp([1, 0], [1, 0]) -> 0 +# m4_list_cmp([1, 2], [1, 0]) -> 1 +# m4_list_cmp([1, 2, 3], [1, 2]) -> 1 +# m4_list_cmp([1, 2, -3], [1, 2]) -> -1 +# m4_list_cmp([1, 0], [1, 2]) -> -1 +# m4_list_cmp([1], [1, 2]) -> -1 +# m4_define([xa], [oops])dnl +# m4_list_cmp([[0xa]], [5+5]) -> 0 +# +# Rather than face the overhead of m4_case, we use a helper function whose +# expansion includes the name of the macro to invoke on the tail, either +# m4_ignore or m4_unquote. This is particularly useful when comparing +# long lists, since less text is being expanded for deciding when to end +# recursion. The recursion is between a pair of macros that alternate +# which list is trimmed by one element; this is more efficient than +# calling m4_cdr on both lists from a single macro. Guarantee exactly +# one expansion of both lists' side effects. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_list_cmp], +[_$0_raw(m4_dquote($1), m4_dquote($2))]) + +m4_define([_m4_list_cmp_raw], +[m4_if([$1], [$2], [0], [_m4_list_cmp_1([$1], $2)])]) + +m4_define([_m4_list_cmp], +[m4_if([$1], [], [0m4_ignore], [$2], [0], [m4_unquote], [$2m4_ignore])]) + +m4_define([_m4_list_cmp_1], +[_m4_list_cmp_2([$2], [m4_shift2($@)], $1)]) + +m4_define([_m4_list_cmp_2], +[_m4_list_cmp([$1$3], m4_cmp([$3+0], [$1+0]))( + [_m4_list_cmp_1(m4_dquote(m4_shift3($@)), $2)])]) + +# m4_max(EXPR, ...) +# m4_min(EXPR, ...) +# ----------------- +# Return the decimal value of the maximum (or minimum) in a series of +# integer expressions. +# +# M4 1.4.x doesn't provide ?:. Hence this huge m4_eval. Avoid m4_eval +# if both arguments are identical, but be aware of m4_max(0xa, 10) (hence +# the use of <=, not just <, in the second multiply). +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_max], +[m4_if([$#], [0], [m4_fatal([too few arguments to $0])], + [$#], [1], [m4_eval([$1])], + [$#$1], [2$2], [m4_eval([$1])], + [$#], [2], [_$0($@)], + [_m4_minmax([_$0], $@)])]) + +m4_define([_m4_max], +[m4_eval((([$1]) > ([$2])) * ([$1]) + (([$1]) <= ([$2])) * ([$2]))]) + +m4_define([m4_min], +[m4_if([$#], [0], [m4_fatal([too few arguments to $0])], + [$#], [1], [m4_eval([$1])], + [$#$1], [2$2], [m4_eval([$1])], + [$#], [2], [_$0($@)], + [_m4_minmax([_$0], $@)])]) + +m4_define([_m4_min], +[m4_eval((([$1]) < ([$2])) * ([$1]) + (([$1]) >= ([$2])) * ([$2]))]) + +# _m4_minmax(METHOD, ARG1, ARG2...) +# --------------------------------- +# Common recursion code for m4_max and m4_min. METHOD must be _m4_max +# or _m4_min, and there must be at least two arguments to combine. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([_m4_minmax], +[m4_if([$#], [3], [$1([$2], [$3])], + [$0([$1], $1([$2], [$3]), m4_shift3($@))])]) + + +# m4_sign(A) +# ---------- +# The sign of the integer expression A. +m4_define([m4_sign], +[m4_eval((([$1]) > 0) - (([$1]) < 0))]) + + + +## ------------------------ ## +## 14. Version processing. ## +## ------------------------ ## + + +# m4_version_unletter(VERSION) +# ---------------------------- +# Normalize beta version numbers with letters to numeric expressions, which +# can then be handed to m4_eval for the purpose of comparison. +# +# Nl -> (N+1).-1.(l#) +# +# for example: +# [2.14a] -> [2.14+1.-1.[0r36:a]] -> 2.15.-1.10 +# [2.14b] -> [2.15+1.-1.[0r36:b]] -> 2.15.-1.11 +# [2.61aa.b] -> [2.61+1.-1.[0r36:aa],+1.-1.[0r36:b]] -> 2.62.-1.370.1.-1.11 +# +# This macro expects reasonable version numbers, but can handle double +# letters and does not expand any macros. Original version strings can +# use both `.' and `-' separators. +# +# Inline constant expansions, to avoid m4_defn overhead. +# _m4_version_unletter is the real workhorse used by m4_version_compare, +# but since [0r36:a] is less readable than 10, we provide a wrapper for +# human use. +m4_define([m4_version_unletter], +[m4_map_sep([m4_eval], [.], + m4_dquote(m4_dquote_elt(m4_unquote(_$0([$1])))))]) +m4_define([_m4_version_unletter], +[m4_bpatsubst(m4_translit([[[$1]]], [.-], [,,]),]dnl +m4_dquote(m4_dquote(m4_defn([m4_cr_Letters])))[[+], + [+1,-1,[0r36:\&]])]) + + +# m4_version_compare(VERSION-1, VERSION-2) +# ---------------------------------------- +# Compare the two version numbers and expand into +# -1 if VERSION-1 < VERSION-2 +# 0 if = +# 1 if > +# +# Since _m4_version_unletter does not output side effects, we can +# safely bypass the overhead of m4_version_cmp. +m4_define([m4_version_compare], +[_m4_list_cmp_raw(_m4_version_unletter([$1]), _m4_version_unletter([$2]))]) + + +# m4_PACKAGE_NAME +# m4_PACKAGE_TARNAME +# m4_PACKAGE_VERSION +# m4_PACKAGE_STRING +# m4_PACKAGE_BUGREPORT +# -------------------- +# If m4sugar/version.m4 is present, then define version strings. This +# file is optional, provided by Autoconf but absent in Bison. +m4_sinclude([m4sugar/version.m4]) + + +# m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL]) +# ---------------------------------------------------- +# Check this Autoconf version against VERSION. +m4_define([m4_version_prereq], +m4_ifdef([m4_PACKAGE_VERSION], +[[m4_if(m4_version_compare(]m4_dquote(m4_defn([m4_PACKAGE_VERSION]))[, [$1]), + [-1], + [m4_default([$3], + [m4_fatal([Autoconf version $1 or higher is required], + [63])])], + [$2])]], +[[m4_fatal([m4sugar/version.m4 not found])]])) + + +## ------------------ ## +## 15. Set handling. ## +## ------------------ ## + +# Autoconf likes to create arbitrarily large sets; for example, as of +# this writing, the configure.ac for coreutils tracks a set of more +# than 400 AC_SUBST. How do we track all of these set members, +# without introducing duplicates? We could use m4_append_uniq, with +# the set NAME residing in the contents of the macro NAME. +# Unfortunately, m4_append_uniq is quadratic for set creation, because +# it costs O(n) to search the string for each of O(n) insertions; not +# to mention that with m4 1.4.x, even using m4_append is slow, costing +# O(n) rather than O(1) per insertion. Other set operations, not used +# by Autoconf but still possible by manipulation of the definition +# tracked in macro NAME, include O(n) deletion of one element and O(n) +# computation of set size. Because the set is exposed to the user via +# the definition of a single macro, we cannot cache any data about the +# set without risking the cache being invalidated by the user +# redefining NAME. +# +# Can we do better? Yes, because m4 gives us an O(1) search function +# for free: ifdef. Additionally, even m4 1.4.x gives us an O(1) +# insert operation for free: pushdef. But to use these, we must +# represent the set via a group of macros; to keep the set consistent, +# we must hide the set so that the user can only manipulate it through +# accessor macros. The contents of the set are maintained through two +# access points; _m4_set([name]) is a pushdef stack of values in the +# set, useful for O(n) traversal of the set contents; while the +# existence of _m4_set([name],value) with no particular value is +# useful for O(1) querying of set membership. And since the user +# cannot externally manipulate the set, we are free to add additional +# caching macros for other performance improvements. Deletion can be +# O(1) per element rather than O(n), by reworking the definition of +# _m4_set([name],value) to be 0 or 1 based on current membership, and +# adding _m4_set_cleanup(name) to defer the O(n) cleanup of +# _m4_set([name]) until we have another reason to do an O(n) +# traversal. The existence of _m4_set_cleanup(name) can then be used +# elsewhere to determine if we must dereference _m4_set([name],value), +# or assume that definition implies set membership. Finally, size can +# be tracked in an O(1) fashion with _m4_set_size(name). +# +# The quoting in _m4_set([name],value) is chosen so that there is no +# ambiguity with a set whose name contains a comma, and so that we can +# supply the value via _m4_defn([_m4_set([name])]) without needing any +# quote manipulation. + +# m4_set_add(SET, VALUE, [IF-UNIQ], [IF-DUP]) +# ------------------------------------------- +# Add VALUE as an element of SET. Expand IF-UNIQ on the first +# addition, and IF-DUP if it is already in the set. Addition of one +# element is O(1), such that overall set creation is O(n). +# +# We do not want to add a duplicate for a previously deleted but +# unpruned element, but it is just as easy to check existence directly +# as it is to query _m4_set_cleanup($1). +m4_define([m4_set_add], +[m4_ifdef([_m4_set([$1],$2)], + [m4_if(m4_indir([_m4_set([$1],$2)]), [0], + [m4_define([_m4_set([$1],$2)], + [1])_m4_set_size([$1], [m4_incr])$3], [$4])], + [m4_define([_m4_set([$1],$2)], + [1])m4_pushdef([_m4_set([$1])], + [$2])_m4_set_size([$1], [m4_incr])$3])]) + +# m4_set_add_all(SET, VALUE...) +# ----------------------------- +# Add each VALUE into SET. This is O(n) in the number of VALUEs, and +# can be faster than calling m4_set_add for each VALUE. +# +# Implement two recursion helpers; the check variant is slower but +# handles the case where an element has previously been removed but +# not pruned. The recursion helpers ignore their second argument, so +# that we can use the faster m4_shift2 and 2 arguments, rather than +# _m4_shift2 and one argument, as the signal to end recursion. +# +# Please keep foreach.m4 in sync with any adjustments made here. +m4_define([m4_set_add_all], +[m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1]) + + m4_len(m4_ifdef([_m4_set_cleanup($1)], [_$0_check], [_$0])([$1], $@))))]) + +m4_define([_m4_set_add_all], +[m4_if([$#], [2], [], + [m4_ifdef([_m4_set([$1],$3)], [], + [m4_define([_m4_set([$1],$3)], [1])m4_pushdef([_m4_set([$1])], + [$3])-])$0([$1], m4_shift2($@))])]) + +m4_define([_m4_set_add_all_check], +[m4_if([$#], [2], [], + [m4_set_add([$1], [$3])$0([$1], m4_shift2($@))])]) + +# m4_set_contains(SET, VALUE, [IF-PRESENT], [IF-ABSENT]) +# ------------------------------------------------------ +# Expand IF-PRESENT if SET contains VALUE, otherwise expand IF-ABSENT. +# This is always O(1). +m4_define([m4_set_contains], +[m4_ifdef([_m4_set_cleanup($1)], + [m4_if(m4_ifdef([_m4_set([$1],$2)], + [m4_indir([_m4_set([$1],$2)])], [0]), [1], [$3], [$4])], + [m4_ifdef([_m4_set([$1],$2)], [$3], [$4])])]) + +# m4_set_contents(SET, [SEP]) +# --------------------------- +# Expand to a single string containing all the elements in SET, +# separated by SEP, without modifying SET. No provision is made for +# disambiguating set elements that contain non-empty SEP as a +# sub-string, or for recognizing a set that contains only the empty +# string. Order of the output is not guaranteed. If any elements +# have been previously removed from the set, this action will prune +# the unused memory. This is O(n) in the size of the set before +# pruning. +# +# Use _m4_popdef for speed. The existence of _m4_set_cleanup($1) +# determines which version of _1 helper we use. +m4_define([m4_set_contents], +[m4_ifdef([_m4_set_cleanup($1)], [_$0_1c], [_$0_1])([$1])_$0_2([$1], + [_m4_defn([_m4_set_($1)])], [[$2]])]) + +# _m4_set_contents_1(SET) +# _m4_set_contents_1c(SET) +# _m4_set_contents_2(SET, SEP, PREP) +# ---------------------------------- +# Expand to a list of quoted elements currently in the set, separated +# by SEP, and moving PREP in front of SEP on recursion. To avoid +# nesting limit restrictions, the algorithm must be broken into two +# parts; _1 destructively copies the stack in reverse into +# _m4_set_($1), producing no output; then _2 destructively copies +# _m4_set_($1) back into the stack in reverse. SEP is expanded while +# _m4_set_($1) contains the current element, so a SEP containing +# _m4_defn([_m4_set_($1)]) can produce output in the order the set was +# created. Behavior is undefined if SEP tries to recursively list or +# modify SET in any way other than calling m4_set_remove on the +# current element. Use _1 if all entries in the stack are guaranteed +# to be in the set, and _1c to prune removed entries. Uses _m4_defn +# and _m4_popdef for speed. +m4_define([_m4_set_contents_1], +[m4_ifdef([_m4_set([$1])], [m4_pushdef([_m4_set_($1)], + _m4_defn([_m4_set([$1])]))_m4_popdef([_m4_set([$1])])$0([$1])])]) + +m4_define([_m4_set_contents_1c], +[m4_ifdef([_m4_set([$1])], + [m4_set_contains([$1], _m4_defn([_m4_set([$1])]), + [m4_pushdef([_m4_set_($1)], _m4_defn([_m4_set([$1])]))], + [_m4_popdef([_m4_set([$1],]_m4_defn( + [_m4_set([$1])])[)])])_m4_popdef([_m4_set([$1])])$0([$1])], + [_m4_popdef([_m4_set_cleanup($1)])])]) + +m4_define([_m4_set_contents_2], +[m4_ifdef([_m4_set_($1)], [m4_pushdef([_m4_set([$1])], + _m4_defn([_m4_set_($1)]))$2[]_m4_popdef([_m4_set_($1)])$0([$1], [$3$2])])]) + +# m4_set_delete(SET) +# ------------------ +# Delete all elements in SET, and reclaim any memory occupied by the +# set. This is O(n) in the set size. +# +# Use _m4_defn and _m4_popdef for speed. +m4_define([m4_set_delete], +[m4_ifdef([_m4_set([$1])], + [_m4_popdef([_m4_set([$1],]_m4_defn([_m4_set([$1])])[)], + [_m4_set([$1])])$0([$1])], + [m4_ifdef([_m4_set_cleanup($1)], + [_m4_popdef([_m4_set_cleanup($1)])])m4_ifdef( + [_m4_set_size($1)], + [_m4_popdef([_m4_set_size($1)])])])]) + +# m4_set_difference(SET1, SET2) +# ----------------------------- +# Produce a LIST of quoted elements that occur in SET1 but not SET2. +# Output a comma prior to any elements, to distinguish the empty +# string from no elements. This can be directly used as a series of +# arguments, such as for m4_join, or wrapped inside quotes for use in +# m4_foreach. Order of the output is not guaranteed. +# +# Short-circuit the idempotence relation. Use _m4_defn for speed. +m4_define([m4_set_difference], +[m4_if([$1], [$2], [], + [m4_set_foreach([$1], [_m4_element], + [m4_set_contains([$2], _m4_defn([_m4_element]), [], + [,_m4_defn([_m4_element])])])])]) + +# m4_set_dump(SET, [SEP]) +# ----------------------- +# Expand to a single string containing all the elements in SET, +# separated by SEP, then delete SET. In general, if you only need to +# list the contents once, this is faster than m4_set_contents. No +# provision is made for disambiguating set elements that contain +# non-empty SEP as a sub-string. Order of the output is not +# guaranteed. This is O(n) in the size of the set before pruning. +# +# Use _m4_popdef for speed. Use existence of _m4_set_cleanup($1) to +# decide if more expensive recursion is needed. +m4_define([m4_set_dump], +[m4_ifdef([_m4_set_size($1)], + [_m4_popdef([_m4_set_size($1)])])m4_ifdef([_m4_set_cleanup($1)], + [_$0_check], [_$0])([$1], [], [$2])]) + +# _m4_set_dump(SET, SEP, PREP) +# _m4_set_dump_check(SET, SEP, PREP) +# ---------------------------------- +# Print SEP and the current element, then delete the element and +# recurse with empty SEP changed to PREP. The check variant checks +# whether the element has been previously removed. Use _m4_defn and +# _m4_popdef for speed. +m4_define([_m4_set_dump], +[m4_ifdef([_m4_set([$1])], + [[$2]_m4_defn([_m4_set([$1])])_m4_popdef([_m4_set([$1],]_m4_defn( + [_m4_set([$1])])[)], [_m4_set([$1])])$0([$1], [$2$3])])]) + +m4_define([_m4_set_dump_check], +[m4_ifdef([_m4_set([$1])], + [m4_set_contains([$1], _m4_defn([_m4_set([$1])]), + [[$2]_m4_defn([_m4_set([$1])])])_m4_popdef( + [_m4_set([$1],]_m4_defn([_m4_set([$1])])[)], + [_m4_set([$1])])$0([$1], [$2$3])], + [_m4_popdef([_m4_set_cleanup($1)])])]) + +# m4_set_empty(SET, [IF-EMPTY], [IF-ELEMENTS]) +# -------------------------------------------- +# Expand IF-EMPTY if SET has no elements, otherwise IF-ELEMENTS. +m4_define([m4_set_empty], +[m4_ifdef([_m4_set_size($1)], + [m4_if(m4_indir([_m4_set_size($1)]), [0], [$2], [$3])], [$2])]) + +# m4_set_foreach(SET, VAR, ACTION) +# -------------------------------- +# For each element of SET, define VAR to the element and expand +# ACTION. ACTION should not recursively list SET's contents, add +# elements to SET, nor delete any element from SET except the one +# currently in VAR. The order that the elements are visited in is not +# guaranteed. This is faster than the corresponding m4_foreach([VAR], +# m4_indir([m4_dquote]m4_set_listc([SET])), [ACTION]) +m4_define([m4_set_foreach], +[m4_pushdef([$2])m4_ifdef([_m4_set_cleanup($1)], + [_m4_set_contents_1c], [_m4_set_contents_1])([$1])_m4_set_contents_2([$1], + [m4_define([$2], _m4_defn([_m4_set_($1)]))$3[]])m4_popdef([$2])]) + +# m4_set_intersection(SET1, SET2) +# ------------------------------- +# Produce a LIST of quoted elements that occur in both SET1 or SET2. +# Output a comma prior to any elements, to distinguish the empty +# string from no elements. This can be directly used as a series of +# arguments, such as for m4_join, or wrapped inside quotes for use in +# m4_foreach. Order of the output is not guaranteed. +# +# Iterate over the smaller set, and short-circuit the idempotence +# relation. Use _m4_defn for speed. +m4_define([m4_set_intersection], +[m4_if([$1], [$2], [m4_set_listc([$1])], + m4_eval(m4_set_size([$2]) < m4_set_size([$1])), [1], [$0([$2], [$1])], + [m4_set_foreach([$1], [_m4_element], + [m4_set_contains([$2], _m4_defn([_m4_element]), + [,_m4_defn([_m4_element])])])])]) + +# m4_set_list(SET) +# m4_set_listc(SET) +# ----------------- +# Produce a LIST of quoted elements of SET. This can be directly used +# as a series of arguments, such as for m4_join or m4_set_add_all, or +# wrapped inside quotes for use in m4_foreach or m4_map. With +# m4_set_list, there is no way to distinguish an empty set from a set +# containing only the empty string; with m4_set_listc, a leading comma +# is output if there are any elements. +m4_define([m4_set_list], +[m4_ifdef([_m4_set_cleanup($1)], [_m4_set_contents_1c], + [_m4_set_contents_1])([$1])_m4_set_contents_2([$1], + [_m4_defn([_m4_set_($1)])], [,])]) + +m4_define([m4_set_listc], +[m4_ifdef([_m4_set_cleanup($1)], [_m4_set_contents_1c], + [_m4_set_contents_1])([$1])_m4_set_contents_2([$1], + [,_m4_defn([_m4_set_($1)])])]) + +# m4_set_remove(SET, VALUE, [IF-PRESENT], [IF-ABSENT]) +# ---------------------------------------------------- +# If VALUE is an element of SET, delete it and expand IF-PRESENT. +# Otherwise expand IF-ABSENT. Deleting a single value is O(1), +# although it leaves memory occupied until the next O(n) traversal of +# the set which will compact the set. +# +# Optimize if the element being removed is the most recently added, +# since defining _m4_set_cleanup($1) slows down so many other macros. +# In particular, this plays well with m4_set_foreach. +m4_define([m4_set_remove], +[m4_set_contains([$1], [$2], [_m4_set_size([$1], + [m4_decr])m4_if(_m4_defn([_m4_set([$1])]), [$2], + [_m4_popdef([_m4_set([$1],$2)], [_m4_set([$1])])], + [m4_define([_m4_set_cleanup($1)])m4_define( + [_m4_set([$1],$2)], [0])])$3], [$4])]) + +# m4_set_size(SET) +# ---------------- +# Expand to the number of elements currently in SET. This operation +# is O(1), and thus more efficient than m4_count(m4_set_list([SET])). +m4_define([m4_set_size], +[m4_ifdef([_m4_set_size($1)], [m4_indir([_m4_set_size($1)])], [0])]) + +# _m4_set_size(SET, ACTION) +# ------------------------- +# ACTION must be either m4_incr or m4_decr, and the size of SET is +# changed accordingly. If the set is empty, ACTION must not be +# m4_decr. +m4_define([_m4_set_size], +[m4_define([_m4_set_size($1)], + m4_ifdef([_m4_set_size($1)], [$2(m4_indir([_m4_set_size($1)]))], + [1]))]) + +# m4_set_union(SET1, SET2) +# ------------------------ +# Produce a LIST of double quoted elements that occur in either SET1 +# or SET2, without duplicates. Output a comma prior to any elements, +# to distinguish the empty string from no elements. This can be +# directly used as a series of arguments, such as for m4_join, or +# wrapped inside quotes for use in m4_foreach. Order of the output is +# not guaranteed. +# +# We can rely on the fact that m4_set_listc prunes SET1, so we don't +# need to check _m4_set([$1],element) for 0. Use _m4_defn for speed. +# Short-circuit the idempotence relation. +m4_define([m4_set_union], +[m4_set_listc([$1])m4_if([$1], [$2], [], [m4_set_foreach([$2], [_m4_element], + [m4_ifdef([_m4_set([$1],]_m4_defn([_m4_element])[)], [], + [,_m4_defn([_m4_element])])])])]) + + +## ------------------- ## +## 16. File handling. ## +## ------------------- ## + + +# It is a real pity that M4 comes with no macros to bind a diversion +# to a file. So we have to deal without, which makes us a lot more +# fragile than we should. + + +# m4_file_append(FILE-NAME, CONTENT) +# ---------------------------------- +m4_define([m4_file_append], +[m4_syscmd([cat >>$1 <<_m4eof +$2 +_m4eof +]) +m4_if(m4_sysval, [0], [], + [m4_fatal([$0: cannot write: $1])])]) + + + +## ------------------------ ## +## 17. Setting M4sugar up. ## +## ------------------------ ## + + +# m4_init +# ------- +# Initialize the m4sugar language. +m4_define([m4_init], +[# All the M4sugar macros start with `m4_', except `dnl' kept as is +# for sake of simplicity. +m4_pattern_forbid([^_?m4_]) +m4_pattern_forbid([^dnl$]) + +# If __m4_version__ is defined, we assume that we are being run by M4 +# 1.6 or newer, and thus that $@ recursion is linear and debugmode(d) +# is available for faster checks of dereferencing undefined macros. +# But if it is missing, we assume we are being run by M4 1.4.x, that +# $@ recursion is quadratic, and that we need foreach-based +# replacement macros. Use the raw builtin to avoid tripping up +# include tracing. +m4_ifdef([__m4_version__], +[m4_debugmode([+d]) +m4_copy([_m4_defn], [m4_defn]) +m4_copy([_m4_popdef], [m4_popdef]) +m4_copy([_m4_undefine], [m4_undefine])], +[m4_builtin([include], [m4sugar/foreach.m4])]) + +# _m4_divert_diversion should be defined: +m4_divert_push([KILL]) + +# Check the divert push/pop perfect balance. +m4_wrap([m4_divert_pop([]) + m4_ifdef([_m4_divert_diversion], + [m4_fatal([$0: unbalanced m4_divert_push:]_m4_divert_n_stack)])[]]) +]) diff --git a/data/xslt/bison.xsl b/data/xslt/bison.xsl new file mode 100644 index 0000000..9a6ce8a --- /dev/null +++ b/data/xslt/bison.xsl @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + s + + + r + + + + + + , + + + + diff --git a/data/xslt/xml2dot.xsl b/data/xslt/xml2dot.xsl new file mode 100644 index 0000000..130692e --- /dev/null +++ b/data/xslt/xml2dot.xsl @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + digraph Automaton { + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -> + + . + + + + + . + + + + + + + + + + + + + [ + + ] + + + + + + , + + + + + + + + + + + dotted + + + solid + + + dashed + + + + + + + + + + + + + + + + + [label=" + + + + "] + + + + + + + + + + -> + + [style= + + + label=" + + + + " + + ] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/xslt/xml2text.xsl b/data/xslt/xml2text.xsl new file mode 100644 index 0000000..a783512 --- /dev/null +++ b/data/xslt/xml2text.xsl @@ -0,0 +1,581 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Nonterminals useless in grammar + + + + + + + + + + + + Terminals unused in grammar + + + + + + + + + + + + + + Rules useless in grammar + + + + + + + + + + + Rules useless in parser due to conflicts + + + + + + + + + Grammar + + + + + + + + + + + + + + + + + + + + + + + + + Terminals, with rules where they appear + + + + + + Nonterminals, with rules where they appear + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + on@left: + + + + + + + , + + on@right: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + state + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + : + + + + + + + . + + + + + + + + + . + + + + + + + + + + + + + + + + /* empty */ + + + + [ + + ] + + + + + + , + + + + + + + + + + + + + shift, and go to state + + + + go to state + + + + + + + + + + + + + + error + ( + + ) + + + + + + + + + + + + [ + + + + accept + + + reduce using rule + + ( + + ) + + + + ] + + + + + + + + + + + + + Conflict between rule + + and token + + resolved as + + an + + + ( + + ). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/xslt/xml2xhtml.xsl b/data/xslt/xml2xhtml.xsl new file mode 100644 index 0000000..91dc630 --- /dev/null +++ b/data/xslt/xml2xhtml.xsl @@ -0,0 +1,745 @@ + + + + + + + + + + + + + + + <xsl:value-of select="bison-xml-report/filename"/> + <xsl:text> - GNU Bison XML Automaton Report</xsl:text> + + + + + + + + + + + + +

GNU Bison XML Automaton Report

+

+ input grammar: +

+ + +

Table of Contents

+ + + + + + +
+ + +

+ + Reductions +

+ + + +
+ + +

+ + Nonterminals useless in grammar +

+ + +

+ + + + + + +

+
+ + + +

+ + Terminals unused in grammar +

+ + +

+ + + + + + + +

+
+ + + +

+ + Rules useless in grammar +

+ + + +

+ + + + +

+
+ + + + + +

+ + Rules useless in parser due to conflicts +

+ +

+ + + +

+ + + + + +

+ + Grammar +

+ +

+ + + +

+ + + + + + + + + + + + + + + + + + + + + +

+ + Conflicts +

+ + + + + +

+ + +

+
+ + + + + + + + + +
+ + + + + + conflicts: + + + + + + + + + + + + + + +

+ + Terminals, with rules where they appear +

+ +

+ +

+ +
+ + +

+ + Nonterminals, with rules where they appear +

+ +

+ +

+ + + + + + + + + + + + + + + + + on left: + + + + + + + + + on right: + + + + + + + + + +
+ + + + + + + + +

+ + Automaton +

+ + + +
+ + + + +

+ + + + + + state + +

+ +

+ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + ε + + + + [ + + ] + + + + + + , + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + error + ( + + ) + + + + + + + + + + + + [ + + + + accept + + + + + + + + + ( + + ) + + + + ] + + + + + + + + + + + + + Conflict between + + + + + + + and token + + resolved as + + an + + + ( + + ). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + +
diff --git a/data/yacc.c b/data/yacc.c new file mode 100644 index 0000000..19f77a5 --- /dev/null +++ b/data/yacc.c @@ -0,0 +1,1741 @@ + -*- C -*- + +# Yacc compatible skeleton for Bison + +# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 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 . + +# Check the value of %define api.push_pull. +b4_percent_define_default([[api.push_pull]], [[pull]]) +b4_percent_define_check_values([[[[api.push_pull]], + [[pull]], [[push]], [[both]]]]) +b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]]) +b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]]) +m4_case(b4_percent_define_get([[api.push_pull]]), + [pull], [m4_define([b4_push_flag], [[0]])], + [push], [m4_define([b4_pull_flag], [[0]])]) + +# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing +# tests function as written, don't let BISON_USE_PUSH_FOR_PULL modify Bison's +# behavior at all when push parsing is already requested. +b4_define_flag_if([use_push_for_pull]) +b4_use_push_for_pull_if([ + b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])], + [m4_define([b4_push_flag], [[1]])])]) + +m4_include(b4_pkgdatadir/[c.m4]) + +## ---------------- ## +## Default values. ## +## ---------------- ## + +# Stack parameters. +m4_define_default([b4_stack_depth_max], [10000]) +m4_define_default([b4_stack_depth_init], [200]) + + +## ------------------------ ## +## Pure/impure interfaces. ## +## ------------------------ ## + +b4_percent_define_default([[api.pure]], [[false]]) +b4_define_flag_if([pure]) +m4_define([b4_pure_flag], + [b4_percent_define_flag_if([[api.pure]], [[1]], [[0]])]) + +# b4_yacc_pure_if(IF-TRUE, IF-FALSE) +# ---------------------------------- +# Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise. +m4_define([b4_yacc_pure_if], +[b4_pure_if([m4_ifset([b4_parse_param], + [$1], [$2])], + [$2])]) + + +# b4_yyerror_args +# --------------- +# Arguments passed to yyerror: user args plus yylloc. +m4_define([b4_yyerror_args], +[b4_yacc_pure_if([b4_locations_if([&yylloc, ])])dnl +m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) + + +# b4_lex_param +# ------------ +# Accumulate in b4_lex_param all the yylex arguments. +# b4_lex_param arrives quoted twice, but we want to keep only one level. +m4_define([b4_lex_param], +m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl +b4_locations_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl +m4_ifdef([b4_lex_param], b4_lex_param))) + + +## ------------ ## +## Data Types. ## +## ------------ ## + +# b4_int_type(MIN, MAX) +# --------------------- +# Return the smallest int type able to handle numbers ranging from +# MIN to MAX (included). Overwrite the version from c.m4, which +# uses only C89 types, so that the user can override the shorter +# types, and so that pre-C89 compilers are handled correctly. +m4_define([b4_int_type], +[m4_if(b4_ints_in($@, [0], [255]), [1], [yytype_uint8], + b4_ints_in($@, [-128], [127]), [1], [yytype_int8], + + b4_ints_in($@, [0], [65535]), [1], [yytype_uint16], + b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16], + + m4_eval([0 <= $1]), [1], [unsigned int], + + [int])]) + + +## ----------------- ## +## Semantic Values. ## +## ----------------- ## + + +# b4_lhs_value([TYPE]) +# -------------------- +# Expansion of $$. +m4_define([b4_lhs_value], +[(yyval[]m4_ifval([$1], [.$1]))]) + + +# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) +# -------------------------------------- +# Expansion of $NUM, where the current rule has RULE-LENGTH +# symbols on RHS. +m4_define([b4_rhs_value], +[(yyvsp@{($2) - ($1)@}m4_ifval([$3], [.$3]))]) + + + +## ----------- ## +## Locations. ## +## ----------- ## + +# b4_lhs_location() +# ----------------- +# Expansion of @$. +m4_define([b4_lhs_location], +[(yyloc)]) + + +# b4_rhs_location(RULE-LENGTH, NUM) +# --------------------------------- +# Expansion of @NUM, where the current rule has RULE-LENGTH symbols +# on RHS. +m4_define([b4_rhs_location], +[(yylsp@{($2) - ($1)@})]) + + + +## --------------------------------------------------------- ## +## Defining symbol actions, e.g., printers and destructors. ## +## --------------------------------------------------------- ## + +# We do want M4 expansion after # for CPP macros. +m4_changecom() +m4_divert_push(0)dnl +@output(b4_parser_file_name@) +b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],dnl ' + [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +]b4_identification +b4_percent_code_get([[top]])[]dnl +m4_if(b4_prefix, [yy], [], +[[/* Substitute the variable and function names. */ +]b4_pull_if([[#define yyparse ]b4_prefix[parse +]])b4_push_if([[#define yypush_parse ]b4_prefix[push_parse +]b4_pull_if([[#define yypull_parse ]b4_prefix[pull_parse +]])[#define yypstate_new ]b4_prefix[pstate_new +#define yypstate_delete ]b4_prefix[pstate_delete +#define yypstate ]b4_prefix[pstate +]])[#define yylex ]b4_prefix[lex +#define yyerror ]b4_prefix[error +#define yylval ]b4_prefix[lval +#define yychar ]b4_prefix[char +#define yydebug ]b4_prefix[debug +#define yynerrs ]b4_prefix[nerrs +]b4_locations_if([[#define yylloc ]b4_prefix[lloc]])])[ + +/* Copy the first part of user declarations. */ +]b4_user_pre_prologue[ + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG ]b4_debug_flag[ +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE ]b4_error_verbose_flag[ +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE ]b4_token_table[ +#endif + +]b4_percent_code_get([[requires]])[]dnl + +b4_token_enums_defines(b4_tokens)[ + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +]m4_ifdef([b4_stype], +[[typedef union ]b4_union_name[ +{ +]b4_user_stype[ +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1]], +[m4_if(b4_tag_seen_flag, 0, +[[typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1]])])[ +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif]b4_locations_if([[ + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif]])b4_push_if([[ + +#ifndef YYPUSH_DECLS +# define YYPUSH_DECLS +struct yypstate; +typedef struct yypstate yypstate; +enum { YYPUSH_MORE = 4 }; + +]b4_pull_if([b4_c_function_decl([[yyparse]], [[int]], b4_parse_param) +])b4_c_function_decl([[yypush_parse]], [[int]], + [[[yypstate *yyps]], [[yyps]]]b4_pure_if([, + [[[int yypushed_char]], [[yypushed_char]]], + [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([, + [[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [, + b4_parse_param])) +b4_pull_if([b4_c_function_decl([[yypull_parse]], [[int]], + [[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [, + b4_parse_param]))]) +b4_c_function_decl([[yypstate_new]], [[yypstate *]], [[[void]], []]) +b4_c_function_decl([[yypstate_delete]], [[void]], + [[[yypstate *yyps]], [[yyps]]])[ +#endif]]) + +b4_percent_code_get([[provides]])[]dnl + +[/* Copy the second part of user declarations. */ +]b4_user_post_prologue +b4_percent_code_get[]dnl + +[#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif ]b4_c_modern[ +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && ]b4_c_modern[ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[ +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +]b4_push_if([], +[[/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && ]b4_c_modern[ +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +]])dnl +[# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && ]b4_c_modern[ +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && ]b4_c_modern[ +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc;]b4_locations_if([ + YYLTYPE yyls_alloc;])[ +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +]b4_locations_if( +[# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM)], +[# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM)])[ + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL ]b4_final_state_number[ +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST ]b4_last[ + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS ]b4_tokens_number[ +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS ]b4_nterms_number[ +/* YYNRULES -- Number of rules. */ +#define YYNRULES ]b4_rules_number[ +/* YYNRULES -- Number of states. */ +#define YYNSTATES ]b4_states_number[ + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK ]b4_undef_token_number[ +#define YYMAXUTOK ]b4_user_token_number_max[ + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const ]b4_int_type_for([b4_translate])[ yytranslate[] = +{ + ]b4_translate[ +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const ]b4_int_type_for([b4_prhs])[ yyprhs[] = +{ + ]b4_prhs[ +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const ]b4_int_type_for([b4_rhs])[ yyrhs[] = +{ + ]b4_rhs[ +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const ]b4_int_type_for([b4_rline])[ yyrline[] = +{ + ]b4_rline[ +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + ]b4_tname[ +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const ]b4_int_type_for([b4_toknum])[ yytoknum[] = +{ + ]b4_toknum[ +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const ]b4_int_type_for([b4_r1])[ yyr1[] = +{ + ]b4_r1[ +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const ]b4_int_type_for([b4_r2])[ yyr2[] = +{ + ]b4_r2[ +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const ]b4_int_type_for([b4_defact])[ yydefact[] = +{ + ]b4_defact[ +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] = +{ + ]b4_defgoto[ +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF ]b4_pact_ninf[ +static const ]b4_int_type_for([b4_pact])[ yypact[] = +{ + ]b4_pact[ +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] = +{ + ]b4_pgoto[ +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF ]b4_table_ninf[ +static const ]b4_int_type_for([b4_table])[ yytable[] = +{ + ]b4_table[ +}; + +static const ]b4_int_type_for([b4_check])[ yycheck[] = +{ + ]b4_check[ +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const ]b4_int_type_for([b4_stos])[ yystos[] = +{ + ]b4_stos[ +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* 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 (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM) +#else +# define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value]b4_locations_if([, Location])[]b4_user_args[); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + +]b4_yy_symbol_print_generate([b4_c_function_def])[ + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +]b4_c_function_def([yy_stack_print], [static void], + [[yytype_int16 *yybottom], [yybottom]], + [[yytype_int16 *yytop], [yytop]])[ +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +]b4_c_function_def([yy_reduce_print], [static void], + [[YYSTYPE *yyvsp], [yyvsp]], + b4_locations_if([[[YYLTYPE *yylsp], [yylsp]], + ])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [, + b4_parse_param]))[ +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &]b4_rhs_value(yynrhs, yyi + 1)[ + ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl + b4_user_args[); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH ]b4_stack_depth_init[ +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH ]b4_stack_depth_max[ +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +]b4_c_function_def([yystrlen], [static YYSIZE_T], + [[const char *yystr], [yystr]])[ +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +]b4_c_function_def([yystpcpy], [static char *], + [[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[ +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + 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; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +]b4_yydestruct_generate([b4_c_function_def])[ + +]b4_push_if([], +[[/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +]b4_c_function_decl([yyparse], [int], + [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[ +#else /* ! YYPARSE_PARAM */ +]b4_c_function_decl([yyparse], [int], b4_parse_param)[ +#endif /* ! YYPARSE_PARAM */]]) + +m4_divert_push([KILL])# ======================== M4 code. +# b4_declare_scanner_communication_variables +# ------------------------------------------ +# Declare the variables that are global, or local to YYPARSE if +# pure-parser. +m4_define([b4_declare_scanner_communication_variables], +[[/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +]b4_locations_if([[ +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; +]])b4_pure_if([], [[ +/* Number of syntax errors so far. */ +int yynerrs; +]])]) + +# b4_declare_parser_state_variables +# --------------------------------- +# Declare all the variables that are needed to maintain the parser state +# between calls to yypush_parse. +m4_define([b4_declare_parser_state_variables], +[b4_pure_if([[ /* Number of syntax errors so far. */ + int yynerrs; +]])[ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values.]b4_locations_if([[ + `yyls': related to locations.]])[ + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; +]b4_locations_if([[ + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; +]])[ + YYSIZE_T yystacksize; +]]) + +m4_divert_pop([KILL])dnl# ====================== End of M4 code. + +b4_pure_if([], [b4_declare_scanner_communication_variables]) + +b4_push_if( +[[struct yypstate + { + ]b4_declare_parser_state_variables[ + /* Used to determine if this is the first time this instance has + been used. */ + int yynew; + };]b4_pure_if([], [[ + +static char yypstate_allocated = 0;]])b4_pull_if([ + +b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[ +{ + return yypull_parse (0]m4_ifset([b4_parse_param], + [[, ]b4_c_args(b4_parse_param)])[); +} + +]b4_c_function_def([[yypull_parse]], [[int]], + [[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [, + b4_parse_param]))[ +{ + int yystatus; + yypstate *yyps_local;]b4_pure_if([[ + int yychar; + YYSTYPE yylval;]b4_locations_if([[ + YYLTYPE yylloc;]])])[ + if (yyps == 0) + { + yyps_local = yypstate_new (); + if (!yyps_local) + {]b4_pure_if([[ + yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[ + if (!yypstate_allocated) + yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[ + return 2; + } + } + else + yyps_local = yyps; + do { + yychar = YYLEX; + yystatus = + yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])[); + } while (yystatus == YYPUSH_MORE); + if (yyps == 0) + yypstate_delete (yyps_local); + return yystatus; +}]])[ + +/* Initialize the parser data structure. */ +]b4_c_function_def([[yypstate_new]], [[yypstate *]])[ +{ + yypstate *yyps;]b4_pure_if([], [[ + if (yypstate_allocated) + return 0;]])[ + yyps = (yypstate *) malloc (sizeof *yyps); + if (!yyps) + return 0; + yyps->yynew = 1;]b4_pure_if([], [[ + yypstate_allocated = 1;]])[ + return yyps; +} + +]b4_c_function_def([[yypstate_delete]], [[void]], + [[[yypstate *yyps]], [[yyps]]])[ +{ +#ifndef yyoverflow + /* If the stack was reallocated but the parse did not complete, then the + stack still needs to be freed. */ + if (!yyps->yynew && yyps->yyss != yyps->yyssa) + YYSTACK_FREE (yyps->yyss); +#endif + free (yyps);]b4_pure_if([], [[ + yypstate_allocated = 0;]])[ +} + +]b4_pure_if([[#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs +]])[#define yystate yyps->yystate +#define yyerrstatus yyps->yyerrstatus +#define yyssa yyps->yyssa +#define yyss yyps->yyss +#define yyssp yyps->yyssp +#define yyvsa yyps->yyvsa +#define yyvs yyps->yyvs +#define yyvsp yyps->yyvsp +]b4_locations_if([[#define yylsa yyps->yylsa +#define yyls yyps->yyls +#define yylsp yyps->yylsp +#define yyerror_range yyps->yyerror_range +]])[#define yystacksize yyps->yystacksize +]])[ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ +]b4_push_if([ +b4_c_function_def([[yypush_parse]], [[int]], + [[[yypstate *yyps]], [[yyps]]]b4_pure_if([, + [[[int yypushed_char]], [[yypushed_char]]], + [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([, + [[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [, + b4_parse_param]))], [ +#ifdef YYPARSE_PARAM +b4_c_function_def([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]]) +#else /* ! YYPARSE_PARAM */ +b4_c_function_def([yyparse], [int], b4_parse_param) +#endif])[ +{ +]b4_pure_if([b4_declare_scanner_communication_variables]) +b4_push_if([b4_pure_if([], [[ int yypushed_char = yychar; + YYSTYPE yypushed_val = yylval; + ]b4_locations_if([[YYLTYPE yypushed_loc = yylloc; +]])])], + [b4_declare_parser_state_variables])[ + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval;]b4_locations_if([[ + YYLTYPE yyloc;]])[ + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0;]b4_push_if([[ + + if (!yyps->yynew) + { + yyn = yypact[yystate]; + goto yyread_pushed_token; + }]])[ + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa;]b4_locations_if([[ + yyls = yylsa;]])[ + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs;]b4_locations_if([[ + yylsp = yyls; + +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[; + yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; +#endif]]) +m4_ifdef([b4_initial_action],[ +m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl +m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl +/* User initialization code. */ +b4_user_initial_action +m4_popdef([b4_dollar_dollar])dnl +m4_popdef([b4_at_dollar])])dnl +m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval; +]])dnl +m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc; +]])[ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss;]b4_locations_if([ + YYLTYPE *yyls1 = yyls;])[ + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp),]b4_locations_if([ + &yyls1, yysize * sizeof (*yylsp),])[ + &yystacksize); +]b4_locations_if([ + yyls = yyls1;])[ + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([ + YYSTACK_RELOCATE (yyls_alloc, yyls);])[ +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1;]b4_locations_if([ + yylsp = yyls + yysize - 1;])[ + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + {]b4_push_if([[ + if (!yyps->yynew) + {]b4_use_push_for_pull_if([], [[ + YYDPRINTF ((stderr, "Return for a new token:\n"));]])[ + yyresult = YYPUSH_MORE; + goto yypushreturn; + } + yyps->yynew = 0;]b4_pure_if([], [[ + /* Restoring the pushed token is only necessary for the first + yypush_parse invocation since subsequent invocations don't overwrite + it before jumping to yyread_pushed_token. */ + yychar = yypushed_char; + yylval = yypushed_val;]b4_locations_if([[ + yylloc = yypushed_loc;]])])[ +yyread_pushed_token:]])[ + YYDPRINTF ((stderr, "Reading a token: "));]b4_push_if([b4_pure_if([[ + yychar = yypushed_char; + if (yypushed_val) + yylval = *yypushed_val;]b4_locations_if([[ + if (yypushed_loc) + yylloc = *yypushed_loc;]])])], [[ + yychar = YYLEX;]])[ + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; +]b4_locations_if([ *++yylsp = yylloc;])[ + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + +]b4_locations_if( +[[ /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[ + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + ]b4_user_actions[ + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval;]b4_locations_if([ + *++yylsp = yyloc;])[ + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (]b4_yyerror_args[YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (]b4_yyerror_args[yymsg); + } + else + { + yyerror (]b4_yyerror_args[YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + +]b4_locations_if([[ yyerror_range[0] = yylloc;]])[ + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + +]b4_locations_if([[ yyerror_range[0] = yylsp[1-yylen]; +]])[ /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + +]b4_locations_if([[ yyerror_range[0] = *yylsp;]])[ + yydestruct ("Error: popping", + yystos[yystate], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; +]b4_locations_if([[ + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + *++yylsp = yyloc;]])[ + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (]b4_yyerror_args[YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +]b4_push_if([[ yyps->yynew = 1; + +yypushreturn: +]])[#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + +]b4_epilogue +b4_defines_if( +[@output(b4_spec_defines_file@) +b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl ' + [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006]) + +b4_percent_code_get([[requires]])[]dnl + +b4_token_enums_defines(b4_tokens) + +[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +]m4_ifdef([b4_stype], +[[typedef union ]b4_union_name[ +{ +]b4_user_stype[ +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1]], +[m4_if(b4_tag_seen_flag, 0, +[[typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1]])])[ +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +]b4_pure_if([], [[extern YYSTYPE ]b4_prefix[lval;]]) + +b4_locations_if( +[#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + +]b4_pure_if([], [[extern YYLTYPE ]b4_prefix[lloc;]]) +)dnl b4_locations_if +b4_push_if([[ +#ifndef YYPUSH_DECLS +# define YYPUSH_DECLS +struct ]b4_prefix[pstate; +typedef struct ]b4_prefix[pstate ]b4_prefix[pstate; +enum { YYPUSH_MORE = 4 }; +]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param) +])b4_c_function_decl([b4_prefix[push_parse]], [[int]], + [[b4_prefix[pstate *yyps]], [[yyps]]]b4_pure_if([, + [[[int yypushed_char]], [[yypushed_char]]], + [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([, + [[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [, + b4_parse_param])) +b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]], + [[b4_prefix[pstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [, + b4_parse_param]))]) +b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]], + [[[void]], []]) +b4_c_function_decl([b4_prefix[pstate_delete]], [[void]], + [[b4_prefix[pstate *yyps]], [[yyps]]])[ +#endif +]]) +b4_percent_code_get([[provides]])[]dnl +])dnl b4_defines_if +m4_divert_pop(0) diff --git a/djgpp/Makefile.maint b/djgpp/Makefile.maint new file mode 100644 index 0000000..3739f97 --- /dev/null +++ b/djgpp/Makefile.maint @@ -0,0 +1,37 @@ +# DJGPP Maintainer's Makefile -*-Makefile-*- +# Requires GNU sed + +## Copyright (C) 2005, 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 . + +top_srcdir = .. +srcdir = . + +SHELL = /bin/sh + +all: README + +README: README.in $(top_srcdir)/configure + PACKAGE=`grep "^[ ]*PACKAGE=" $(top_srcdir)/configure | sed -e 's/^[ ]*PACKAGE=//' -e s/[\"\']//g`; \ + VERSION=`grep "^[ ]*VERSION=" $(top_srcdir)/configure | sed -e 's/^[ ]*VERSION=//' -e s/[\"\']//g`; \ + package_version=`echo "$${VERSION}" | sed 's/\.//g'`; \ + tree_version=`echo "$${VERSION}" | sed 's/\.//2g'`; \ + sed \ + -e "s/@V@/$${PACKAGE}-$${VERSION}/g" \ + -e "s/@VERSION@/$${VERSION}/g" \ + -e "s/@PACKAGE_VERSION@/$$package_version/g" \ + -e "s/@TREE_VERSION@/$$tree_version/g" \ + $(srcdir)/README.in > t-$@ + mv t-$@ $@ diff --git a/djgpp/README.in b/djgpp/README.in new file mode 100644 index 0000000..d559a09 --- /dev/null +++ b/djgpp/README.in @@ -0,0 +1,195 @@ +This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP. + +Copyright (C) 2005, 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 . + + +1.: DJGPP specific changes. + ======================= + + The DJGPP port of Bison offers LFN and SFN support depending on which + OS it is running. If LFN support is available or not is determinated at + run time. If LFN support is available (DOS session under Win9X, Win2K, + WinXP, etc.) the standard posix file name extensions will be used. + These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN + support is available (plain DOS), then the standard MSDOS short file + names will be used. These are: y_tab.c, y_tab.h, y.out, etc. + It should be noticed that this bison version needs the m4 program as + back end to generate the parser file (y.tab.c etc.) from the skeleton + files. This implies that m4 must always be installed to get bison + working. m4 will use a couple of m4 scripts that will be installed in + /dev/env/DJDIR/share/bison and shall not be removed. + It should also be noticed that the skeleton files bison.simple and + bison.hairy are no longer supported. This applies also to the environ- + ment variables BISON_HAIRY and BISON_SIMPLE. Those variables are *no* + longer honored at all. + The kind of skeleton file bison.hairy is no longer supported at all. + The skeleton file bison.simple is now called yacc.c and is an m4 script. + The other two skeleton files supported by this bison version are glr.c + and lalr1.cc. The first one is a generalized LR C parser based on + Bison's LALR(1) tables and the second one is a experimental C++ parser + class. + As has been told before, bison uses m4 to generate the parser file. + This is done by forking and using pipes for the IPC. MSDOS does not + support this functionality so this has been reproduced in the usual + way by redirecting stdin and stdout of bison and m4 to temporary files + and processing these files in sequence. + It should be noticed that due to the great amount of file names that do + not cleanly map to 8.3 file names, you will need an OS with LFN support + to configure and compile the sources. On Win98 this implies that the + generation of numeric tails for 8.3 file name aliases must be enabled + or the compilation will fail. + + + Please **read** the docs. + + +2.: Installing the binary package. + ============================== + +2.1.: Copy the binary distribution into the top DJGPP installation directory, + just unzip it preserving the directory structure running *ONE* of the + following commands: + unzip32 bsn@PACKAGE_VERSION@b.zip or + djtarx bsn@PACKAGE_VERSION@b.zip or + pkunzip -d bsn@PACKAGE_VERSION@b.zip + + + +3.: Building the binaries from sources. + =================================== + +3.1.: Create a temporary directory and copy the source package into the + directory. If you download the source distribution from one of the + DJGPP sites, just unzip it preserving the directory structure + running *ONE* of the following commands: + unzip32 bsn@PACKAGE_VERSION@s.zip or + djtarx bsn@PACKAGE_VERSION@s.zip or + pkunzip -d bsn@PACKAGE_VERSION@s.zip + and proceed to the paragraph 3.3, below. + +3.2.: Source distributions downloaded from one of the GNU FTP sites need + some more work to unpack, if LFN support is not available. If LFN is + available then you can extract the source files from the archive with + any unzip program and proceed to the paragraph 3.3, below. Any file + name issue will be handled by the the DJGPP configuration files. + To unpack the source distribution on SFN systems, first, you MUST use + the `djunpack' batch file to unzip the package. That is because some + file names in the official distributions need to be changed to avoid + problems on the various platforms supported by DJGPP. + `djunpack' invokes the `djtar' program (that is part of the basic DJGPP + development kit) to rename these files on the fly given a file with + name mappings; the distribution includes a file `djgpp/fnchange.lst' + with the necessary mappings. So you need first to retrieve that batch + file, and then invoke it to unpack the distribution. Here's how: + + djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@VERSION@.tar.gz > djunpack.bat + djunpack bison-@VERSION@.tar.gz + + (The name of the distribution archive and the leading directory of the + path to `djunpack.bat' in the distribution will be different for + versions of Bison other than @VERSION@.) + + If the argument to `djunpack.bat' include leading directories, it MUST + be given with the DOS-style backslashes; Unix-style forward slashes + will NOT work. + + If the distribution comes as a .tar.bz2 archive, and your version of + `djtar' doesn't support bzip2 decompression, you need to unpack it as + follows: + + bnzip2 bison-@VERSION@.tar.bz2 + djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@VERSION@.tar > djunpack.bat + djunpack bison-@VERSION@.tar + +3.3.: To build the binaries you will need the following binary packages: + djdev203.zip (or a later but NOT a prior version) + bsh204b.zip (or a later but NOT a prior version) + gccNNNb.zip, gppNNN.zip, bnuNNNb.zip, makNNNb.zip, filNNNb.zip, + perlNNNb.zip, shlNNNb.zip, txtNNNb.zip, txiNNNb.zip, grepNNNb.zip, + sedNNNb.zip and m4NNN.zip + + If you want to run the check you will need also: + difNNNb.zip + + NNN represents the latest version number of the binary packages. All + this packages can be found in the /v2gnu directory of any + ftp.delorie.com mirror. + You will need bsh204b.zip or later and *NOT* a prior version or + the build will fail. The same applies to djdev203.zip. Please note + that Bison requires m4-144b.zip or later to work properly. + +3.4.: If for some reason you want to reconfigure the package cd into the top + srcdir (bison-@TREE_VERSION@) and run the following commands: + del djgpp\config.cache + make clean + djgpp\config + + Please note that you *MUST* delete the config.cache file in the djgpp + subdir or you will not really reconfigure the sources because the + configuration informations will be read from the cache file instead + of being newly computed. + To build the programs in a directory other than where the sources are, + you must add the parameter that specifies the source directory, + e.g: + x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@ + + Lets assume you want to build the binaries in a directory placed on a + different drive (z:\build in this case) from where the sources are, + then you will run the following commands: + z: + md \build + cd \build + x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@ + + The order of the options and the srcdir option does not matter. You + *MUST* use forward slashes to specify the source directory. + + The batch file will set same environment variables, make MSDOS specific + modifications to the Makefile.in's and supply all other needed options + to the configure script. + +3.5.: To compile the package run from the top srcdir the command: + make + +3.6.: Now you can run the tests if you like. From the top srcdir run the + command: + make check + + No test should fail but the tests #131 (Doxygen Public Documentation) + and #132 (Doxygen Private Documentation) will be skipped. Please note + that the testsuite only works with LFN available. On plain DOS, most + of the tests will fail due to invalid DOS names. + +3.7.: To install the binaries, header, library, catalogs, and info docs + run the following command from the top srcdir: + make install + + This will install the products into your DJGPP installation tree given + by the default prefix "/dev/env/DJDIR". If you prefer to install them + into some other directory you will have to set prefix to the appropiate + value: + make install prefix=z:/some/other/place + + + + Send GNU bison specific bug reports to . + Send suggestions and bug reports concerning the DJGPP port to + comp.os.msdos.djgpp or . + + +Enjoy. + + Guerrero, Juan Manuel diff --git a/djgpp/config.bat b/djgpp/config.bat new file mode 100644 index 0000000..61a02d6 --- /dev/null +++ b/djgpp/config.bat @@ -0,0 +1,547 @@ +@echo off +Rem Configure Bison for DJGPP. + +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 Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +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 the Free Software Foundation, either version 3 of the License, or +Rem (at your option) any later version. +Rem +Rem This program is distributed in the hope that it will be useful, +Rem but WITHOUT ANY WARRANTY; without even the implied warranty of +Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Rem GNU General Public License for more details. +Rem +Rem You should have received a copy of the GNU General Public License +Rem along with this program. If not, see . + +echo Configuring Bison for DJGPP v2.x... + +Rem The SmallEnv tests protect against fixed and too small size +Rem of the environment in stock DOS shell. + +Rem Find out if NLS is wanted or not, +Rem if dependency-tracking is wanted or not, +Rem if caching is wanted or not +Rem and where the sources are. +Rem We always default to NLS support, +Rem no dependency tracking +Rem and to in place configuration. +set ARGS= +set NLS=enabled +if not "%NLS%" == "enabled" goto SmallEnv +set CACHING=enabled +if not "%CACHING%" == "enabled" goto SmallEnv +set DEPENDENCY_TRACKING=disabled +if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv +set LIBICONV_PREFIX=disabled +if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv +set LIBINTL_PREFIX=disabled +if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv +set HTML=enabled +if not "%HTML%" == "enabled" goto SmallEnv +set XSRC=. +if not "%XSRC%" == "." goto SmallEnv + +Rem Loop over all arguments. +Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS. +Rem All other arguments are stored into ARGS. +:ArgLoop +if "%1" == "nls" goto NextArgument +if "%1" == "NLS" goto NextArgument +if "%1" == "no-nls" goto NoNLS +if "%1" == "no-NLS" goto NoNLS +if "%1" == "NO-NLS" goto NoNLS +goto CachingOption +:NoNLS +if "%1" == "no-nls" set NLS=disabled +if "%1" == "no-NLS" set NLS=disabled +if "%1" == "NO-NLS" set NLS=disabled +if not "%NLS%" == "disabled" goto SmallEnv +goto NextArgument +:CachingOption +if "%1" == "cache" goto NextArgument +if "%1" == "CACHE" goto NextArgument +if "%1" == "no-cache" goto NoCaching +if "%1" == "no-CACHE" goto NoCaching +if "%1" == "NO-CACHE" goto NoCaching +goto DependencyOption +:NoCaching +if "%1" == "no-cache" set CACHING=disabled +if "%1" == "no-CACHE" set CACHING=disabled +if "%1" == "NO-CACHE" set CACHING=disabled +if not "%CACHING%" == "disabled" goto SmallEnv +goto NextArgument +:DependencyOption +if "%1" == "no-dep" goto NextArgument +if "%1" == "no-DEP" goto NextArgument +if "%1" == "NO-DEP" goto NextArgument +if "%1" == "dep" goto DependecyTraking +if "%1" == "DEP" goto DependecyTraking +goto LibiconvPrefixOption +:DependecyTraking +if "%1" == "dep" set DEPENDENCY_TRACKING=enabled +if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled +if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv +goto NextArgument +:LibiconvPrefixOption +if "%1" == "no-libiconvprefix" goto NextArgument +if "%1" == "no-LIBICONVPREFIX" goto NextArgument +if "%1" == "NO-LIBICONVPREFIX" goto NextArgument +if "%1" == "libiconvprefix" goto WithLibiconvPrefix +if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix +goto LibintlPrefixOption +:WithLibiconvPrefix +if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled +if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled +if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv +goto NextArgument +:LibintlPrefixOption +if "%1" == "no-libiconvprefix" goto NextArgument +if "%1" == "no-LIBICONVPREFIX" goto NextArgument +if "%1" == "NO-LIBICONVPREFIX" goto NextArgument +if "%1" == "libintlprefix" goto _WithLibintlPrefix +if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix +goto HTMLOption +:_WithLibintlPrefix +if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled +if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled +if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv +:HTMLOption +if "%1" == "withhtml" goto NextArgument +if "%1" == "withHTML" goto NextArgument +if "%1" == "WITHHTML" goto NextArgument +if "%1" == "withouthtml" goto _WithoutHTML +if "%1" == "withoutHTML" goto _WithoutHTML +if "%1" == "WITHOUTHTML" goto _WithoutHTML +goto SrcDirOption +:_WithoutHTML +if "%1" == "withouthtml" set HTML=disabled +if "%1" == "withoutHTML" set HTML=disabled +if "%1" == "WITHOUTHTML" set HTML=disabled +if not "%HTML%" == "disabled" goto SmallEnv +goto NextArgument +:SrcDirOption +echo %1 | grep -q "/" +if errorlevel 1 goto CollectArgument +set XSRC=%1 +if not "%XSRC%" == "%1" goto SmallEnv +goto NextArgument +:CollectArgument +set _ARGS=%ARGS% %1 +if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv +echo %_ARGS% | grep -q "[^ ]" +if not errorlevel 0 set ARGS=%_ARGS% +set _ARGS= +:NextArgument +shift +if not "%1" == "" goto ArgLoop + +Rem Create an arguments file for the configure script. +echo --srcdir=%XSRC% > args +if "%CACHING%" == "enabled" echo --cache-file=%XSRC%/djgpp/config.cache >> args +if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable-dependency-tracking >> args +if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> args +if "%LIBICONV_PREFIX%" == "enabled" echo --with-libiconv-prefix >> args +if "%LIBICONV_PREFIX%" == "disabled" echo --without-libiconv-prefix >> args +if "%LIBINTL_PREFIX%" == "enabled" echo --with-libintl-prefix >> args +if "%LIBINTL_PREFIX%" == "disabled" echo --without-libintl-prefix >> args +if "%HTML%" == "enabled" echo --enable-html >> args +if "%HTML%" == "disabled" echo --disable-html >> args +if not "%ARGS%" == "" echo %ARGS% >> args +set ARGS= +set CACHING= +set DEPENDENCY_TRACKING= +set LIBICONV_PREFIX= +set LIBINTL_PREFIX= +set HTML= + +if "%XSRC%" == "." goto InPlace + +:NotInPlace +redir -e /dev/null update %XSRC%/configure.org ./configure +test -f ./configure +if errorlevel 1 update %XSRC%/configure ./configure + +:InPlace +Rem Update configuration files +echo Updating configuration scripts... +test -f ./configure.org +if errorlevel 1 update configure configure.org +sed -f %XSRC%/djgpp/config.sed configure.org > configure +if errorlevel 1 goto SedError + +Rem Make sure they have a config.site file +set CONFIG_SITE=%XSRC%/djgpp/config.site +if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv + +Rem inttypes_.h and inttypes.h map to the same 8.3 alias. +test -f %XSRC%/lib/inttypes_.h +if not errorlevel 1 mv -f %XSRC%/lib/inttypes_.h %XSRC%/lib/_inttypes.h + +Rem Make sure crucial file names are not munged by unpacking +test -f %XSRC%/po/Makefile.in.in +if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in +test -f %XSRC%/po/Makefile.in-in +if errorlevel 1 mv -f %XSRC%/po/Makefile.in %XSRC%/po/Makefile.in-in +test -f %XSRC%/po/Makefile.in-in +if errorlevel 1 mv -f %XSRC%/po/Makefile.inin %XSRC%/po/Makefile.in-in +test -f %XSRC%/po/Makefile.in-in +if errorlevel 1 mv -f %XSRC%/po/Makefile.in_in %XSRC%/po/Makefile.in-in +test -f %XSRC%/po/Makefile.in-in +if errorlevel 1 mv -f %XSRC%/po/Makefile_in.in %XSRC%/po/Makefile.in-in +test -f %XSRC%/runtime-po/Makefile.in.in +if not errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in.in %XSRC%/runtime-po/Makefile.in-in +test -f %XSRC%/runtime-po/Makefile.in-in +if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in %XSRC%/runtime-po/Makefile.in-in +test -f %XSRC%/runtime-po/Makefile.in-in +if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.inin %XSRC%/runtime-po/Makefile.in-in +test -f %XSRC%/runtime-po/Makefile.in-in +if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in_in %XSRC%/runtime-po/Makefile.in-in +test -f %XSRC%/runtime-po/Makefile.in-in +if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile_in.in %XSRC%/runtime-po/Makefile.in-in +test -f %XSRC%/data/c++.m4 +if not errorlevel 1 mv -f %XSRC%/data/c++.m4 %XSRC%/data/cxx.m4 +test -f %XSRC%/data/cxx.m4 +if errorlevel 1 mv -f %XSRC%/data/cpp.m4 %XSRC%/data/cxx.m4 +test -f %XSRC%/data/c++-skel.m4 +if not errorlevel 1 mv -f %XSRC%/data/c++-skel.m4 %XSRC%/data/cxx-skel.m4 +test -f %XSRC%/data/cxx-skel.m4 +if errorlevel 1 mv -f %XSRC%/data/cpp-skel.m4 %XSRC%/data/cxx-skel.m4 +test -f %XSRC%/build-aux/javacomp.sh.in +if not errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in +test -f %XSRC%/build-aux/javacomp.sh-in +if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh %XSRC%/build-aux/javacomp.sh-in +test -f %XSRC%/build-aux/javacomp.sh-in +if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.shin %XSRC%/build-aux/javacomp.sh-in +test -f %XSRC%/build-aux/javacomp.sh-in +if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh_in %XSRC%/build-aux/javacomp.sh-in +test -f %XSRC%/build-aux/javacomp.sh-in +if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in +test -f %XSRC%/build-aux/javaexec.sh.in +if not errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh.in %XSRC%/build-aux/javaexec.sh-in +test -f %XSRC%/build-aux/javaexec.sh-in +if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh %XSRC%/build-aux/javaexec.sh-in +test -f %XSRC%/build-aux/javaexec.sh-in +if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.shin %XSRC%/build-aux/javaexec.sh-in +test -f %XSRC%/build-aux/javaexec.sh-in +if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh_in %XSRC%/build-aux/javaexec.sh-in +test -f %XSRC%/build-aux/javaexec.sh-in +if errorlevel 1 mv -f %XSRC%/build-aux/javaexec_sh.in %XSRC%/build-aux/javaexec.sh-in +test -f %XSRC%/doc/yacc.1.in +if not errorlevel 1 mv -f %XSRC%/doc/yacc.1.in %XSRC%/doc/yacc.1-in +test -f %XSRC%/doc/yacc.1-in +if errorlevel 1 mv -f %XSRC%/doc/yacc.1 %XSRC%/doc/yacc.1-in +test -f %XSRC%/doc/yacc.1-in +if errorlevel 1 mv -f %XSRC%/doc/yacc.1in %XSRC%/doc/yacc.1-in +test -f %XSRC%/doc/yacc.1-in +if errorlevel 1 mv -f %XSRC%/doc/yacc.1_in %XSRC%/doc/yacc.1-in +test -f %XSRC%/doc/yacc.1-in +if errorlevel 1 mv -f %XSRC%/doc/yacc_1.in %XSRC%/doc/yacc.1-in +test -f %XSRC%/etc/bench.pl.in +if not errorlevel 1 mv -f %XSRC%/etc/bench.pl.in %XSRC%/etc/bench.pl-in +test -f %XSRC%/etc/bench.pl-in +if errorlevel 1 mv -f %XSRC%/etc/bench.pl %XSRC%/etc/bench.pl-in +test -f %XSRC%/etc/bench.pl-in +if errorlevel 1 mv -f %XSRC%/etc/bench.plin %XSRC%/etc/bench.pl-in +test -f %XSRC%/etc/bench.pl-in +if errorlevel 1 mv -f %XSRC%/etc/bench.pl_in %XSRC%/etc/bench.pl-in +test -f %XSRC%/etc/bench.pl-in +if errorlevel 1 mv -f %XSRC%/etc/bench_pl.in %XSRC%/etc/bench.pl-in + +:scan_gram_c_Test +test -f %XSRC%/src/c-scan-gram.c +if not errorlevel 1 goto scan_skel_c_Test +test -f %XSRC%/src/scan-gram-c.c +if not errorlevel 1 mv -f %XSRC%/src/scan-gram-c.c %XSRC%/src/c-scan-gram.c +:scan_skel_c_Test +test -f %XSRC%/src/c-scan-skel.c +if not errorlevel 1 goto FixFiles +test -f %XSRC%/src/scan-skel-c.c +if not errorlevel 1 mv -f %XSRC%/src/scan-skel-c.c %XSRC%/src/c-scan-skel.c + +:FixFiles +Rem Fix data/lalr1.cc and data/location.cc to reflect the renaming of c++.m4 +sed "s/c++\.m4/cxx.m4/" %XSRC%/data/lalr1.cc > lalr1.cc +if errorlevel 1 goto lalr1_ccFileError +mv ./lalr1.cc %XSRC%/data/lalr1.cc +sed "s/c++\.m4/cxx.m4/" %XSRC%/data/location.cc > location.cc +if errorlevel 1 goto location_ccFileError +mv ./location.cc %XSRC%/data/location.cc +sed "s/c++\.m4/cxx.m4/" %XSRC%/data/glr.cc > glr.cc +if errorlevel 1 goto glr_ccFileError +mv ./glr.cc %XSRC%/data/glr.cc + +Rem Fix src/getargs.c to reflect the renaming of c++-skel.m4 +sed "s/c++-skel\.m4/cxx-skel.m4/" %XSRC%/src/getargs.c > getargs.c +if errorlevel 1 goto getargs_cFileError +mv ./getargs.c %XSRC%/src/getargs.c + +Rem Define DJGPP specific defs in config.hin +echo Editing config.hin... +test -f %XSRC%/lib/config_h.org +if errorlevel 1 update %XSRC%/lib/config.hin %XSRC%/lib/config_h.org +sed -f %XSRC%/djgpp/config_h.sed %XSRC%/lib/config_h.org > config.hin +if errorlevel 1 goto SedError2 +mv -f config.hin %XSRC%/lib/config.hin + + +Rem Fixing ilicit testsuite file name. +test -f %XSRC%/tests/c++.at +if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at + +test -f %XSRC%/tests/testsuite.org +if errorlevel 1 update %XSRC%/tests/testsuite %XSRC%/tests/testsuite.org +sed -f %XSRC%/djgpp/testsuite.sed %XSRC%/tests/testsuite.org > testsuite.tmp +if errorlevel 1 goto SedError3 +mv -f ./testsuite.tmp %XSRC%/tests/testsuite + +Rem Fixing ilicit calc++ file names in the calc++ directory. +test -d %XSRC%/examples/calc++ +if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx +test -d %XSRC%/examples/calcxx +if errorlevel 1 mv -f %XSRC%/examples/calcpp %XSRC%/examples/calcxx +test -f %XSRC%/examples/calcxx/calc++-scanner.cc +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc +test -f %XSRC%/examples/calcxx/calcxx-scanner.cc +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc +test -f %XSRC%/examples/calcxx/calc++-scanner.ll +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll +test -f %XSRC%/examples/calcxx/calcxx-scanner.ll +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll +test -f %XSRC%/examples/calcxx/calc++-driver.cc +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc +test -f %XSRC%/examples/calcxx/calcxx-driver.cc +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc +test -f %XSRC%/examples/calcxx/calc++-driver.hh +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh +test -f %XSRC%/examples/calcxx/calcxx-driver.hh +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh +test -f %XSRC%/examples/calcxx/calc++-parser.cc +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc +test -f %XSRC%/examples/calcxx/calcxx-parser.cc +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc +test -f %XSRC%/examples/calcxx/calc++-parser.hh +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh +test -f %XSRC%/examples/calcxx/calcxx-parser.hh +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh +test -f %XSRC%/examples/calcxx/calc++-parser.stamp +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp +test -f %XSRC%/examples/calcxx/calcxx-parser.stamp +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp +test -f %XSRC%/examples/calcxx/calc++-parser.yy +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy +test -f %XSRC%/examples/calcxx/calcxx-parser.yy +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy +test -f %XSRC%/examples/calcxx/calc++.cc +if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++.cc %XSRC%/examples/calcxx/calcxx.cc +test -f %XSRC%/examples/calcxx/calcxx.cc +if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp.cc %XSRC%/examples/calcxx/calcxx.cc + +Rem Fixing #include lines in calcxx files. +sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx.cc > calcxx.cc +if errorlevel 1 goto calcxxFileError +mv ./calcxx.cc %XSRC%/examples/calcxx/calcxx.cc +sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.cc > calcxx-driver.cc +if errorlevel 1 goto calcxxFileError +mv ./calcxx-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc +sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.hh > calcxx-driver.hh +if errorlevel 1 goto calcxxFileError +mv ./calcxx-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh +sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.cc > calcxx-parser.cc +if errorlevel 1 goto calcxxFileError +mv ./calcxx-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc +sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.hh > calcxx-parser.hh +if errorlevel 1 goto calcxxFileError +mv ./calcxx-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh +:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.yy > calcxx-parser.yy +:if errorlevel 1 goto calcxxFileError +:mv ./calcxx-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy +sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.cc > calcxx-scanner.cc +if errorlevel 1 goto calcxxFileError +mv ./calcxx-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc +:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.ll > calcxx-scanner.ll +:if errorlevel 1 goto calcxxFileError +:mv ./calcxx-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll +sed "s/calc++/calcxx/" %XSRC%/examples/calcxx/test > test +if errorlevel 1 goto calcxxFileError +mv ./test %XSRC%/examples/calcxx/test + + +Rem Fixing the scanner files to make file names 8.3 valid. +Rem Use only if you want to change the scan-gram.l and scan-skel.l files. +: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-gram.l > scan-gram.l +: if errorlevel 1 goto ScannerFileError +: mv ./scan-gram.l %XSRC%/src/scan-gram.l +: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-skel.l > scan-skel.l +: if errorlevel 1 goto ScannerFileError +: mv ./scan-skel.l %XSRC%/src/scan-skel.l + + +Rem This is required because DOS/Windows are case-insensitive +Rem to file names, and "make install" will do nothing if Make +Rem finds a file called `install'. +if exist INSTALL ren INSTALL INSTALL.txt + +Rem Set SHELL to a sane default or some configure tests stop working +Rem if the package is configured across partitions. +if not "%SHELL%" == "" goto HomeName +set SHELL=/bin/sh +if not "%SHELL%" == "/bin/sh" goto SmallEnv +echo No SHELL found in the environment, using default value + +:HomeName +Rem Set HOME to a sane default so configure stops complaining. +if not "%HOME%" == "" goto HostName +set HOME=%XSRC%/djgpp +if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv +echo No HOME found in the environment, using default value + +:HostName +Rem Set HOSTNAME so it shows in config.status +if not "%HOSTNAME%" == "" goto hostdone +if "%windir%" == "" goto msdos +set OS=MS-Windows +if not "%OS%" == "MS-Windows" goto SmallEnv +goto haveos +:msdos +set OS=MS-DOS +if not "%OS%" == "MS-DOS" goto SmallEnv +:haveos +if not "%USERNAME%" == "" goto haveuname +if not "%USER%" == "" goto haveuser +echo No USERNAME and no USER found in the environment, using default values +set HOSTNAME=Unknown PC +if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv +goto userdone +:haveuser +set HOSTNAME=%USER%'s PC +if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv +goto userdone +:haveuname +set HOSTNAME=%USERNAME%'s PC +if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv +:userdone +set _HOSTNAME=%HOSTNAME%, %OS% +if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv +set HOSTNAME=%_HOSTNAME% +:hostdone +set _HOSTNAME= +set OS= + +Rem install-sh is required by the configure script but clashes with the +Rem various Makefile install-foo targets, so we MUST have it before the +Rem script runs and rename it afterwards +test -f %XSRC%/install-sh +if not errorlevel 1 goto NoRen0 +test -f %XSRC%/install-sh.sh +if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh +:NoRen0 + +if "%NLS%" == "disabled" goto WithoutNLS + +:WithNLS +Rem Check for the needed libraries and binaries. +test -x /dev/env/DJDIR/bin/msgfmt.exe +if errorlevel 1 goto MissingNLSTools +test -x /dev/env/DJDIR/bin/xgettext.exe +if errorlevel 1 goto MissingNLSTools +test -f /dev/env/DJDIR/include/libcharset.h +if errorlevel 1 goto MissingNLSTools +test -f /dev/env/DJDIR/lib/libcharset.a +if errorlevel 1 goto MissingNLSTools +test -f /dev/env/DJDIR/include/iconv.h +if errorlevel 1 goto MissingNLSTools +test -f /dev/env/DJDIR/lib/libiconv.a +if errorlevel 1 goto MissingNLSTools +test -f /dev/env/DJDIR/include/libintl.h +if errorlevel 1 goto MissingNLSTools +test -f /dev/env/DJDIR/lib/libintl.a +if errorlevel 1 goto MissingNLSTools + +Rem Recreate the files in the %XSRC%/po subdir with our ported tools. +redir -e /dev/null rm %XSRC%/po/*.gmo +redir -e /dev/null rm %XSRC%/po/bison.pot +redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c +redir -e /dev/null rm %XSRC%/po/stamp-cat-id + +Rem Update the arguments file for the configure script. +Rem We prefer without-included-gettext because libintl.a from gettext package +Rem is the only one that is garanteed to have been ported to DJGPP. +echo --enable-nls --without-included-gettext >> args +goto ConfigurePackage + +:MissingNLSTools +echo Needed libs/tools for NLS not found. Configuring without NLS. +:WithoutNLS +Rem Update the arguments file for the configure script. +echo --disable-nls >> args + +:ConfigurePackage +echo Running the ./configure script... +sh ./configure @args +if errorlevel 1 goto CfgError +rm args +echo Done. +goto End + +:lalr1_ccFileError +echo ./data/lalr1.cc file editing failed! +goto End + +:glr_ccFileError +echo ./data/glr.cc file editing failed! +goto End + +:getargs_cFileError +echo ./src/getargs.c file editing failed! +goto End + +:location_ccFileError +echo ./data/location.cc file editing failed! +goto End + +:calcxxFileError +echo ./examples/calcxx file editing failed! +goto End + +:ScannerFileError +echo ./scanner file editing failed! +goto End + +:SedError +echo ./configure script editing failed! +goto End + +:SedError2 +echo ./lib/config.hin editing failed! +goto End + +:SedError3 +echo ./tests/testsuite editing failed! +goto End + +:CfgError +echo ./configure script exited abnormally! +goto End + +:SmallEnv +echo Your environment size is too small. Enlarge it and run me again. +echo Configuration NOT done! + +:End +test -f %XSRC%/install-sh.sh +if not errorlevel 1 goto NoRen1 +test -f %XSRC%/install-sh +if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh +:NoRen1 +if "%SHELL%" == "/bin/sh" set SHELL= +if "%HOME%" == "%XSRC%/djgpp" set HOME= +set CONFIG_SITE= +set HOSTNAME= +set NLS= +set XSRC= diff --git a/djgpp/config.sed b/djgpp/config.sed new file mode 100644 index 0000000..86050e4 --- /dev/null +++ b/djgpp/config.sed @@ -0,0 +1,191 @@ +# DJGPP specific configuration file. +# Sed script for additional DJGPP specific editing +# of the configure script generated by autoconf 2.62. + + +# Copyright (C) 2005, 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 . + + +# Additional editing of Makefiles +/^eval sed.*ac_file_inputs.*tmp\/out \\$/ { +:loop +n +/^$/!b loop +a\ +cat > "$tmp/subs-djgpp.sed" << eof_djgpp\ +# DJGPP specific Makefile changes.\ +s,\\.deps,_deps,g\ +s,\\.libs,_libs,g\ +s,\\.new\\.,_new.,g\ +s,\\.old\\.,_old.,g\ +s,\\.tab\\.,_tab.,g\ +s,c++\\.at,cxx.at,g\ +s,c++\\.m4,cxx.m4,g\ +s,c++-skel\\.m4,cxx-skel.m4,g\ +s,calc++,calcxx,g\ +s,scan-gram-c,c-scan-gram,g\ +s,scan-skel-c,c-scan-skel,g\ +s,inttypes_,_inttypes,g\ +s,javacomp\\.sh\\.in,javacomp.sh-in,g\ +s,javaexec\\.sh\\.in,javaexec.sh-in,g\ +s,yacc\\.1\\.in,yacc.1-in,g\ +s,bench\\.pl\\.in,bench.pl-in,g\ +s,Makefile\\.am\\.in,Makefile.am-in,g\ +s,Makefile\\.in\\.in,Makefile.in-in,g\ +/^\\.y\\.c:/,/^$/ {\ + /\\\$(YACCCOMPILE)/ {\ + a\\\\\ + -@test -f y.tab.c && mv -f y.tab.c y_tab.c\\\\\ + -@test -f y.tab.h && mv -f y.tab.h y_tab.h\ + }\ +}\ +/^libbison.a:/ i\\\\\ +\\$(top_srcdir)/djgpp/subpipe.c: \\$(top_srcdir)/djgpp/subpipe.h\\\\\ +subpipe.o: \\$(top_srcdir)/djgpp/subpipe.c \\$(top_srcdir)/djgpp/subpipe.h\\\\\ + \\$(COMPILE) -c \\$<\ +/^yacc:/ i\\\\\ +yacc.bat:\\\\\ + echo "bison\\$(EXEEXT) -y %1 %2 %3 %4 %5 %6 %7 %8 %9" >\\$@\ +/^bin_SCRIPTS =/s/$/ yacc.bat/\ +/^MOSTLYCLEANFILES = yacc/s/$/ yacc.bat/\ +/cross-options.texi:/,/^$/ s|bison|&.exe|g\ +/^\\.x\\.1:/,/^$/ s|\\$program|&.exe|g\ +eof_djgpp\ +sed -f "\$tmp/subs-djgpp.sed" \$tmp/out > \$tmp/out.djgpp\ +mv -f \$tmp/out.djgpp \$tmp/out +} + +# Makefile.in.in is renamed to Makefile.in-in. +/ac_config_files=/ { + /runtime-po/!s|po/Makefile\.in|&:po/Makefile.in-in| + s|runtime-po/Makefile\.in|&:runtime-po/Makefile.in-in| + s|javacomp\.sh\.in|javacomp.sh-in| + s|javaexec\.sh\.in|javaexec.sh-in| + s|doc/yacc\.1|&:doc/yacc.1-in| + s|etc/bench.pl|&:etc/bench.pl-in| +} + +/CONFIG_FILES=/ { + /runtime-po/!s|po/Makefile\.in|&:po/Makefile.in-in|2 + s|runtime-po/Makefile\.in|&:runtime-po/Makefile.in-in|2 + s|javacomp\.sh\.in|javacomp.sh-in| + s|javaexec\.sh\.in|javaexec.sh-in| + s|doc/yacc\.1|&:doc/yacc.1-in|2 + s|etc/bench\.pl|&:etc/bench.pl-in|2 +} + +# We always use _deps and _libs instead of .deps and .libs, because +# the latter is an invalid name on 8+3 MS-DOS file system. This makes +# the generated Makefiles good for every DJGPP installation, not only +# the one where the package was configured (which could happen to be +# a Windows box, where leading dots in file names are allowed). +/^rmdir[ ]*\.tst/ i\ +am__leading_dot=_ + +# Replace (command) > /dev/null with `command > /dev/null`, since +# parenthesized commands always return zero status in the ported Bash, +# even if the named command doesn't exist +/if ([^|;`]*null/{ + s,(,`, + s,),, + /null[ ]*2>&1/ s,2>&1,&`, + /null.*null/ s,null.*null,&`, + /null.*null/ !{ + /null[ ]*2>&1/ !s,null,&`, + } +} + +# DOS-style absolute file names should be supported as well +/\*) top_srcdir=/s,/\*,[\\\\/]* | ?:[\\\\/]*, + +# The following two items are changes needed for configuring +# and compiling across partitions. +# 1) The given srcdir value is always translated from the +# "x:" syntax into "/dev/x" syntax while we run configure. +/^[ ]*-srcdir=\*.*$/ a\ + ac_optarg=`echo "$ac_optarg" | sed "s,^\\([A-Za-z]\\):,/dev/\\1,"` +/set X `ls -Lt \$srcdir/ i\ + if `echo $srcdir | grep "^/dev/" - > /dev/null`; then\ + srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`\ + fi + +# Autoconf 2.52e generated configure scripts +# write absolute paths into Makefiles and bison.in +# making them useless for DJGPP installations for +# which the package has not been configured for. +/MISSING=/,/^$/ { + /^fi$/ a\ +am_missing_run=`echo "$am_missing_run" | sed 's%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'` +} +/^install_sh=/a\ +install_sh=`echo "$install_sh" | sed 's%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'` + +# This will only work if the assumption that the +# testsuite is ran from the following path: +# ${top_srcdir}/tests/testsuite.dir +# holds. The explicit names are of no importance. +# ../../. == ${top_srcdir} +#/^esac$/,/^ac_abs_srcdir=/ { +/^ac_abs_srcdir=/ i\ +ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`\ +ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`\ +ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"` +#ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"` +/^ac_abs_srcdir=/ a\ +for dj_dir in $ac_abs_builddir $ac_abs_top_builddir $ac_abs_top_srcdir $ac_abs_srcdir\ +do\ + ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%//%/%g"`\ + ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%//%/%g"`\ + ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%//%/%g"`\ + ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%//%/%g"`\ +done + +# Add DJGPP version information. +/^#define VERSION/ s/\$VERSION/& (DJGPP port (r1))/ + +# We need makeinfo to make the html formated docs. +/\$am_missing_run[ ]*makeinfo/ s,\$am_missing_run,, + +# The path to the FORTRAN compiler and libraries +# shall contain no absolute path reference so it +# will be good for all djgpp installations. +/^FLIBS="\$ac_cv_flibs"/ i\ +ac_djgpp_path=`echo "$DJDIR" | sed 's%\\\\\\%/%g' | tr $as_cr_LETTERS $as_cr_letters`\ +ac_cv_flibs=`echo "$ac_cv_flibs" | sed "s%-L$ac_djgpp_path%-L/dev/env/DJDIR%g"` + +# Autoconf generated configure scripts write absolute +# paths of certain header files into Makefiles making +# them useless for DJGPP installations for which the +# package has not been configured for. +/^.*echo "\$as_me:\$LINENO: result: \$gl_cv_absolute_.*$/ { +h +s,^.*\(gl_cv_absolute_\)\([a-z0-9_]*\)\(_h\).*$,\1\2\3=`echo $\1\2\3 | sed "s%[^:]:.*/include/%/dev/env/DJDIR/include/%"`, +G +} +/^.*echo "\$as_me:\$LINENO: result: \$gl_cv_full_.*$/ { +h +s,^.*\(gl_cv_full_\)\([a-z0-9_]*\)\(_h\).*$,\1\2\3=`echo $\1\2\3 | sed "s%[^:]:.*/include/%/dev/env/DJDIR/include/%"`, +G +} + +# The following is not a valid DOS file name +s/calc++/calcxx/g + +# The CR test for awk does not work for DJGPP. +/^ac_cs_awk_cr=/,/^$/ { + /^fi$/ a\ +ac_cs_awk_cr=$ac_cr +} diff --git a/djgpp/config.site b/djgpp/config.site new file mode 100644 index 0000000..526da0c --- /dev/null +++ b/djgpp/config.site @@ -0,0 +1,85 @@ +#! /bin/sh + +# This is the config.site file for configuring GNU packages +# which are to be built with DJGPP tools. + +# Copyright (C) 2005, 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 . + + +# Include the djgpp subdirectory in PATH, so that getconf is found +PATH="$srcdir/djgpp:$PATH" + +# These two variables are required, otherwise looking for +# programs along the PATH will not work. +PATH_SEPARATOR=: +PATH_EXPAND=y + +# This is required in for "test -f foo" to find foo.exe +export TEST_FINDS_EXE=y + +# The root of the DJGPP tree serves as the default prefix +test "x$prefix" = xNONE && prefix='/dev/env/DJDIR' + +# This is required for config.status script to be run, since +# ./configure runs it by invoking ${CONFIG_SHELL-/bin/sh} +CONFIG_SHELL=${CONFIG_SHELL='sh'} + +# These are set here so the generated Makefile's will be good +# for every DJGPP installation, not only the one where the +# package was configured. +# $INSTALL must be an absolute path name, otherwise config.status +# will try to prepend ./ and ../ to it when it goes into subdirs. +INSTALL=${INSTALL='/dev/env/DJDIR/bin/ginstall -c'} +RANLIB=${RANLIB='ranlib'} +GMSGFMT=${GMSGFMT='/dev/env/DJDIR/bin/msgfmt'} +MSGFMT=${MSGFMT='/dev/env/DJDIR/bin/msgfmt'} +XGETTEXT=${XGETTEXT='/dev/env/DJDIR/bin/xgettext'} +AWK=${AWK='gawk'} + +# A sane default for emacs. +ac_cv_path_EMACS=${EMACS='/dev/env/DJDIR/gnu/emacs/bin/emacs'} + +# A sane default for m4. +ac_cv_path_M4=${M4='/dev/env/DJDIR/bin/m4'} + +# A sane default for grep. +ac_cv_path_GREP=${GREP='/dev/env/DJDIR/bin/grep'} + +# A sane default for egrep. +ac_cv_path_EGREP=${EGREP='/dev/env/DJDIR/bin/egrep'} + +# A sane default for fgrep. +ac_cv_path_FGREP=${FGREP='/dev/env/DJDIR/bin/fgrep'} + +# A sane default for sed. +ac_cv_path_SED=${SED='/dev/env/DJDIR/bin/sed'} + +# A sane default for mkdir. +ac_cv_path_mkdir=${MKDIR_P='/dev/env/DJDIR/bin/mkdir -p'} + +# These are set here so the generated libtool will be good +# for every DJGPP installation, not only the one where the +# package was configured. +NM=${NM='nm'} +LD=${LD='ld'} + +# Force the test for 'ln -s' to report 'cp -pf'. +ac_cv_prog_LN_S='cp -pf' + +# There is no fork and vfork functionality. +ac_cv_func_fork=no +ac_cv_func_vfork=no +ac_cv_func_pipe=no diff --git a/djgpp/config_h.sed b/djgpp/config_h.sed new file mode 100644 index 0000000..1cbab24 --- /dev/null +++ b/djgpp/config_h.sed @@ -0,0 +1,28 @@ +# sed script for DJGPP specific editing of config.hin + +# Copyright (C) 2005, 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 . + + +$ a\ +\ +\ +/* DJGPP specific defines. */\ +\ +#include \ +#define TAB_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".tab" : "_tab")\ +#define OUTPUT_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".output" : ".out")\ +\ +#define DEFAULT_TMPDIR "/dev/env/DJDIR/tmp" diff --git a/djgpp/djunpack.bat b/djgpp/djunpack.bat new file mode 100644 index 0000000..51b9800 --- /dev/null +++ b/djgpp/djunpack.bat @@ -0,0 +1,87 @@ +@echo off +Rem +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 +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 with other file names after truncation to DOS 8+3 namespace. +Rem +Rem Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Rem +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 the Free Software Foundation, either version 3 of the License, or +Rem (at your option) any later version. +Rem +Rem This program is distributed in the hope that it will be useful, +Rem but WITHOUT ANY WARRANTY; without even the implied warranty of +Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Rem GNU General Public License for more details. +Rem +Rem You should have received a copy of the GNU General Public License +Rem along with this program. If not, see . +Rem +Rem +Rem Invoke like this: +Rem +Rem djunpack bison-XYZ.tar.gz +Rem or +Rem djunpack bison-XYZ.tar.bz2 +Rem +Rem where XYZ is the version number. If the argument includes leading +Rem directories, it MUST use backslashes, not forward slashes. +Rem + +set ENVIRONMENT_SIZE_TEST_STRING=ENVIRONMENT_SIZE_TEST_STRING +if "%ENVIRONMENT_SIZE_TEST_STRING%"=="ENVIRONMENT_SIZE_TEST_STRING" GoTo EnvOk +Rem If their environment space is too small, re-exec with a larger one +command.com /e:4096 /c %0 %1 +GoTo End + +:EnvOk +set ENVIRONMENT_SIZE_TEST_STRING= +if "%1" == "" GoTo NoArgument +if not exist %1 GoTo NoArchive +Rem Extract top src dir from archive file. +djtar -t %1 > top_src.dir +Rem The following uses a feature of COPY whereby it does not copy +Rem empty files. We need that because the previous line will create +Rem an empty fnchange.tmp even if the command failed for some reason. +copy top_src.dir junk.tmp > nul +if not exist junk.tmp GoTo NoDjTar +del junk.tmp +sed "1{s/^.*bison-/djtar -x -p -o bison-/;s|$|djgpp/fnchange.lst %%1 > fnchange.tmp|};2,$d" top_src.dir > ext_list.bat +Rem See the comment above about the reason for using COPY. +copy ext_list.bat junk.tmp > nul +if not exist junk.tmp GoTo NoSed +del junk.tmp +Rem Extract fnchange.lst from archive. +call ext_list.bat %1 +del ext_list.bat +sed "1{s|^.*bison-|s/@V@/bison-|;s|$|g|};2,$d" top_src.dir > version.sed +sed -f version.sed < fnchange.tmp > fnchange.lst +del version.sed +del fnchange.tmp +del top_src.dir +Rem unpack the source distribution +djtar -x -n fnchange.lst %1 +del fnchange.lst +GoTo End + +:NoSed +del junk.tmp +echo FAIL: Sed is not available. +GoTo End +:NoDjTar +del junk.tmp +echo FAIL: DJTAR is not available or no fnchange.lst file in %1. +GoTo End +:NoArchive +echo FAIL: the file %1 does not seem to exist. +echo Remember that %1 cannot use forward slashes, only backslashes. +GoTo End +:NoArgument +echo FAIL: no archive file has been specified. +echo Remember that the file name cannot use forward slashes, only backslashes. +:End diff --git a/djgpp/fnchange.lst b/djgpp/fnchange.lst new file mode 100644 index 0000000..1b43d9b --- /dev/null +++ b/djgpp/fnchange.lst @@ -0,0 +1,27 @@ +@V@/build-aux/javacomp.sh.in @V@/build-aux/javacomp.sh-in +@V@/build-aux/javaexec.sh.in @V@/build-aux/javaexec.sh-in +@V@/data/c++-skel.m4 @V@/data/cxx-skel.m4 +@V@/data/c++.m4 @V@/data/cxx.m4 +@V@/doc/yacc.1.in @V@/doc/yacc.1-in +@V@/etc/bench.pl.in @V@/etc/bench.pl-in +@V@/examples/calc++/ @V@/examples/calcxx/ +@V@/examples/calc++/Makefile.am @V@/examples/calcxx/Makefile.am +@V@/examples/calc++/Makefile.in @V@/examples/calcxx/Makefile.in +@V@/examples/calc++/calc++-scanner.cc @V@/examples/calcxx/calcxx-scanner.cc +@V@/examples/calc++/calc++-scanner.ll @V@/examples/calcxx/calcxx-scanner.ll +@V@/examples/calc++/calc++.cc @V@/examples/calcxx/calcxx.cc +@V@/examples/calc++/calc++-driver.hh @V@/examples/calcxx/calcxx-driver.hh +@V@/examples/calc++/calc++-driver.cc @V@/examples/calcxx/calcxx-driver.cc +@V@/examples/calc++/stack.hh @V@/examples/calcxx/stack.hh +@V@/examples/calc++/position.hh @V@/examples/calcxx/position.hh +@V@/examples/calc++/location.hh @V@/examples/calcxx/location.hh +@V@/examples/calc++/calc++-parser.hh @V@/examples/calcxx/calcxx-parser.hh +@V@/examples/calc++/calc++-parser.cc @V@/examples/calcxx/calcxx-parser.cc +@V@/examples/calc++/calc++-parser.stamp @V@/examples/calcxx/calcxx-parser.stamp +@V@/examples/calc++/calc++-parser.yy @V@/examples/calcxx/calcxx-parser.yy +@V@/examples/calc++/test @V@/examples/calcxx/test +@V@/po/Makefile.in.in @V@/po/Makefile.in-in +@V@/runtime-po/Makefile.in.in @V@/runtime-po/Makefile.in-in +@V@/src/scan-gram-c.c @V@/src/c-scan-gram.c +@V@/src/scan-skel-c.c @V@/src/c-scan-skel.c +@V@/tests/c++.at @V@/tests/cxx.at diff --git a/djgpp/subpipe.c b/djgpp/subpipe.c new file mode 100644 index 0000000..955dcd2 --- /dev/null +++ b/djgpp/subpipe.c @@ -0,0 +1,293 @@ +/* Subprocesses with pipes. + + Copyright (C) 2005, 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 . */ + +/* Written by Juan Manuel Guerrero . */ + + +#include + +#include "subpipe.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xalloc.h" + + +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +# define STDOUT_FILENO 1 +#endif + + +#include "error.h" + +#include "gettext.h" +#define _(Msgid) gettext (Msgid) + + +/* Initialize this module. */ + + +static int old_stdin; +static int old_stdout; +static char **arguments; +static char tmp_file_name[2][L_tmpnam]; + +#define remove_tmp_file(fd, name) \ + do { \ + close ((fd)); \ + if (unlink ((name))) \ + error (EXIT_FAILURE, 0, _("removing of `%s' failed"), (name)); \ + } while (0) + + +void +init_subpipe(void) +{ + char *tmpdir; + int fd; + + tmpdir = getenv("TMPDIR"); + if (tmpdir == NULL) + tmpdir = getenv("TMP"); + if (tmpdir == NULL) + tmpdir = getenv("TEMP"); + if (access(tmpdir, D_OK)) + tmpdir = "."; + + strcpy(tmp_file_name[0], tmpdir); + strcat(tmp_file_name[0], "/bnXXXXXX"); + fd = mkstemp(tmp_file_name[0]); + if (fd < 0) + error(EXIT_FAILURE, 0, _("creation of a temporary file failed")); + close (fd); + + strcpy(tmp_file_name[1], tmpdir); + strcat(tmp_file_name[1], "/bnXXXXXX"); + fd = mkstemp(tmp_file_name[1]); + if (fd < 0) + error(EXIT_FAILURE, 0, _("creation of a temporary file failed")); + close (fd); +} + + +/* Create a subprocess that is run as a filter. ARGV is the + NULL-terminated argument vector for the subprocess. Store read and + write file descriptors for communication with the subprocess into + FD[0] and FD[1]: input meant for the process can be written into + FD[0], and output from the process can be read from FD[1]. Return + the subprocess id. + + Because DOS has neither fork nor pipe functionality to run the subprocess + as a filter, the filter is reproduced using temporary files. First bison's + stdout is redirected to a temporary file. After bison has produced all of + is output, this file is closed and connected to m4's stdin. All m4's output + is redirected from m4's stdout to a second temporary file and reopened as + bison's stdin. */ + +pid_t +create_subpipe(char const *const *argv, int fd[2]) +{ + int argc; + int from_in_fd; /* pipe from bison to m4. */ + pid_t pid; + + + pid = getpid(); + + /* + * Save original stdin and stdout + * for later restauration. + */ + old_stdin = dup(STDIN_FILENO); + if (old_stdin < 0) + error(EXIT_FAILURE, 0, _("saving stdin failed")); + + old_stdout = dup(STDOUT_FILENO); + if (old_stdout < 0) + error(EXIT_FAILURE, 0, _("saving stdout failed")); + + /* + * Save argv for later use. + */ + for (argc = 0; argv[argc]; argc++) + ; + argc++; + arguments = xmalloc(argc * sizeof(arguments[0])); + for (argc = 0; argv[argc]; argc++) + { + arguments[argc] = xmalloc((strlen(argv[argc]) + 1) * sizeof(arguments[0][0])); + strcpy(arguments[argc], argv[argc]); + } + arguments[argc] = NULL; + + /* + * All bison's output will be gathered in this temporary file + * and will be redirected to m4's stdin. + */ + from_in_fd = open(tmp_file_name[0], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR); + if (from_in_fd < 0) + error(EXIT_FAILURE, 0, _("opening of tmpfile failed")); + if (dup2(from_in_fd, STDOUT_FILENO) < 0) + { + remove_tmp_file(from_in_fd, tmp_file_name[0]); + error(EXIT_FAILURE, 0, _("redirecting bison's stdout to the temporary file failed")); + } + close(from_in_fd); + + + fd[0] = STDOUT_FILENO; + return pid; +} + + +/* A signal handler that just records that a signal has happened. */ +static int child_interrupted; + +static void +signal_catcher(int signo) +{ + child_interrupted++; +} + + +void +end_of_output_subpipe(pid_t pid, int fd[2]) +{ + char *program; + int from_out_fd = open(tmp_file_name[0], O_RDONLY, S_IRUSR); /* pipe from bison to m4. */ + int to_in_fd = open(tmp_file_name[1], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR); /* pipe from m4 to bison. */ + int status; + void (*previous_handler)(int); + + + program = strrchr(arguments[0], '/'); + if (program) + program++; + else + program = arguments[0]; + + /* + * Redirect bison's output to m4's stdin. + */ + if (from_out_fd < 0) + error(EXIT_FAILURE, 0, _("opening of tmpfile failed")); + if (dup2(from_out_fd, STDIN_FILENO) < 0) + { + remove_tmp_file(from_out_fd, tmp_file_name[0]); + error(EXIT_FAILURE, 0, _("redirecting m4's stdin from the temporary file failed")); + } + close(from_out_fd); + + /* + * All m4's output will be gathered in this temporary file + * and will be redirected to bison's stdin. + */ + if (to_in_fd < 0) + { + remove_tmp_file(STDIN_FILENO, tmp_file_name[0]); + error(EXIT_FAILURE, 0, _("opening of a temporary file failed")); + } + if (dup2(to_in_fd, STDOUT_FILENO) < 0) + { + remove_tmp_file(STDIN_FILENO, tmp_file_name[0]); + remove_tmp_file(to_in_fd, tmp_file_name[1]); + error(EXIT_FAILURE, 0, _("redirecting m4's stdout to a temporary file failed")); + } + close(to_in_fd); + + /* + * Run m4. + */ + child_interrupted = 0; + errno = 0; + previous_handler = signal(SIGINT, signal_catcher); + status = spawnvp(P_WAIT, program, arguments); + signal(SIGINT, previous_handler); + if (child_interrupted) + { + remove_tmp_file(STDIN_FILENO, tmp_file_name[0]); + remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]); + error(EXIT_FAILURE, 0, _("subsidiary program `%s' interrupted"), program); + } + if (status) + { + remove_tmp_file(STDIN_FILENO, tmp_file_name[0]); + remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]); + error(EXIT_FAILURE, 0, _(errno == ENOENT + ? "subsidiary program `%s' not found" + : status < 1 + ? "subsidiary program `%s' failed" + : "subsidiary program `%s' failed (status=%i, errno=%i)"), program, status, errno); + } + + + /* + * Redirect m4's output to bison's stdin. + */ + if (dup2(old_stdout, STDOUT_FILENO) < 0) + error(EXIT_FAILURE, 0, "restore of bison's stdout failed"); + close(old_stdout); + to_in_fd = open(tmp_file_name[1], O_RDONLY, S_IRUSR); /* pipe from m4 to bison. */ + if (to_in_fd < 0) + { + remove_tmp_file(STDIN_FILENO, tmp_file_name[0]); + error(EXIT_FAILURE, 0, _("opening of tmpfile failed")); + } + if (dup2(to_in_fd, STDIN_FILENO) < 0) + { + remove_tmp_file(STDIN_FILENO, tmp_file_name[0]); + remove_tmp_file(to_in_fd, tmp_file_name[1]); + error(EXIT_FAILURE, -1, "dup2"); + error(EXIT_FAILURE, 0, _("redirecting bison's stdin from the temporary file failed")); + } + close(to_in_fd); + + + fd[1] = STDIN_FILENO; +} + + +/* Free resources, unlink temporary files and restore stdin and stdout. */ + +void +reap_subpipe(pid_t pid, char const *program) +{ + int argc; + + for (argc = 0; arguments[argc]; argc++) + free(arguments[argc]); + free(arguments); + + if (unlink(tmp_file_name[0])) + error(EXIT_FAILURE, 0, _("removing of `%s' failed"), tmp_file_name[0]); + if (unlink(tmp_file_name[1])) + error(EXIT_FAILURE, 0, _("removing of `%s' failed"), tmp_file_name[1]); + + if (dup2(old_stdin, STDIN_FILENO) < 0) + error(EXIT_FAILURE, 0, "restore of bison's stdin failed"); + close(old_stdin); +} diff --git a/djgpp/subpipe.h b/djgpp/subpipe.h new file mode 100644 index 0000000..7892097 --- /dev/null +++ b/djgpp/subpipe.h @@ -0,0 +1,26 @@ +/* Subprocesses with pipes. + Copyright (C) 2005, 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 . */ + +/* Written by Juan Manuel Guerrero . */ + +#if HAVE_SYS_TYPES_H +# include +#endif + +void init_subpipe(void); +pid_t create_subpipe(char const * const *, int[2]); +void end_of_output_subpipe(pid_t, int[2]); +void reap_subpipe(pid_t, char const *); diff --git a/djgpp/testsuite.sed b/djgpp/testsuite.sed new file mode 100644 index 0000000..266dab5 --- /dev/null +++ b/djgpp/testsuite.sed @@ -0,0 +1,24 @@ +# DJGPP specific configuration file. +# Sed script for additional DJGPP specific editing +# of the testsuite script generated by autoconf 2.61. + + +# Copyright (C) 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 . + + +# Remove disallowed characters from file names. + +s/~!@#\\\$%^&\*()-=_+{}\[\]|\\\\:;<>, ./~!@#\\$%^\&()-=_+{}[];, ./g diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in new file mode 100644 index 0000000..6127439 --- /dev/null +++ b/doc/Doxyfile.in @@ -0,0 +1,1087 @@ +# Doxyfile 1.3.4 -*- Makefile -*- + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "@PACKAGE_NAME@" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = "@PACKAGE_VERSION@" + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = . + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, +# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en +# (Japanese with English messages), Korean, Norwegian, Polish, Portuguese, +# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = YES + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited +# members of a class in the documentation of that class as if those members were +# ordinary class members. Constructors, destructors and assignment operators of +# the base classes will not be shown. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources +# only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = @top_srcdir@/src \ + @top_builddir@/src + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp +# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc + +FILE_PATTERNS = *.c \ + *.h \ + *.l \ + *.y + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = @top_srcdir@/src/scan-gram.c \ + @top_srcdir@/src/scan-skel.c \ + @top_builddir@/src/parse-*.[ch] + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are +# excluded from the input. + +EXCLUDE_SYMLINKS = YES + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output dir. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = YES + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse the +# parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. Note that this +# option is superceded by the HAVE_DOT option below. This is only a fallback. It is +# recommended to install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similiar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of +# the graphs generated by dot. A depth value of 3 means that only +# nodes reachable from the root by following a path via at most 3 +# edges will be shown. Nodes that lay further from the root node will +# be omitted. Note that setting this option to 1 or 2 may greatly +# reduce the computation time needed for large code bases. Also note +# that a graph may be further truncated if the graph's image +# dimensions are not sufficient to fit the graph (see +# MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the +# depth value (the default), the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..36370fc --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,122 @@ +## Process this file with automake to produce Makefile.in -*-Makefile-*- +## Copyright (C) 2001, 2002, 2003, 2005, 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 . + +AM_MAKEINFOFLAGS = --no-split +info_TEXINFOS = bison.texinfo +bison_TEXINFOS = $(srcdir)/cross-options.texi gpl-3.0.texi fdl.texi + +CLEANFILES = bison.fns +CLEANDIRS = *.t2d +clean-local: + rm -rf $(CLEANDIRS) + +CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl +$(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c $(CROSS_OPTIONS_PL) + -rm -f $@ $@.tmp + cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison + $(top_builddir)/src/bison --help | perl $(CROSS_OPTIONS_PL) >$@.tmp + mv $@.tmp $@ +MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi + +## ---------- ## +## Ref card. ## +## ---------- ## + +EXTRA_DIST = refcard.tex +CLEANFILES += refcard.dvi refcard.log refcard.ps + +refcard.dvi: refcard.tex + tex refcard.tex + +refcard.ps: refcard.dvi + + +## ----------- ## +## Man Pages. ## +## ----------- ## + +dist_man_MANS = $(srcdir)/bison.1 + +EXTRA_DIST += $(dist_man_MANS:.1=.x) common.x +MAINTAINERCLEANFILES += $(dist_man_MANS) + +# Depend on configure to get version number changes. +common_dep = $(top_srcdir)/configure $(srcdir)/common.x +srcsrcdir = $(top_srcdir)/bin +$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c + +# Differences to ignore when comparing the man page (the date). +remove_time_stamp = \ + sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/' + +MOSTLYCLEANFILES = $(srcdir)/*.t + +SUFFIXES = .x .1 + +PREPATH = $(top_builddir)/src +.x.1: + @program=`expr "/$*" : '.*/\(.*\)'` && \ + save_IFS=$IFS; \ + IFS=$(PATH_SEPARATOR); \ + for dir in $(PREPATH); do \ + IFS=$save_IFS; \ + echo cd $$dir '&&' $(MAKE) $(AM_MAKEFLAGS) $$program && \ + (cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $$program) || exit; \ + done + @echo "Updating man page $@" + PATH="$(PREPATH)$(PATH_SEPARATOR)$$PATH"; \ + export PATH; \ + $(HELP2MAN) \ + --include=$*.x \ + --include=$(srcdir)/common.x \ + --output=$@.t `echo '$*' | sed 's,.*/,,'` + if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \ + $(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \ + touch $@; \ + else \ + mv $@.t $@; \ + fi + rm -f $@*.t + +nodist_man_MANS = yacc.1 + +## -------------- ## +## Doxygenation. ## +## -------------- ## + +DOXYGEN = doxygen + +.PHONY: doc html + +doc: html + +html-local: Doxyfile + $(DOXYGEN) + +edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \ + -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \ + -e 's,@top_builddir\@,$(top_builddir),g' \ + -e 's,@top_srcdir\@,$(top_srcdir),g' + +EXTRA_DIST += Doxyfile.in +CLEANFILES += Doxyfile +# Sed is used to generate Doxyfile from Doxyfile.in instead of +# configure, because the former is way faster than the latter. +Doxyfile: $(srcdir)/Doxyfile.in + $(edit) $(srcdir)/Doxyfile.in >Doxyfile + +CLEANDIRS += html latex diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..1a11ffc --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,1023 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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 . +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = doc +DIST_COMMON = $(bison_TEXINFOS) $(dist_man_MANS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/stamp-vti \ + $(srcdir)/version.texi $(srcdir)/yacc.1.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = yacc.1 +SOURCES = +DIST_SOURCES = +INFO_DEPS = $(srcdir)/bison.info +TEXINFO_TEX = $(top_srcdir)/build-aux/texinfo.tex +am__TEXINFO_TEX_DIR = $(top_srcdir)/build-aux +DVIS = bison.dvi +PDFS = bison.pdf +PSS = bison.ps +HTMLS = bison.html +TEXINFOS = bison.texinfo +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(dist_man_MANS) $(nodist_man_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_MAKEINFOFLAGS = --no-split +info_TEXINFOS = bison.texinfo +bison_TEXINFOS = $(srcdir)/cross-options.texi gpl-3.0.texi fdl.texi +CLEANFILES = bison.fns refcard.dvi refcard.log refcard.ps Doxyfile +CLEANDIRS = *.t2d html latex +CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl +MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi $(dist_man_MANS) +EXTRA_DIST = refcard.tex $(dist_man_MANS:.1=.x) common.x Doxyfile.in +dist_man_MANS = $(srcdir)/bison.1 + +# Depend on configure to get version number changes. +common_dep = $(top_srcdir)/configure $(srcdir)/common.x +srcsrcdir = $(top_srcdir)/bin + +# Differences to ignore when comparing the man page (the date). +remove_time_stamp = \ + sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/' + +MOSTLYCLEANFILES = $(srcdir)/*.t +SUFFIXES = .x .1 +PREPATH = $(top_builddir)/src +nodist_man_MANS = yacc.1 +DOXYGEN = doxygen +edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \ + -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \ + -e 's,@top_builddir\@,$(top_builddir),g' \ + -e 's,@top_srcdir\@,$(top_srcdir),g' + +all: all-am + +.SUFFIXES: +.SUFFIXES: .x .1 .dvi .html .info .pdf .ps .texinfo +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +yacc.1: $(top_builddir)/config.status $(srcdir)/yacc.1.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +.texinfo.info: + restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && cd $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $<; \ + then \ + rc=0; \ + cd $(srcdir); \ + else \ + rc=$$?; \ + cd $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc + +.texinfo.dvi: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $< + +.texinfo.pdf: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) $< + +.texinfo.html: + rm -rf $(@:.html=.htp) + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@; \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi +$(srcdir)/bison.info: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS) +bison.dvi: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS) +bison.pdf: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS) +bison.html: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS) +$(srcdir)/version.texi: $(srcdir)/stamp-vti +$(srcdir)/stamp-vti: bison.texinfo $(top_srcdir)/configure + @(dir=.; test -f ./bison.texinfo || dir=$(srcdir); \ + set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/bison.texinfo`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > vti.tmp + @cmp -s vti.tmp $(srcdir)/version.texi \ + || (echo "Updating $(srcdir)/version.texi"; \ + cp vti.tmp $(srcdir)/version.texi) + -@rm -f vti.tmp + @cp $(srcdir)/version.texi $@ + +mostlyclean-vti: + -rm -f vti.tmp + +maintainer-clean-vti: + -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi +.dvi.ps: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) -o $@ $< + +uninstall-dvi-am: + @$(NORMAL_UNINSTALL) + @list='$(DVIS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ + rm -f "$(DESTDIR)$(dvidir)/$$f"; \ + done + +uninstall-html-am: + @$(NORMAL_UNINSTALL) + @list='$(HTMLS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-info-am: + @$(PRE_UNINSTALL) + @if test -d '$(DESTDIR)$(infodir)' && \ + (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ + done + +uninstall-pdf-am: + @$(NORMAL_UNINSTALL) + @list='$(PDFS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +uninstall-ps-am: + @$(NORMAL_UNINSTALL) + @list='$(PSS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ + rm -f "$(DESTDIR)$(psdir)/$$f"; \ + done + +dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ + else :; fi; \ + done; \ + done + +mostlyclean-aminfo: + -rm -rf bison.aux bison.cp bison.cps bison.fn bison.ky bison.kys bison.log \ + bison.pg bison.pgs bison.tmp bison.toc bison.tp bison.vr \ + bison.dvi bison.pdf bison.ps bison.html + +maintainer-clean-aminfo: + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ + done +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-info +check-am: all-am +check: check-am +all-am: Makefile $(INFO_DEPS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: $(DVIS) + +html: html-am + +html-am: $(HTMLS) html-local + +info: info-am + +info-am: $(INFO_DEPS) + +install-data-am: install-info-am install-man + +install-dvi: install-dvi-am + +install-dvi-am: $(DVIS) + @$(NORMAL_INSTALL) + test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" + @list='$(DVIS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(dvidir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(dvidir)/$$f"; \ + done +install-exec-am: + +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done +install-info: install-info-am + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ + $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ + else : ; fi; \ + done; \ + done + @$(POST_INSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: $(PDFS) + @$(NORMAL_INSTALL) + test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" + @list='$(PDFS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \ + done +install-ps: install-ps-am + +install-ps-am: $(PSS) + @$(NORMAL_INSTALL) + test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" + @list='$(PSS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(psdir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(psdir)/$$f"; \ + done +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti + +pdf: pdf-am + +pdf-am: $(PDFS) + +ps: ps-am + +ps-am: $(PSS) + +uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ + uninstall-man uninstall-pdf-am uninstall-ps-am + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-local \ + dist-info distclean distclean-generic distdir dvi dvi-am html \ + html-am html-local info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf \ + pdf-am ps ps-am uninstall uninstall-am uninstall-dvi-am \ + uninstall-html-am uninstall-info-am uninstall-man \ + uninstall-man1 uninstall-pdf-am uninstall-ps-am + +clean-local: + rm -rf $(CLEANDIRS) +$(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c $(CROSS_OPTIONS_PL) + -rm -f $@ $@.tmp + cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison + $(top_builddir)/src/bison --help | perl $(CROSS_OPTIONS_PL) >$@.tmp + mv $@.tmp $@ + +refcard.dvi: refcard.tex + tex refcard.tex + +refcard.ps: refcard.dvi +$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c +.x.1: + @program=`expr "/$*" : '.*/\(.*\)'` && \ + save_IFS=$IFS; \ + IFS=$(PATH_SEPARATOR); \ + for dir in $(PREPATH); do \ + IFS=$save_IFS; \ + echo cd $$dir '&&' $(MAKE) $(AM_MAKEFLAGS) $$program && \ + (cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $$program) || exit; \ + done + @echo "Updating man page $@" + PATH="$(PREPATH)$(PATH_SEPARATOR)$$PATH"; \ + export PATH; \ + $(HELP2MAN) \ + --include=$*.x \ + --include=$(srcdir)/common.x \ + --output=$@.t `echo '$*' | sed 's,.*/,,'` + if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \ + $(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \ + touch $@; \ + else \ + mv $@.t $@; \ + fi + rm -f $@*.t + +.PHONY: doc html + +doc: html + +html-local: Doxyfile + $(DOXYGEN) +# Sed is used to generate Doxyfile from Doxyfile.in instead of +# configure, because the former is way faster than the latter. +Doxyfile: $(srcdir)/Doxyfile.in + $(edit) $(srcdir)/Doxyfile.in >Doxyfile +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/bison.1 b/doc/bison.1 new file mode 100644 index 0000000..b03b5fc --- /dev/null +++ b/doc/bison.1 @@ -0,0 +1,198 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. +.TH BISON "1" "December 2008" "bison 2.4.1" "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 +(this is an experimental feature) +.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 . +.SH COPYRIGHT +Copyright \(co 2008 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. diff --git a/doc/bison.info b/doc/bison.info new file mode 100644 index 0000000..8151e73 --- /dev/null +++ b/doc/bison.info @@ -0,0 +1,10995 @@ +This is bison.info, produced by makeinfo version 4.11 from +bison.texinfo. + +This manual (19 November 2008) is for GNU Bison (version 2.4.1), the +GNU parser generator. + + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover texts + being "A GNU Manual," and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + "GNU Free Documentation License." + + (a) The FSF's Back-Cover Text is: "You have the freedom to copy and + modify this GNU manual. Buying copies from the FSF supports it in + developing GNU and promoting software freedom." + +INFO-DIR-SECTION Software development +START-INFO-DIR-ENTRY +* bison: (bison). GNU parser generator (Yacc replacement). +END-INFO-DIR-ENTRY + + +File: bison.info, Node: Top, Next: Introduction, Up: (dir) + +Bison +***** + +This manual (19 November 2008) is for GNU Bison (version 2.4.1), the +GNU parser generator. + + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover texts + being "A GNU Manual," and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + "GNU Free Documentation License." + + (a) The FSF's Back-Cover Text is: "You have the freedom to copy and + modify this GNU manual. Buying copies from the FSF supports it in + developing GNU and promoting software freedom." + +* Menu: + +* Introduction:: +* Conditions:: +* Copying:: The GNU General Public License says + how you can copy and share Bison. + +Tutorial sections: +* Concepts:: Basic concepts for understanding Bison. +* Examples:: Three simple explained examples of using Bison. + +Reference sections: +* Grammar File:: Writing Bison declarations and rules. +* Interface:: C-language interface to the parser function `yyparse'. +* Algorithm:: How the Bison parser works at run-time. +* Error Recovery:: Writing rules for error recovery. +* Context Dependency:: What to do if your language syntax is too + messy for Bison to handle straightforwardly. +* Debugging:: Understanding or debugging Bison parsers. +* Invocation:: How to run Bison (to produce the parser source file). +* Other Languages:: Creating C++ and Java parsers. +* FAQ:: Frequently Asked Questions +* Table of Symbols:: All the keywords of the Bison language are explained. +* Glossary:: Basic concepts are explained. +* Copying This Manual:: License for copying this manual. +* Index:: Cross-references to the text. + + --- The Detailed Node Listing --- + +The Concepts of Bison + +* Language and Grammar:: Languages and context-free grammars, + as mathematical ideas. +* Grammar in Bison:: How we represent grammars for Bison's sake. +* Semantic Values:: Each token or syntactic grouping can have + a semantic value (the value of an integer, + the name of an identifier, etc.). +* Semantic Actions:: Each rule can have an action containing C code. +* GLR Parsers:: Writing parsers for general context-free languages. +* Locations Overview:: Tracking Locations. +* Bison Parser:: What are Bison's input and output, + how is the output used? +* Stages:: Stages in writing and running Bison grammars. +* Grammar Layout:: Overall structure of a Bison grammar file. + +Writing GLR Parsers + +* Simple GLR Parsers:: Using GLR parsers on unambiguous grammars. +* Merging GLR Parses:: Using GLR parsers to resolve ambiguities. +* GLR Semantic Actions:: Deferred semantic actions have special concerns. +* Compiler Requirements:: GLR parsers require a modern C compiler. + +Examples + +* RPN Calc:: Reverse polish notation calculator; + a first example with no operator precedence. +* Infix Calc:: Infix (algebraic) notation calculator. + Operator precedence is introduced. +* Simple Error Recovery:: Continuing after syntax errors. +* Location Tracking Calc:: Demonstrating the use of @N and @$. +* Multi-function Calc:: Calculator with memory and trig functions. + It uses multiple data-types for semantic values. +* Exercises:: Ideas for improving the multi-function calculator. + +Reverse Polish Notation Calculator + +* Rpcalc Declarations:: Prologue (declarations) for rpcalc. +* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation. +* Rpcalc Lexer:: The lexical analyzer. +* Rpcalc Main:: The controlling function. +* Rpcalc Error:: The error reporting function. +* Rpcalc Generate:: Running Bison on the grammar file. +* Rpcalc Compile:: Run the C compiler on the output code. + +Grammar Rules for `rpcalc' + +* Rpcalc Input:: +* Rpcalc Line:: +* Rpcalc Expr:: + +Location Tracking Calculator: `ltcalc' + +* Ltcalc Declarations:: Bison and C declarations for ltcalc. +* Ltcalc Rules:: Grammar rules for ltcalc, with explanations. +* Ltcalc Lexer:: The lexical analyzer. + +Multi-Function Calculator: `mfcalc' + +* Mfcalc Declarations:: Bison declarations for multi-function calculator. +* Mfcalc Rules:: Grammar rules for the calculator. +* Mfcalc Symbol Table:: Symbol table management subroutines. + +Bison Grammar Files + +* Grammar Outline:: Overall layout of the grammar file. +* Symbols:: Terminal and nonterminal symbols. +* Rules:: How to write grammar rules. +* Recursion:: Writing recursive rules. +* Semantics:: Semantic values and actions. +* Locations:: Locations and actions. +* Declarations:: All kinds of Bison declarations are described here. +* Multiple Parsers:: Putting more than one Bison parser in one program. + +Outline of a Bison Grammar + +* Prologue:: Syntax and usage of the prologue. +* Prologue Alternatives:: Syntax and usage of alternatives to the prologue. +* Bison Declarations:: Syntax and usage of the Bison declarations section. +* Grammar Rules:: Syntax and usage of the grammar rules section. +* Epilogue:: Syntax and usage of the epilogue. + +Defining Language Semantics + +* Value Type:: Specifying one data type for all semantic values. +* Multiple Types:: Specifying several alternative data types. +* Actions:: An action is the semantic definition of a grammar rule. +* Action Types:: Specifying data types for actions to operate on. +* Mid-Rule Actions:: Most actions go at the end of a rule. + This says when, why and how to use the exceptional + action in the middle of a rule. + +Tracking Locations + +* Location Type:: Specifying a data type for locations. +* Actions and Locations:: Using locations in actions. +* Location Default Action:: Defining a general way to compute locations. + +Bison Declarations + +* Require Decl:: Requiring a Bison version. +* Token Decl:: Declaring terminal symbols. +* Precedence Decl:: Declaring terminals with precedence and associativity. +* Union Decl:: Declaring the set of all semantic value types. +* Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Initial Action Decl:: Code run before parsing starts. +* Destructor Decl:: Declaring how symbols are freed. +* Expect Decl:: Suppressing warnings about parsing conflicts. +* Start Decl:: Specifying the start symbol. +* Pure Decl:: Requesting a reentrant parser. +* Push Decl:: Requesting a push parser. +* Decl Summary:: Table of all Bison declarations. + +Parser C-Language Interface + +* Parser Function:: How to call `yyparse' and what it returns. +* Push Parser Function:: How to call `yypush_parse' and what it returns. +* Pull Parser Function:: How to call `yypull_parse' and what it returns. +* Parser Create Function:: How to call `yypstate_new' and what it returns. +* Parser Delete Function:: How to call `yypstate_delete' and what it returns. +* Lexical:: You must supply a function `yylex' + which reads tokens. +* Error Reporting:: You must supply a function `yyerror'. +* Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user's + native language. + +The Lexical Analyzer Function `yylex' + +* Calling Convention:: How `yyparse' calls `yylex'. +* Token Values:: How `yylex' must return the semantic value + of the token it has read. +* Token Locations:: How `yylex' must return the text location + (line number, etc.) of the token, if the + actions want that. +* Pure Calling:: How the calling convention differs in a pure parser + (*note A Pure (Reentrant) Parser: Pure Decl.). + +The Bison Parser Algorithm + +* Lookahead:: Parser looks one token ahead when deciding what to do. +* Shift/Reduce:: Conflicts: when either shifting or reduction is valid. +* Precedence:: Operator precedence works by resolving conflicts. +* Contextual Precedence:: When an operator's precedence depends on context. +* Parser States:: The parser is a finite-state-machine with stack. +* Reduce/Reduce:: When two rules are applicable in the same situation. +* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified. +* Generalized LR Parsing:: Parsing arbitrary context-free grammars. +* Memory Management:: What happens when memory is exhausted. How to avoid it. + +Operator Precedence + +* Why Precedence:: An example showing why precedence is needed. +* Using Precedence:: How to specify precedence in Bison grammars. +* Precedence Examples:: How these features are used in the previous example. +* How Precedence:: How they work. + +Handling Context Dependencies + +* Semantic Tokens:: Token parsing can depend on the semantic context. +* Lexical Tie-ins:: Token parsing can depend on the syntactic context. +* Tie-in Recovery:: Lexical tie-ins have implications for how + error recovery rules must be written. + +Debugging Your Parser + +* Understanding:: Understanding the structure of your parser. +* Tracing:: Tracing the execution of your parser. + +Invoking Bison + +* Bison Options:: All the options described in detail, + in alphabetical order by short options. +* Option Cross Key:: Alphabetical list of long options. +* Yacc Library:: Yacc-compatible `yylex' and `main'. + +Parsers Written In Other Languages + +* C++ Parsers:: The interface to generate C++ parser classes +* Java Parsers:: The interface to generate Java parser classes + +C++ Parsers + +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Interface:: Instantiating and running the parser +* C++ Scanner Interface:: Exchanges between yylex and parse +* A Complete C++ Example:: Demonstrating their use + +A Complete C++ Example + +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band + +Java Parsers + +* Java Bison Interface:: Asking for Java parser generation +* Java Semantic Values:: %type and %token vs. Java +* Java Location Values:: The position and location classes +* Java Parser Interface:: Instantiating and running the parser +* Java Scanner Interface:: Specifying the scanner for the parser +* Java Action Features:: Special features for use in actions +* Java Differences:: Differences between C/C++ and Java Grammars +* Java Declarations Summary:: List of Bison declarations used with Java + +Frequently Asked Questions + +* Memory Exhausted:: Breaking the Stack Limits +* How Can I Reset the Parser:: `yyparse' Keeps some State +* Strings are Destroyed:: `yylval' Loses Track of Strings +* Implementing Gotos/Loops:: Control Flow in the Calculator +* Multiple start-symbols:: Factoring closely related grammars +* Secure? Conform?:: Is Bison POSIX safe? +* I can't build Bison:: Troubleshooting +* Where can I find help?:: Troubleshouting +* Bug Reports:: Troublereporting +* More Languages:: Parsers in C++, Java, and so on +* Beta Testing:: Experimenting development versions +* Mailing Lists:: Meeting other Bison users + +Copying This Manual + +* Copying This Manual:: License for copying this manual. + + +File: bison.info, Node: Introduction, Next: Conditions, Prev: Top, Up: Top + +Introduction +************ + +"Bison" is a general-purpose parser generator that converts an +annotated context-free grammar into an LALR(1) or GLR parser for that +grammar. Once you are proficient with Bison, you can use it to develop +a wide range of language parsers, from those used in simple desk +calculators to complex programming languages. + + Bison is upward compatible with Yacc: all properly-written Yacc +grammars ought to work with Bison with no change. Anyone familiar with +Yacc should be able to use Bison with little trouble. You need to be +fluent in C or C++ programming in order to use Bison or to understand +this manual. + + We begin with tutorial chapters that explain the basic concepts of +using Bison and show three explained examples, each building on the +last. If you don't know Bison or Yacc, start by reading these +chapters. Reference chapters follow which describe specific aspects of +Bison in detail. + + Bison was written primarily by Robert Corbett; Richard Stallman made +it Yacc-compatible. Wilfred Hansen of Carnegie Mellon University added +multi-character string literals and other features. + + This edition corresponds to version 2.4.1 of Bison. + + +File: bison.info, Node: Conditions, Next: Copying, Prev: Introduction, Up: Top + +Conditions for Using Bison +************************** + +The distribution terms for Bison-generated parsers permit using the +parsers in nonfree programs. Before Bison version 2.2, these extra +permissions applied only when Bison was generating LALR(1) parsers in +C. And before Bison version 1.24, Bison-generated parsers could be +used only in programs that were free software. + + The other GNU programming tools, such as the GNU C compiler, have +never had such a requirement. They could always be used for nonfree +software. The reason Bison was different was not due to a special +policy decision; it resulted from applying the usual General Public +License to all of the Bison source code. + + The output of the Bison utility--the Bison parser file--contains a +verbatim copy of a sizable piece of Bison, which is the code for the +parser's implementation. (The actions from your grammar are inserted +into this implementation at one point, but most of the rest of the +implementation is not changed.) When we applied the GPL terms to the +skeleton code for the parser's implementation, the effect was to +restrict the use of Bison output to free software. + + We didn't change the terms because of sympathy for people who want to +make software proprietary. *Software should be free.* But we +concluded that limiting Bison's use to free software was doing little to +encourage people to make other software free. So we decided to make the +practical conditions for using Bison match the practical conditions for +using the other GNU tools. + + This exception applies when Bison is generating code for a parser. +You can tell whether the exception applies to a Bison output file by +inspecting the file for text beginning with "As a special +exception...". The text spells out the exact terms of the exception. + + +File: bison.info, Node: Copying, Next: Concepts, Prev: Conditions, Up: Top + +GNU GENERAL PUBLIC LICENSE +************************** + + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/' + + Everyone is permitted to copy and distribute verbatim copies of this + license document, but changing it is not allowed. + +Preamble +======== + +The GNU General Public License is a free, copyleft license for software +and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains +free software for all its users. We, the Free Software Foundation, use +the GNU General Public License for most of our software; it applies +also to any other work released this way by its authors. You can apply +it to your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you +have certain responsibilities if you distribute copies of the software, +or if you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the +manufacturer can do so. This is fundamentally incompatible with the +aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for +individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the +practice for those products. If such problems arise substantially in +other domains, we stand ready to extend this provision to those domains +in future versions of the GPL, as needed to protect the freedom of +users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS +==================== + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public + License. + + "Copyright" also means copyright-like laws that apply to other + kinds of works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this + License. Each licensee is addressed as "you". "Licensees" and + "recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the + work in a fashion requiring copyright permission, other than the + making of an exact copy. The resulting work is called a "modified + version" of the earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work + based on the Program. + + To "propagate" a work means to do anything with it that, without + permission, would make you directly or secondarily liable for + infringement under applicable copyright law, except executing it + on a computer or modifying a private copy. Propagation includes + copying, distribution (with or without modification), making + available to the public, and in some countries other activities as + well. + + To "convey" a work means any kind of propagation that enables other + parties to make or receive copies. Mere interaction with a user + through a computer network, with no transfer of a copy, is not + conveying. + + An interactive user interface displays "Appropriate Legal Notices" + to the extent that it includes a convenient and prominently visible + feature that (1) displays an appropriate copyright notice, and (2) + tells the user that there is no warranty for the work (except to + the extent that warranties are provided), that licensees may + convey the work under this License, and how to view a copy of this + License. If the interface presents a list of user commands or + options, such as a menu, a prominent item in the list meets this + criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work + for making modifications to it. "Object code" means any + non-source form of a work. + + A "Standard Interface" means an interface that either is an + official standard defined by a recognized standards body, or, in + the case of interfaces specified for a particular programming + language, one that is widely used among developers working in that + language. + + The "System Libraries" of an executable work include anything, + other than the work as a whole, that (a) is included in the normal + form of packaging a Major Component, but which is not part of that + Major Component, and (b) serves only to enable use of the work + with that Major Component, or to implement a Standard Interface + for which an implementation is available to the public in source + code form. A "Major Component", in this context, means a major + essential component (kernel, window system, and so on) of the + specific operating system (if any) on which the executable work + runs, or a compiler used to produce the work, or an object code + interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all + the source code needed to generate, install, and (for an executable + work) run the object code and to modify the work, including + scripts to control those activities. However, it does not include + the work's System Libraries, or general-purpose tools or generally + available free programs which are used unmodified in performing + those activities but which are not part of the work. For example, + Corresponding Source includes interface definition files + associated with source files for the work, and the source code for + shared libraries and dynamically linked subprograms that the work + is specifically designed to require, such as by intimate data + communication or control flow between those subprograms and other + parts of the work. + + The Corresponding Source need not include anything that users can + regenerate automatically from other parts of the Corresponding + Source. + + The Corresponding Source for a work in source code form is that + same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of + copyright on the Program, and are irrevocable provided the stated + conditions are met. This License explicitly affirms your unlimited + permission to run the unmodified Program. The output from running + a covered work is covered by this License only if the output, + given its content, constitutes a covered work. This License + acknowledges your rights of fair use or other equivalent, as + provided by copyright law. + + You may make, run and propagate covered works that you do not + convey, without conditions so long as your license otherwise + remains in force. You may convey covered works to others for the + sole purpose of having them make modifications exclusively for + you, or provide you with facilities for running those works, + provided that you comply with the terms of this License in + conveying all material for which you do not control copyright. + Those thus making or running the covered works for you must do so + exclusively on your behalf, under your direction and control, on + terms that prohibit them from making any copies of your + copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under + the conditions stated below. Sublicensing is not allowed; section + 10 makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological + measure under any applicable law fulfilling obligations under + article 11 of the WIPO copyright treaty adopted on 20 December + 1996, or similar laws prohibiting or restricting circumvention of + such measures. + + When you convey a covered work, you waive any legal power to forbid + circumvention of technological measures to the extent such + circumvention is effected by exercising rights under this License + with respect to the covered work, and you disclaim any intention + to limit operation or modification of the work as a means of + enforcing, against the work's users, your or third parties' legal + rights to forbid circumvention of technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you + receive it, in any medium, provided that you conspicuously and + appropriately publish on each copy an appropriate copyright notice; + keep intact all notices stating that this License and any + non-permissive terms added in accord with section 7 apply to the + code; keep intact all notices of the absence of any warranty; and + give all recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, + and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to + produce it from the Program, in the form of source code under the + terms of section 4, provided that you also meet all of these + conditions: + + a. The work must carry prominent notices stating that you + modified it, and giving a relevant date. + + b. The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in + section 4 to "keep intact all notices". + + c. You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable + section 7 additional terms, to the whole of the work, and all + its parts, regardless of how they are packaged. This License + gives no permission to license the work in any other way, but + it does not invalidate such permission if you have separately + received it. + + d. If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has + interactive interfaces that do not display Appropriate Legal + Notices, your work need not make them do so. + + A compilation of a covered work with other separate and independent + works, which are not by their nature extensions of the covered + work, and which are not combined with it such as to form a larger + program, in or on a volume of a storage or distribution medium, is + called an "aggregate" if the compilation and its resulting + copyright are not used to limit the access or legal rights of the + compilation's users beyond what the individual works permit. + Inclusion of a covered work in an aggregate does not cause this + License to apply to the other parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms + of sections 4 and 5, provided that you also convey the + machine-readable Corresponding Source under the terms of this + License, in one of these ways: + + a. Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b. Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for + as long as you offer spare parts or customer support for that + product model, to give anyone who possesses the object code + either (1) a copy of the Corresponding Source for all the + software in the product that is covered by this License, on a + durable physical medium customarily used for software + interchange, for a price no more than your reasonable cost of + physically performing this conveying of source, or (2) access + to copy the Corresponding Source from a network server at no + charge. + + c. Convey individual copies of the object code with a copy of + the written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, + and only if you received the object code with such an offer, + in accord with subsection 6b. + + d. Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access + to the Corresponding Source in the same way through the same + place at no further charge. You need not require recipients + to copy the Corresponding Source along with the object code. + If the place to copy the object code is a network server, the + Corresponding Source may be on a different server (operated + by you or a third party) that supports equivalent copying + facilities, provided you maintain clear directions next to + the object code saying where to find the Corresponding Source. + Regardless of what server hosts the Corresponding Source, you + remain obligated to ensure that it is available for as long + as needed to satisfy these requirements. + + e. Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the + general public at no charge under subsection 6d. + + + A separable portion of the object code, whose source code is + excluded from the Corresponding Source as a System Library, need + not be included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means + any tangible personal property which is normally used for personal, + family, or household purposes, or (2) anything designed or sold for + incorporation into a dwelling. In determining whether a product + is a consumer product, doubtful cases shall be resolved in favor of + coverage. For a particular product received by a particular user, + "normally used" refers to a typical or common use of that class of + product, regardless of the status of the particular user or of the + way in which the particular user actually uses, or expects or is + expected to use, the product. A product is a consumer product + regardless of whether the product has substantial commercial, + industrial or non-consumer uses, unless such uses represent the + only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, + procedures, authorization keys, or other information required to + install and execute modified versions of a covered work in that + User Product from a modified version of its Corresponding Source. + The information must suffice to ensure that the continued + functioning of the modified object code is in no case prevented or + interfered with solely because modification has been made. + + If you convey an object code work under this section in, or with, + or specifically for use in, a User Product, and the conveying + occurs as part of a transaction in which the right of possession + and use of the User Product is transferred to the recipient in + perpetuity or for a fixed term (regardless of how the transaction + is characterized), the Corresponding Source conveyed under this + section must be accompanied by the Installation Information. But + this requirement does not apply if neither you nor any third party + retains the ability to install modified object code on the User + Product (for example, the work has been installed in ROM). + + The requirement to provide Installation Information does not + include a requirement to continue to provide support service, + warranty, or updates for a work that has been modified or + installed by the recipient, or for the User Product in which it + has been modified or installed. Access to a network may be denied + when the modification itself materially and adversely affects the + operation of the network or violates the rules and protocols for + communication across the network. + + Corresponding Source conveyed, and Installation Information + provided, in accord with this section must be in a format that is + publicly documented (and with an implementation available to the + public in source code form), and must require no special password + or key for unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of + this License by making exceptions from one or more of its + conditions. Additional permissions that are applicable to the + entire Program shall be treated as though they were included in + this License, to the extent that they are valid under applicable + law. If additional permissions apply only to part of the Program, + that part may be used separately under those permissions, but the + entire Program remains governed by this License without regard to + the additional permissions. + + When you convey a copy of a covered work, you may at your option + remove any additional permissions from that copy, or from any part + of it. (Additional permissions may be written to require their own + removal in certain cases when you modify the work.) You may place + additional permissions on material, added by you to a covered work, + for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material + you add to a covered work, you may (if authorized by the copyright + holders of that material) supplement the terms of this License + with terms: + + a. Disclaiming warranty or limiting liability differently from + the terms of sections 15 and 16 of this License; or + + b. Requiring preservation of specified reasonable legal notices + or author attributions in that material or in the Appropriate + Legal Notices displayed by works containing it; or + + c. Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be + marked in reasonable ways as different from the original + version; or + + d. Limiting the use for publicity purposes of names of licensors + or authors of the material; or + + e. Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f. Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified + versions of it) with contractual assumptions of liability to + the recipient, for any liability that these contractual + assumptions directly impose on those licensors and authors. + + All other non-permissive additional terms are considered "further + restrictions" within the meaning of section 10. If the Program as + you received it, or any part of it, contains a notice stating that + it is governed by this License along with a term that is a further + restriction, you may remove that term. If a license document + contains a further restriction but permits relicensing or + conveying under this License, you may add to a covered work + material governed by the terms of that license document, provided + that the further restriction does not survive such relicensing or + conveying. + + If you add terms to a covered work in accord with this section, you + must place, in the relevant source files, a statement of the + additional terms that apply to those files, or a notice indicating + where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in + the form of a separately written license, or stated as exceptions; + the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly + provided under this License. Any attempt otherwise to propagate or + modify it is void, and will automatically terminate your rights + under this License (including any patent licenses granted under + the third paragraph of section 11). + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, 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, you do not qualify to receive new + licenses for the same material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or + run a copy of the Program. Ancillary propagation of a covered work + occurring solely as a consequence of using peer-to-peer + transmission to receive a copy likewise does not require + acceptance. However, nothing other than this License grants you + permission to propagate or modify any covered work. These actions + infringe copyright if you do not accept this License. Therefore, + by modifying or propagating a covered work, you indicate your + acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically + receives a license from the original licensors, to run, modify and + propagate that work, subject to this License. You are not + responsible for enforcing compliance by third parties with this + License. + + An "entity transaction" is a transaction transferring control of an + organization, or substantially all assets of one, or subdividing an + organization, or merging organizations. If propagation of a + covered work results from an entity transaction, each party to that + transaction who receives a copy of the work also receives whatever + licenses to the work the party's predecessor in interest had or + could give under the previous paragraph, plus a right to + possession of the Corresponding Source of the work from the + predecessor in interest, if the predecessor has it or can get it + with reasonable efforts. + + You may not impose any further restrictions on the exercise of the + rights granted or affirmed under this License. For example, you + may not impose a license fee, royalty, or other charge for + exercise of rights granted under this License, and you may not + initiate litigation (including a cross-claim or counterclaim in a + lawsuit) alleging that any patent claim is infringed by making, + using, selling, offering for sale, or importing the Program or any + portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this + License of the Program or a work on which the Program is based. + The work thus licensed is called the contributor's "contributor + version". + + A contributor's "essential patent claims" are all patent claims + owned or controlled by the contributor, whether already acquired or + hereafter acquired, that would be infringed by some manner, + permitted by this License, of making, using, or selling its + contributor version, but do not include claims that would be + infringed only as a consequence of further modification of the + contributor version. For purposes of this definition, "control" + includes the right to grant patent sublicenses in a manner + consistent with the requirements of this License. + + Each contributor grants you a non-exclusive, worldwide, + royalty-free patent license under the contributor's essential + patent claims, to make, use, sell, offer for sale, import and + otherwise run, modify and propagate the contents of its + contributor version. + + In the following three paragraphs, a "patent license" is any + express agreement or commitment, however denominated, not to + enforce a patent (such as an express permission to practice a + patent or covenant not to sue for patent infringement). To + "grant" such a patent license to a party means to make such an + agreement or commitment not to enforce a patent against the party. + + If you convey a covered work, knowingly relying on a patent + license, and the Corresponding Source of the work is not available + for anyone to copy, free of charge and under the terms of this + License, through a publicly available network server or other + readily accessible means, then you must either (1) cause the + Corresponding Source to be so available, or (2) arrange to deprive + yourself of the benefit of the patent license for this particular + work, or (3) arrange, in a manner consistent with the requirements + of this License, to extend the patent license to downstream + recipients. "Knowingly relying" means you have actual knowledge + that, but for the patent license, your conveying the covered work + in a country, or your recipient's use of the covered work in a + country, would infringe one or more identifiable patents in that + country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or + arrangement, you convey, or propagate by procuring conveyance of, a + covered work, and grant a patent license to some of the parties + receiving the covered work authorizing them to use, propagate, + modify or convey a specific copy of the covered work, then the + patent license you grant is automatically extended to all + recipients of the covered work and works based on it. + + A patent license is "discriminatory" if it does not include within + the scope of its coverage, prohibits the exercise of, or is + conditioned on the non-exercise of one or more of the rights that + are specifically granted under this License. You may not convey a + covered work if you are a party to an arrangement with a third + party that is in the business of distributing software, under + which you make payment to the third party based on the extent of + your activity of conveying the work, and under which the third + party grants, to any of the parties who would receive the covered + work from you, a discriminatory patent license (a) in connection + with copies of the covered work conveyed by you (or copies made + from those copies), or (b) primarily for and in connection with + specific products or compilations that contain the covered work, + unless you entered into that arrangement, or that patent license + was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting + any implied license or other defenses to infringement that may + otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, + agreement or otherwise) that contradict the conditions of this + License, they do not excuse you from the conditions of this + License. If you cannot convey a covered work so as to satisfy + simultaneously your obligations under this License and any other + pertinent obligations, then as a consequence you may not convey it + at all. For example, if you agree to terms that obligate you to + collect a royalty for further conveying from those to whom you + convey the Program, the only way you could satisfy both those + terms and this License would be to refrain entirely from conveying + the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have + permission to link or combine any covered work with a work licensed + under version 3 of the GNU Affero General Public License into a + single combined work, and to convey the resulting work. The terms + of this License will continue to apply to the part which is the + covered work, but the special requirements of the GNU Affero + General Public License, section 13, concerning interaction through + a network will apply to the combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new + versions of the GNU General Public License from time to time. + Such new versions will be similar in spirit to the present + version, but may differ in detail to address new problems or + concerns. + + Each version is given a distinguishing version number. If the + Program specifies that a certain numbered version of the GNU + General Public License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that numbered version or of any later version published by the + Free Software Foundation. If the Program does not specify a + version number of the GNU General Public License, you may choose + any version ever published by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future + versions of the GNU General Public License can be used, that + proxy's public statement of acceptance of a version permanently + authorizes you to choose that version for the Program. + + Later license versions may give you additional or different + permissions. However, no additional obligations are imposed on any + author or copyright holder as a result of your choosing to follow a + later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY + APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE + COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE + RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. + SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES + AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU + FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE + THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA + BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER + PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF + THE POSSIBILITY OF SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided + above cannot be given local legal effect according to their terms, + reviewing courts shall apply local law that most closely + approximates an absolute waiver of all civil liability in + connection with the Program, unless a warranty or assumption of + liability accompanies a copy of the Program in return for a fee. + + +END OF TERMS AND CONDITIONS +=========================== + +How to Apply These Terms to Your New Programs +============================================= + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. + Copyright (C) YEAR NAME OF AUTHOR + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + 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/'. + + Also add information on how to contact you by electronic and paper +mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + PROGRAM Copyright (C) YEAR NAME OF AUTHOR + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + + The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, your +program's commands might be different; for a GUI interface, you would +use an "about box". + + You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see `http://www.gnu.org/licenses/'. + + The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read `http://www.gnu.org/philosophy/why-not-lgpl.html'. + + +File: bison.info, Node: Concepts, Next: Examples, Prev: Copying, Up: Top + +1 The Concepts of Bison +*********************** + +This chapter introduces many of the basic concepts without which the +details of Bison will not make sense. If you do not already know how to +use Bison or Yacc, we suggest you start by reading this chapter +carefully. + +* Menu: + +* Language and Grammar:: Languages and context-free grammars, + as mathematical ideas. +* Grammar in Bison:: How we represent grammars for Bison's sake. +* Semantic Values:: Each token or syntactic grouping can have + a semantic value (the value of an integer, + the name of an identifier, etc.). +* Semantic Actions:: Each rule can have an action containing C code. +* GLR Parsers:: Writing parsers for general context-free languages. +* Locations Overview:: Tracking Locations. +* Bison Parser:: What are Bison's input and output, + how is the output used? +* Stages:: Stages in writing and running Bison grammars. +* Grammar Layout:: Overall structure of a Bison grammar file. + + +File: bison.info, Node: Language and Grammar, Next: Grammar in Bison, Up: Concepts + +1.1 Languages and Context-Free Grammars +======================================= + +In order for Bison to parse a language, it must be described by a +"context-free grammar". This means that you specify one or more +"syntactic groupings" and give rules for constructing them from their +parts. For example, in the C language, one kind of grouping is called +an `expression'. One rule for making an expression might be, "An +expression can be made of a minus sign and another expression". +Another would be, "An expression can be an integer". As you can see, +rules are often recursive, but there must be at least one rule which +leads out of the recursion. + + The most common formal system for presenting such rules for humans +to read is "Backus-Naur Form" or "BNF", which was developed in order to +specify the language Algol 60. Any grammar expressed in BNF is a +context-free grammar. The input to Bison is essentially +machine-readable BNF. + + There are various important subclasses of context-free grammar. +Although it can handle almost all context-free grammars, Bison is +optimized for what are called LALR(1) grammars. In brief, in these +grammars, it must be possible to tell how to parse any portion of an +input string with just a single token of lookahead. Strictly speaking, +that is a description of an LR(1) grammar, and LALR(1) involves +additional restrictions that are hard to explain simply; but it is rare +in actual practice to find an LR(1) grammar that fails to be LALR(1). +*Note Mysterious Reduce/Reduce Conflicts: Mystery Conflicts, for more +information on this. + + Parsers for LALR(1) grammars are "deterministic", meaning roughly +that the next grammar rule to apply at any point in the input is +uniquely determined by the preceding input and a fixed, finite portion +(called a "lookahead") of the remaining input. A context-free grammar +can be "ambiguous", meaning that there are multiple ways to apply the +grammar rules to get the same inputs. Even unambiguous grammars can be +"nondeterministic", meaning that no fixed lookahead always suffices to +determine the next grammar rule to apply. With the proper +declarations, Bison is also able to parse these more general +context-free grammars, using a technique known as GLR parsing (for +Generalized LR). Bison's GLR parsers are able to handle any +context-free grammar for which the number of possible parses of any +given string is finite. + + In the formal grammatical rules for a language, each kind of +syntactic unit or grouping is named by a "symbol". Those which are +built by grouping smaller constructs according to grammatical rules are +called "nonterminal symbols"; those which can't be subdivided are called +"terminal symbols" or "token types". We call a piece of input +corresponding to a single terminal symbol a "token", and a piece +corresponding to a single nonterminal symbol a "grouping". + + We can use the C language as an example of what symbols, terminal and +nonterminal, mean. The tokens of C are identifiers, constants (numeric +and string), and the various keywords, arithmetic operators and +punctuation marks. So the terminal symbols of a grammar for C include +`identifier', `number', `string', plus one symbol for each keyword, +operator or punctuation mark: `if', `return', `const', `static', `int', +`char', `plus-sign', `open-brace', `close-brace', `comma' and many more. +(These tokens can be subdivided into characters, but that is a matter of +lexicography, not grammar.) + + Here is a simple C function subdivided into tokens: + + int /* keyword `int' */ + square (int x) /* identifier, open-paren, keyword `int', + identifier, close-paren */ + { /* open-brace */ + return x * x; /* keyword `return', identifier, asterisk, + identifier, semicolon */ + } /* close-brace */ + + The syntactic groupings of C include the expression, the statement, +the declaration, and the function definition. These are represented in +the grammar of C by nonterminal symbols `expression', `statement', +`declaration' and `function definition'. The full grammar uses dozens +of additional language constructs, each with its own nonterminal +symbol, in order to express the meanings of these four. The example +above is a function definition; it contains one declaration, and one +statement. In the statement, each `x' is an expression and so is `x * +x'. + + Each nonterminal symbol must have grammatical rules showing how it +is made out of simpler constructs. For example, one kind of C +statement is the `return' statement; this would be described with a +grammar rule which reads informally as follows: + + A `statement' can be made of a `return' keyword, an `expression' + and a `semicolon'. + +There would be many other rules for `statement', one for each kind of +statement in C. + + One nonterminal symbol must be distinguished as the special one which +defines a complete utterance in the language. It is called the "start +symbol". In a compiler, this means a complete input program. In the C +language, the nonterminal symbol `sequence of definitions and +declarations' plays this role. + + For example, `1 + 2' is a valid C expression--a valid part of a C +program--but it is not valid as an _entire_ C program. In the +context-free grammar of C, this follows from the fact that `expression' +is not the start symbol. + + The Bison parser reads a sequence of tokens as its input, and groups +the tokens using the grammar rules. If the input is valid, the end +result is that the entire token sequence reduces to a single grouping +whose symbol is the grammar's start symbol. If we use a grammar for C, +the entire input must be a `sequence of definitions and declarations'. +If not, the parser reports a syntax error. + + +File: bison.info, Node: Grammar in Bison, Next: Semantic Values, Prev: Language and Grammar, Up: Concepts + +1.2 From Formal Rules to Bison Input +==================================== + +A formal grammar is a mathematical construct. To define the language +for Bison, you must write a file expressing the grammar in Bison syntax: +a "Bison grammar" file. *Note Bison Grammar Files: Grammar File. + + A nonterminal symbol in the formal grammar is represented in Bison +input as an identifier, like an identifier in C. By convention, it +should be in lower case, such as `expr', `stmt' or `declaration'. + + The Bison representation for a terminal symbol is also called a +"token type". Token types as well can be represented as C-like +identifiers. By convention, these identifiers should be upper case to +distinguish them from nonterminals: for example, `INTEGER', +`IDENTIFIER', `IF' or `RETURN'. A terminal symbol that stands for a +particular keyword in the language should be named after that keyword +converted to upper case. The terminal symbol `error' is reserved for +error recovery. *Note Symbols::. + + A terminal symbol can also be represented as a character literal, +just like a C character constant. You should do this whenever a token +is just a single character (parenthesis, plus-sign, etc.): use that +same character in a literal as the terminal symbol for that token. + + A third way to represent a terminal symbol is with a C string +constant containing several characters. *Note Symbols::, for more +information. + + The grammar rules also have an expression in Bison syntax. For +example, here is the Bison rule for a C `return' statement. The +semicolon in quotes is a literal character token, representing part of +the C syntax for the statement; the naked semicolon, and the colon, are +Bison punctuation used in every rule. + + stmt: RETURN expr ';' + ; + +*Note Syntax of Grammar Rules: Rules. + + +File: bison.info, Node: Semantic Values, Next: Semantic Actions, Prev: Grammar in Bison, Up: Concepts + +1.3 Semantic Values +=================== + +A formal grammar selects tokens only by their classifications: for +example, if a rule mentions the terminal symbol `integer constant', it +means that _any_ integer constant is grammatically valid in that +position. The precise value of the constant is irrelevant to how to +parse the input: if `x+4' is grammatical then `x+1' or `x+3989' is +equally grammatical. + + But the precise value is very important for what the input means +once it is parsed. A compiler is useless if it fails to distinguish +between 4, 1 and 3989 as constants in the program! Therefore, each +token in a Bison grammar has both a token type and a "semantic value". +*Note Defining Language Semantics: Semantics, for details. + + The token type is a terminal symbol defined in the grammar, such as +`INTEGER', `IDENTIFIER' or `',''. It tells everything you need to know +to decide where the token may validly appear and how to group it with +other tokens. The grammar rules know nothing about tokens except their +types. + + The semantic value has all the rest of the information about the +meaning of the token, such as the value of an integer, or the name of an +identifier. (A token such as `','' which is just punctuation doesn't +need to have any semantic value.) + + For example, an input token might be classified as token type +`INTEGER' and have the semantic value 4. Another input token might +have the same token type `INTEGER' but value 3989. When a grammar rule +says that `INTEGER' is allowed, either of these tokens is acceptable +because each is an `INTEGER'. When the parser accepts the token, it +keeps track of the token's semantic value. + + Each grouping can also have a semantic value as well as its +nonterminal symbol. For example, in a calculator, an expression +typically has a semantic value that is a number. In a compiler for a +programming language, an expression typically has a semantic value that +is a tree structure describing the meaning of the expression. + + +File: bison.info, Node: Semantic Actions, Next: GLR Parsers, Prev: Semantic Values, Up: Concepts + +1.4 Semantic Actions +==================== + +In order to be useful, a program must do more than parse input; it must +also produce some output based on the input. In a Bison grammar, a +grammar rule can have an "action" made up of C statements. Each time +the parser recognizes a match for that rule, the action is executed. +*Note Actions::. + + Most of the time, the purpose of an action is to compute the +semantic value of the whole construct from the semantic values of its +parts. For example, suppose we have a rule which says an expression +can be the sum of two expressions. When the parser recognizes such a +sum, each of the subexpressions has a semantic value which describes +how it was built up. The action for this rule should create a similar +sort of value for the newly recognized larger expression. + + For example, here is a rule that says an expression can be the sum of +two subexpressions: + + expr: expr '+' expr { $$ = $1 + $3; } + ; + +The action says how to produce the semantic value of the sum expression +from the values of the two subexpressions. + + +File: bison.info, Node: GLR Parsers, Next: Locations Overview, Prev: Semantic Actions, Up: Concepts + +1.5 Writing GLR Parsers +======================= + +In some grammars, Bison's standard LALR(1) parsing algorithm cannot +decide whether to apply a certain grammar rule at a given point. That +is, it may not be able to decide (on the basis of the input read so +far) which of two possible reductions (applications of a grammar rule) +applies, or whether to apply a reduction or read more of the input and +apply a reduction later in the input. These are known respectively as +"reduce/reduce" conflicts (*note Reduce/Reduce::), and "shift/reduce" +conflicts (*note Shift/Reduce::). + + To use a grammar that is not easily modified to be LALR(1), a more +general parsing algorithm is sometimes necessary. If you include +`%glr-parser' among the Bison declarations in your file (*note Grammar +Outline::), the result is a Generalized LR (GLR) parser. These parsers +handle Bison grammars that contain no unresolved conflicts (i.e., after +applying precedence declarations) identically to LALR(1) parsers. +However, when faced with unresolved shift/reduce and reduce/reduce +conflicts, GLR parsers use the simple expedient of doing both, +effectively cloning the parser to follow both possibilities. Each of +the resulting parsers can again split, so that at any given time, there +can be any number of possible parses being explored. The parsers +proceed in lockstep; that is, all of them consume (shift) a given input +symbol before any of them proceed to the next. Each of the cloned +parsers eventually meets one of two possible fates: either it runs into +a parsing error, in which case it simply vanishes, or it merges with +another parser, because the two of them have reduced the input to an +identical set of symbols. + + During the time that there are multiple parsers, semantic actions are +recorded, but not performed. When a parser disappears, its recorded +semantic actions disappear as well, and are never performed. When a +reduction makes two parsers identical, causing them to merge, Bison +records both sets of semantic actions. Whenever the last two parsers +merge, reverting to the single-parser case, Bison resolves all the +outstanding actions either by precedences given to the grammar rules +involved, or by performing both actions, and then calling a designated +user-defined function on the resulting values to produce an arbitrary +merged result. + +* Menu: + +* Simple GLR Parsers:: Using GLR parsers on unambiguous grammars. +* Merging GLR Parses:: Using GLR parsers to resolve ambiguities. +* GLR Semantic Actions:: Deferred semantic actions have special concerns. +* Compiler Requirements:: GLR parsers require a modern C compiler. + + +File: bison.info, Node: Simple GLR Parsers, Next: Merging GLR Parses, Up: GLR Parsers + +1.5.1 Using GLR on Unambiguous Grammars +--------------------------------------- + +In the simplest cases, you can use the GLR algorithm to parse grammars +that are unambiguous, but fail to be LALR(1). Such grammars typically +require more than one symbol of lookahead, or (in rare cases) fall into +the category of grammars in which the LALR(1) algorithm throws away too +much information (they are in LR(1), but not LALR(1), *note Mystery +Conflicts::). + + Consider a problem that arises in the declaration of enumerated and +subrange types in the programming language Pascal. Here are some +examples: + + type subrange = lo .. hi; + type enum = (a, b, c); + +The original language standard allows only numeric literals and +constant identifiers for the subrange bounds (`lo' and `hi'), but +Extended Pascal (ISO/IEC 10206) and many other Pascal implementations +allow arbitrary expressions there. This gives rise to the following +situation, containing a superfluous pair of parentheses: + + type subrange = (a) .. b; + +Compare this to the following declaration of an enumerated type with +only one value: + + type enum = (a); + +(These declarations are contrived, but they are syntactically valid, +and more-complicated cases can come up in practical programs.) + + These two declarations look identical until the `..' token. With +normal LALR(1) one-token lookahead it is not possible to decide between +the two forms when the identifier `a' is parsed. It is, however, +desirable for a parser to decide this, since in the latter case `a' +must become a new identifier to represent the enumeration value, while +in the former case `a' must be evaluated with its current meaning, +which may be a constant or even a function call. + + You could parse `(a)' as an "unspecified identifier in parentheses", +to be resolved later, but this typically requires substantial +contortions in both semantic actions and large parts of the grammar, +where the parentheses are nested in the recursive rules for expressions. + + You might think of using the lexer to distinguish between the two +forms by returning different tokens for currently defined and undefined +identifiers. But if these declarations occur in a local scope, and `a' +is defined in an outer scope, then both forms are possible--either +locally redefining `a', or using the value of `a' from the outer scope. +So this approach cannot work. + + A simple solution to this problem is to declare the parser to use +the GLR algorithm. When the GLR parser reaches the critical state, it +merely splits into two branches and pursues both syntax rules +simultaneously. Sooner or later, one of them runs into a parsing +error. If there is a `..' token before the next `;', the rule for +enumerated types fails since it cannot accept `..' anywhere; otherwise, +the subrange type rule fails since it requires a `..' token. So one of +the branches fails silently, and the other one continues normally, +performing all the intermediate actions that were postponed during the +split. + + If the input is syntactically incorrect, both branches fail and the +parser reports a syntax error as usual. + + The effect of all this is that the parser seems to "guess" the +correct branch to take, or in other words, it seems to use more +lookahead than the underlying LALR(1) algorithm actually allows for. +In this example, LALR(2) would suffice, but also some cases that are +not LALR(k) for any k can be handled this way. + + In general, a GLR parser can take quadratic or cubic worst-case time, +and the current Bison parser even takes exponential time and space for +some grammars. In practice, this rarely happens, and for many grammars +it is possible to prove that it cannot happen. The present example +contains only one conflict between two rules, and the type-declaration +context containing the conflict cannot be nested. So the number of +branches that can exist at any time is limited by the constant 2, and +the parsing time is still linear. + + Here is a Bison grammar corresponding to the example above. It +parses a vastly simplified form of Pascal type declarations. + + %token TYPE DOTDOT ID + + %left '+' '-' + %left '*' '/' + + %% + + type_decl : TYPE ID '=' type ';' + ; + + type : '(' id_list ')' + | expr DOTDOT expr + ; + + id_list : ID + | id_list ',' ID + ; + + expr : '(' expr ')' + | expr '+' expr + | expr '-' expr + | expr '*' expr + | expr '/' expr + | ID + ; + + When used as a normal LALR(1) grammar, Bison correctly complains +about one reduce/reduce conflict. In the conflicting situation the +parser chooses one of the alternatives, arbitrarily the one declared +first. Therefore the following correct input is not recognized: + + type t = (a) .. b; + + The parser can be turned into a GLR parser, while also telling Bison +to be silent about the one known reduce/reduce conflict, by adding +these two declarations to the Bison input file (before the first `%%'): + + %glr-parser + %expect-rr 1 + +No change in the grammar itself is required. Now the parser recognizes +all valid declarations, according to the limited syntax above, +transparently. In fact, the user does not even notice when the parser +splits. + + So here we have a case where we can use the benefits of GLR, almost +without disadvantages. Even in simple cases like this, however, there +are at least two potential problems to beware. First, always analyze +the conflicts reported by Bison to make sure that GLR splitting is only +done where it is intended. A GLR parser splitting inadvertently may +cause problems less obvious than an LALR parser statically choosing the +wrong alternative in a conflict. Second, consider interactions with +the lexer (*note Semantic Tokens::) with great care. Since a split +parser consumes tokens without performing any actions during the split, +the lexer cannot obtain information via parser actions. Some cases of +lexer interactions can be eliminated by using GLR to shift the +complications from the lexer to the parser. You must check the +remaining cases for correctness. + + In our example, it would be safe for the lexer to return tokens +based on their current meanings in some symbol table, because no new +symbols are defined in the middle of a type declaration. Though it is +possible for a parser to define the enumeration constants as they are +parsed, before the type declaration is completed, it actually makes no +difference since they cannot be used within the same enumerated type +declaration. + + +File: bison.info, Node: Merging GLR Parses, Next: GLR Semantic Actions, Prev: Simple GLR Parsers, Up: GLR Parsers + +1.5.2 Using GLR to Resolve Ambiguities +-------------------------------------- + +Let's consider an example, vastly simplified from a C++ grammar. + + %{ + #include + #define YYSTYPE char const * + int yylex (void); + void yyerror (char const *); + %} + + %token TYPENAME ID + + %right '=' + %left '+' + + %glr-parser + + %% + + prog : + | prog stmt { printf ("\n"); } + ; + + stmt : expr ';' %dprec 1 + | decl %dprec 2 + ; + + expr : ID { printf ("%s ", $$); } + | TYPENAME '(' expr ')' + { printf ("%s ", $1); } + | expr '+' expr { printf ("+ "); } + | expr '=' expr { printf ("= "); } + ; + + decl : TYPENAME declarator ';' + { printf ("%s ", $1); } + | TYPENAME declarator '=' expr ';' + { printf ("%s ", $1); } + ; + + declarator : ID { printf ("\"%s\" ", $1); } + | '(' declarator ')' + ; + +This models a problematic part of the C++ grammar--the ambiguity between +certain declarations and statements. For example, + + T (x) = y+z; + +parses as either an `expr' or a `stmt' (assuming that `T' is recognized +as a `TYPENAME' and `x' as an `ID'). Bison detects this as a +reduce/reduce conflict between the rules `expr : ID' and `declarator : +ID', which it cannot resolve at the time it encounters `x' in the +example above. Since this is a GLR parser, it therefore splits the +problem into two parses, one for each choice of resolving the +reduce/reduce conflict. Unlike the example from the previous section +(*note Simple GLR Parsers::), however, neither of these parses "dies," +because the grammar as it stands is ambiguous. One of the parsers +eventually reduces `stmt : expr ';'' and the other reduces `stmt : +decl', after which both parsers are in an identical state: they've seen +`prog stmt' and have the same unprocessed input remaining. We say that +these parses have "merged." + + At this point, the GLR parser requires a specification in the +grammar of how to choose between the competing parses. In the example +above, the two `%dprec' declarations specify that Bison is to give +precedence to the parse that interprets the example as a `decl', which +implies that `x' is a declarator. The parser therefore prints + + "x" y z + T + + The `%dprec' declarations only come into play when more than one +parse survives. Consider a different input string for this parser: + + T (x) + y; + +This is another example of using GLR to parse an unambiguous construct, +as shown in the previous section (*note Simple GLR Parsers::). Here, +there is no ambiguity (this cannot be parsed as a declaration). +However, at the time the Bison parser encounters `x', it does not have +enough information to resolve the reduce/reduce conflict (again, +between `x' as an `expr' or a `declarator'). In this case, no +precedence declaration is used. Again, the parser splits into two, one +assuming that `x' is an `expr', and the other assuming `x' is a +`declarator'. The second of these parsers then vanishes when it sees +`+', and the parser prints + + x T y + + + Suppose that instead of resolving the ambiguity, you wanted to see +all the possibilities. For this purpose, you must merge the semantic +actions of the two possible parsers, rather than choosing one over the +other. To do so, you could change the declaration of `stmt' as follows: + + stmt : expr ';' %merge + | decl %merge + ; + +and define the `stmtMerge' function as: + + static YYSTYPE + stmtMerge (YYSTYPE x0, YYSTYPE x1) + { + printf (" "); + return ""; + } + +with an accompanying forward declaration in the C declarations at the +beginning of the file: + + %{ + #define YYSTYPE char const * + static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); + %} + +With these declarations, the resulting parser parses the first example +as both an `expr' and a `decl', and prints + + "x" y z + T x T y z + = + + Bison requires that all of the productions that participate in any +particular merge have identical `%merge' clauses. Otherwise, the +ambiguity would be unresolvable, and the parser will report an error +during any parse that results in the offending merge. + + +File: bison.info, Node: GLR Semantic Actions, Next: Compiler Requirements, Prev: Merging GLR Parses, Up: GLR Parsers + +1.5.3 GLR Semantic Actions +-------------------------- + +By definition, a deferred semantic action is not performed at the same +time as the associated reduction. This raises caveats for several +Bison features you might use in a semantic action in a GLR parser. + + In any semantic action, you can examine `yychar' to determine the +type of the lookahead token present at the time of the associated +reduction. After checking that `yychar' is not set to `YYEMPTY' or +`YYEOF', you can then examine `yylval' and `yylloc' to determine the +lookahead token's semantic value and location, if any. In a +nondeferred semantic action, you can also modify any of these variables +to influence syntax analysis. *Note Lookahead Tokens: Lookahead. + + In a deferred semantic action, it's too late to influence syntax +analysis. In this case, `yychar', `yylval', and `yylloc' are set to +shallow copies of the values they had at the time of the associated +reduction. For this reason alone, modifying them is dangerous. +Moreover, the result of modifying them is undefined and subject to +change with future versions of Bison. For example, if a semantic +action might be deferred, you should never write it to invoke +`yyclearin' (*note Action Features::) or to attempt to free memory +referenced by `yylval'. + + Another Bison feature requiring special consideration is `YYERROR' +(*note Action Features::), which you can invoke in a semantic action to +initiate error recovery. During deterministic GLR operation, the +effect of `YYERROR' is the same as its effect in an LALR(1) parser. In +a deferred semantic action, its effect is undefined. + + Also, see *note Default Action for Locations: Location Default +Action, which describes a special usage of `YYLLOC_DEFAULT' in GLR +parsers. + + +File: bison.info, Node: Compiler Requirements, Prev: GLR Semantic Actions, Up: GLR Parsers + +1.5.4 Considerations when Compiling GLR Parsers +----------------------------------------------- + +The GLR parsers require a compiler for ISO C89 or later. In addition, +they use the `inline' keyword, which is not C89, but is C99 and is a +common extension in pre-C99 compilers. It is up to the user of these +parsers to handle portability issues. For instance, if using Autoconf +and the Autoconf macro `AC_C_INLINE', a mere + + %{ + #include + %} + +will suffice. Otherwise, we suggest + + %{ + #if __STDC_VERSION__ < 199901 && ! defined __GNUC__ && ! defined inline + #define inline + #endif + %} + + +File: bison.info, Node: Locations Overview, Next: Bison Parser, Prev: GLR Parsers, Up: Concepts + +1.6 Locations +============= + +Many applications, like interpreters or compilers, have to produce +verbose and useful error messages. To achieve this, one must be able +to keep track of the "textual location", or "location", of each +syntactic construct. Bison provides a mechanism for handling these +locations. + + Each token has a semantic value. In a similar fashion, each token +has an associated location, but the type of locations is the same for +all tokens and groupings. Moreover, the output parser is equipped with +a default data structure for storing locations (*note Locations::, for +more details). + + Like semantic values, locations can be reached in actions using a +dedicated set of constructs. In the example above, the location of the +whole grouping is `@$', while the locations of the subexpressions are +`@1' and `@3'. + + When a rule is matched, a default action is used to compute the +semantic value of its left hand side (*note Actions::). In the same +way, another default action is used for locations. However, the action +for locations is general enough for most cases, meaning there is +usually no need to describe for each rule how `@$' should be formed. +When building a new location for a given grouping, the default behavior +of the output parser is to take the beginning of the first symbol, and +the end of the last symbol. + + +File: bison.info, Node: Bison Parser, Next: Stages, Prev: Locations Overview, Up: Concepts + +1.7 Bison Output: the Parser File +================================= + +When you run Bison, you give it a Bison grammar file as input. The +output is a C source file that parses the language described by the +grammar. This file is called a "Bison parser". Keep in mind that the +Bison utility and the Bison parser are two distinct programs: the Bison +utility is a program whose output is the Bison parser that becomes part +of your program. + + The job of the Bison parser is to group tokens into groupings +according to the grammar rules--for example, to build identifiers and +operators into expressions. As it does this, it runs the actions for +the grammar rules it uses. + + The tokens come from a function called the "lexical analyzer" that +you must supply in some fashion (such as by writing it in C). The Bison +parser calls the lexical analyzer each time it wants a new token. It +doesn't know what is "inside" the tokens (though their semantic values +may reflect this). Typically the lexical analyzer makes the tokens by +parsing characters of text, but Bison does not depend on this. *Note +The Lexical Analyzer Function `yylex': Lexical. + + The Bison parser file is C code which defines a function named +`yyparse' which implements that grammar. This function does not make a +complete C program: you must supply some additional functions. One is +the lexical analyzer. Another is an error-reporting function which the +parser calls to report an error. In addition, a complete C program must +start with a function called `main'; you have to provide this, and +arrange for it to call `yyparse' or the parser will never run. *Note +Parser C-Language Interface: Interface. + + Aside from the token type names and the symbols in the actions you +write, all symbols defined in the Bison parser file itself begin with +`yy' or `YY'. This includes interface functions such as the lexical +analyzer function `yylex', the error reporting function `yyerror' and +the parser function `yyparse' itself. This also includes numerous +identifiers used for internal purposes. Therefore, you should avoid +using C identifiers starting with `yy' or `YY' in the Bison grammar +file except for the ones defined in this manual. Also, you should +avoid using the C identifiers `malloc' and `free' for anything other +than their usual meanings. + + In some cases the Bison parser file includes system headers, and in +those cases your code should respect the identifiers reserved by those +headers. On some non-GNU hosts, `', `', +`', and `' are included as needed to declare memory +allocators and related types. `' is included if message +translation is in use (*note Internationalization::). Other system +headers may be included if you define `YYDEBUG' to a nonzero value +(*note Tracing Your Parser: Tracing.). + + +File: bison.info, Node: Stages, Next: Grammar Layout, Prev: Bison Parser, Up: Concepts + +1.8 Stages in Using Bison +========================= + +The actual language-design process using Bison, from grammar +specification to a working compiler or interpreter, has these parts: + + 1. Formally specify the grammar in a form recognized by Bison (*note + Bison Grammar Files: Grammar File.). For each grammatical rule in + the language, describe the action that is to be taken when an + instance of that rule is recognized. The action is described by a + sequence of C statements. + + 2. Write a lexical analyzer to process input and pass tokens to the + parser. The lexical analyzer may be written by hand in C (*note + The Lexical Analyzer Function `yylex': Lexical.). It could also + be produced using Lex, but the use of Lex is not discussed in this + manual. + + 3. Write a controlling function that calls the Bison-produced parser. + + 4. Write error-reporting routines. + + To turn this source code as written into a runnable program, you +must follow these steps: + + 1. Run Bison on the grammar to produce the parser. + + 2. Compile the code output by Bison, as well as any other source + files. + + 3. Link the object files to produce the finished product. + + +File: bison.info, Node: Grammar Layout, Prev: Stages, Up: Concepts + +1.9 The Overall Layout of a Bison Grammar +========================================= + +The input file for the Bison utility is a "Bison grammar file". The +general form of a Bison grammar file is as follows: + + %{ + PROLOGUE + %} + + BISON DECLARATIONS + + %% + GRAMMAR RULES + %% + EPILOGUE + +The `%%', `%{' and `%}' are punctuation that appears in every Bison +grammar file to separate the sections. + + The prologue may define types and variables used in the actions. +You can also use preprocessor commands to define macros used there, and +use `#include' to include header files that do any of these things. +You need to declare the lexical analyzer `yylex' and the error printer +`yyerror' here, along with any other global identifiers used by the +actions in the grammar rules. + + The Bison declarations declare the names of the terminal and +nonterminal symbols, and may also describe operator precedence and the +data types of semantic values of various symbols. + + The grammar rules define how to construct each nonterminal symbol +from its parts. + + The epilogue can contain any code you want to use. Often the +definitions of functions declared in the prologue go here. In a simple +program, all the rest of the program can go here. + + +File: bison.info, Node: Examples, Next: Grammar File, Prev: Concepts, Up: Top + +2 Examples +********** + +Now we show and explain three sample programs written using Bison: a +reverse polish notation calculator, an algebraic (infix) notation +calculator, and a multi-function calculator. All three have been tested +under BSD Unix 4.3; each produces a usable, though limited, interactive +desk-top calculator. + + These examples are simple, but Bison grammars for real programming +languages are written the same way. You can copy these examples into a +source file to try them. + +* Menu: + +* RPN Calc:: Reverse polish notation calculator; + a first example with no operator precedence. +* Infix Calc:: Infix (algebraic) notation calculator. + Operator precedence is introduced. +* Simple Error Recovery:: Continuing after syntax errors. +* Location Tracking Calc:: Demonstrating the use of @N and @$. +* Multi-function Calc:: Calculator with memory and trig functions. + It uses multiple data-types for semantic values. +* Exercises:: Ideas for improving the multi-function calculator. + + +File: bison.info, Node: RPN Calc, Next: Infix Calc, Up: Examples + +2.1 Reverse Polish Notation Calculator +====================================== + +The first example is that of a simple double-precision "reverse polish +notation" calculator (a calculator using postfix operators). This +example provides a good starting point, since operator precedence is +not an issue. The second example will illustrate how operator +precedence is handled. + + The source code for this calculator is named `rpcalc.y'. The `.y' +extension is a convention used for Bison input files. + +* Menu: + +* Rpcalc Declarations:: Prologue (declarations) for rpcalc. +* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation. +* Rpcalc Lexer:: The lexical analyzer. +* Rpcalc Main:: The controlling function. +* Rpcalc Error:: The error reporting function. +* Rpcalc Generate:: Running Bison on the grammar file. +* Rpcalc Compile:: Run the C compiler on the output code. + + +File: bison.info, Node: Rpcalc Declarations, Next: Rpcalc Rules, Up: RPN Calc + +2.1.1 Declarations for `rpcalc' +------------------------------- + +Here are the C and Bison declarations for the reverse polish notation +calculator. As in C, comments are placed between `/*...*/'. + + /* Reverse polish notation calculator. */ + + %{ + #define YYSTYPE double + #include + int yylex (void); + void yyerror (char const *); + %} + + %token NUM + + %% /* Grammar rules and actions follow. */ + + The declarations section (*note The prologue: Prologue.) contains two +preprocessor directives and two forward declarations. + + The `#define' directive defines the macro `YYSTYPE', thus specifying +the C data type for semantic values of both tokens and groupings (*note +Data Types of Semantic Values: Value Type.). The Bison parser will use +whatever type `YYSTYPE' is defined as; if you don't define it, `int' is +the default. Because we specify `double', each token and each +expression has an associated value, which is a floating point number. + + The `#include' directive is used to declare the exponentiation +function `pow'. + + The forward declarations for `yylex' and `yyerror' are needed +because the C language requires that functions be declared before they +are used. These functions will be defined in the epilogue, but the +parser calls them so they must be declared in the prologue. + + The second section, Bison declarations, provides information to Bison +about the token types (*note The Bison Declarations Section: Bison +Declarations.). Each terminal symbol that is not a single-character +literal must be declared here. (Single-character literals normally +don't need to be declared.) In this example, all the arithmetic +operators are designated by single-character literals, so the only +terminal symbol that needs to be declared is `NUM', the token type for +numeric constants. + + +File: bison.info, Node: Rpcalc Rules, Next: Rpcalc Lexer, Prev: Rpcalc Declarations, Up: RPN Calc + +2.1.2 Grammar Rules for `rpcalc' +-------------------------------- + +Here are the grammar rules for the reverse polish notation calculator. + + input: /* empty */ + | input line + ; + + line: '\n' + | exp '\n' { printf ("\t%.10g\n", $1); } + ; + + exp: NUM { $$ = $1; } + | exp exp '+' { $$ = $1 + $2; } + | exp exp '-' { $$ = $1 - $2; } + | exp exp '*' { $$ = $1 * $2; } + | exp exp '/' { $$ = $1 / $2; } + /* Exponentiation */ + | exp exp '^' { $$ = pow ($1, $2); } + /* Unary minus */ + | exp 'n' { $$ = -$1; } + ; + %% + + The groupings of the rpcalc "language" defined here are the +expression (given the name `exp'), the line of input (`line'), and the +complete input transcript (`input'). Each of these nonterminal symbols +has several alternate rules, joined by the vertical bar `|' which is +read as "or". The following sections explain what these rules mean. + + The semantics of the language is determined by the actions taken +when a grouping is recognized. The actions are the C code that appears +inside braces. *Note Actions::. + + You must specify these actions in C, but Bison provides the means for +passing semantic values between the rules. In each action, the +pseudo-variable `$$' stands for the semantic value for the grouping +that the rule is going to construct. Assigning a value to `$$' is the +main job of most actions. The semantic values of the components of the +rule are referred to as `$1', `$2', and so on. + +* Menu: + +* Rpcalc Input:: +* Rpcalc Line:: +* Rpcalc Expr:: + + +File: bison.info, Node: Rpcalc Input, Next: Rpcalc Line, Up: Rpcalc Rules + +2.1.2.1 Explanation of `input' +.............................. + +Consider the definition of `input': + + input: /* empty */ + | input line + ; + + This definition reads as follows: "A complete input is either an +empty string, or a complete input followed by an input line". Notice +that "complete input" is defined in terms of itself. This definition +is said to be "left recursive" since `input' appears always as the +leftmost symbol in the sequence. *Note Recursive Rules: Recursion. + + The first alternative is empty because there are no symbols between +the colon and the first `|'; this means that `input' can match an empty +string of input (no tokens). We write the rules this way because it is +legitimate to type `Ctrl-d' right after you start the calculator. It's +conventional to put an empty alternative first and write the comment +`/* empty */' in it. + + The second alternate rule (`input line') handles all nontrivial +input. It means, "After reading any number of lines, read one more +line if possible." The left recursion makes this rule into a loop. +Since the first alternative matches empty input, the loop can be +executed zero or more times. + + The parser function `yyparse' continues to process input until a +grammatical error is seen or the lexical analyzer says there are no more +input tokens; we will arrange for the latter to happen at end-of-input. + + +File: bison.info, Node: Rpcalc Line, Next: Rpcalc Expr, Prev: Rpcalc Input, Up: Rpcalc Rules + +2.1.2.2 Explanation of `line' +............................. + +Now consider the definition of `line': + + line: '\n' + | exp '\n' { printf ("\t%.10g\n", $1); } + ; + + The first alternative is a token which is a newline character; this +means that rpcalc accepts a blank line (and ignores it, since there is +no action). The second alternative is an expression followed by a +newline. This is the alternative that makes rpcalc useful. The +semantic value of the `exp' grouping is the value of `$1' because the +`exp' in question is the first symbol in the alternative. The action +prints this value, which is the result of the computation the user +asked for. + + This action is unusual because it does not assign a value to `$$'. +As a consequence, the semantic value associated with the `line' is +uninitialized (its value will be unpredictable). This would be a bug if +that value were ever used, but we don't use it: once rpcalc has printed +the value of the user's input line, that value is no longer needed. + + +File: bison.info, Node: Rpcalc Expr, Prev: Rpcalc Line, Up: Rpcalc Rules + +2.1.2.3 Explanation of `expr' +............................. + +The `exp' grouping has several rules, one for each kind of expression. +The first rule handles the simplest expressions: those that are just +numbers. The second handles an addition-expression, which looks like +two expressions followed by a plus-sign. The third handles +subtraction, and so on. + + exp: NUM + | exp exp '+' { $$ = $1 + $2; } + | exp exp '-' { $$ = $1 - $2; } + ... + ; + + We have used `|' to join all the rules for `exp', but we could +equally well have written them separately: + + exp: NUM ; + exp: exp exp '+' { $$ = $1 + $2; } ; + exp: exp exp '-' { $$ = $1 - $2; } ; + ... + + Most of the rules have actions that compute the value of the +expression in terms of the value of its parts. For example, in the +rule for addition, `$1' refers to the first component `exp' and `$2' +refers to the second one. The third component, `'+'', has no meaningful +associated semantic value, but if it had one you could refer to it as +`$3'. When `yyparse' recognizes a sum expression using this rule, the +sum of the two subexpressions' values is produced as the value of the +entire expression. *Note Actions::. + + You don't have to give an action for every rule. When a rule has no +action, Bison by default copies the value of `$1' into `$$'. This is +what happens in the first rule (the one that uses `NUM'). + + The formatting shown here is the recommended convention, but Bison +does not require it. You can add or change white space as much as you +wish. For example, this: + + exp : NUM | exp exp '+' {$$ = $1 + $2; } | ... ; + +means the same thing as this: + + exp: NUM + | exp exp '+' { $$ = $1 + $2; } + | ... + ; + +The latter, however, is much more readable. + + +File: bison.info, Node: Rpcalc Lexer, Next: Rpcalc Main, Prev: Rpcalc Rules, Up: RPN Calc + +2.1.3 The `rpcalc' Lexical Analyzer +----------------------------------- + +The lexical analyzer's job is low-level parsing: converting characters +or sequences of characters into tokens. The Bison parser gets its +tokens by calling the lexical analyzer. *Note The Lexical Analyzer +Function `yylex': Lexical. + + Only a simple lexical analyzer is needed for the RPN calculator. +This lexical analyzer skips blanks and tabs, then reads in numbers as +`double' and returns them as `NUM' tokens. Any other character that +isn't part of a number is a separate token. Note that the token-code +for such a single-character token is the character itself. + + The return value of the lexical analyzer function is a numeric code +which represents a token type. The same text used in Bison rules to +stand for this token type is also a C expression for the numeric code +for the type. This works in two ways. If the token type is a +character literal, then its numeric code is that of the character; you +can use the same character literal in the lexical analyzer to express +the number. If the token type is an identifier, that identifier is +defined by Bison as a C macro whose definition is the appropriate +number. In this example, therefore, `NUM' becomes a macro for `yylex' +to use. + + The semantic value of the token (if it has one) is stored into the +global variable `yylval', which is where the Bison parser will look for +it. (The C data type of `yylval' is `YYSTYPE', which was defined at +the beginning of the grammar; *note Declarations for `rpcalc': Rpcalc +Declarations.) + + A token type code of zero is returned if the end-of-input is +encountered. (Bison recognizes any nonpositive value as indicating +end-of-input.) + + Here is the code for the lexical analyzer: + + /* The lexical analyzer returns a double floating point + number on the stack and the token NUM, or the numeric code + of the character read if not a number. It skips all blanks + and tabs, and returns 0 for end-of-input. */ + + #include + + int + yylex (void) + { + int c; + + /* Skip white space. */ + while ((c = getchar ()) == ' ' || c == '\t') + ; + /* Process numbers. */ + if (c == '.' || isdigit (c)) + { + ungetc (c, stdin); + scanf ("%lf", &yylval); + return NUM; + } + /* Return end-of-input. */ + if (c == EOF) + return 0; + /* Return a single char. */ + return c; + } + + +File: bison.info, Node: Rpcalc Main, Next: Rpcalc Error, Prev: Rpcalc Lexer, Up: RPN Calc + +2.1.4 The Controlling Function +------------------------------ + +In keeping with the spirit of this example, the controlling function is +kept to the bare minimum. The only requirement is that it call +`yyparse' to start the process of parsing. + + int + main (void) + { + return yyparse (); + } + + +File: bison.info, Node: Rpcalc Error, Next: Rpcalc Generate, Prev: Rpcalc Main, Up: RPN Calc + +2.1.5 The Error Reporting Routine +--------------------------------- + +When `yyparse' detects a syntax error, it calls the error reporting +function `yyerror' to print an error message (usually but not always +`"syntax error"'). It is up to the programmer to supply `yyerror' +(*note Parser C-Language Interface: Interface.), so here is the +definition we will use: + + #include + + /* Called by yyparse on error. */ + void + yyerror (char const *s) + { + fprintf (stderr, "%s\n", s); + } + + After `yyerror' returns, the Bison parser may recover from the error +and continue parsing if the grammar contains a suitable error rule +(*note Error Recovery::). Otherwise, `yyparse' returns nonzero. We +have not written any error rules in this example, so any invalid input +will cause the calculator program to exit. This is not clean behavior +for a real calculator, but it is adequate for the first example. + + +File: bison.info, Node: Rpcalc Generate, Next: Rpcalc Compile, Prev: Rpcalc Error, Up: RPN Calc + +2.1.6 Running Bison to Make the Parser +-------------------------------------- + +Before running Bison to produce a parser, we need to decide how to +arrange all the source code in one or more source files. For such a +simple example, the easiest thing is to put everything in one file. The +definitions of `yylex', `yyerror' and `main' go at the end, in the +epilogue of the file (*note The Overall Layout of a Bison Grammar: +Grammar Layout.). + + For a large project, you would probably have several source files, +and use `make' to arrange to recompile them. + + With all the source in a single file, you use the following command +to convert it into a parser file: + + bison FILE.y + +In this example the file was called `rpcalc.y' (for "Reverse Polish +CALCulator"). Bison produces a file named `FILE.tab.c', removing the +`.y' from the original file name. The file output by Bison contains +the source code for `yyparse'. The additional functions in the input +file (`yylex', `yyerror' and `main') are copied verbatim to the output. + + +File: bison.info, Node: Rpcalc Compile, Prev: Rpcalc Generate, Up: RPN Calc + +2.1.7 Compiling the Parser File +------------------------------- + +Here is how to compile and run the parser file: + + # List files in current directory. + $ ls + rpcalc.tab.c rpcalc.y + + # Compile the Bison parser. + # `-lm' tells compiler to search math library for `pow'. + $ cc -lm -o rpcalc rpcalc.tab.c + + # List files again. + $ ls + rpcalc rpcalc.tab.c rpcalc.y + + The file `rpcalc' now contains the executable code. Here is an +example session using `rpcalc'. + + $ rpcalc + 4 9 + + 13 + 3 7 + 3 4 5 *+- + -13 + 3 7 + 3 4 5 * + - n Note the unary minus, `n' + 13 + 5 6 / 4 n + + -3.166666667 + 3 4 ^ Exponentiation + 81 + ^D End-of-file indicator + $ + + +File: bison.info, Node: Infix Calc, Next: Simple Error Recovery, Prev: RPN Calc, Up: Examples + +2.2 Infix Notation Calculator: `calc' +===================================== + +We now modify rpcalc to handle infix operators instead of postfix. +Infix notation involves the concept of operator precedence and the need +for parentheses nested to arbitrary depth. Here is the Bison code for +`calc.y', an infix desk-top calculator. + + /* Infix notation calculator. */ + + %{ + #define YYSTYPE double + #include + #include + int yylex (void); + void yyerror (char const *); + %} + + /* Bison declarations. */ + %token NUM + %left '-' '+' + %left '*' '/' + %left NEG /* negation--unary minus */ + %right '^' /* exponentiation */ + + %% /* The grammar follows. */ + input: /* empty */ + | input line + ; + + line: '\n' + | exp '\n' { printf ("\t%.10g\n", $1); } + ; + + exp: NUM { $$ = $1; } + | exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp { $$ = $1 / $3; } + | '-' exp %prec NEG { $$ = -$2; } + | exp '^' exp { $$ = pow ($1, $3); } + | '(' exp ')' { $$ = $2; } + ; + %% + +The functions `yylex', `yyerror' and `main' can be the same as before. + + There are two important new features shown in this code. + + In the second section (Bison declarations), `%left' declares token +types and says they are left-associative operators. The declarations +`%left' and `%right' (right associativity) take the place of `%token' +which is used to declare a token type name without associativity. +(These tokens are single-character literals, which ordinarily don't +need to be declared. We declare them here to specify the +associativity.) + + Operator precedence is determined by the line ordering of the +declarations; the higher the line number of the declaration (lower on +the page or screen), the higher the precedence. Hence, exponentiation +has the highest precedence, unary minus (`NEG') is next, followed by +`*' and `/', and so on. *Note Operator Precedence: Precedence. + + The other important new feature is the `%prec' in the grammar +section for the unary minus operator. The `%prec' simply instructs +Bison that the rule `| '-' exp' has the same precedence as `NEG'--in +this case the next-to-highest. *Note Context-Dependent Precedence: +Contextual Precedence. + + Here is a sample run of `calc.y': + + $ calc + 4 + 4.5 - (34/(8*3+-3)) + 6.880952381 + -56 + 2 + -54 + 3 ^ 2 + 9 + + +File: bison.info, Node: Simple Error Recovery, Next: Location Tracking Calc, Prev: Infix Calc, Up: Examples + +2.3 Simple Error Recovery +========================= + +Up to this point, this manual has not addressed the issue of "error +recovery"--how to continue parsing after the parser detects a syntax +error. All we have handled is error reporting with `yyerror'. Recall +that by default `yyparse' returns after calling `yyerror'. This means +that an erroneous input line causes the calculator program to exit. +Now we show how to rectify this deficiency. + + The Bison language itself includes the reserved word `error', which +may be included in the grammar rules. In the example below it has been +added to one of the alternatives for `line': + + line: '\n' + | exp '\n' { printf ("\t%.10g\n", $1); } + | error '\n' { yyerrok; } + ; + + This addition to the grammar allows for simple error recovery in the +event of a syntax error. If an expression that cannot be evaluated is +read, the error will be recognized by the third rule for `line', and +parsing will continue. (The `yyerror' function is still called upon to +print its message as well.) The action executes the statement +`yyerrok', a macro defined automatically by Bison; its meaning is that +error recovery is complete (*note Error Recovery::). Note the +difference between `yyerrok' and `yyerror'; neither one is a misprint. + + This form of error recovery deals with syntax errors. There are +other kinds of errors; for example, division by zero, which raises an +exception signal that is normally fatal. A real calculator program +must handle this signal and use `longjmp' to return to `main' and +resume parsing input lines; it would also have to discard the rest of +the current line of input. We won't discuss this issue further because +it is not specific to Bison programs. + + +File: bison.info, Node: Location Tracking Calc, Next: Multi-function Calc, Prev: Simple Error Recovery, Up: Examples + +2.4 Location Tracking Calculator: `ltcalc' +========================================== + +This example extends the infix notation calculator with location +tracking. This feature will be used to improve the error messages. For +the sake of clarity, this example is a simple integer calculator, since +most of the work needed to use locations will be done in the lexical +analyzer. + +* Menu: + +* Ltcalc Declarations:: Bison and C declarations for ltcalc. +* Ltcalc Rules:: Grammar rules for ltcalc, with explanations. +* Ltcalc Lexer:: The lexical analyzer. + + +File: bison.info, Node: Ltcalc Declarations, Next: Ltcalc Rules, Up: Location Tracking Calc + +2.4.1 Declarations for `ltcalc' +------------------------------- + +The C and Bison declarations for the location tracking calculator are +the same as the declarations for the infix notation calculator. + + /* Location tracking calculator. */ + + %{ + #define YYSTYPE int + #include + int yylex (void); + void yyerror (char const *); + %} + + /* Bison declarations. */ + %token NUM + + %left '-' '+' + %left '*' '/' + %left NEG + %right '^' + + %% /* The grammar follows. */ + +Note there are no declarations specific to locations. Defining a data +type for storing locations is not needed: we will use the type provided +by default (*note Data Types of Locations: Location Type.), which is a +four member structure with the following integer fields: `first_line', +`first_column', `last_line' and `last_column'. By conventions, and in +accordance with the GNU Coding Standards and common practice, the line +and column count both start at 1. + + +File: bison.info, Node: Ltcalc Rules, Next: Ltcalc Lexer, Prev: Ltcalc Declarations, Up: Location Tracking Calc + +2.4.2 Grammar Rules for `ltcalc' +-------------------------------- + +Whether handling locations or not has no effect on the syntax of your +language. Therefore, grammar rules for this example will be very close +to those of the previous example: we will only modify them to benefit +from the new information. + + Here, we will use locations to report divisions by zero, and locate +the wrong expressions or subexpressions. + + input : /* empty */ + | input line + ; + + line : '\n' + | exp '\n' { printf ("%d\n", $1); } + ; + + exp : NUM { $$ = $1; } + | exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp + { + if ($3) + $$ = $1 / $3; + else + { + $$ = 1; + fprintf (stderr, "%d.%d-%d.%d: division by zero", + @3.first_line, @3.first_column, + @3.last_line, @3.last_column); + } + } + | '-' exp %prec NEG { $$ = -$2; } + | exp '^' exp { $$ = pow ($1, $3); } + | '(' exp ')' { $$ = $2; } + + This code shows how to reach locations inside of semantic actions, by +using the pseudo-variables `@N' for rule components, and the +pseudo-variable `@$' for groupings. + + We don't need to assign a value to `@$': the output parser does it +automatically. By default, before executing the C code of each action, +`@$' is set to range from the beginning of `@1' to the end of `@N', for +a rule with N components. This behavior can be redefined (*note +Default Action for Locations: Location Default Action.), and for very +specific rules, `@$' can be computed by hand. + + +File: bison.info, Node: Ltcalc Lexer, Prev: Ltcalc Rules, Up: Location Tracking Calc + +2.4.3 The `ltcalc' Lexical Analyzer. +------------------------------------ + +Until now, we relied on Bison's defaults to enable location tracking. +The next step is to rewrite the lexical analyzer, and make it able to +feed the parser with the token locations, as it already does for +semantic values. + + To this end, we must take into account every single character of the +input text, to avoid the computed locations of being fuzzy or wrong: + + int + yylex (void) + { + int c; + + /* Skip white space. */ + while ((c = getchar ()) == ' ' || c == '\t') + ++yylloc.last_column; + + /* Step. */ + yylloc.first_line = yylloc.last_line; + yylloc.first_column = yylloc.last_column; + + /* Process numbers. */ + if (isdigit (c)) + { + yylval = c - '0'; + ++yylloc.last_column; + while (isdigit (c = getchar ())) + { + ++yylloc.last_column; + yylval = yylval * 10 + c - '0'; + } + ungetc (c, stdin); + return NUM; + } + + /* Return end-of-input. */ + if (c == EOF) + return 0; + + /* Return a single char, and update location. */ + if (c == '\n') + { + ++yylloc.last_line; + yylloc.last_column = 0; + } + else + ++yylloc.last_column; + return c; + } + + Basically, the lexical analyzer performs the same processing as +before: it skips blanks and tabs, and reads numbers or single-character +tokens. In addition, it updates `yylloc', the global variable (of type +`YYLTYPE') containing the token's location. + + Now, each time this function returns a token, the parser has its +number as well as its semantic value, and its location in the text. +The last needed change is to initialize `yylloc', for example in the +controlling function: + + int + main (void) + { + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 0; + return yyparse (); + } + + Remember that computing locations is not a matter of syntax. Every +character must be associated to a location update, whether it is in +valid input, in comments, in literal strings, and so on. + + +File: bison.info, Node: Multi-function Calc, Next: Exercises, Prev: Location Tracking Calc, Up: Examples + +2.5 Multi-Function Calculator: `mfcalc' +======================================= + +Now that the basics of Bison have been discussed, it is time to move on +to a more advanced problem. The above calculators provided only five +functions, `+', `-', `*', `/' and `^'. It would be nice to have a +calculator that provides other mathematical functions such as `sin', +`cos', etc. + + It is easy to add new operators to the infix calculator as long as +they are only single-character literals. The lexical analyzer `yylex' +passes back all nonnumeric characters as tokens, so new grammar rules +suffice for adding a new operator. But we want something more +flexible: built-in functions whose syntax has this form: + + FUNCTION_NAME (ARGUMENT) + +At the same time, we will add memory to the calculator, by allowing you +to create named variables, store values in them, and use them later. +Here is a sample session with the multi-function calculator: + + $ mfcalc + pi = 3.141592653589 + 3.1415926536 + sin(pi) + 0.0000000000 + alpha = beta1 = 2.3 + 2.3000000000 + alpha + 2.3000000000 + ln(alpha) + 0.8329091229 + exp(ln(beta1)) + 2.3000000000 + $ + + Note that multiple assignment and nested function calls are +permitted. + +* Menu: + +* Mfcalc Declarations:: Bison declarations for multi-function calculator. +* Mfcalc Rules:: Grammar rules for the calculator. +* Mfcalc Symbol Table:: Symbol table management subroutines. + + +File: bison.info, Node: Mfcalc Declarations, Next: Mfcalc Rules, Up: Multi-function Calc + +2.5.1 Declarations for `mfcalc' +------------------------------- + +Here are the C and Bison declarations for the multi-function calculator. + + %{ + #include /* For math functions, cos(), sin(), etc. */ + #include "calc.h" /* Contains definition of `symrec'. */ + int yylex (void); + void yyerror (char const *); + %} + %union { + double val; /* For returning numbers. */ + symrec *tptr; /* For returning symbol-table pointers. */ + } + %token NUM /* Simple double precision number. */ + %token VAR FNCT /* Variable and Function. */ + %type exp + + %right '=' + %left '-' '+' + %left '*' '/' + %left NEG /* negation--unary minus */ + %right '^' /* exponentiation */ + %% /* The grammar follows. */ + + The above grammar introduces only two new features of the Bison +language. These features allow semantic values to have various data +types (*note More Than One Value Type: Multiple Types.). + + The `%union' declaration specifies the entire list of possible types; +this is instead of defining `YYSTYPE'. The allowable types are now +double-floats (for `exp' and `NUM') and pointers to entries in the +symbol table. *Note The Collection of Value Types: Union Decl. + + Since values can now have various types, it is necessary to +associate a type with each grammar symbol whose semantic value is used. +These symbols are `NUM', `VAR', `FNCT', and `exp'. Their declarations +are augmented with information about their data type (placed between +angle brackets). + + The Bison construct `%type' is used for declaring nonterminal +symbols, just as `%token' is used for declaring token types. We have +not used `%type' before because nonterminal symbols are normally +declared implicitly by the rules that define them. But `exp' must be +declared explicitly so we can specify its value type. *Note +Nonterminal Symbols: Type Decl. + + +File: bison.info, Node: Mfcalc Rules, Next: Mfcalc Symbol Table, Prev: Mfcalc Declarations, Up: Multi-function Calc + +2.5.2 Grammar Rules for `mfcalc' +-------------------------------- + +Here are the grammar rules for the multi-function calculator. Most of +them are copied directly from `calc'; three rules, those which mention +`VAR' or `FNCT', are new. + + input: /* empty */ + | input line + ; + + line: + '\n' + | exp '\n' { printf ("\t%.10g\n", $1); } + | error '\n' { yyerrok; } + ; + + exp: NUM { $$ = $1; } + | VAR { $$ = $1->value.var; } + | VAR '=' exp { $$ = $3; $1->value.var = $3; } + | FNCT '(' exp ')' { $$ = (*($1->value.fnctptr))($3); } + | exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp { $$ = $1 / $3; } + | '-' exp %prec NEG { $$ = -$2; } + | exp '^' exp { $$ = pow ($1, $3); } + | '(' exp ')' { $$ = $2; } + ; + /* End of grammar. */ + %% + + +File: bison.info, Node: Mfcalc Symbol Table, Prev: Mfcalc Rules, Up: Multi-function Calc + +2.5.3 The `mfcalc' Symbol Table +------------------------------- + +The multi-function calculator requires a symbol table to keep track of +the names and meanings of variables and functions. This doesn't affect +the grammar rules (except for the actions) or the Bison declarations, +but it requires some additional C functions for support. + + The symbol table itself consists of a linked list of records. Its +definition, which is kept in the header `calc.h', is as follows. It +provides for either functions or variables to be placed in the table. + + /* Function type. */ + typedef double (*func_t) (double); + + /* Data type for links in the chain of symbols. */ + struct symrec + { + char *name; /* name of symbol */ + int type; /* type of symbol: either VAR or FNCT */ + union + { + double var; /* value of a VAR */ + func_t fnctptr; /* value of a FNCT */ + } value; + struct symrec *next; /* link field */ + }; + + typedef struct symrec symrec; + + /* The symbol table: a chain of `struct symrec'. */ + extern symrec *sym_table; + + symrec *putsym (char const *, int); + symrec *getsym (char const *); + + The new version of `main' includes a call to `init_table', a +function that initializes the symbol table. Here it is, and +`init_table' as well: + + #include + + /* Called by yyparse on error. */ + void + yyerror (char const *s) + { + printf ("%s\n", s); + } + + struct init + { + char const *fname; + double (*fnct) (double); + }; + + struct init const arith_fncts[] = + { + "sin", sin, + "cos", cos, + "atan", atan, + "ln", log, + "exp", exp, + "sqrt", sqrt, + 0, 0 + }; + + /* The symbol table: a chain of `struct symrec'. */ + symrec *sym_table; + + /* Put arithmetic functions in table. */ + void + init_table (void) + { + int i; + symrec *ptr; + for (i = 0; arith_fncts[i].fname != 0; i++) + { + ptr = putsym (arith_fncts[i].fname, FNCT); + ptr->value.fnctptr = arith_fncts[i].fnct; + } + } + + int + main (void) + { + init_table (); + return yyparse (); + } + + By simply editing the initialization list and adding the necessary +include files, you can add additional functions to the calculator. + + Two important functions allow look-up and installation of symbols in +the symbol table. The function `putsym' is passed a name and the type +(`VAR' or `FNCT') of the object to be installed. The object is linked +to the front of the list, and a pointer to the object is returned. The +function `getsym' is passed the name of the symbol to look up. If +found, a pointer to that symbol is returned; otherwise zero is returned. + + symrec * + putsym (char const *sym_name, int sym_type) + { + symrec *ptr; + ptr = (symrec *) malloc (sizeof (symrec)); + ptr->name = (char *) malloc (strlen (sym_name) + 1); + strcpy (ptr->name,sym_name); + ptr->type = sym_type; + ptr->value.var = 0; /* Set value to 0 even if fctn. */ + ptr->next = (struct symrec *)sym_table; + sym_table = ptr; + return ptr; + } + + symrec * + getsym (char const *sym_name) + { + symrec *ptr; + for (ptr = sym_table; ptr != (symrec *) 0; + ptr = (symrec *)ptr->next) + if (strcmp (ptr->name,sym_name) == 0) + return ptr; + return 0; + } + + The function `yylex' must now recognize variables, numeric values, +and the single-character arithmetic operators. Strings of alphanumeric +characters with a leading letter are recognized as either variables or +functions depending on what the symbol table says about them. + + The string is passed to `getsym' for look up in the symbol table. If +the name appears in the table, a pointer to its location and its type +(`VAR' or `FNCT') is returned to `yyparse'. If it is not already in +the table, then it is installed as a `VAR' using `putsym'. Again, a +pointer and its type (which must be `VAR') is returned to `yyparse'. + + No change is needed in the handling of numeric values and arithmetic +operators in `yylex'. + + #include + + int + yylex (void) + { + int c; + + /* Ignore white space, get first nonwhite character. */ + while ((c = getchar ()) == ' ' || c == '\t'); + + if (c == EOF) + return 0; + + /* Char starts a number => parse the number. */ + if (c == '.' || isdigit (c)) + { + ungetc (c, stdin); + scanf ("%lf", &yylval.val); + return NUM; + } + + /* Char starts an identifier => read the name. */ + if (isalpha (c)) + { + symrec *s; + static char *symbuf = 0; + static int length = 0; + int i; + + /* Initially make the buffer long enough + for a 40-character symbol name. */ + if (length == 0) + length = 40, symbuf = (char *)malloc (length + 1); + + i = 0; + do + { + /* If buffer is full, make it bigger. */ + if (i == length) + { + length *= 2; + symbuf = (char *) realloc (symbuf, length + 1); + } + /* Add this character to the buffer. */ + symbuf[i++] = c; + /* Get another character. */ + c = getchar (); + } + while (isalnum (c)); + + ungetc (c, stdin); + symbuf[i] = '\0'; + + s = getsym (symbuf); + if (s == 0) + s = putsym (symbuf, VAR); + yylval.tptr = s; + return s->type; + } + + /* Any other character is a token by itself. */ + return c; + } + + This program is both powerful and flexible. You may easily add new +functions, and it is a simple job to modify this code to install +predefined variables such as `pi' or `e' as well. + + +File: bison.info, Node: Exercises, Prev: Multi-function Calc, Up: Examples + +2.6 Exercises +============= + + 1. Add some new functions from `math.h' to the initialization list. + + 2. Add another array that contains constants and their values. Then + modify `init_table' to add these constants to the symbol table. + It will be easiest to give the constants type `VAR'. + + 3. Make the program report an error if the user refers to an + uninitialized variable in any way except to store a value in it. + + +File: bison.info, Node: Grammar File, Next: Interface, Prev: Examples, Up: Top + +3 Bison Grammar Files +********************* + +Bison takes as input a context-free grammar specification and produces a +C-language function that recognizes correct instances of the grammar. + + The Bison grammar input file conventionally has a name ending in +`.y'. *Note Invoking Bison: Invocation. + +* Menu: + +* Grammar Outline:: Overall layout of the grammar file. +* Symbols:: Terminal and nonterminal symbols. +* Rules:: How to write grammar rules. +* Recursion:: Writing recursive rules. +* Semantics:: Semantic values and actions. +* Locations:: Locations and actions. +* Declarations:: All kinds of Bison declarations are described here. +* Multiple Parsers:: Putting more than one Bison parser in one program. + + +File: bison.info, Node: Grammar Outline, Next: Symbols, Up: Grammar File + +3.1 Outline of a Bison Grammar +============================== + +A Bison grammar file has four main sections, shown here with the +appropriate delimiters: + + %{ + PROLOGUE + %} + + BISON DECLARATIONS + + %% + GRAMMAR RULES + %% + + EPILOGUE + + Comments enclosed in `/* ... */' may appear in any of the sections. +As a GNU extension, `//' introduces a comment that continues until end +of line. + +* Menu: + +* Prologue:: Syntax and usage of the prologue. +* Prologue Alternatives:: Syntax and usage of alternatives to the prologue. +* Bison Declarations:: Syntax and usage of the Bison declarations section. +* Grammar Rules:: Syntax and usage of the grammar rules section. +* Epilogue:: Syntax and usage of the epilogue. + + +File: bison.info, Node: Prologue, Next: Prologue Alternatives, Up: Grammar Outline + +3.1.1 The prologue +------------------ + +The PROLOGUE section contains macro definitions and declarations of +functions and variables that are used in the actions in the grammar +rules. These are copied to the beginning of the parser file so that +they precede the definition of `yyparse'. You can use `#include' to +get the declarations from a header file. If you don't need any C +declarations, you may omit the `%{' and `%}' delimiters that bracket +this section. + + The PROLOGUE section is terminated by the first occurrence of `%}' +that is outside a comment, a string literal, or a character constant. + + You may have more than one PROLOGUE section, intermixed with the +BISON DECLARATIONS. This allows you to have C and Bison declarations +that refer to each other. For example, the `%union' declaration may +use types defined in a header file, and you may wish to prototype +functions that take arguments of type `YYSTYPE'. This can be done with +two PROLOGUE blocks, one before and one after the `%union' declaration. + + %{ + #define _GNU_SOURCE + #include + #include "ptypes.h" + %} + + %union { + long int n; + tree t; /* `tree' is defined in `ptypes.h'. */ + } + + %{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) + %} + + ... + + When in doubt, it is usually safer to put prologue code before all +Bison declarations, rather than after. For example, any definitions of +feature test macros like `_GNU_SOURCE' or `_POSIX_C_SOURCE' should +appear before all Bison declarations, as feature test macros can affect +the behavior of Bison-generated `#include' directives. + + +File: bison.info, Node: Prologue Alternatives, Next: Bison Declarations, Prev: Prologue, Up: Grammar Outline + +3.1.2 Prologue Alternatives +--------------------------- + +(The prologue alternatives described here are experimental. More user +feedback will help to determine whether they should become permanent +features.) + + The functionality of PROLOGUE sections can often be subtle and +inflexible. As an alternative, Bison provides a %code directive with +an explicit qualifier field, which identifies the purpose of the code +and thus the location(s) where Bison should generate it. For C/C++, +the qualifier can be omitted for the default location, or it can be one +of `requires', `provides', `top'. *Note %code: Decl Summary. + + Look again at the example of the previous section: + + %{ + #define _GNU_SOURCE + #include + #include "ptypes.h" + %} + + %union { + long int n; + tree t; /* `tree' is defined in `ptypes.h'. */ + } + + %{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) + %} + + ... + +Notice that there are two PROLOGUE sections here, but there's a subtle +distinction between their functionality. For example, if you decide to +override Bison's default definition for `YYLTYPE', in which PROLOGUE +section should you write your new definition? You should write it in +the first since Bison will insert that code into the parser source code +file _before_ the default `YYLTYPE' definition. In which PROLOGUE +section should you prototype an internal function, `trace_token', that +accepts `YYLTYPE' and `yytokentype' as arguments? You should prototype +it in the second since Bison will insert that code _after_ the +`YYLTYPE' and `yytokentype' definitions. + + This distinction in functionality between the two PROLOGUE sections +is established by the appearance of the `%union' between them. This +behavior raises a few questions. First, why should the position of a +`%union' affect definitions related to `YYLTYPE' and `yytokentype'? +Second, what if there is no `%union'? In that case, the second kind of +PROLOGUE section is not available. This behavior is not intuitive. + + To avoid this subtle `%union' dependency, rewrite the example using a +`%code top' and an unqualified `%code'. Let's go ahead and add the new +`YYLTYPE' definition and the `trace_token' prototype at the same time: + + %code top { + #define _GNU_SOURCE + #include + + /* WARNING: The following code really belongs + * in a `%code requires'; see below. */ + + #include "ptypes.h" + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + { + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + } YYLTYPE; + } + + %union { + long int n; + tree t; /* `tree' is defined in `ptypes.h'. */ + } + + %code { + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) + static void trace_token (enum yytokentype token, YYLTYPE loc); + } + + ... + +In this way, `%code top' and the unqualified `%code' achieve the same +functionality as the two kinds of PROLOGUE sections, but it's always +explicit which kind you intend. Moreover, both kinds are always +available even in the absence of `%union'. + + The `%code top' block above logically contains two parts. The first +two lines before the warning need to appear near the top of the parser +source code file. The first line after the warning is required by +`YYSTYPE' and thus also needs to appear in the parser source code file. +However, if you've instructed Bison to generate a parser header file +(*note %defines: Decl Summary.), you probably want that line to appear +before the `YYSTYPE' definition in that header file as well. The +`YYLTYPE' definition should also appear in the parser header file to +override the default `YYLTYPE' definition there. + + In other words, in the `%code top' block above, all but the first two +lines are dependency code required by the `YYSTYPE' and `YYLTYPE' +definitions. Thus, they belong in one or more `%code requires': + + %code top { + #define _GNU_SOURCE + #include + } + + %code requires { + #include "ptypes.h" + } + %union { + long int n; + tree t; /* `tree' is defined in `ptypes.h'. */ + } + + %code requires { + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + { + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + } YYLTYPE; + } + + %code { + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) + static void trace_token (enum yytokentype token, YYLTYPE loc); + } + + ... + +Now Bison will insert `#include "ptypes.h"' and the new `YYLTYPE' +definition before the Bison-generated `YYSTYPE' and `YYLTYPE' +definitions in both the parser source code file and the parser header +file. (By the same reasoning, `%code requires' would also be the +appropriate place to write your own definition for `YYSTYPE'.) + + When you are writing dependency code for `YYSTYPE' and `YYLTYPE', you +should prefer `%code requires' over `%code top' regardless of whether +you instruct Bison to generate a parser header file. When you are +writing code that you need Bison to insert only into the parser source +code file and that has no special need to appear at the top of that +file, you should prefer the unqualified `%code' over `%code top'. +These practices will make the purpose of each block of your code +explicit to Bison and to other developers reading your grammar file. +Following these practices, we expect the unqualified `%code' and `%code +requires' to be the most important of the four PROLOGUE alternatives. + + At some point while developing your parser, you might decide to +provide `trace_token' to modules that are external to your parser. +Thus, you might wish for Bison to insert the prototype into both the +parser header file and the parser source code file. Since this +function is not a dependency required by `YYSTYPE' or `YYLTYPE', it +doesn't make sense to move its prototype to a `%code requires'. More +importantly, since it depends upon `YYLTYPE' and `yytokentype', `%code +requires' is not sufficient. Instead, move its prototype from the +unqualified `%code' to a `%code provides': + + %code top { + #define _GNU_SOURCE + #include + } + + %code requires { + #include "ptypes.h" + } + %union { + long int n; + tree t; /* `tree' is defined in `ptypes.h'. */ + } + + %code requires { + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + { + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + } YYLTYPE; + } + + %code provides { + void trace_token (enum yytokentype token, YYLTYPE loc); + } + + %code { + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) + } + + ... + +Bison will insert the `trace_token' prototype into both the parser +header file and the parser source code file after the definitions for +`yytokentype', `YYLTYPE', and `YYSTYPE'. + + The above examples are careful to write directives in an order that +reflects the layout of the generated parser source code and header +files: `%code top', `%code requires', `%code provides', and then +`%code'. While your grammar files may generally be easier to read if +you also follow this order, Bison does not require it. Instead, Bison +lets you choose an organization that makes sense to you. + + You may declare any of these directives multiple times in the +grammar file. In that case, Bison concatenates the contained code in +declaration order. This is the only way in which the position of one +of these directives within the grammar file affects its functionality. + + The result of the previous two properties is greater flexibility in +how you may organize your grammar file. For example, you may organize +semantic-type-related directives by semantic type: + + %code requires { #include "type1.h" } + %union { type1 field1; } + %destructor { type1_free ($$); } + %printer { type1_print ($$); } + + %code requires { #include "type2.h" } + %union { type2 field2; } + %destructor { type2_free ($$); } + %printer { type2_print ($$); } + +You could even place each of the above directive groups in the rules +section of the grammar file next to the set of rules that uses the +associated semantic type. (In the rules section, you must terminate +each of those directives with a semicolon.) And you don't have to +worry that some directive (like a `%union') in the definitions section +is going to adversely affect their functionality in some +counter-intuitive manner just because it comes first. Such an +organization is not possible using PROLOGUE sections. + + This section has been concerned with explaining the advantages of +the four PROLOGUE alternatives over the original Yacc PROLOGUE. +However, in most cases when using these directives, you shouldn't need +to think about all the low-level ordering issues discussed here. +Instead, you should simply use these directives to label each block of +your code according to its purpose and let Bison handle the ordering. +`%code' is the most generic label. Move code to `%code requires', +`%code provides', or `%code top' as needed. + + +File: bison.info, Node: Bison Declarations, Next: Grammar Rules, Prev: Prologue Alternatives, Up: Grammar Outline + +3.1.3 The Bison Declarations Section +------------------------------------ + +The BISON DECLARATIONS section contains declarations that define +terminal and nonterminal symbols, specify precedence, and so on. In +some simple grammars you may not need any declarations. *Note Bison +Declarations: Declarations. + + +File: bison.info, Node: Grammar Rules, Next: Epilogue, Prev: Bison Declarations, Up: Grammar Outline + +3.1.4 The Grammar Rules Section +------------------------------- + +The "grammar rules" section contains one or more Bison grammar rules, +and nothing else. *Note Syntax of Grammar Rules: Rules. + + There must always be at least one grammar rule, and the first `%%' +(which precedes the grammar rules) may never be omitted even if it is +the first thing in the file. + + +File: bison.info, Node: Epilogue, Prev: Grammar Rules, Up: Grammar Outline + +3.1.5 The epilogue +------------------ + +The EPILOGUE is copied verbatim to the end of the parser file, just as +the PROLOGUE is copied to the beginning. This is the most convenient +place to put anything that you want to have in the parser file but +which need not come before the definition of `yyparse'. For example, +the definitions of `yylex' and `yyerror' often go here. Because C +requires functions to be declared before being used, you often need to +declare functions like `yylex' and `yyerror' in the Prologue, even if +you define them in the Epilogue. *Note Parser C-Language Interface: +Interface. + + If the last section is empty, you may omit the `%%' that separates it +from the grammar rules. + + The Bison parser itself contains many macros and identifiers whose +names start with `yy' or `YY', so it is a good idea to avoid using any +such names (except those documented in this manual) in the epilogue of +the grammar file. + + +File: bison.info, Node: Symbols, Next: Rules, Prev: Grammar Outline, Up: Grammar File + +3.2 Symbols, Terminal and Nonterminal +===================================== + +"Symbols" in Bison grammars represent the grammatical classifications +of the language. + + A "terminal symbol" (also known as a "token type") represents a +class of syntactically equivalent tokens. You use the symbol in grammar +rules to mean that a token in that class is allowed. The symbol is +represented in the Bison parser by a numeric code, and the `yylex' +function returns a token type code to indicate what kind of token has +been read. You don't need to know what the code value is; you can use +the symbol to stand for it. + + A "nonterminal symbol" stands for a class of syntactically +equivalent groupings. The symbol name is used in writing grammar rules. +By convention, it should be all lower case. + + Symbol names can contain letters, digits (not at the beginning), +underscores and periods. Periods make sense only in nonterminals. + + There are three ways of writing terminal symbols in the grammar: + + * A "named token type" is written with an identifier, like an + identifier in C. By convention, it should be all upper case. Each + such name must be defined with a Bison declaration such as + `%token'. *Note Token Type Names: Token Decl. + + * A "character token type" (or "literal character token") is written + in the grammar using the same syntax used in C for character + constants; for example, `'+'' is a character token type. A + character token type doesn't need to be declared unless you need to + specify its semantic value data type (*note Data Types of Semantic + Values: Value Type.), associativity, or precedence (*note Operator + Precedence: Precedence.). + + By convention, a character token type is used only to represent a + token that consists of that particular character. Thus, the token + type `'+'' is used to represent the character `+' as a token. + Nothing enforces this convention, but if you depart from it, your + program will confuse other readers. + + All the usual escape sequences used in character literals in C can + be used in Bison as well, but you must not use the null character + as a character literal because its numeric code, zero, signifies + end-of-input (*note Calling Convention for `yylex': Calling + Convention.). Also, unlike standard C, trigraphs have no special + meaning in Bison character literals, nor is backslash-newline + allowed. + + * A "literal string token" is written like a C string constant; for + example, `"<="' is a literal string token. A literal string token + doesn't need to be declared unless you need to specify its semantic + value data type (*note Value Type::), associativity, or precedence + (*note Precedence::). + + You can associate the literal string token with a symbolic name as + an alias, using the `%token' declaration (*note Token + Declarations: Token Decl.). If you don't do that, the lexical + analyzer has to retrieve the token number for the literal string + token from the `yytname' table (*note Calling Convention::). + + *Warning*: literal string tokens do not work in Yacc. + + By convention, a literal string token is used only to represent a + token that consists of that particular string. Thus, you should + use the token type `"<="' to represent the string `<=' as a token. + Bison does not enforce this convention, but if you depart from it, + people who read your program will be confused. + + All the escape sequences used in string literals in C can be used + in Bison as well, except that you must not use a null character + within a string literal. Also, unlike Standard C, trigraphs have + no special meaning in Bison string literals, nor is + backslash-newline allowed. A literal string token must contain + two or more characters; for a token containing just one character, + use a character token (see above). + + How you choose to write a terminal symbol has no effect on its +grammatical meaning. That depends only on where it appears in rules and +on when the parser function returns that symbol. + + The value returned by `yylex' is always one of the terminal symbols, +except that a zero or negative value signifies end-of-input. Whichever +way you write the token type in the grammar rules, you write it the +same way in the definition of `yylex'. The numeric code for a +character token type is simply the positive numeric code of the +character, so `yylex' can use the identical value to generate the +requisite code, though you may need to convert it to `unsigned char' to +avoid sign-extension on hosts where `char' is signed. Each named token +type becomes a C macro in the parser file, so `yylex' can use the name +to stand for the code. (This is why periods don't make sense in +terminal symbols.) *Note Calling Convention for `yylex': Calling +Convention. + + If `yylex' is defined in a separate file, you need to arrange for the +token-type macro definitions to be available there. Use the `-d' +option when you run Bison, so that it will write these macro definitions +into a separate header file `NAME.tab.h' which you can include in the +other source files that need it. *Note Invoking Bison: Invocation. + + If you want to write a grammar that is portable to any Standard C +host, you must use only nonnull character tokens taken from the basic +execution character set of Standard C. This set consists of the ten +digits, the 52 lower- and upper-case English letters, and the +characters in the following C-language string: + + "\a\b\t\n\v\f\r !\"#%&'()*+,-./:;<=>?[\\]^_{|}~" + + The `yylex' function and Bison must use a consistent character set +and encoding for character tokens. For example, if you run Bison in an +ASCII environment, but then compile and run the resulting program in an +environment that uses an incompatible character set like EBCDIC, the +resulting program may not work because the tables generated by Bison +will assume ASCII numeric values for character tokens. It is standard +practice for software distributions to contain C source files that were +generated by Bison in an ASCII environment, so installers on platforms +that are incompatible with ASCII must rebuild those files before +compiling them. + + The symbol `error' is a terminal symbol reserved for error recovery +(*note Error Recovery::); you shouldn't use it for any other purpose. +In particular, `yylex' should never return this value. The default +value of the error token is 256, unless you explicitly assigned 256 to +one of your tokens with a `%token' declaration. + + +File: bison.info, Node: Rules, Next: Recursion, Prev: Symbols, Up: Grammar File + +3.3 Syntax of Grammar Rules +=========================== + +A Bison grammar rule has the following general form: + + RESULT: COMPONENTS... + ; + +where RESULT is the nonterminal symbol that this rule describes, and +COMPONENTS are various terminal and nonterminal symbols that are put +together by this rule (*note Symbols::). + + For example, + + exp: exp '+' exp + ; + +says that two groupings of type `exp', with a `+' token in between, can +be combined into a larger grouping of type `exp'. + + White space in rules is significant only to separate symbols. You +can add extra white space as you wish. + + Scattered among the components can be ACTIONS that determine the +semantics of the rule. An action looks like this: + + {C STATEMENTS} + +This is an example of "braced code", that is, C code surrounded by +braces, much like a compound statement in C. Braced code can contain +any sequence of C tokens, so long as its braces are balanced. Bison +does not check the braced code for correctness directly; it merely +copies the code to the output file, where the C compiler can check it. + + Within braced code, the balanced-brace count is not affected by +braces within comments, string literals, or character constants, but it +is affected by the C digraphs `<%' and `%>' that represent braces. At +the top level braced code must be terminated by `}' and not by a +digraph. Bison does not look for trigraphs, so if braced code uses +trigraphs you should ensure that they do not affect the nesting of +braces or the boundaries of comments, string literals, or character +constants. + + Usually there is only one action and it follows the components. +*Note Actions::. + + Multiple rules for the same RESULT can be written separately or can +be joined with the vertical-bar character `|' as follows: + + RESULT: RULE1-COMPONENTS... + | RULE2-COMPONENTS... + ... + ; + +They are still considered distinct rules even when joined in this way. + + If COMPONENTS in a rule is empty, it means that RESULT can match the +empty string. For example, here is how to define a comma-separated +sequence of zero or more `exp' groupings: + + expseq: /* empty */ + | expseq1 + ; + + expseq1: exp + | expseq1 ',' exp + ; + +It is customary to write a comment `/* empty */' in each rule with no +components. + + +File: bison.info, Node: Recursion, Next: Semantics, Prev: Rules, Up: Grammar File + +3.4 Recursive Rules +=================== + +A rule is called "recursive" when its RESULT nonterminal appears also +on its right hand side. Nearly all Bison grammars need to use +recursion, because that is the only way to define a sequence of any +number of a particular thing. Consider this recursive definition of a +comma-separated sequence of one or more expressions: + + expseq1: exp + | expseq1 ',' exp + ; + +Since the recursive use of `expseq1' is the leftmost symbol in the +right hand side, we call this "left recursion". By contrast, here the +same construct is defined using "right recursion": + + expseq1: exp + | exp ',' expseq1 + ; + +Any kind of sequence can be defined using either left recursion or right +recursion, but you should always use left recursion, because it can +parse a sequence of any number of elements with bounded stack space. +Right recursion uses up space on the Bison stack in proportion to the +number of elements in the sequence, because all the elements must be +shifted onto the stack before the rule can be applied even once. *Note +The Bison Parser Algorithm: Algorithm, for further explanation of this. + + "Indirect" or "mutual" recursion occurs when the result of the rule +does not appear directly on its right hand side, but does appear in +rules for other nonterminals which do appear on its right hand side. + + For example: + + expr: primary + | primary '+' primary + ; + + primary: constant + | '(' expr ')' + ; + +defines two mutually-recursive nonterminals, since each refers to the +other. + + +File: bison.info, Node: Semantics, Next: Locations, Prev: Recursion, Up: Grammar File + +3.5 Defining Language Semantics +=============================== + +The grammar rules for a language determine only the syntax. The +semantics are determined by the semantic values associated with various +tokens and groupings, and by the actions taken when various groupings +are recognized. + + For example, the calculator calculates properly because the value +associated with each expression is the proper number; it adds properly +because the action for the grouping `X + Y' is to add the numbers +associated with X and Y. + +* Menu: + +* Value Type:: Specifying one data type for all semantic values. +* Multiple Types:: Specifying several alternative data types. +* Actions:: An action is the semantic definition of a grammar rule. +* Action Types:: Specifying data types for actions to operate on. +* Mid-Rule Actions:: Most actions go at the end of a rule. + This says when, why and how to use the exceptional + action in the middle of a rule. + + +File: bison.info, Node: Value Type, Next: Multiple Types, Up: Semantics + +3.5.1 Data Types of Semantic Values +----------------------------------- + +In a simple program it may be sufficient to use the same data type for +the semantic values of all language constructs. This was true in the +RPN and infix calculator examples (*note Reverse Polish Notation +Calculator: RPN Calc.). + + Bison normally uses the type `int' for semantic values if your +program uses the same data type for all language constructs. To +specify some other type, define `YYSTYPE' as a macro, like this: + + #define YYSTYPE double + +`YYSTYPE''s replacement list should be a type name that does not +contain parentheses or square brackets. This macro definition must go +in the prologue of the grammar file (*note Outline of a Bison Grammar: +Grammar Outline.). + + +File: bison.info, Node: Multiple Types, Next: Actions, Prev: Value Type, Up: Semantics + +3.5.2 More Than One Value Type +------------------------------ + +In most programs, you will need different data types for different kinds +of tokens and groupings. For example, a numeric constant may need type +`int' or `long int', while a string constant needs type `char *', and +an identifier might need a pointer to an entry in the symbol table. + + To use more than one data type for semantic values in one parser, +Bison requires you to do two things: + + * Specify the entire collection of possible data types, either by + using the `%union' Bison declaration (*note The Collection of + Value Types: Union Decl.), or by using a `typedef' or a `#define' + to define `YYSTYPE' to be a union type whose member names are the + type tags. + + * Choose one of those types for each symbol (terminal or + nonterminal) for which semantic values are used. This is done for + tokens with the `%token' Bison declaration (*note Token Type + Names: Token Decl.) and for groupings with the `%type' Bison + declaration (*note Nonterminal Symbols: Type Decl.). + + +File: bison.info, Node: Actions, Next: Action Types, Prev: Multiple Types, Up: Semantics + +3.5.3 Actions +------------- + +An action accompanies a syntactic rule and contains C code to be +executed each time an instance of that rule is recognized. The task of +most actions is to compute a semantic value for the grouping built by +the rule from the semantic values associated with tokens or smaller +groupings. + + An action consists of braced code containing C statements, and can be +placed at any position in the rule; it is executed at that position. +Most rules have just one action at the end of the rule, following all +the components. Actions in the middle of a rule are tricky and used +only for special purposes (*note Actions in Mid-Rule: Mid-Rule +Actions.). + + The C code in an action can refer to the semantic values of the +components matched by the rule with the construct `$N', which stands for +the value of the Nth component. The semantic value for the grouping +being constructed is `$$'. Bison translates both of these constructs +into expressions of the appropriate type when it copies the actions +into the parser file. `$$' is translated to a modifiable lvalue, so it +can be assigned to. + + Here is a typical example: + + exp: ... + | exp '+' exp + { $$ = $1 + $3; } + +This rule constructs an `exp' from two smaller `exp' groupings +connected by a plus-sign token. In the action, `$1' and `$3' refer to +the semantic values of the two component `exp' groupings, which are the +first and third symbols on the right hand side of the rule. The sum is +stored into `$$' so that it becomes the semantic value of the +addition-expression just recognized by the rule. If there were a +useful semantic value associated with the `+' token, it could be +referred to as `$2'. + + Note that the vertical-bar character `|' is really a rule separator, +and actions are attached to a single rule. This is a difference with +tools like Flex, for which `|' stands for either "or", or "the same +action as that of the next rule". In the following example, the action +is triggered only when `b' is found: + + a-or-b: 'a'|'b' { a_or_b_found = 1; }; + + If you don't specify an action for a rule, Bison supplies a default: +`$$ = $1'. Thus, the value of the first symbol in the rule becomes the +value of the whole rule. Of course, the default action is valid only +if the two data types match. There is no meaningful default action for +an empty rule; every empty rule must have an explicit action unless the +rule's value does not matter. + + `$N' with N zero or negative is allowed for reference to tokens and +groupings on the stack _before_ those that match the current rule. +This is a very risky practice, and to use it reliably you must be +certain of the context in which the rule is applied. Here is a case in +which you can use this reliably: + + foo: expr bar '+' expr { ... } + | expr bar '-' expr { ... } + ; + + bar: /* empty */ + { previous_expr = $0; } + ; + + As long as `bar' is used only in the fashion shown here, `$0' always +refers to the `expr' which precedes `bar' in the definition of `foo'. + + It is also possible to access the semantic value of the lookahead +token, if any, from a semantic action. This semantic value is stored +in `yylval'. *Note Special Features for Use in Actions: Action +Features. + + +File: bison.info, Node: Action Types, Next: Mid-Rule Actions, Prev: Actions, Up: Semantics + +3.5.4 Data Types of Values in Actions +------------------------------------- + +If you have chosen a single data type for semantic values, the `$$' and +`$N' constructs always have that data type. + + If you have used `%union' to specify a variety of data types, then +you must declare a choice among these types for each terminal or +nonterminal symbol that can have a semantic value. Then each time you +use `$$' or `$N', its data type is determined by which symbol it refers +to in the rule. In this example, + + exp: ... + | exp '+' exp + { $$ = $1 + $3; } + +`$1' and `$3' refer to instances of `exp', so they all have the data +type declared for the nonterminal symbol `exp'. If `$2' were used, it +would have the data type declared for the terminal symbol `'+'', +whatever that might be. + + Alternatively, you can specify the data type when you refer to the +value, by inserting `' after the `$' at the beginning of the +reference. For example, if you have defined types as shown here: + + %union { + int itype; + double dtype; + } + +then you can write `$1' to refer to the first subunit of the +rule as an integer, or `$1' to refer to it as a double. + + +File: bison.info, Node: Mid-Rule Actions, Prev: Action Types, Up: Semantics + +3.5.5 Actions in Mid-Rule +------------------------- + +Occasionally it is useful to put an action in the middle of a rule. +These actions are written just like usual end-of-rule actions, but they +are executed before the parser even recognizes the following components. + + A mid-rule action may refer to the components preceding it using +`$N', but it may not refer to subsequent components because it is run +before they are parsed. + + The mid-rule action itself counts as one of the components of the +rule. This makes a difference when there is another action later in +the same rule (and usually there is another at the end): you have to +count the actions along with the symbols when working out which number +N to use in `$N'. + + The mid-rule action can also have a semantic value. The action can +set its value with an assignment to `$$', and actions later in the rule +can refer to the value using `$N'. Since there is no symbol to name +the action, there is no way to declare a data type for the value in +advance, so you must use the `$<...>N' construct to specify a data type +each time you refer to this value. + + There is no way to set the value of the entire rule with a mid-rule +action, because assignments to `$$' do not have that effect. The only +way to set the value for the entire rule is with an ordinary action at +the end of the rule. + + Here is an example from a hypothetical compiler, handling a `let' +statement that looks like `let (VARIABLE) STATEMENT' and serves to +create a variable named VARIABLE temporarily for the duration of +STATEMENT. To parse this construct, we must put VARIABLE into the +symbol table while STATEMENT is parsed, then remove it afterward. Here +is how it is done: + + stmt: LET '(' var ')' + { $$ = push_context (); + declare_variable ($3); } + stmt { $$ = $6; + pop_context ($5); } + +As soon as `let (VARIABLE)' has been recognized, the first action is +run. It saves a copy of the current semantic context (the list of +accessible variables) as its semantic value, using alternative +`context' in the data-type union. Then it calls `declare_variable' to +add the new variable to that list. Once the first action is finished, +the embedded statement `stmt' can be parsed. Note that the mid-rule +action is component number 5, so the `stmt' is component number 6. + + After the embedded statement is parsed, its semantic value becomes +the value of the entire `let'-statement. Then the semantic value from +the earlier action is used to restore the prior list of variables. This +removes the temporary `let'-variable from the list so that it won't +appear to exist while the rest of the program is parsed. + + In the above example, if the parser initiates error recovery (*note +Error Recovery::) while parsing the tokens in the embedded statement +`stmt', it might discard the previous semantic context `$5' +without restoring it. Thus, `$5' needs a destructor (*note +Freeing Discarded Symbols: Destructor Decl.). However, Bison currently +provides no means to declare a destructor specific to a particular +mid-rule action's semantic value. + + One solution is to bury the mid-rule action inside a nonterminal +symbol and to declare a destructor for that symbol: + + %type let + %destructor { pop_context ($$); } let + + %% + + stmt: let stmt + { $$ = $2; + pop_context ($1); } + ; + + let: LET '(' var ')' + { $$ = push_context (); + declare_variable ($3); } + ; + +Note that the action is now at the end of its rule. Any mid-rule +action can be converted to an end-of-rule action in this way, and this +is what Bison actually does to implement mid-rule actions. + + Taking action before a rule is completely recognized often leads to +conflicts since the parser must commit to a parse in order to execute +the action. For example, the following two rules, without mid-rule +actions, can coexist in a working parser because the parser can shift +the open-brace token and look at what follows before deciding whether +there is a declaration or not: + + compound: '{' declarations statements '}' + | '{' statements '}' + ; + +But when we add a mid-rule action as follows, the rules become +nonfunctional: + + compound: { prepare_for_local_variables (); } + '{' declarations statements '}' + | '{' statements '}' + ; + +Now the parser is forced to decide whether to run the mid-rule action +when it has read no farther than the open-brace. In other words, it +must commit to using one rule or the other, without sufficient +information to do it correctly. (The open-brace token is what is called +the "lookahead" token at this time, since the parser is still deciding +what to do about it. *Note Lookahead Tokens: Lookahead.) + + You might think that you could correct the problem by putting +identical actions into the two rules, like this: + + compound: { prepare_for_local_variables (); } + '{' declarations statements '}' + | { prepare_for_local_variables (); } + '{' statements '}' + ; + +But this does not help, because Bison does not realize that the two +actions are identical. (Bison never tries to understand the C code in +an action.) + + If the grammar is such that a declaration can be distinguished from a +statement by the first token (which is true in C), then one solution +which does work is to put the action after the open-brace, like this: + + compound: '{' { prepare_for_local_variables (); } + declarations statements '}' + | '{' statements '}' + ; + +Now the first token of the following declaration or statement, which +would in any case tell Bison which rule to use, can still do so. + + Another solution is to bury the action inside a nonterminal symbol +which serves as a subroutine: + + subroutine: /* empty */ + { prepare_for_local_variables (); } + ; + + compound: subroutine + '{' declarations statements '}' + | subroutine + '{' statements '}' + ; + +Now Bison can execute the action in the rule for `subroutine' without +deciding which rule for `compound' it will eventually use. + + +File: bison.info, Node: Locations, Next: Declarations, Prev: Semantics, Up: Grammar File + +3.6 Tracking Locations +====================== + +Though grammar rules and semantic actions are enough to write a fully +functional parser, it can be useful to process some additional +information, especially symbol locations. + + The way locations are handled is defined by providing a data type, +and actions to take when rules are matched. + +* Menu: + +* Location Type:: Specifying a data type for locations. +* Actions and Locations:: Using locations in actions. +* Location Default Action:: Defining a general way to compute locations. + + +File: bison.info, Node: Location Type, Next: Actions and Locations, Up: Locations + +3.6.1 Data Type of Locations +---------------------------- + +Defining a data type for locations is much simpler than for semantic +values, since all tokens and groupings always use the same type. + + You can specify the type of locations by defining a macro called +`YYLTYPE', just as you can specify the semantic value type by defining +a `YYSTYPE' macro (*note Value Type::). When `YYLTYPE' is not defined, +Bison uses a default structure type with four members: + + typedef struct YYLTYPE + { + int first_line; + int first_column; + int last_line; + int last_column; + } YYLTYPE; + + At the beginning of the parsing, Bison initializes all these fields +to 1 for `yylloc'. + + +File: bison.info, Node: Actions and Locations, Next: Location Default Action, Prev: Location Type, Up: Locations + +3.6.2 Actions and Locations +--------------------------- + +Actions are not only useful for defining language semantics, but also +for describing the behavior of the output parser with locations. + + The most obvious way for building locations of syntactic groupings +is very similar to the way semantic values are computed. In a given +rule, several constructs can be used to access the locations of the +elements being matched. The location of the Nth component of the right +hand side is `@N', while the location of the left hand side grouping is +`@$'. + + Here is a basic example using the default data type for locations: + + exp: ... + | exp '/' exp + { + @$.first_column = @1.first_column; + @$.first_line = @1.first_line; + @$.last_column = @3.last_column; + @$.last_line = @3.last_line; + if ($3) + $$ = $1 / $3; + else + { + $$ = 1; + fprintf (stderr, + "Division by zero, l%d,c%d-l%d,c%d", + @3.first_line, @3.first_column, + @3.last_line, @3.last_column); + } + } + + As for semantic values, there is a default action for locations that +is run each time a rule is matched. It sets the beginning of `@$' to +the beginning of the first symbol, and the end of `@$' to the end of the +last symbol. + + With this default action, the location tracking can be fully +automatic. The example above simply rewrites this way: + + exp: ... + | exp '/' exp + { + if ($3) + $$ = $1 / $3; + else + { + $$ = 1; + fprintf (stderr, + "Division by zero, l%d,c%d-l%d,c%d", + @3.first_line, @3.first_column, + @3.last_line, @3.last_column); + } + } + + It is also possible to access the location of the lookahead token, +if any, from a semantic action. This location is stored in `yylloc'. +*Note Special Features for Use in Actions: Action Features. + + +File: bison.info, Node: Location Default Action, Prev: Actions and Locations, Up: Locations + +3.6.3 Default Action for Locations +---------------------------------- + +Actually, actions are not the best place to compute locations. Since +locations are much more general than semantic values, there is room in +the output parser to redefine the default action to take for each rule. +The `YYLLOC_DEFAULT' macro is invoked each time a rule is matched, +before the associated action is run. It is also invoked while +processing a syntax error, to compute the error's location. Before +reporting an unresolvable syntactic ambiguity, a GLR parser invokes +`YYLLOC_DEFAULT' recursively to compute the location of that ambiguity. + + Most of the time, this macro is general enough to suppress location +dedicated code from semantic actions. + + The `YYLLOC_DEFAULT' macro takes three parameters. The first one is +the location of the grouping (the result of the computation). When a +rule is matched, the second parameter identifies locations of all right +hand side elements of the rule being matched, and the third parameter +is the size of the rule's right hand side. When a GLR parser reports +an ambiguity, which of multiple candidate right hand sides it passes to +`YYLLOC_DEFAULT' is undefined. When processing a syntax error, the +second parameter identifies locations of the symbols that were +discarded during error processing, and the third parameter is the +number of discarded symbols. + + By default, `YYLLOC_DEFAULT' is defined this way: + + # define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + while (0) + + where `YYRHSLOC (rhs, k)' is the location of the Kth symbol in RHS +when K is positive, and the location of the symbol just before the +reduction when K and N are both zero. + + When defining `YYLLOC_DEFAULT', you should consider that: + + * All arguments are free of side-effects. However, only the first + one (the result) should be modified by `YYLLOC_DEFAULT'. + + * For consistency with semantic actions, valid indexes within the + right hand side range from 1 to N. When N is zero, only 0 is a + valid index, and it refers to the symbol just before the reduction. + During error processing N is always positive. + + * Your macro should parenthesize its arguments, if need be, since the + actual arguments may not be surrounded by parentheses. Also, your + macro should expand to something that can be used as a single + statement when it is followed by a semicolon. + + +File: bison.info, Node: Declarations, Next: Multiple Parsers, Prev: Locations, Up: Grammar File + +3.7 Bison Declarations +====================== + +The "Bison declarations" section of a Bison grammar defines the symbols +used in formulating the grammar and the data types of semantic values. +*Note Symbols::. + + All token type names (but not single-character literal tokens such as +`'+'' and `'*'') must be declared. Nonterminal symbols must be +declared if you need to specify which data type to use for the semantic +value (*note More Than One Value Type: Multiple Types.). + + The first rule in the file also specifies the start symbol, by +default. If you want some other symbol to be the start symbol, you +must declare it explicitly (*note Languages and Context-Free Grammars: +Language and Grammar.). + +* Menu: + +* Require Decl:: Requiring a Bison version. +* Token Decl:: Declaring terminal symbols. +* Precedence Decl:: Declaring terminals with precedence and associativity. +* Union Decl:: Declaring the set of all semantic value types. +* Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Initial Action Decl:: Code run before parsing starts. +* Destructor Decl:: Declaring how symbols are freed. +* Expect Decl:: Suppressing warnings about parsing conflicts. +* Start Decl:: Specifying the start symbol. +* Pure Decl:: Requesting a reentrant parser. +* Push Decl:: Requesting a push parser. +* Decl Summary:: Table of all Bison declarations. + + +File: bison.info, Node: Require Decl, Next: Token Decl, Up: Declarations + +3.7.1 Require a Version of Bison +-------------------------------- + +You may require the minimum version of Bison to process the grammar. If +the requirement is not met, `bison' exits with an error (exit status +63). + + %require "VERSION" + + +File: bison.info, Node: Token Decl, Next: Precedence Decl, Prev: Require Decl, Up: Declarations + +3.7.2 Token Type Names +---------------------- + +The basic way to declare a token type name (terminal symbol) is as +follows: + + %token NAME + + Bison will convert this into a `#define' directive in the parser, so +that the function `yylex' (if it is in this file) can use the name NAME +to stand for this token type's code. + + Alternatively, you can use `%left', `%right', or `%nonassoc' instead +of `%token', if you wish to specify associativity and precedence. +*Note Operator Precedence: Precedence Decl. + + You can explicitly specify the numeric code for a token type by +appending a nonnegative decimal or hexadecimal integer value in the +field immediately following the token name: + + %token NUM 300 + %token XNUM 0x12d // a GNU extension + +It is generally best, however, to let Bison choose the numeric codes for +all token types. Bison will automatically select codes that don't +conflict with each other or with normal characters. + + In the event that the stack type is a union, you must augment the +`%token' or other token declaration to include the data type +alternative delimited by angle-brackets (*note More Than One Value +Type: Multiple Types.). + + For example: + + %union { /* define stack type */ + double val; + symrec *tptr; + } + %token NUM /* define token NUM and its type */ + + You can associate a literal string token with a token type name by +writing the literal string at the end of a `%token' declaration which +declares the name. For example: + + %token arrow "=>" + +For example, a grammar for the C language might specify these names with +equivalent literal string tokens: + + %token OR "||" + %token LE 134 "<=" + %left OR "<=" + +Once you equate the literal string and the token name, you can use them +interchangeably in further declarations or the grammar rules. The +`yylex' function can use the token name or the literal string to obtain +the token type code number (*note Calling Convention::). Syntax error +messages passed to `yyerror' from the parser will reference the literal +string instead of the token name. + + The token numbered as 0 corresponds to end of file; the following +line allows for nicer error messages referring to "end of file" instead +of "$end": + + %token END 0 "end of file" + + +File: bison.info, Node: Precedence Decl, Next: Union Decl, Prev: Token Decl, Up: Declarations + +3.7.3 Operator Precedence +------------------------- + +Use the `%left', `%right' or `%nonassoc' declaration to declare a token +and specify its precedence and associativity, all at once. These are +called "precedence declarations". *Note Operator Precedence: +Precedence, for general information on operator precedence. + + The syntax of a precedence declaration is nearly the same as that of +`%token': either + + %left SYMBOLS... + +or + + %left SYMBOLS... + + And indeed any of these declarations serves the purposes of `%token'. +But in addition, they specify the associativity and relative precedence +for all the SYMBOLS: + + * The associativity of an operator OP determines how repeated uses + of the operator nest: whether `X OP Y OP Z' is parsed by grouping + X with Y first or by grouping Y with Z first. `%left' specifies + left-associativity (grouping X with Y first) and `%right' + specifies right-associativity (grouping Y with Z first). + `%nonassoc' specifies no associativity, which means that `X OP Y + OP Z' is considered a syntax error. + + * The precedence of an operator determines how it nests with other + operators. All the tokens declared in a single precedence + declaration have equal precedence and nest together according to + their associativity. When two tokens declared in different + precedence declarations associate, the one declared later has the + higher precedence and is grouped first. + + For backward compatibility, there is a confusing difference between +the argument lists of `%token' and precedence declarations. Only a +`%token' can associate a literal string with a token type name. A +precedence declaration always interprets a literal string as a +reference to a separate token. For example: + + %left OR "<=" // Does not declare an alias. + %left OR 134 "<=" 135 // Declares 134 for OR and 135 for "<=". + + +File: bison.info, Node: Union Decl, Next: Type Decl, Prev: Precedence Decl, Up: Declarations + +3.7.4 The Collection of Value Types +----------------------------------- + +The `%union' declaration specifies the entire collection of possible +data types for semantic values. The keyword `%union' is followed by +braced code containing the same thing that goes inside a `union' in C. + + For example: + + %union { + double val; + symrec *tptr; + } + +This says that the two alternative types are `double' and `symrec *'. +They are given names `val' and `tptr'; these names are used in the +`%token' and `%type' declarations to pick one of the types for a +terminal or nonterminal symbol (*note Nonterminal Symbols: Type Decl.). + + As an extension to POSIX, a tag is allowed after the `union'. For +example: + + %union value { + double val; + symrec *tptr; + } + +specifies the union tag `value', so the corresponding C type is `union +value'. If you do not specify a tag, it defaults to `YYSTYPE'. + + As another extension to POSIX, you may specify multiple `%union' +declarations; their contents are concatenated. However, only the first +`%union' declaration can specify a tag. + + Note that, unlike making a `union' declaration in C, you need not +write a semicolon after the closing brace. + + Instead of `%union', you can define and use your own union type +`YYSTYPE' if your grammar contains at least one `' tag. For +example, you can put the following into a header file `parser.h': + + union YYSTYPE { + double val; + symrec *tptr; + }; + typedef union YYSTYPE YYSTYPE; + +and then your grammar can use the following instead of `%union': + + %{ + #include "parser.h" + %} + %type expr + %token ID + + +File: bison.info, Node: Type Decl, Next: Initial Action Decl, Prev: Union Decl, Up: Declarations + +3.7.5 Nonterminal Symbols +------------------------- + +When you use `%union' to specify multiple value types, you must declare +the value type of each nonterminal symbol for which values are used. +This is done with a `%type' declaration, like this: + + %type NONTERMINAL... + +Here NONTERMINAL is the name of a nonterminal symbol, and TYPE is the +name given in the `%union' to the alternative that you want (*note The +Collection of Value Types: Union Decl.). You can give any number of +nonterminal symbols in the same `%type' declaration, if they have the +same value type. Use spaces to separate the symbol names. + + You can also declare the value type of a terminal symbol. To do +this, use the same `' construction in a declaration for the +terminal symbol. All kinds of token declarations allow `'. + + +File: bison.info, Node: Initial Action Decl, Next: Destructor Decl, Prev: Type Decl, Up: Declarations + +3.7.6 Performing Actions before Parsing +--------------------------------------- + +Sometimes your parser needs to perform some initializations before +parsing. The `%initial-action' directive allows for such arbitrary +code. + + -- Directive: %initial-action { CODE } + Declare that the braced CODE must be invoked before parsing each + time `yyparse' is called. The CODE may use `$$' and `@$' -- + initial value and location of the lookahead -- and the + `%parse-param'. + + For instance, if your locations use a file name, you may use + + %parse-param { char const *file_name }; + %initial-action + { + @$.initialize (file_name); + }; + + +File: bison.info, Node: Destructor Decl, Next: Expect Decl, Prev: Initial Action Decl, Up: Declarations + +3.7.7 Freeing Discarded Symbols +------------------------------- + +During error recovery (*note Error Recovery::), symbols already pushed +on the stack and tokens coming from the rest of the file are discarded +until the parser falls on its feet. If the parser runs out of memory, +or if it returns via `YYABORT' or `YYACCEPT', all the symbols on the +stack must be discarded. Even if the parser succeeds, it must discard +the start symbol. + + When discarded symbols convey heap based information, this memory is +lost. While this behavior can be tolerable for batch parsers, such as +in traditional compilers, it is unacceptable for programs like shells or +protocol implementations that may parse and execute indefinitely. + + The `%destructor' directive defines code that is called when a +symbol is automatically discarded. + + -- Directive: %destructor { CODE } SYMBOLS + Invoke the braced CODE whenever the parser discards one of the + SYMBOLS. Within CODE, `$$' designates the semantic value + associated with the discarded symbol, and `@$' designates its + location. The additional parser parameters are also available + (*note The Parser Function `yyparse': Parser Function.). + + When a symbol is listed among SYMBOLS, its `%destructor' is called + a per-symbol `%destructor'. You may also define a per-type + `%destructor' by listing a semantic type tag among SYMBOLS. In + that case, the parser will invoke this CODE whenever it discards + any grammar symbol that has that semantic type tag unless that + symbol has its own per-symbol `%destructor'. + + Finally, you can define two different kinds of default + `%destructor's. (These default forms are experimental. More user + feedback will help to determine whether they should become + permanent features.) You can place each of `<*>' and `<>' in the + SYMBOLS list of exactly one `%destructor' declaration in your + grammar file. The parser will invoke the CODE associated with one + of these whenever it discards any user-defined grammar symbol that + has no per-symbol and no per-type `%destructor'. The parser uses + the CODE for `<*>' in the case of such a grammar symbol for which + you have formally declared a semantic type tag (`%type' counts as + such a declaration, but `$$' does not). The parser uses the + CODE for `<>' in the case of such a grammar symbol that has no + declared semantic type tag. + +For example: + + %union { char *string; } + %token STRING1 + %token STRING2 + %type string1 + %type string2 + %union { char character; } + %token CHR + %type chr + %token TAGLESS + + %destructor { } + %destructor { free ($$); } <*> + %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1 + %destructor { printf ("Discarding tagless symbol.\n"); } <> + +guarantees that, when the parser discards any user-defined symbol that +has a semantic type tag other than `', it passes its +semantic value to `free' by default. However, when the parser discards +a `STRING1' or a `string1', it also prints its line number to `stdout'. +It performs only the second `%destructor' in this case, so it invokes +`free' only once. Finally, the parser merely prints a message whenever +it discards any symbol, such as `TAGLESS', that has no semantic type +tag. + + A Bison-generated parser invokes the default `%destructor's only for +user-defined as opposed to Bison-defined symbols. For example, the +parser will not invoke either kind of default `%destructor' for the +special Bison-defined symbols `$accept', `$undefined', or `$end' (*note +Bison Symbols: Table of Symbols.), none of which you can reference in +your grammar. It also will not invoke either for the `error' token +(*note error: Table of Symbols.), which is always defined by Bison +regardless of whether you reference it in your grammar. However, it +may invoke one of them for the end token (token 0) if you redefine it +from `$end' to, for example, `END': + + %token END 0 + + Finally, Bison will never invoke a `%destructor' for an unreferenced +mid-rule semantic value (*note Actions in Mid-Rule: Mid-Rule Actions.). +That is, Bison does not consider a mid-rule to have a semantic value if +you do not reference `$$' in the mid-rule's action or `$N' (where N is +the RHS symbol position of the mid-rule) in any later action in that +rule. However, if you do reference either, the Bison-generated parser +will invoke the `<>' `%destructor' whenever it discards the mid-rule +symbol. + + + "Discarded symbols" are the following: + + * stacked symbols popped during the first phase of error recovery, + + * incoming terminals during the second phase of error recovery, + + * the current lookahead and the entire stack (except the current + right-hand side symbols) when the parser returns immediately, and + + * the start symbol, when the parser succeeds. + + The parser can "return immediately" because of an explicit call to +`YYABORT' or `YYACCEPT', or failed error recovery, or memory exhaustion. + + Right-hand side symbols of a rule that explicitly triggers a syntax +error via `YYERROR' are not discarded automatically. As a rule of +thumb, destructors are invoked only when user actions cannot manage the +memory. + + +File: bison.info, Node: Expect Decl, Next: Start Decl, Prev: Destructor Decl, Up: Declarations + +3.7.8 Suppressing Conflict Warnings +----------------------------------- + +Bison normally warns if there are any conflicts in the grammar (*note +Shift/Reduce Conflicts: Shift/Reduce.), but most real grammars have +harmless shift/reduce conflicts which are resolved in a predictable way +and would be difficult to eliminate. It is desirable to suppress the +warning about these conflicts unless the number of conflicts changes. +You can do this with the `%expect' declaration. + + The declaration looks like this: + + %expect N + + Here N is a decimal integer. The declaration says there should be N +shift/reduce conflicts and no reduce/reduce conflicts. Bison reports +an error if the number of shift/reduce conflicts differs from N, or if +there are any reduce/reduce conflicts. + + For normal LALR(1) parsers, reduce/reduce conflicts are more +serious, and should be eliminated entirely. Bison will always report +reduce/reduce conflicts for these parsers. With GLR parsers, however, +both kinds of conflicts are routine; otherwise, there would be no need +to use GLR parsing. Therefore, it is also possible to specify an +expected number of reduce/reduce conflicts in GLR parsers, using the +declaration: + + %expect-rr N + + In general, using `%expect' involves these steps: + + * Compile your grammar without `%expect'. Use the `-v' option to + get a verbose list of where the conflicts occur. Bison will also + print the number of conflicts. + + * Check each of the conflicts to make sure that Bison's default + resolution is what you really want. If not, rewrite the grammar + and go back to the beginning. + + * Add an `%expect' declaration, copying the number N from the number + which Bison printed. With GLR parsers, add an `%expect-rr' + declaration as well. + + Now Bison will warn you if you introduce an unexpected conflict, but +will keep silent otherwise. + + +File: bison.info, Node: Start Decl, Next: Pure Decl, Prev: Expect Decl, Up: Declarations + +3.7.9 The Start-Symbol +---------------------- + +Bison assumes by default that the start symbol for the grammar is the +first nonterminal specified in the grammar specification section. The +programmer may override this restriction with the `%start' declaration +as follows: + + %start SYMBOL + + +File: bison.info, Node: Pure Decl, Next: Push Decl, Prev: Start Decl, Up: Declarations + +3.7.10 A Pure (Reentrant) Parser +-------------------------------- + +A "reentrant" program is one which does not alter in the course of +execution; in other words, it consists entirely of "pure" (read-only) +code. Reentrancy is important whenever asynchronous execution is +possible; for example, a nonreentrant program may not be safe to call +from a signal handler. In systems with multiple threads of control, a +nonreentrant program must be called only within interlocks. + + Normally, Bison generates a parser which is not reentrant. This is +suitable for most uses, and it permits compatibility with Yacc. (The +standard Yacc interfaces are inherently nonreentrant, because they use +statically allocated variables for communication with `yylex', +including `yylval' and `yylloc'.) + + Alternatively, you can generate a pure, reentrant parser. The Bison +declaration `%define api.pure' says that you want the parser to be +reentrant. It looks like this: + + %define api.pure + + The result is that the communication variables `yylval' and `yylloc' +become local variables in `yyparse', and a different calling convention +is used for the lexical analyzer function `yylex'. *Note Calling +Conventions for Pure Parsers: Pure Calling, for the details of this. +The variable `yynerrs' becomes local in `yyparse' in pull mode but it +becomes a member of yypstate in push mode. (*note The Error Reporting +Function `yyerror': Error Reporting.). The convention for calling +`yyparse' itself is unchanged. + + Whether the parser is pure has nothing to do with the grammar rules. +You can generate either a pure parser or a nonreentrant parser from any +valid grammar. + + +File: bison.info, Node: Push Decl, Next: Decl Summary, Prev: Pure Decl, Up: Declarations + +3.7.11 A Push Parser +-------------------- + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + + A pull parser is called once and it takes control until all its input +is completely parsed. A push parser, on the other hand, is called each +time a new token is made available. + + A push parser is typically useful when the parser is part of a main +event loop in the client's application. This is typically a +requirement of a GUI, when the main event loop needs to be triggered +within a certain time period. + + Normally, Bison generates a pull parser. The following Bison +declaration says that you want the parser to be a push parser (*note +%define api.push_pull: Decl Summary.): + + %define api.push_pull "push" + + In almost all cases, you want to ensure that your push parser is also +a pure parser (*note A Pure (Reentrant) Parser: Pure Decl.). The only +time you should create an impure push parser is to have backwards +compatibility with the impure Yacc pull mode interface. Unless you know +what you are doing, your declarations should look like this: + + %define api.pure + %define api.push_pull "push" + + There is a major notable functional difference between the pure push +parser and the impure push parser. It is acceptable for a pure push +parser to have many parser instances, of the same type of parser, in +memory at the same time. An impure push parser should only use one +parser at a time. + + When a push parser is selected, Bison will generate some new symbols +in the generated parser. `yypstate' is a structure that the generated +parser uses to store the parser's state. `yypstate_new' is the +function that will create a new parser instance. `yypstate_delete' +will free the resources associated with the corresponding parser +instance. Finally, `yypush_parse' is the function that should be +called whenever a token is available to provide the parser. A trivial +example of using a pure push parser would look like this: + + int status; + yypstate *ps = yypstate_new (); + do { + status = yypush_parse (ps, yylex (), NULL); + } while (status == YYPUSH_MORE); + yypstate_delete (ps); + + If the user decided to use an impure push parser, a few things about +the generated parser will change. The `yychar' variable becomes a +global variable instead of a variable in the `yypush_parse' function. +For this reason, the signature of the `yypush_parse' function is +changed to remove the token as a parameter. A nonreentrant push parser +example would thus look like this: + + extern int yychar; + int status; + yypstate *ps = yypstate_new (); + do { + yychar = yylex (); + status = yypush_parse (ps); + } while (status == YYPUSH_MORE); + yypstate_delete (ps); + + That's it. Notice the next token is put into the global variable +`yychar' for use by the next invocation of the `yypush_parse' function. + + Bison also supports both the push parser interface along with the +pull parser interface in the same generated parser. In order to get +this functionality, you should replace the `%define api.push_pull +"push"' declaration with the `%define api.push_pull "both"' +declaration. Doing this will create all of the symbols mentioned +earlier along with the two extra symbols, `yyparse' and `yypull_parse'. +`yyparse' can be used exactly as it normally would be used. However, +the user should note that it is implemented in the generated parser by +calling `yypull_parse'. This makes the `yyparse' function that is +generated with the `%define api.push_pull "both"' declaration slower +than the normal `yyparse' function. If the user calls the +`yypull_parse' function it will parse the rest of the input stream. It +is possible to `yypush_parse' tokens to select a subgrammar and then +`yypull_parse' the rest of the input stream. If you would like to +switch back and forth between between parsing styles, you would have to +write your own `yypull_parse' function that knows when to quit looking +for input. An example of using the `yypull_parse' function would look +like this: + + yypstate *ps = yypstate_new (); + yypull_parse (ps); /* Will call the lexer */ + yypstate_delete (ps); + + Adding the `%define api.pure' declaration does exactly the same +thing to the generated parser with `%define api.push_pull "both"' as it +did for `%define api.push_pull "push"'. + + +File: bison.info, Node: Decl Summary, Prev: Push Decl, Up: Declarations + +3.7.12 Bison Declaration Summary +-------------------------------- + +Here is a summary of the declarations used to define a grammar: + + -- Directive: %union + Declare the collection of data types that semantic values may have + (*note The Collection of Value Types: Union Decl.). + + -- Directive: %token + Declare a terminal symbol (token type name) with no precedence or + associativity specified (*note Token Type Names: Token Decl.). + + -- Directive: %right + Declare a terminal symbol (token type name) that is + right-associative (*note Operator Precedence: Precedence Decl.). + + -- Directive: %left + Declare a terminal symbol (token type name) that is + left-associative (*note Operator Precedence: Precedence Decl.). + + -- Directive: %nonassoc + Declare a terminal symbol (token type name) that is nonassociative + (*note Operator Precedence: Precedence Decl.). Using it in a way + that would be associative is a syntax error. + + -- Directive: %type + Declare the type of semantic values for a nonterminal symbol + (*note Nonterminal Symbols: Type Decl.). + + -- Directive: %start + Specify the grammar's start symbol (*note The Start-Symbol: Start + Decl.). + + -- Directive: %expect + Declare the expected number of shift-reduce conflicts (*note + Suppressing Conflict Warnings: Expect Decl.). + + +In order to change the behavior of `bison', use the following +directives: + + -- Directive: %code {CODE} + This is the unqualified form of the `%code' directive. It inserts + CODE verbatim at a language-dependent default location in the + output(1). + + For C/C++, the default location is the parser source code file + after the usual contents of the parser header file. Thus, `%code' + replaces the traditional Yacc prologue, `%{CODE%}', for most + purposes. For a detailed discussion, see *note Prologue + Alternatives::. + + For Java, the default location is inside the parser class. + + (Like all the Yacc prologue alternatives, this directive is + experimental. More user feedback will help to determine whether + it should become a permanent feature.) + + -- Directive: %code QUALIFIER {CODE} + This is the qualified form of the `%code' directive. If you need + to specify location-sensitive verbatim CODE that does not belong + at the default location selected by the unqualified `%code' form, + use this form instead. + + QUALIFIER identifies the purpose of CODE and thus the location(s) + where Bison should generate it. Not all values of QUALIFIER are + available for all target languages: + + * requires + + * Language(s): C, C++ + + * Purpose: This is the best place to write dependency code + required for `YYSTYPE' and `YYLTYPE'. In other words, + it's the best place to define types referenced in + `%union' directives, and it's the best place to override + Bison's default `YYSTYPE' and `YYLTYPE' definitions. + + * Location(s): The parser header file and the parser + source code file before the Bison-generated `YYSTYPE' + and `YYLTYPE' definitions. + + * provides + + * Language(s): C, C++ + + * Purpose: This is the best place to write additional + definitions and declarations that should be provided to + other modules. + + * Location(s): The parser header file and the parser + source code file after the Bison-generated `YYSTYPE', + `YYLTYPE', and token definitions. + + * top + + * Language(s): C, C++ + + * Purpose: The unqualified `%code' or `%code requires' + should usually be more appropriate than `%code top'. + However, occasionally it is necessary to insert code + much nearer the top of the parser source code file. For + example: + + %code top { + #define _GNU_SOURCE + #include + } + + * Location(s): Near the top of the parser source code file. + + * imports + + * Language(s): Java + + * Purpose: This is the best place to write Java import + directives. + + * Location(s): The parser Java file after any Java package + directive and before any class definitions. + + (Like all the Yacc prologue alternatives, this directive is + experimental. More user feedback will help to determine whether + it should become a permanent feature.) + + For a detailed discussion of how to use `%code' in place of the + traditional Yacc prologue for C/C++, see *note Prologue + Alternatives::. + + -- Directive: %debug + In the parser file, define the macro `YYDEBUG' to 1 if it is not + already defined, so that the debugging facilities are compiled. + *Note Tracing Your Parser: Tracing. + + -- Directive: %define VARIABLE + -- Directive: %define VARIABLE "VALUE" + Define a variable to adjust Bison's behavior. The possible + choices for VARIABLE, as well as their meanings, depend on the + selected target language and/or the parser skeleton (*note + %language: Decl Summary, *note %skeleton: Decl Summary.). + + Bison will warn if a VARIABLE is defined multiple times. + + Omitting `"VALUE"' is always equivalent to specifying it as `""'. + + Some VARIABLEs may be used as Booleans. In this case, Bison will + complain if the variable definition does not meet one of the + following four conditions: + + 1. `"VALUE"' is `"true"' + + 2. `"VALUE"' is omitted (or is `""'). This is equivalent to + `"true"'. + + 3. `"VALUE"' is `"false"'. + + 4. VARIABLE is never defined. In this case, Bison selects a + default value, which may depend on the selected target + language and/or parser skeleton. + + Some of the accepted VARIABLEs are: + + * api.pure + + * Language(s): C + + * Purpose: Request a pure (reentrant) parser program. + *Note A Pure (Reentrant) Parser: Pure Decl. + + * Accepted Values: Boolean + + * Default Value: `"false"' + + * api.push_pull + + * Language(s): C (LALR(1) only) + + * Purpose: Requests a pull parser, a push parser, or both. + *Note A Push Parser: Push Decl. (The current push + parsing interface is experimental and may evolve. More + user feedback will help to stabilize it.) + + * Accepted Values: `"pull"', `"push"', `"both"' + + * Default Value: `"pull"' + + * lr.keep_unreachable_states + + * Language(s): all + + * Purpose: Requests that Bison allow unreachable parser + states to remain in the parser tables. Bison considers + a state to be unreachable if there exists no sequence of + transitions from the start state to that state. A state + can become unreachable during conflict resolution if + Bison disables a shift action leading to it from a + predecessor state. Keeping unreachable states is + sometimes useful for analysis purposes, but they are + useless in the generated parser. + + * Accepted Values: Boolean + + * Default Value: `"false"' + + * Caveats: + + * Unreachable states may contain conflicts and may + use rules not used in any other state. Thus, + keeping unreachable states may induce warnings that + are irrelevant to your parser's behavior, and it + may eliminate warnings that are relevant. Of + course, the change in warnings may actually be + relevant to a parser table analysis that wants to + keep unreachable states, so this behavior will + likely remain in future Bison releases. + + * While Bison is able to remove unreachable states, + it is not guaranteed to remove other kinds of + useless states. Specifically, when Bison disables + reduce actions during conflict resolution, some + goto actions may become useless, and thus some + additional states may become useless. If Bison + were to compute which goto actions were useless and + then disable those actions, it could identify such + states as unreachable and then remove those states. + However, Bison does not compute which goto actions + are useless. + + * namespace + + * Languages(s): C++ + + * Purpose: Specifies the namespace for the parser class. + For example, if you specify: + + %define namespace "foo::bar" + + Bison uses `foo::bar' verbatim in references such as: + + foo::bar::parser::semantic_type + + However, to open a namespace, Bison removes any leading + `::' and then splits on any remaining occurrences: + + namespace foo { namespace bar { + class position; + class location; + } } + + * Accepted Values: Any absolute or relative C++ namespace + reference without a trailing `"::"'. For example, + `"foo"' or `"::foo::bar"'. + + * Default Value: The value specified by `%name-prefix', + which defaults to `yy'. This usage of `%name-prefix' is + for backward compatibility and can be confusing since + `%name-prefix' also specifies the textual prefix for the + lexical analyzer function. Thus, if you specify + `%name-prefix', it is best to also specify `%define + namespace' so that `%name-prefix' _only_ affects the + lexical analyzer function. For example, if you specify: + + %define namespace "foo" + %name-prefix "bar::" + + The parser namespace is `foo' and `yylex' is referenced + as `bar::lex'. + + + -- Directive: %defines + Write a header file containing macro definitions for the token type + names defined in the grammar as well as a few other declarations. + If the parser output file is named `NAME.c' then this file is + named `NAME.h'. + + For C parsers, the output header declares `YYSTYPE' unless + `YYSTYPE' is already defined as a macro or you have used a + `' tag without using `%union'. Therefore, if you are using + a `%union' (*note More Than One Value Type: Multiple Types.) with + components that require other definitions, or if you have defined + a `YYSTYPE' macro or type definition (*note Data Types of Semantic + Values: Value Type.), you need to arrange for these definitions to + be propagated to all modules, e.g., by putting them in a + prerequisite header that is included both by your parser and by + any other module that needs `YYSTYPE'. + + Unless your parser is pure, the output header declares `yylval' as + an external variable. *Note A Pure (Reentrant) Parser: Pure Decl. + + If you have also used locations, the output header declares + `YYLTYPE' and `yylloc' using a protocol similar to that of the + `YYSTYPE' macro and `yylval'. *Note Tracking Locations: Locations. + + This output file is normally essential if you wish to put the + definition of `yylex' in a separate source file, because `yylex' + typically needs to be able to refer to the above-mentioned + declarations and to the token type codes. *Note Semantic Values + of Tokens: Token Values. + + If you have declared `%code requires' or `%code provides', the + output header also contains their code. *Note %code: Decl Summary. + + -- Directive: %defines DEFINES-FILE + Same as above, but save in the file DEFINES-FILE. + + -- Directive: %destructor + Specify how the parser should reclaim the memory associated to + discarded symbols. *Note Freeing Discarded Symbols: Destructor + Decl. + + -- Directive: %file-prefix "PREFIX" + Specify a prefix to use for all Bison output file names. The + names are chosen as if the input file were named `PREFIX.y'. + + -- Directive: %language "LANGUAGE" + Specify the programming language for the generated parser. + Currently supported languages include C, C++, and Java. LANGUAGE + is case-insensitive. + + This directive is experimental and its effect may be modified in + future releases. + + -- Directive: %locations + Generate the code processing the locations (*note Special Features + for Use in Actions: Action Features.). This mode is enabled as + soon as the grammar uses the special `@N' tokens, but if your + grammar does not use it, using `%locations' allows for more + accurate syntax error messages. + + -- Directive: %name-prefix "PREFIX" + Rename the external symbols used in the parser so that they start + with PREFIX instead of `yy'. The precise list of symbols renamed + in C parsers is `yyparse', `yylex', `yyerror', `yynerrs', + `yylval', `yychar', `yydebug', and (if locations are used) + `yylloc'. If you use a push parser, `yypush_parse', + `yypull_parse', `yypstate', `yypstate_new' and `yypstate_delete' + will also be renamed. For example, if you use `%name-prefix + "c_"', the names become `c_parse', `c_lex', and so on. For C++ + parsers, see the `%define namespace' documentation in this section. + *Note Multiple Parsers in the Same Program: Multiple Parsers. + + -- Directive: %no-lines + Don't generate any `#line' preprocessor commands in the parser + file. Ordinarily Bison writes these commands in the parser file + so that the C compiler and debuggers will associate errors and + object code with your source file (the grammar file). This + directive causes them to associate errors with the parser file, + treating it an independent source file in its own right. + + -- Directive: %output "FILE" + Specify FILE for the parser file. + + -- Directive: %pure-parser + Deprecated version of `%define api.pure' (*note %define: Decl + Summary.), for which Bison is more careful to warn about + unreasonable usage. + + -- Directive: %require "VERSION" + Require version VERSION or higher of Bison. *Note Require a + Version of Bison: Require Decl. + + -- Directive: %skeleton "FILE" + Specify the skeleton to use. + + If FILE does not contain a `/', FILE is the name of a skeleton + file in the Bison installation directory. If it does, FILE is an + absolute file name or a file name relative to the directory of the + grammar file. This is similar to how most shells resolve commands. + + -- Directive: %token-table + Generate an array of token names in the parser file. The name of + the array is `yytname'; `yytname[I]' is the name of the token + whose internal Bison token code number is I. The first three + elements of `yytname' correspond to the predefined tokens `"$end"', + `"error"', and `"$undefined"'; after these come the symbols + defined in the grammar file. + + The name in the table includes all the characters needed to + represent the token in Bison. For single-character literals and + literal strings, this includes the surrounding quoting characters + and any escape sequences. For example, the Bison single-character + literal `'+'' corresponds to a three-character name, represented + in C as `"'+'"'; and the Bison two-character literal string `"\\/"' + corresponds to a five-character name, represented in C as + `"\"\\\\/\""'. + + When you specify `%token-table', Bison also generates macro + definitions for macros `YYNTOKENS', `YYNNTS', and `YYNRULES', and + `YYNSTATES': + + `YYNTOKENS' + The highest token number, plus one. + + `YYNNTS' + The number of nonterminal symbols. + + `YYNRULES' + The number of grammar rules, + + `YYNSTATES' + The number of parser states (*note Parser States::). + + -- Directive: %verbose + Write an extra output file containing verbose descriptions of the + parser states and what is done for each type of lookahead token in + that state. *Note Understanding Your Parser: Understanding, for + more information. + + -- Directive: %yacc + Pretend the option `--yacc' was given, i.e., imitate Yacc, + including its naming conventions. *Note Bison Options::, for more. + + ---------- Footnotes ---------- + + (1) The default location is actually skeleton-dependent; writers +of non-standard skeletons however should choose the default location +consistently with the behavior of the standard Bison skeletons. + + +File: bison.info, Node: Multiple Parsers, Prev: Declarations, Up: Grammar File + +3.8 Multiple Parsers in the Same Program +======================================== + +Most programs that use Bison parse only one language and therefore +contain only one Bison parser. But what if you want to parse more than +one language with the same program? Then you need to avoid a name +conflict between different definitions of `yyparse', `yylval', and so +on. + + The easy way to do this is to use the option `-p PREFIX' (*note +Invoking Bison: Invocation.). This renames the interface functions and +variables of the Bison parser to start with PREFIX instead of `yy'. +You can use this to give each parser distinct names that do not +conflict. + + The precise list of symbols renamed is `yyparse', `yylex', +`yyerror', `yynerrs', `yylval', `yylloc', `yychar' and `yydebug'. If +you use a push parser, `yypush_parse', `yypull_parse', `yypstate', +`yypstate_new' and `yypstate_delete' will also be renamed. For +example, if you use `-p c', the names become `cparse', `clex', and so +on. + + *All the other variables and macros associated with Bison are not +renamed.* These others are not global; there is no conflict if the same +name is used in different parsers. For example, `YYSTYPE' is not +renamed, but defining this in different ways in different parsers causes +no trouble (*note Data Types of Semantic Values: Value Type.). + + The `-p' option works by adding macro definitions to the beginning +of the parser source file, defining `yyparse' as `PREFIXparse', and so +on. This effectively substitutes one name for the other in the entire +parser file. + + +File: bison.info, Node: Interface, Next: Algorithm, Prev: Grammar File, Up: Top + +4 Parser C-Language Interface +***************************** + +The Bison parser is actually a C function named `yyparse'. Here we +describe the interface conventions of `yyparse' and the other functions +that it needs to use. + + Keep in mind that the parser uses many C identifiers starting with +`yy' and `YY' for internal purposes. If you use such an identifier +(aside from those in this manual) in an action or in epilogue in the +grammar file, you are likely to run into trouble. + +* Menu: + +* Parser Function:: How to call `yyparse' and what it returns. +* Push Parser Function:: How to call `yypush_parse' and what it returns. +* Pull Parser Function:: How to call `yypull_parse' and what it returns. +* Parser Create Function:: How to call `yypstate_new' and what it returns. +* Parser Delete Function:: How to call `yypstate_delete' and what it returns. +* Lexical:: You must supply a function `yylex' + which reads tokens. +* Error Reporting:: You must supply a function `yyerror'. +* Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user's + native language. + + +File: bison.info, Node: Parser Function, Next: Push Parser Function, Up: Interface + +4.1 The Parser Function `yyparse' +================================= + +You call the function `yyparse' to cause parsing to occur. This +function reads tokens, executes actions, and ultimately returns when it +encounters end-of-input or an unrecoverable syntax error. You can also +write an action which directs `yyparse' to return immediately without +reading further. + + -- Function: int yyparse (void) + The value returned by `yyparse' is 0 if parsing was successful + (return is due to end-of-input). + + The value is 1 if parsing failed because of invalid input, i.e., + input that contains a syntax error or that causes `YYABORT' to be + invoked. + + The value is 2 if parsing failed due to memory exhaustion. + + In an action, you can cause immediate return from `yyparse' by using +these macros: + + -- Macro: YYACCEPT + Return immediately with value 0 (to report success). + + -- Macro: YYABORT + Return immediately with value 1 (to report failure). + + If you use a reentrant parser, you can optionally pass additional +parameter information to it in a reentrant way. To do so, use the +declaration `%parse-param': + + -- Directive: %parse-param {ARGUMENT-DECLARATION} + Declare that an argument declared by the braced-code + ARGUMENT-DECLARATION is an additional `yyparse' argument. The + ARGUMENT-DECLARATION is used when declaring functions or + prototypes. The last identifier in ARGUMENT-DECLARATION must be + the argument name. + + Here's an example. Write this in the parser: + + %parse-param {int *nastiness} + %parse-param {int *randomness} + +Then call the parser like this: + + { + int nastiness, randomness; + ... /* Store proper data in `nastiness' and `randomness'. */ + value = yyparse (&nastiness, &randomness); + ... + } + +In the grammar actions, use expressions like this to refer to the data: + + exp: ... { ...; *randomness += 1; ... } + + +File: bison.info, Node: Push Parser Function, Next: Pull Parser Function, Prev: Parser Function, Up: Interface + +4.2 The Push Parser Function `yypush_parse' +=========================================== + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + + You call the function `yypush_parse' to parse a single token. This +function is available if either the `%define api.push_pull "push"' or +`%define api.push_pull "both"' declaration is used. *Note A Push +Parser: Push Decl. + + -- Function: int yypush_parse (yypstate *yyps) + The value returned by `yypush_parse' is the same as for yyparse + with the following exception. `yypush_parse' will return + YYPUSH_MORE if more input is required to finish parsing the + grammar. + + +File: bison.info, Node: Pull Parser Function, Next: Parser Create Function, Prev: Push Parser Function, Up: Interface + +4.3 The Pull Parser Function `yypull_parse' +=========================================== + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + + You call the function `yypull_parse' to parse the rest of the input +stream. This function is available if the `%define api.push_pull +"both"' declaration is used. *Note A Push Parser: Push Decl. + + -- Function: int yypull_parse (yypstate *yyps) + The value returned by `yypull_parse' is the same as for `yyparse'. + + +File: bison.info, Node: Parser Create Function, Next: Parser Delete Function, Prev: Pull Parser Function, Up: Interface + +4.4 The Parser Create Function `yystate_new' +============================================ + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + + You call the function `yypstate_new' to create a new parser instance. +This function is available if either the `%define api.push_pull "push"' +or `%define api.push_pull "both"' declaration is used. *Note A Push +Parser: Push Decl. + + -- Function: yypstate *yypstate_new (void) + The fuction will return a valid parser instance if there was + memory available or 0 if no memory was available. In impure mode, + it will also return 0 if a parser instance is currently allocated. + + +File: bison.info, Node: Parser Delete Function, Next: Lexical, Prev: Parser Create Function, Up: Interface + +4.5 The Parser Delete Function `yystate_delete' +=============================================== + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + + You call the function `yypstate_delete' to delete a parser instance. +function is available if either the `%define api.push_pull "push"' or +`%define api.push_pull "both"' declaration is used. *Note A Push +Parser: Push Decl. + + -- Function: void yypstate_delete (yypstate *yyps) + This function will reclaim the memory associated with a parser + instance. After this call, you should no longer attempt to use + the parser instance. + + +File: bison.info, Node: Lexical, Next: Error Reporting, Prev: Parser Delete Function, Up: Interface + +4.6 The Lexical Analyzer Function `yylex' +========================================= + +The "lexical analyzer" function, `yylex', recognizes tokens from the +input stream and returns them to the parser. Bison does not create +this function automatically; you must write it so that `yyparse' can +call it. The function is sometimes referred to as a lexical scanner. + + In simple programs, `yylex' is often defined at the end of the Bison +grammar file. If `yylex' is defined in a separate source file, you +need to arrange for the token-type macro definitions to be available +there. To do this, use the `-d' option when you run Bison, so that it +will write these macro definitions into a separate header file +`NAME.tab.h' which you can include in the other source files that need +it. *Note Invoking Bison: Invocation. + +* Menu: + +* Calling Convention:: How `yyparse' calls `yylex'. +* Token Values:: How `yylex' must return the semantic value + of the token it has read. +* Token Locations:: How `yylex' must return the text location + (line number, etc.) of the token, if the + actions want that. +* Pure Calling:: How the calling convention differs in a pure parser + (*note A Pure (Reentrant) Parser: Pure Decl.). + + +File: bison.info, Node: Calling Convention, Next: Token Values, Up: Lexical + +4.6.1 Calling Convention for `yylex' +------------------------------------ + +The value that `yylex' returns must be the positive numeric code for +the type of token it has just found; a zero or negative value signifies +end-of-input. + + When a token is referred to in the grammar rules by a name, that name +in the parser file becomes a C macro whose definition is the proper +numeric code for that token type. So `yylex' can use the name to +indicate that type. *Note Symbols::. + + When a token is referred to in the grammar rules by a character +literal, the numeric code for that character is also the code for the +token type. So `yylex' can simply return that character code, possibly +converted to `unsigned char' to avoid sign-extension. The null +character must not be used this way, because its code is zero and that +signifies end-of-input. + + Here is an example showing these things: + + int + yylex (void) + { + ... + if (c == EOF) /* Detect end-of-input. */ + return 0; + ... + if (c == '+' || c == '-') + return c; /* Assume token type for `+' is '+'. */ + ... + return INT; /* Return the type of the token. */ + ... + } + +This interface has been designed so that the output from the `lex' +utility can be used without change as the definition of `yylex'. + + If the grammar uses literal string tokens, there are two ways that +`yylex' can determine the token type codes for them: + + * If the grammar defines symbolic token names as aliases for the + literal string tokens, `yylex' can use these symbolic names like + all others. In this case, the use of the literal string tokens in + the grammar file has no effect on `yylex'. + + * `yylex' can find the multicharacter token in the `yytname' table. + The index of the token in the table is the token type's code. The + name of a multicharacter token is recorded in `yytname' with a + double-quote, the token's characters, and another double-quote. + The token's characters are escaped as necessary to be suitable as + input to Bison. + + Here's code for looking up a multicharacter token in `yytname', + assuming that the characters of the token are stored in + `token_buffer', and assuming that the token does not contain any + characters like `"' that require escaping. + + for (i = 0; i < YYNTOKENS; i++) + { + if (yytname[i] != 0 + && yytname[i][0] == '"' + && ! strncmp (yytname[i] + 1, token_buffer, + strlen (token_buffer)) + && yytname[i][strlen (token_buffer) + 1] == '"' + && yytname[i][strlen (token_buffer) + 2] == 0) + break; + } + + The `yytname' table is generated only if you use the + `%token-table' declaration. *Note Decl Summary::. + + +File: bison.info, Node: Token Values, Next: Token Locations, Prev: Calling Convention, Up: Lexical + +4.6.2 Semantic Values of Tokens +------------------------------- + +In an ordinary (nonreentrant) parser, the semantic value of the token +must be stored into the global variable `yylval'. When you are using +just one data type for semantic values, `yylval' has that type. Thus, +if the type is `int' (the default), you might write this in `yylex': + + ... + yylval = value; /* Put value onto Bison stack. */ + return INT; /* Return the type of the token. */ + ... + + When you are using multiple data types, `yylval''s type is a union +made from the `%union' declaration (*note The Collection of Value +Types: Union Decl.). So when you store a token's value, you must use +the proper member of the union. If the `%union' declaration looks like +this: + + %union { + int intval; + double val; + symrec *tptr; + } + +then the code in `yylex' might look like this: + + ... + yylval.intval = value; /* Put value onto Bison stack. */ + return INT; /* Return the type of the token. */ + ... + + +File: bison.info, Node: Token Locations, Next: Pure Calling, Prev: Token Values, Up: Lexical + +4.6.3 Textual Locations of Tokens +--------------------------------- + +If you are using the `@N'-feature (*note Tracking Locations: +Locations.) in actions to keep track of the textual locations of tokens +and groupings, then you must provide this information in `yylex'. The +function `yyparse' expects to find the textual location of a token just +parsed in the global variable `yylloc'. So `yylex' must store the +proper data in that variable. + + By default, the value of `yylloc' is a structure and you need only +initialize the members that are going to be used by the actions. The +four members are called `first_line', `first_column', `last_line' and +`last_column'. Note that the use of this feature makes the parser +noticeably slower. + + The data type of `yylloc' has the name `YYLTYPE'. + + +File: bison.info, Node: Pure Calling, Prev: Token Locations, Up: Lexical + +4.6.4 Calling Conventions for Pure Parsers +------------------------------------------ + +When you use the Bison declaration `%define api.pure' to request a +pure, reentrant parser, the global communication variables `yylval' and +`yylloc' cannot be used. (*Note A Pure (Reentrant) Parser: Pure Decl.) +In such parsers the two global variables are replaced by pointers +passed as arguments to `yylex'. You must declare them as shown here, +and pass the information back by storing it through those pointers. + + int + yylex (YYSTYPE *lvalp, YYLTYPE *llocp) + { + ... + *lvalp = value; /* Put value onto Bison stack. */ + return INT; /* Return the type of the token. */ + ... + } + + If the grammar file does not use the `@' constructs to refer to +textual locations, then the type `YYLTYPE' will not be defined. In +this case, omit the second argument; `yylex' will be called with only +one argument. + + If you wish to pass the additional parameter data to `yylex', use +`%lex-param' just like `%parse-param' (*note Parser Function::). + + -- Directive: lex-param {ARGUMENT-DECLARATION} + Declare that the braced-code ARGUMENT-DECLARATION is an additional + `yylex' argument declaration. + + For instance: + + %parse-param {int *nastiness} + %lex-param {int *nastiness} + %parse-param {int *randomness} + +results in the following signature: + + int yylex (int *nastiness); + int yyparse (int *nastiness, int *randomness); + + If `%define api.pure' is added: + + int yylex (YYSTYPE *lvalp, int *nastiness); + int yyparse (int *nastiness, int *randomness); + +and finally, if both `%define api.pure' and `%locations' are used: + + int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness); + int yyparse (int *nastiness, int *randomness); + + +File: bison.info, Node: Error Reporting, Next: Action Features, Prev: Lexical, Up: Interface + +4.7 The Error Reporting Function `yyerror' +========================================== + +The Bison parser detects a "syntax error" or "parse error" whenever it +reads a token which cannot satisfy any syntax rule. An action in the +grammar can also explicitly proclaim an error, using the macro +`YYERROR' (*note Special Features for Use in Actions: Action Features.). + + The Bison parser expects to report the error by calling an error +reporting function named `yyerror', which you must supply. It is +called by `yyparse' whenever a syntax error is found, and it receives +one argument. For a syntax error, the string is normally +`"syntax error"'. + + If you invoke the directive `%error-verbose' in the Bison +declarations section (*note The Bison Declarations Section: Bison +Declarations.), then Bison provides a more verbose and specific error +message string instead of just plain `"syntax error"'. + + The parser can detect one other kind of error: memory exhaustion. +This can happen when the input contains constructions that are very +deeply nested. It isn't likely you will encounter this, since the Bison +parser normally extends its stack automatically up to a very large +limit. But if memory is exhausted, `yyparse' calls `yyerror' in the +usual fashion, except that the argument string is `"memory exhausted"'. + + In some cases diagnostics like `"syntax error"' are translated +automatically from English to some other language before they are +passed to `yyerror'. *Note Internationalization::. + + The following definition suffices in simple programs: + + void + yyerror (char const *s) + { + fprintf (stderr, "%s\n", s); + } + + After `yyerror' returns to `yyparse', the latter will attempt error +recovery if you have written suitable error recovery grammar rules +(*note Error Recovery::). If recovery is impossible, `yyparse' will +immediately return 1. + + Obviously, in location tracking pure parsers, `yyerror' should have +an access to the current location. This is indeed the case for the GLR +parsers, but not for the Yacc parser, for historical reasons. I.e., if +`%locations %define api.pure' is passed then the prototypes for +`yyerror' are: + + void yyerror (char const *msg); /* Yacc parsers. */ + void yyerror (YYLTYPE *locp, char const *msg); /* GLR parsers. */ + + If `%parse-param {int *nastiness}' is used, then: + + void yyerror (int *nastiness, char const *msg); /* Yacc parsers. */ + void yyerror (int *nastiness, char const *msg); /* GLR parsers. */ + + Finally, GLR and Yacc parsers share the same `yyerror' calling +convention for absolutely pure parsers, i.e., when the calling +convention of `yylex' _and_ the calling convention of `%define +api.pure' are pure. I.e.: + + /* Location tracking. */ + %locations + /* Pure yylex. */ + %define api.pure + %lex-param {int *nastiness} + /* Pure yyparse. */ + %parse-param {int *nastiness} + %parse-param {int *randomness} + +results in the following signatures for all the parser kinds: + + int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness); + int yyparse (int *nastiness, int *randomness); + void yyerror (YYLTYPE *locp, + int *nastiness, int *randomness, + char const *msg); + +The prototypes are only indications of how the code produced by Bison +uses `yyerror'. Bison-generated code always ignores the returned +value, so `yyerror' can return any type, including `void'. Also, +`yyerror' can be a variadic function; that is why the message is always +passed last. + + Traditionally `yyerror' returns an `int' that is always ignored, but +this is purely for historical reasons, and `void' is preferable since +it more accurately describes the return type for `yyerror'. + + The variable `yynerrs' contains the number of syntax errors reported +so far. Normally this variable is global; but if you request a pure +parser (*note A Pure (Reentrant) Parser: Pure Decl.) then it is a +local variable which only the actions can access. + + +File: bison.info, Node: Action Features, Next: Internationalization, Prev: Error Reporting, Up: Interface + +4.8 Special Features for Use in Actions +======================================= + +Here is a table of Bison constructs, variables and macros that are +useful in actions. + + -- Variable: $$ + Acts like a variable that contains the semantic value for the + grouping made by the current rule. *Note Actions::. + + -- Variable: $N + Acts like a variable that contains the semantic value for the Nth + component of the current rule. *Note Actions::. + + -- Variable: $$ + Like `$$' but specifies alternative TYPEALT in the union specified + by the `%union' declaration. *Note Data Types of Values in + Actions: Action Types. + + -- Variable: $N + Like `$N' but specifies alternative TYPEALT in the union specified + by the `%union' declaration. *Note Data Types of Values in + Actions: Action Types. + + -- Macro: YYABORT; + Return immediately from `yyparse', indicating failure. *Note The + Parser Function `yyparse': Parser Function. + + -- Macro: YYACCEPT; + Return immediately from `yyparse', indicating success. *Note The + Parser Function `yyparse': Parser Function. + + -- Macro: YYBACKUP (TOKEN, VALUE); + Unshift a token. This macro is allowed only for rules that reduce + a single value, and only when there is no lookahead token. It is + also disallowed in GLR parsers. It installs a lookahead token + with token type TOKEN and semantic value VALUE; then it discards + the value that was going to be reduced by this rule. + + If the macro is used when it is not valid, such as when there is a + lookahead token already, then it reports a syntax error with a + message `cannot back up' and performs ordinary error recovery. + + In either case, the rest of the action is not executed. + + -- Macro: YYEMPTY + Value stored in `yychar' when there is no lookahead token. + + -- Macro: YYEOF + Value stored in `yychar' when the lookahead is the end of the input + stream. + + -- Macro: YYERROR; + Cause an immediate syntax error. This statement initiates error + recovery just as if the parser itself had detected an error; + however, it does not call `yyerror', and does not print any + message. If you want to print an error message, call `yyerror' + explicitly before the `YYERROR;' statement. *Note Error + Recovery::. + + -- Macro: YYRECOVERING + The expression `YYRECOVERING ()' yields 1 when the parser is + recovering from a syntax error, and 0 otherwise. *Note Error + Recovery::. + + -- Variable: yychar + Variable containing either the lookahead token, or `YYEOF' when the + lookahead is the end of the input stream, or `YYEMPTY' when no + lookahead has been performed so the next token is not yet known. + Do not modify `yychar' in a deferred semantic action (*note GLR + Semantic Actions::). *Note Lookahead Tokens: Lookahead. + + -- Macro: yyclearin; + Discard the current lookahead token. This is useful primarily in + error rules. Do not invoke `yyclearin' in a deferred semantic + action (*note GLR Semantic Actions::). *Note Error Recovery::. + + -- Macro: yyerrok; + Resume generating error messages immediately for subsequent syntax + errors. This is useful primarily in error rules. *Note Error + Recovery::. + + -- Variable: yylloc + Variable containing the lookahead token location when `yychar' is + not set to `YYEMPTY' or `YYEOF'. Do not modify `yylloc' in a + deferred semantic action (*note GLR Semantic Actions::). *Note + Actions and Locations: Actions and Locations. + + -- Variable: yylval + Variable containing the lookahead token semantic value when + `yychar' is not set to `YYEMPTY' or `YYEOF'. Do not modify + `yylval' in a deferred semantic action (*note GLR Semantic + Actions::). *Note Actions: Actions. + + -- Value: @$ + Acts like a structure variable containing information on the + textual location of the grouping made by the current rule. *Note + Tracking Locations: Locations. + + + -- Value: @N + Acts like a structure variable containing information on the + textual location of the Nth component of the current rule. *Note + Tracking Locations: Locations. + + +File: bison.info, Node: Internationalization, Prev: Action Features, Up: Interface + +4.9 Parser Internationalization +=============================== + +A Bison-generated parser can print diagnostics, including error and +tracing messages. By default, they appear in English. However, Bison +also supports outputting diagnostics in the user's native language. To +make this work, the user should set the usual environment variables. +*Note The User's View: (gettext)Users. For example, the shell command +`export LC_ALL=fr_CA.UTF-8' might set the user's locale to French +Canadian using the UTF-8 encoding. The exact set of available locales +depends on the user's installation. + + The maintainer of a package that uses a Bison-generated parser +enables the internationalization of the parser's output through the +following steps. Here we assume a package that uses GNU Autoconf and +GNU Automake. + + 1. Into the directory containing the GNU Autoconf macros used by the + package--often called `m4'--copy the `bison-i18n.m4' file + installed by Bison under `share/aclocal/bison-i18n.m4' in Bison's + installation directory. For example: + + cp /usr/local/share/aclocal/bison-i18n.m4 m4/bison-i18n.m4 + + 2. In the top-level `configure.ac', after the `AM_GNU_GETTEXT' + invocation, add an invocation of `BISON_I18N'. This macro is + defined in the file `bison-i18n.m4' that you copied earlier. It + causes `configure' to find the value of the `BISON_LOCALEDIR' + variable, and it defines the source-language symbol `YYENABLE_NLS' + to enable translations in the Bison-generated parser. + + 3. In the `main' function of your program, designate the directory + containing Bison's runtime message catalog, through a call to + `bindtextdomain' with domain name `bison-runtime'. For example: + + bindtextdomain ("bison-runtime", BISON_LOCALEDIR); + + Typically this appears after any other call `bindtextdomain + (PACKAGE, LOCALEDIR)' that your package already has. Here we rely + on `BISON_LOCALEDIR' to be defined as a string through the + `Makefile'. + + 4. In the `Makefile.am' that controls the compilation of the `main' + function, make `BISON_LOCALEDIR' available as a C preprocessor + macro, either in `DEFS' or in `AM_CPPFLAGS'. For example: + + DEFS = @DEFS@ -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' + + or: + + AM_CPPFLAGS = -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' + + 5. Finally, invoke the command `autoreconf' to generate the build + infrastructure. + + +File: bison.info, Node: Algorithm, Next: Error Recovery, Prev: Interface, Up: Top + +5 The Bison Parser Algorithm +**************************** + +As Bison reads tokens, it pushes them onto a stack along with their +semantic values. The stack is called the "parser stack". Pushing a +token is traditionally called "shifting". + + For example, suppose the infix calculator has read `1 + 5 *', with a +`3' to come. The stack will have four elements, one for each token +that was shifted. + + But the stack does not always have an element for each token read. +When the last N tokens and groupings shifted match the components of a +grammar rule, they can be combined according to that rule. This is +called "reduction". Those tokens and groupings are replaced on the +stack by a single grouping whose symbol is the result (left hand side) +of that rule. Running the rule's action is part of the process of +reduction, because this is what computes the semantic value of the +resulting grouping. + + For example, if the infix calculator's parser stack contains this: + + 1 + 5 * 3 + +and the next input token is a newline character, then the last three +elements can be reduced to 15 via the rule: + + expr: expr '*' expr; + +Then the stack contains just these three elements: + + 1 + 15 + +At this point, another reduction can be made, resulting in the single +value 16. Then the newline token can be shifted. + + The parser tries, by shifts and reductions, to reduce the entire +input down to a single grouping whose symbol is the grammar's +start-symbol (*note Languages and Context-Free Grammars: Language and +Grammar.). + + This kind of parser is known in the literature as a bottom-up parser. + +* Menu: + +* Lookahead:: Parser looks one token ahead when deciding what to do. +* Shift/Reduce:: Conflicts: when either shifting or reduction is valid. +* Precedence:: Operator precedence works by resolving conflicts. +* Contextual Precedence:: When an operator's precedence depends on context. +* Parser States:: The parser is a finite-state-machine with stack. +* Reduce/Reduce:: When two rules are applicable in the same situation. +* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified. +* Generalized LR Parsing:: Parsing arbitrary context-free grammars. +* Memory Management:: What happens when memory is exhausted. How to avoid it. + + +File: bison.info, Node: Lookahead, Next: Shift/Reduce, Up: Algorithm + +5.1 Lookahead Tokens +==================== + +The Bison parser does _not_ always reduce immediately as soon as the +last N tokens and groupings match a rule. This is because such a +simple strategy is inadequate to handle most languages. Instead, when a +reduction is possible, the parser sometimes "looks ahead" at the next +token in order to decide what to do. + + When a token is read, it is not immediately shifted; first it +becomes the "lookahead token", which is not on the stack. Now the +parser can perform one or more reductions of tokens and groupings on +the stack, while the lookahead token remains off to the side. When no +more reductions should take place, the lookahead token is shifted onto +the stack. This does not mean that all possible reductions have been +done; depending on the token type of the lookahead token, some rules +may choose to delay their application. + + Here is a simple case where lookahead is needed. These three rules +define expressions which contain binary addition operators and postfix +unary factorial operators (`!'), and allow parentheses for grouping. + + expr: term '+' expr + | term + ; + + term: '(' expr ')' + | term '!' + | NUMBER + ; + + Suppose that the tokens `1 + 2' have been read and shifted; what +should be done? If the following token is `)', then the first three +tokens must be reduced to form an `expr'. This is the only valid +course, because shifting the `)' would produce a sequence of symbols +`term ')'', and no rule allows this. + + If the following token is `!', then it must be shifted immediately so +that `2 !' can be reduced to make a `term'. If instead the parser were +to reduce before shifting, `1 + 2' would become an `expr'. It would +then be impossible to shift the `!' because doing so would produce on +the stack the sequence of symbols `expr '!''. No rule allows that +sequence. + + The lookahead token is stored in the variable `yychar'. Its +semantic value and location, if any, are stored in the variables +`yylval' and `yylloc'. *Note Special Features for Use in Actions: +Action Features. + + +File: bison.info, Node: Shift/Reduce, Next: Precedence, Prev: Lookahead, Up: Algorithm + +5.2 Shift/Reduce Conflicts +========================== + +Suppose we are parsing a language which has if-then and if-then-else +statements, with a pair of rules like this: + + if_stmt: + IF expr THEN stmt + | IF expr THEN stmt ELSE stmt + ; + +Here we assume that `IF', `THEN' and `ELSE' are terminal symbols for +specific keyword tokens. + + When the `ELSE' token is read and becomes the lookahead token, the +contents of the stack (assuming the input is valid) are just right for +reduction by the first rule. But it is also legitimate to shift the +`ELSE', because that would lead to eventual reduction by the second +rule. + + This situation, where either a shift or a reduction would be valid, +is called a "shift/reduce conflict". Bison is designed to resolve +these conflicts by choosing to shift, unless otherwise directed by +operator precedence declarations. To see the reason for this, let's +contrast it with the other alternative. + + Since the parser prefers to shift the `ELSE', the result is to attach +the else-clause to the innermost if-statement, making these two inputs +equivalent: + + if x then if y then win (); else lose; + + if x then do; if y then win (); else lose; end; + + But if the parser chose to reduce when possible rather than shift, +the result would be to attach the else-clause to the outermost +if-statement, making these two inputs equivalent: + + if x then if y then win (); else lose; + + if x then do; if y then win (); end; else lose; + + The conflict exists because the grammar as written is ambiguous: +either parsing of the simple nested if-statement is legitimate. The +established convention is that these ambiguities are resolved by +attaching the else-clause to the innermost if-statement; this is what +Bison accomplishes by choosing to shift rather than reduce. (It would +ideally be cleaner to write an unambiguous grammar, but that is very +hard to do in this case.) This particular ambiguity was first +encountered in the specifications of Algol 60 and is called the +"dangling `else'" ambiguity. + + To avoid warnings from Bison about predictable, legitimate +shift/reduce conflicts, use the `%expect N' declaration. There will be +no warning as long as the number of shift/reduce conflicts is exactly N. +*Note Suppressing Conflict Warnings: Expect Decl. + + The definition of `if_stmt' above is solely to blame for the +conflict, but the conflict does not actually appear without additional +rules. Here is a complete Bison input file that actually manifests the +conflict: + + %token IF THEN ELSE variable + %% + stmt: expr + | if_stmt + ; + + if_stmt: + IF expr THEN stmt + | IF expr THEN stmt ELSE stmt + ; + + expr: variable + ; + + +File: bison.info, Node: Precedence, Next: Contextual Precedence, Prev: Shift/Reduce, Up: Algorithm + +5.3 Operator Precedence +======================= + +Another situation where shift/reduce conflicts appear is in arithmetic +expressions. Here shifting is not always the preferred resolution; the +Bison declarations for operator precedence allow you to specify when to +shift and when to reduce. + +* Menu: + +* Why Precedence:: An example showing why precedence is needed. +* Using Precedence:: How to specify precedence in Bison grammars. +* Precedence Examples:: How these features are used in the previous example. +* How Precedence:: How they work. + + +File: bison.info, Node: Why Precedence, Next: Using Precedence, Up: Precedence + +5.3.1 When Precedence is Needed +------------------------------- + +Consider the following ambiguous grammar fragment (ambiguous because the +input `1 - 2 * 3' can be parsed in two different ways): + + expr: expr '-' expr + | expr '*' expr + | expr '<' expr + | '(' expr ')' + ... + ; + +Suppose the parser has seen the tokens `1', `-' and `2'; should it +reduce them via the rule for the subtraction operator? It depends on +the next token. Of course, if the next token is `)', we must reduce; +shifting is invalid because no single rule can reduce the token +sequence `- 2 )' or anything starting with that. But if the next token +is `*' or `<', we have a choice: either shifting or reduction would +allow the parse to complete, but with different results. + + To decide which one Bison should do, we must consider the results. +If the next operator token OP is shifted, then it must be reduced first +in order to permit another opportunity to reduce the difference. The +result is (in effect) `1 - (2 OP 3)'. On the other hand, if the +subtraction is reduced before shifting OP, the result is +`(1 - 2) OP 3'. Clearly, then, the choice of shift or reduce should +depend on the relative precedence of the operators `-' and OP: `*' +should be shifted first, but not `<'. + + What about input such as `1 - 2 - 5'; should this be `(1 - 2) - 5' +or should it be `1 - (2 - 5)'? For most operators we prefer the +former, which is called "left association". The latter alternative, +"right association", is desirable for assignment operators. The choice +of left or right association is a matter of whether the parser chooses +to shift or reduce when the stack contains `1 - 2' and the lookahead +token is `-': shifting makes right-associativity. + + +File: bison.info, Node: Using Precedence, Next: Precedence Examples, Prev: Why Precedence, Up: Precedence + +5.3.2 Specifying Operator Precedence +------------------------------------ + +Bison allows you to specify these choices with the operator precedence +declarations `%left' and `%right'. Each such declaration contains a +list of tokens, which are operators whose precedence and associativity +is being declared. The `%left' declaration makes all those operators +left-associative and the `%right' declaration makes them +right-associative. A third alternative is `%nonassoc', which declares +that it is a syntax error to find the same operator twice "in a row". + + The relative precedence of different operators is controlled by the +order in which they are declared. The first `%left' or `%right' +declaration in the file declares the operators whose precedence is +lowest, the next such declaration declares the operators whose +precedence is a little higher, and so on. + + +File: bison.info, Node: Precedence Examples, Next: How Precedence, Prev: Using Precedence, Up: Precedence + +5.3.3 Precedence Examples +------------------------- + +In our example, we would want the following declarations: + + %left '<' + %left '-' + %left '*' + + In a more complete example, which supports other operators as well, +we would declare them in groups of equal precedence. For example, +`'+'' is declared with `'-'': + + %left '<' '>' '=' NE LE GE + %left '+' '-' + %left '*' '/' + +(Here `NE' and so on stand for the operators for "not equal" and so on. +We assume that these tokens are more than one character long and +therefore are represented by names, not character literals.) + + +File: bison.info, Node: How Precedence, Prev: Precedence Examples, Up: Precedence + +5.3.4 How Precedence Works +-------------------------- + +The first effect of the precedence declarations is to assign precedence +levels to the terminal symbols declared. The second effect is to assign +precedence levels to certain rules: each rule gets its precedence from +the last terminal symbol mentioned in the components. (You can also +specify explicitly the precedence of a rule. *Note Context-Dependent +Precedence: Contextual Precedence.) + + Finally, the resolution of conflicts works by comparing the +precedence of the rule being considered with that of the lookahead +token. If the token's precedence is higher, the choice is to shift. +If the rule's precedence is higher, the choice is to reduce. If they +have equal precedence, the choice is made based on the associativity of +that precedence level. The verbose output file made by `-v' (*note +Invoking Bison: Invocation.) says how each conflict was resolved. + + Not all rules and not all tokens have precedence. If either the +rule or the lookahead token has no precedence, then the default is to +shift. + + +File: bison.info, Node: Contextual Precedence, Next: Parser States, Prev: Precedence, Up: Algorithm + +5.4 Context-Dependent Precedence +================================ + +Often the precedence of an operator depends on the context. This sounds +outlandish at first, but it is really very common. For example, a minus +sign typically has a very high precedence as a unary operator, and a +somewhat lower precedence (lower than multiplication) as a binary +operator. + + The Bison precedence declarations, `%left', `%right' and +`%nonassoc', can only be used once for a given token; so a token has +only one precedence declared in this way. For context-dependent +precedence, you need to use an additional mechanism: the `%prec' +modifier for rules. + + The `%prec' modifier declares the precedence of a particular rule by +specifying a terminal symbol whose precedence should be used for that +rule. It's not necessary for that symbol to appear otherwise in the +rule. The modifier's syntax is: + + %prec TERMINAL-SYMBOL + +and it is written after the components of the rule. Its effect is to +assign the rule the precedence of TERMINAL-SYMBOL, overriding the +precedence that would be deduced for it in the ordinary way. The +altered rule precedence then affects how conflicts involving that rule +are resolved (*note Operator Precedence: Precedence.). + + Here is how `%prec' solves the problem of unary minus. First, +declare a precedence for a fictitious terminal symbol named `UMINUS'. +There are no tokens of this type, but the symbol serves to stand for its +precedence: + + ... + %left '+' '-' + %left '*' + %left UMINUS + + Now the precedence of `UMINUS' can be used in specific rules: + + exp: ... + | exp '-' exp + ... + | '-' exp %prec UMINUS + + +File: bison.info, Node: Parser States, Next: Reduce/Reduce, Prev: Contextual Precedence, Up: Algorithm + +5.5 Parser States +================= + +The function `yyparse' is implemented using a finite-state machine. +The values pushed on the parser stack are not simply token type codes; +they represent the entire sequence of terminal and nonterminal symbols +at or near the top of the stack. The current state collects all the +information about previous input which is relevant to deciding what to +do next. + + Each time a lookahead token is read, the current parser state +together with the type of lookahead token are looked up in a table. +This table entry can say, "Shift the lookahead token." In this case, +it also specifies the new parser state, which is pushed onto the top of +the parser stack. Or it can say, "Reduce using rule number N." This +means that a certain number of tokens or groupings are taken off the +top of the stack, and replaced by one grouping. In other words, that +number of states are popped from the stack, and one new state is pushed. + + There is one other alternative: the table can say that the lookahead +token is erroneous in the current state. This causes error processing +to begin (*note Error Recovery::). + + +File: bison.info, Node: Reduce/Reduce, Next: Mystery Conflicts, Prev: Parser States, Up: Algorithm + +5.6 Reduce/Reduce Conflicts +=========================== + +A reduce/reduce conflict occurs if there are two or more rules that +apply to the same sequence of input. This usually indicates a serious +error in the grammar. + + For example, here is an erroneous attempt to define a sequence of +zero or more `word' groupings. + + sequence: /* empty */ + { printf ("empty sequence\n"); } + | maybeword + | sequence word + { printf ("added word %s\n", $2); } + ; + + maybeword: /* empty */ + { printf ("empty maybeword\n"); } + | word + { printf ("single word %s\n", $1); } + ; + +The error is an ambiguity: there is more than one way to parse a single +`word' into a `sequence'. It could be reduced to a `maybeword' and +then into a `sequence' via the second rule. Alternatively, +nothing-at-all could be reduced into a `sequence' via the first rule, +and this could be combined with the `word' using the third rule for +`sequence'. + + There is also more than one way to reduce nothing-at-all into a +`sequence'. This can be done directly via the first rule, or +indirectly via `maybeword' and then the second rule. + + You might think that this is a distinction without a difference, +because it does not change whether any particular input is valid or +not. But it does affect which actions are run. One parsing order runs +the second rule's action; the other runs the first rule's action and +the third rule's action. In this example, the output of the program +changes. + + Bison resolves a reduce/reduce conflict by choosing to use the rule +that appears first in the grammar, but it is very risky to rely on +this. Every reduce/reduce conflict must be studied and usually +eliminated. Here is the proper way to define `sequence': + + sequence: /* empty */ + { printf ("empty sequence\n"); } + | sequence word + { printf ("added word %s\n", $2); } + ; + + Here is another common error that yields a reduce/reduce conflict: + + sequence: /* empty */ + | sequence words + | sequence redirects + ; + + words: /* empty */ + | words word + ; + + redirects:/* empty */ + | redirects redirect + ; + +The intention here is to define a sequence which can contain either +`word' or `redirect' groupings. The individual definitions of +`sequence', `words' and `redirects' are error-free, but the three +together make a subtle ambiguity: even an empty input can be parsed in +infinitely many ways! + + Consider: nothing-at-all could be a `words'. Or it could be two +`words' in a row, or three, or any number. It could equally well be a +`redirects', or two, or any number. Or it could be a `words' followed +by three `redirects' and another `words'. And so on. + + Here are two ways to correct these rules. First, to make it a +single level of sequence: + + sequence: /* empty */ + | sequence word + | sequence redirect + ; + + Second, to prevent either a `words' or a `redirects' from being +empty: + + sequence: /* empty */ + | sequence words + | sequence redirects + ; + + words: word + | words word + ; + + redirects:redirect + | redirects redirect + ; + + +File: bison.info, Node: Mystery Conflicts, Next: Generalized LR Parsing, Prev: Reduce/Reduce, Up: Algorithm + +5.7 Mysterious Reduce/Reduce Conflicts +====================================== + +Sometimes reduce/reduce conflicts can occur that don't look warranted. +Here is an example: + + %token ID + + %% + def: param_spec return_spec ',' + ; + param_spec: + type + | name_list ':' type + ; + return_spec: + type + | name ':' type + ; + type: ID + ; + name: ID + ; + name_list: + name + | name ',' name_list + ; + + It would seem that this grammar can be parsed with only a single +token of lookahead: when a `param_spec' is being read, an `ID' is a +`name' if a comma or colon follows, or a `type' if another `ID' +follows. In other words, this grammar is LR(1). + + However, Bison, like most parser generators, cannot actually handle +all LR(1) grammars. In this grammar, two contexts, that after an `ID' +at the beginning of a `param_spec' and likewise at the beginning of a +`return_spec', are similar enough that Bison assumes they are the same. +They appear similar because the same set of rules would be active--the +rule for reducing to a `name' and that for reducing to a `type'. Bison +is unable to determine at that stage of processing that the rules would +require different lookahead tokens in the two contexts, so it makes a +single parser state for them both. Combining the two contexts causes a +conflict later. In parser terminology, this occurrence means that the +grammar is not LALR(1). + + In general, it is better to fix deficiencies than to document them. +But this particular deficiency is intrinsically hard to fix; parser +generators that can handle LR(1) grammars are hard to write and tend to +produce parsers that are very large. In practice, Bison is more useful +as it is now. + + When the problem arises, you can often fix it by identifying the two +parser states that are being confused, and adding something to make them +look distinct. In the above example, adding one rule to `return_spec' +as follows makes the problem go away: + + %token BOGUS + ... + %% + ... + return_spec: + type + | name ':' type + /* This rule is never used. */ + | ID BOGUS + ; + + This corrects the problem because it introduces the possibility of an +additional active rule in the context after the `ID' at the beginning of +`return_spec'. This rule is not active in the corresponding context in +a `param_spec', so the two contexts receive distinct parser states. As +long as the token `BOGUS' is never generated by `yylex', the added rule +cannot alter the way actual input is parsed. + + In this particular example, there is another way to solve the +problem: rewrite the rule for `return_spec' to use `ID' directly +instead of via `name'. This also causes the two confusing contexts to +have different sets of active rules, because the one for `return_spec' +activates the altered rule for `return_spec' rather than the one for +`name'. + + param_spec: + type + | name_list ':' type + ; + return_spec: + type + | ID ':' type + ; + + For a more detailed exposition of LALR(1) parsers and parser +generators, please see: Frank DeRemer and Thomas Pennello, Efficient +Computation of LALR(1) Look-Ahead Sets, `ACM Transactions on +Programming Languages and Systems', Vol. 4, No. 4 (October 1982), pp. +615-649 `http://doi.acm.org/10.1145/69622.357187'. + + +File: bison.info, Node: Generalized LR Parsing, Next: Memory Management, Prev: Mystery Conflicts, Up: Algorithm + +5.8 Generalized LR (GLR) Parsing +================================ + +Bison produces _deterministic_ parsers that choose uniquely when to +reduce and which reduction to apply based on a summary of the preceding +input and on one extra token of lookahead. As a result, normal Bison +handles a proper subset of the family of context-free languages. +Ambiguous grammars, since they have strings with more than one possible +sequence of reductions cannot have deterministic parsers in this sense. +The same is true of languages that require more than one symbol of +lookahead, since the parser lacks the information necessary to make a +decision at the point it must be made in a shift-reduce parser. +Finally, as previously mentioned (*note Mystery Conflicts::), there are +languages where Bison's particular choice of how to summarize the input +seen so far loses necessary information. + + When you use the `%glr-parser' declaration in your grammar file, +Bison generates a parser that uses a different algorithm, called +Generalized LR (or GLR). A Bison GLR parser uses the same basic +algorithm for parsing as an ordinary Bison parser, but behaves +differently in cases where there is a shift-reduce conflict that has not +been resolved by precedence rules (*note Precedence::) or a +reduce-reduce conflict. When a GLR parser encounters such a situation, +it effectively _splits_ into a several parsers, one for each possible +shift or reduction. These parsers then proceed as usual, consuming +tokens in lock-step. Some of the stacks may encounter other conflicts +and split further, with the result that instead of a sequence of states, +a Bison GLR parsing stack is what is in effect a tree of states. + + In effect, each stack represents a guess as to what the proper parse +is. Additional input may indicate that a guess was wrong, in which case +the appropriate stack silently disappears. Otherwise, the semantics +actions generated in each stack are saved, rather than being executed +immediately. When a stack disappears, its saved semantic actions never +get executed. When a reduction causes two stacks to become equivalent, +their sets of semantic actions are both saved with the state that +results from the reduction. We say that two stacks are equivalent when +they both represent the same sequence of states, and each pair of +corresponding states represents a grammar symbol that produces the same +segment of the input token stream. + + Whenever the parser makes a transition from having multiple states +to having one, it reverts to the normal LALR(1) parsing algorithm, +after resolving and executing the saved-up actions. At this +transition, some of the states on the stack will have semantic values +that are sets (actually multisets) of possible actions. The parser +tries to pick one of the actions by first finding one whose rule has +the highest dynamic precedence, as set by the `%dprec' declaration. +Otherwise, if the alternative actions are not ordered by precedence, +but there the same merging function is declared for both rules by the +`%merge' declaration, Bison resolves and evaluates both and then calls +the merge function on the result. Otherwise, it reports an ambiguity. + + It is possible to use a data structure for the GLR parsing tree that +permits the processing of any LALR(1) grammar in linear time (in the +size of the input), any unambiguous (not necessarily LALR(1)) grammar in +quadratic worst-case time, and any general (possibly ambiguous) +context-free grammar in cubic worst-case time. However, Bison currently +uses a simpler data structure that requires time proportional to the +length of the input times the maximum number of stacks required for any +prefix of the input. Thus, really ambiguous or nondeterministic +grammars can require exponential time and space to process. Such badly +behaving examples, however, are not generally of practical interest. +Usually, nondeterminism in a grammar is local--the parser is "in doubt" +only for a few tokens at a time. Therefore, the current data structure +should generally be adequate. On LALR(1) portions of a grammar, in +particular, it is only slightly slower than with the default Bison +parser. + + For a more detailed exposition of GLR parsers, please see: Elizabeth +Scott, Adrian Johnstone and Shamsa Sadaf Hussain, Tomita-Style +Generalised LR Parsers, Royal Holloway, University of London, +Department of Computer Science, TR-00-12, +`http://www.cs.rhul.ac.uk/research/languages/publications/tomita_style_1.ps', +(2000-12-24). + + +File: bison.info, Node: Memory Management, Prev: Generalized LR Parsing, Up: Algorithm + +5.9 Memory Management, and How to Avoid Memory Exhaustion +========================================================= + +The Bison parser stack can run out of memory if too many tokens are +shifted and not reduced. When this happens, the parser function +`yyparse' calls `yyerror' and then returns 2. + + Because Bison parsers have growing stacks, hitting the upper limit +usually results from using a right recursion instead of a left +recursion, *Note Recursive Rules: Recursion. + + By defining the macro `YYMAXDEPTH', you can control how deep the +parser stack can become before memory is exhausted. Define the macro +with a value that is an integer. This value is the maximum number of +tokens that can be shifted (and not reduced) before overflow. + + The stack space allowed is not necessarily allocated. If you +specify a large value for `YYMAXDEPTH', the parser normally allocates a +small stack at first, and then makes it bigger by stages as needed. +This increasing allocation happens automatically and silently. +Therefore, you do not need to make `YYMAXDEPTH' painfully small merely +to save space for ordinary inputs that do not need much stack. + + However, do not allow `YYMAXDEPTH' to be a value so large that +arithmetic overflow could occur when calculating the size of the stack +space. Also, do not allow `YYMAXDEPTH' to be less than `YYINITDEPTH'. + + The default value of `YYMAXDEPTH', if you do not define it, is 10000. + + You can control how much stack is allocated initially by defining the +macro `YYINITDEPTH' to a positive integer. For the C LALR(1) parser, +this value must be a compile-time constant unless you are assuming C99 +or some other target language or compiler that allows variable-length +arrays. The default is 200. + + Do not allow `YYINITDEPTH' to be greater than `YYMAXDEPTH'. + + Because of semantical differences between C and C++, the LALR(1) +parsers in C produced by Bison cannot grow when compiled by C++ +compilers. In this precise case (compiling a C parser as C++) you are +suggested to grow `YYINITDEPTH'. The Bison maintainers hope to fix +this deficiency in a future release. + + +File: bison.info, Node: Error Recovery, Next: Context Dependency, Prev: Algorithm, Up: Top + +6 Error Recovery +**************** + +It is not usually acceptable to have a program terminate on a syntax +error. For example, a compiler should recover sufficiently to parse the +rest of the input file and check it for errors; a calculator should +accept another expression. + + In a simple interactive command parser where each input is one line, +it may be sufficient to allow `yyparse' to return 1 on error and have +the caller ignore the rest of the input line when that happens (and +then call `yyparse' again). But this is inadequate for a compiler, +because it forgets all the syntactic context leading up to the error. +A syntax error deep within a function in the compiler input should not +cause the compiler to treat the following line like the beginning of a +source file. + + You can define how to recover from a syntax error by writing rules to +recognize the special token `error'. This is a terminal symbol that is +always defined (you need not declare it) and reserved for error +handling. The Bison parser generates an `error' token whenever a +syntax error happens; if you have provided a rule to recognize this +token in the current context, the parse can continue. + + For example: + + stmnts: /* empty string */ + | stmnts '\n' + | stmnts exp '\n' + | stmnts error '\n' + + The fourth rule in this example says that an error followed by a +newline makes a valid addition to any `stmnts'. + + What happens if a syntax error occurs in the middle of an `exp'? The +error recovery rule, interpreted strictly, applies to the precise +sequence of a `stmnts', an `error' and a newline. If an error occurs in +the middle of an `exp', there will probably be some additional tokens +and subexpressions on the stack after the last `stmnts', and there will +be tokens to read before the next newline. So the rule is not +applicable in the ordinary way. + + But Bison can force the situation to fit the rule, by discarding +part of the semantic context and part of the input. First it discards +states and objects from the stack until it gets back to a state in +which the `error' token is acceptable. (This means that the +subexpressions already parsed are discarded, back to the last complete +`stmnts'.) At this point the `error' token can be shifted. Then, if +the old lookahead token is not acceptable to be shifted next, the +parser reads tokens and discards them until it finds a token which is +acceptable. In this example, Bison reads and discards input until the +next newline so that the fourth rule can apply. Note that discarded +symbols are possible sources of memory leaks, see *note Freeing +Discarded Symbols: Destructor Decl, for a means to reclaim this memory. + + The choice of error rules in the grammar is a choice of strategies +for error recovery. A simple and useful strategy is simply to skip the +rest of the current input line or current statement if an error is +detected: + + stmnt: error ';' /* On error, skip until ';' is read. */ + + It is also useful to recover to the matching close-delimiter of an +opening-delimiter that has already been parsed. Otherwise the +close-delimiter will probably appear to be unmatched, and generate +another, spurious error message: + + primary: '(' expr ')' + | '(' error ')' + ... + ; + + Error recovery strategies are necessarily guesses. When they guess +wrong, one syntax error often leads to another. In the above example, +the error recovery rule guesses that an error is due to bad input +within one `stmnt'. Suppose that instead a spurious semicolon is +inserted in the middle of a valid `stmnt'. After the error recovery +rule recovers from the first error, another syntax error will be found +straightaway, since the text following the spurious semicolon is also +an invalid `stmnt'. + + To prevent an outpouring of error messages, the parser will output +no error message for another syntax error that happens shortly after +the first; only after three consecutive input tokens have been +successfully shifted will error messages resume. + + Note that rules which accept the `error' token may have actions, just +as any other rules can. + + You can make error messages resume immediately by using the macro +`yyerrok' in an action. If you do this in the error rule's action, no +error messages will be suppressed. This macro requires no arguments; +`yyerrok;' is a valid C statement. + + The previous lookahead token is reanalyzed immediately after an +error. If this is unacceptable, then the macro `yyclearin' may be used +to clear this token. Write the statement `yyclearin;' in the error +rule's action. *Note Special Features for Use in Actions: Action +Features. + + For example, suppose that on a syntax error, an error handling +routine is called that advances the input stream to some point where +parsing should once again commence. The next symbol returned by the +lexical scanner is probably correct. The previous lookahead token +ought to be discarded with `yyclearin;'. + + The expression `YYRECOVERING ()' yields 1 when the parser is +recovering from a syntax error, and 0 otherwise. Syntax error +diagnostics are suppressed while recovering from a syntax error. + + +File: bison.info, Node: Context Dependency, Next: Debugging, Prev: Error Recovery, Up: Top + +7 Handling Context Dependencies +******************************* + +The Bison paradigm is to parse tokens first, then group them into larger +syntactic units. In many languages, the meaning of a token is affected +by its context. Although this violates the Bison paradigm, certain +techniques (known as "kludges") may enable you to write Bison parsers +for such languages. + +* Menu: + +* Semantic Tokens:: Token parsing can depend on the semantic context. +* Lexical Tie-ins:: Token parsing can depend on the syntactic context. +* Tie-in Recovery:: Lexical tie-ins have implications for how + error recovery rules must be written. + + (Actually, "kludge" means any technique that gets its job done but is +neither clean nor robust.) + + +File: bison.info, Node: Semantic Tokens, Next: Lexical Tie-ins, Up: Context Dependency + +7.1 Semantic Info in Token Types +================================ + +The C language has a context dependency: the way an identifier is used +depends on what its current meaning is. For example, consider this: + + foo (x); + + This looks like a function call statement, but if `foo' is a typedef +name, then this is actually a declaration of `x'. How can a Bison +parser for C decide how to parse this input? + + The method used in GNU C is to have two different token types, +`IDENTIFIER' and `TYPENAME'. When `yylex' finds an identifier, it +looks up the current declaration of the identifier in order to decide +which token type to return: `TYPENAME' if the identifier is declared as +a typedef, `IDENTIFIER' otherwise. + + The grammar rules can then express the context dependency by the +choice of token type to recognize. `IDENTIFIER' is accepted as an +expression, but `TYPENAME' is not. `TYPENAME' can start a declaration, +but `IDENTIFIER' cannot. In contexts where the meaning of the +identifier is _not_ significant, such as in declarations that can +shadow a typedef name, either `TYPENAME' or `IDENTIFIER' is +accepted--there is one rule for each of the two token types. + + This technique is simple to use if the decision of which kinds of +identifiers to allow is made at a place close to where the identifier is +parsed. But in C this is not always so: C allows a declaration to +redeclare a typedef name provided an explicit type has been specified +earlier: + + typedef int foo, bar; + int baz (void) + { + static bar (bar); /* redeclare `bar' as static variable */ + extern foo foo (foo); /* redeclare `foo' as function */ + return foo (bar); + } + + Unfortunately, the name being declared is separated from the +declaration construct itself by a complicated syntactic structure--the +"declarator". + + As a result, part of the Bison parser for C needs to be duplicated, +with all the nonterminal names changed: once for parsing a declaration +in which a typedef name can be redefined, and once for parsing a +declaration in which that can't be done. Here is a part of the +duplication, with actions omitted for brevity: + + initdcl: + declarator maybeasm '=' + init + | declarator maybeasm + ; + + notype_initdcl: + notype_declarator maybeasm '=' + init + | notype_declarator maybeasm + ; + +Here `initdcl' can redeclare a typedef name, but `notype_initdcl' +cannot. The distinction between `declarator' and `notype_declarator' +is the same sort of thing. + + There is some similarity between this technique and a lexical tie-in +(described next), in that information which alters the lexical analysis +is changed during parsing by other parts of the program. The +difference is here the information is global, and is used for other +purposes in the program. A true lexical tie-in has a special-purpose +flag controlled by the syntactic context. + + +File: bison.info, Node: Lexical Tie-ins, Next: Tie-in Recovery, Prev: Semantic Tokens, Up: Context Dependency + +7.2 Lexical Tie-ins +=================== + +One way to handle context-dependency is the "lexical tie-in": a flag +which is set by Bison actions, whose purpose is to alter the way tokens +are parsed. + + For example, suppose we have a language vaguely like C, but with a +special construct `hex (HEX-EXPR)'. After the keyword `hex' comes an +expression in parentheses in which all integers are hexadecimal. In +particular, the token `a1b' must be treated as an integer rather than +as an identifier if it appears in that context. Here is how you can do +it: + + %{ + int hexflag; + int yylex (void); + void yyerror (char const *); + %} + %% + ... + expr: IDENTIFIER + | constant + | HEX '(' + { hexflag = 1; } + expr ')' + { hexflag = 0; + $$ = $4; } + | expr '+' expr + { $$ = make_sum ($1, $3); } + ... + ; + + constant: + INTEGER + | STRING + ; + +Here we assume that `yylex' looks at the value of `hexflag'; when it is +nonzero, all integers are parsed in hexadecimal, and tokens starting +with letters are parsed as integers if possible. + + The declaration of `hexflag' shown in the prologue of the parser file +is needed to make it accessible to the actions (*note The Prologue: +Prologue.). You must also write the code in `yylex' to obey the flag. + + +File: bison.info, Node: Tie-in Recovery, Prev: Lexical Tie-ins, Up: Context Dependency + +7.3 Lexical Tie-ins and Error Recovery +====================================== + +Lexical tie-ins make strict demands on any error recovery rules you +have. *Note Error Recovery::. + + The reason for this is that the purpose of an error recovery rule is +to abort the parsing of one construct and resume in some larger +construct. For example, in C-like languages, a typical error recovery +rule is to skip tokens until the next semicolon, and then start a new +statement, like this: + + stmt: expr ';' + | IF '(' expr ')' stmt { ... } + ... + error ';' + { hexflag = 0; } + ; + + If there is a syntax error in the middle of a `hex (EXPR)' +construct, this error rule will apply, and then the action for the +completed `hex (EXPR)' will never run. So `hexflag' would remain set +for the entire rest of the input, or until the next `hex' keyword, +causing identifiers to be misinterpreted as integers. + + To avoid this problem the error recovery rule itself clears +`hexflag'. + + There may also be an error recovery rule that works within +expressions. For example, there could be a rule which applies within +parentheses and skips to the close-parenthesis: + + expr: ... + | '(' expr ')' + { $$ = $2; } + | '(' error ')' + ... + + If this rule acts within the `hex' construct, it is not going to +abort that construct (since it applies to an inner level of parentheses +within the construct). Therefore, it should not clear the flag: the +rest of the `hex' construct should be parsed with the flag still in +effect. + + What if there is an error recovery rule which might abort out of the +`hex' construct or might not, depending on circumstances? There is no +way you can write the action to determine whether a `hex' construct is +being aborted or not. So if you are using a lexical tie-in, you had +better make sure your error recovery rules are not of this kind. Each +rule must be such that you can be sure that it always will, or always +won't, have to clear the flag. + + +File: bison.info, Node: Debugging, Next: Invocation, Prev: Context Dependency, Up: Top + +8 Debugging Your Parser +*********************** + +Developing a parser can be a challenge, especially if you don't +understand the algorithm (*note The Bison Parser Algorithm: +Algorithm.). Even so, sometimes a detailed description of the automaton +can help (*note Understanding Your Parser: Understanding.), or tracing +the execution of the parser can give some insight on why it behaves +improperly (*note Tracing Your Parser: Tracing.). + +* Menu: + +* Understanding:: Understanding the structure of your parser. +* Tracing:: Tracing the execution of your parser. + + +File: bison.info, Node: Understanding, Next: Tracing, Up: Debugging + +8.1 Understanding Your Parser +============================= + +As documented elsewhere (*note The Bison Parser Algorithm: Algorithm.) +Bison parsers are "shift/reduce automata". In some cases (much more +frequent than one would hope), looking at this automaton is required to +tune or simply fix a parser. Bison provides two different +representation of it, either textually or graphically (as a DOT file). + + The textual file is generated when the options `--report' or +`--verbose' are specified, see *Note Invoking Bison: Invocation. Its +name is made by removing `.tab.c' or `.c' from the parser output file +name, and adding `.output' instead. Therefore, if the input file is +`foo.y', then the parser file is called `foo.tab.c' by default. As a +consequence, the verbose output file is called `foo.output'. + + The following grammar file, `calc.y', will be used in the sequel: + + %token NUM STR + %left '+' '-' + %left '*' + %% + exp: exp '+' exp + | exp '-' exp + | exp '*' exp + | exp '/' exp + | NUM + ; + useless: STR; + %% + + `bison' reports: + + calc.y: warning: 1 nonterminal and 1 rule useless in grammar + calc.y:11.1-7: warning: nonterminal useless in grammar: useless + calc.y:11.10-12: warning: rule useless in grammar: useless: STR + calc.y: conflicts: 7 shift/reduce + + When given `--report=state', in addition to `calc.tab.c', it creates +a file `calc.output' with contents detailed below. The order of the +output and the exact presentation might vary, but the interpretation is +the same. + + The first section includes details on conflicts that were solved +thanks to precedence and/or associativity: + + Conflict in state 8 between rule 2 and token '+' resolved as reduce. + Conflict in state 8 between rule 2 and token '-' resolved as reduce. + Conflict in state 8 between rule 2 and token '*' resolved as shift. +... + + +The next section lists states that still have conflicts. + + State 8 conflicts: 1 shift/reduce + State 9 conflicts: 1 shift/reduce + State 10 conflicts: 1 shift/reduce + State 11 conflicts: 4 shift/reduce + +The next section reports useless tokens, nonterminal and rules. Useless +nonterminals and rules are removed in order to produce a smaller parser, +but useless tokens are preserved, since they might be used by the +scanner (note the difference between "useless" and "unused" below): + + Nonterminals useless in grammar: + useless + + Terminals unused in grammar: + STR + + Rules useless in grammar: + #6 useless: STR; + +The next section reproduces the exact grammar that Bison used: + + Grammar + + Number, Line, Rule + 0 5 $accept -> exp $end + 1 5 exp -> exp '+' exp + 2 6 exp -> exp '-' exp + 3 7 exp -> exp '*' exp + 4 8 exp -> exp '/' exp + 5 9 exp -> NUM + +and reports the uses of the symbols: + + Terminals, with rules where they appear + + $end (0) 0 + '*' (42) 3 + '+' (43) 1 + '-' (45) 2 + '/' (47) 4 + error (256) + NUM (258) 5 + + Nonterminals, with rules where they appear + + $accept (8) + on left: 0 + exp (9) + on left: 1 2 3 4 5, on right: 0 1 2 3 4 + +Bison then proceeds onto the automaton itself, describing each state +with it set of "items", also known as "pointed rules". Each item is a +production rule together with a point (marked by `.') that the input +cursor. + + state 0 + + $accept -> . exp $ (rule 0) + + NUM shift, and go to state 1 + + exp go to state 2 + + This reads as follows: "state 0 corresponds to being at the very +beginning of the parsing, in the initial rule, right before the start +symbol (here, `exp'). When the parser returns to this state right +after having reduced a rule that produced an `exp', the control flow +jumps to state 2. If there is no such transition on a nonterminal +symbol, and the lookahead is a `NUM', then this token is shifted on the +parse stack, and the control flow jumps to state 1. Any other +lookahead triggers a syntax error." + + Even though the only active rule in state 0 seems to be rule 0, the +report lists `NUM' as a lookahead token because `NUM' can be at the +beginning of any rule deriving an `exp'. By default Bison reports the +so-called "core" or "kernel" of the item set, but if you want to see +more detail you can invoke `bison' with `--report=itemset' to list all +the items, include those that can be derived: + + state 0 + + $accept -> . exp $ (rule 0) + exp -> . exp '+' exp (rule 1) + exp -> . exp '-' exp (rule 2) + exp -> . exp '*' exp (rule 3) + exp -> . exp '/' exp (rule 4) + exp -> . NUM (rule 5) + + NUM shift, and go to state 1 + + exp go to state 2 + +In the state 1... + + state 1 + + exp -> NUM . (rule 5) + + $default reduce using rule 5 (exp) + +the rule 5, `exp: NUM;', is completed. Whatever the lookahead token +(`$default'), the parser will reduce it. If it was coming from state +0, then, after this reduction it will return to state 0, and will jump +to state 2 (`exp: go to state 2'). + + state 2 + + $accept -> exp . $ (rule 0) + exp -> exp . '+' exp (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + + $ shift, and go to state 3 + '+' shift, and go to state 4 + '-' shift, and go to state 5 + '*' shift, and go to state 6 + '/' shift, and go to state 7 + +In state 2, the automaton can only shift a symbol. For instance, +because of the item `exp -> exp . '+' exp', if the lookahead if `+', it +will be shifted on the parse stack, and the automaton control will jump +to state 4, corresponding to the item `exp -> exp '+' . exp'. Since +there is no default action, any other token than those listed above +will trigger a syntax error. + + The state 3 is named the "final state", or the "accepting state": + + state 3 + + $accept -> exp $ . (rule 0) + + $default accept + +the initial rule is completed (the start symbol and the end of input +were read), the parsing exits successfully. + + The interpretation of states 4 to 7 is straightforward, and is left +to the reader. + + state 4 + + exp -> exp '+' . exp (rule 1) + + NUM shift, and go to state 1 + + exp go to state 8 + + state 5 + + exp -> exp '-' . exp (rule 2) + + NUM shift, and go to state 1 + + exp go to state 9 + + state 6 + + exp -> exp '*' . exp (rule 3) + + NUM shift, and go to state 1 + + exp go to state 10 + + state 7 + + exp -> exp '/' . exp (rule 4) + + NUM shift, and go to state 1 + + exp go to state 11 + + As was announced in beginning of the report, `State 8 conflicts: 1 +shift/reduce': + + state 8 + + exp -> exp . '+' exp (rule 1) + exp -> exp '+' exp . (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) + + Indeed, there are two actions associated to the lookahead `/': +either shifting (and going to state 7), or reducing rule 1. The +conflict means that either the grammar is ambiguous, or the parser lacks +information to make the right decision. Indeed the grammar is +ambiguous, as, since we did not specify the precedence of `/', the +sentence `NUM + NUM / NUM' can be parsed as `NUM + (NUM / NUM)', which +corresponds to shifting `/', or as `(NUM + NUM) / NUM', which +corresponds to reducing rule 1. + + Because in LALR(1) parsing a single decision can be made, Bison +arbitrarily chose to disable the reduction, see *note Shift/Reduce +Conflicts: Shift/Reduce. Discarded actions are reported in between +square brackets. + + Note that all the previous states had a single possible action: +either shifting the next token and going to the corresponding state, or +reducing a single rule. In the other cases, i.e., when shifting _and_ +reducing is possible or when _several_ reductions are possible, the +lookahead is required to select the action. State 8 is one such state: +if the lookahead is `*' or `/' then the action is shifting, otherwise +the action is reducing rule 1. In other words, the first two items, +corresponding to rule 1, are not eligible when the lookahead token is +`*', since we specified that `*' has higher precedence than `+'. More +generally, some items are eligible only with some set of possible +lookahead tokens. When run with `--report=lookahead', Bison specifies +these lookahead tokens: + + state 8 + + exp -> exp . '+' exp (rule 1) + exp -> exp '+' exp . [$, '+', '-', '/'] (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) + + The remaining states are similar: + + state 9 + + exp -> exp . '+' exp (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp '-' exp . (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 2 (exp)] + $default reduce using rule 2 (exp) + + state 10 + + exp -> exp . '+' exp (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp '*' exp . (rule 3) + exp -> exp . '/' exp (rule 4) + + '/' shift, and go to state 7 + + '/' [reduce using rule 3 (exp)] + $default reduce using rule 3 (exp) + + state 11 + + exp -> exp . '+' exp (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + exp -> exp '/' exp . (rule 4) + + '+' shift, and go to state 4 + '-' shift, and go to state 5 + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '+' [reduce using rule 4 (exp)] + '-' [reduce using rule 4 (exp)] + '*' [reduce using rule 4 (exp)] + '/' [reduce using rule 4 (exp)] + $default reduce using rule 4 (exp) + +Observe that state 11 contains conflicts not only due to the lack of +precedence of `/' with respect to `+', `-', and `*', but also because +the associativity of `/' is not specified. + + +File: bison.info, Node: Tracing, Prev: Understanding, Up: Debugging + +8.2 Tracing Your Parser +======================= + +If a Bison grammar compiles properly but doesn't do what you want when +it runs, the `yydebug' parser-trace feature can help you figure out why. + + There are several means to enable compilation of trace facilities: + +the macro `YYDEBUG' + Define the macro `YYDEBUG' to a nonzero value when you compile the + parser. This is compliant with POSIX Yacc. You could use + `-DYYDEBUG=1' as a compiler option or you could put `#define + YYDEBUG 1' in the prologue of the grammar file (*note The + Prologue: Prologue.). + +the option `-t', `--debug' + Use the `-t' option when you run Bison (*note Invoking Bison: + Invocation.). This is POSIX compliant too. + +the directive `%debug' + Add the `%debug' directive (*note Bison Declaration Summary: Decl + Summary.). This is a Bison extension, which will prove useful + when Bison will output parsers for languages that don't use a + preprocessor. Unless POSIX and Yacc portability matter to you, + this is the preferred solution. + + We suggest that you always enable the debug option so that debugging +is always possible. + + The trace facility outputs messages with macro calls of the form +`YYFPRINTF (stderr, FORMAT, ARGS)' where FORMAT and ARGS are the usual +`printf' format and variadic arguments. If you define `YYDEBUG' to a +nonzero value but do not define `YYFPRINTF', `' is +automatically included and `YYFPRINTF' is defined to `fprintf'. + + Once you have compiled the program with trace facilities, the way to +request a trace is to store a nonzero value in the variable `yydebug'. +You can do this by making the C code do it (in `main', perhaps), or you +can alter the value with a C debugger. + + Each step taken by the parser when `yydebug' is nonzero produces a +line or two of trace information, written on `stderr'. The trace +messages tell you these things: + + * Each time the parser calls `yylex', what kind of token was read. + + * Each time a token is shifted, the depth and complete contents of + the state stack (*note Parser States::). + + * Each time a rule is reduced, which rule it is, and the complete + contents of the state stack afterward. + + To make sense of this information, it helps to refer to the listing +file produced by the Bison `-v' option (*note Invoking Bison: +Invocation.). This file shows the meaning of each state in terms of +positions in various rules, and also what each state will do with each +possible input token. As you read the successive trace messages, you +can see that the parser is functioning according to its specification in +the listing file. Eventually you will arrive at the place where +something undesirable happens, and you will see which parts of the +grammar are to blame. + + The parser file is a C program and you can use C debuggers on it, +but it's not easy to interpret what it is doing. The parser function +is a finite-state machine interpreter, and aside from the actions it +executes the same code over and over. Only the values of variables +show where in the grammar it is working. + + The debugging information normally gives the token type of each token +read, but not its semantic value. You can optionally define a macro +named `YYPRINT' to provide a way to print the value. If you define +`YYPRINT', it should take three arguments. The parser will pass a +standard I/O stream, the numeric code for the token type, and the token +value (from `yylval'). + + Here is an example of `YYPRINT' suitable for the multi-function +calculator (*note Declarations for `mfcalc': Mfcalc Declarations.): + + %{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(file, type, value) print_token_value (file, type, value) + %} + + ... %% ... %% ... + + static void + print_token_value (FILE *file, int type, YYSTYPE value) + { + if (type == VAR) + fprintf (file, "%s", value.tptr->name); + else if (type == NUM) + fprintf (file, "%d", value.val); + } + + +File: bison.info, Node: Invocation, Next: Other Languages, Prev: Debugging, Up: Top + +9 Invoking Bison +**************** + +The usual way to invoke Bison is as follows: + + bison INFILE + + Here INFILE is the grammar file name, which usually ends in `.y'. +The parser file's name is made by replacing the `.y' with `.tab.c' and +removing any leading directory. Thus, the `bison foo.y' file name +yields `foo.tab.c', and the `bison hack/foo.y' file name yields +`foo.tab.c'. It's also possible, in case you are writing C++ code +instead of C in your grammar file, to name it `foo.ypp' or `foo.y++'. +Then, the output files will take an extension like the given one as +input (respectively `foo.tab.cpp' and `foo.tab.c++'). This feature +takes effect with all options that manipulate file names like `-o' or +`-d'. + + For example : + + bison -d INFILE.YXX + will produce `infile.tab.cxx' and `infile.tab.hxx', and + + bison -d -o OUTPUT.C++ INFILE.Y + will produce `output.c++' and `outfile.h++'. + + For compatibility with POSIX, the standard Bison distribution also +contains a shell script called `yacc' that invokes Bison with the `-y' +option. + +* Menu: + +* Bison Options:: All the options described in detail, + in alphabetical order by short options. +* Option Cross Key:: Alphabetical list of long options. +* Yacc Library:: Yacc-compatible `yylex' and `main'. + + +File: bison.info, Node: Bison Options, Next: Option Cross Key, Up: Invocation + +9.1 Bison Options +================= + +Bison supports both traditional single-letter options and mnemonic long +option names. Long option names are indicated with `--' instead of +`-'. Abbreviations for option names are allowed as long as they are +unique. When a long option takes an argument, like `--file-prefix', +connect the option name and the argument with `='. + + Here is a list of options that can be used with Bison, alphabetized +by short option. It is followed by a cross key alphabetized by long +option. + +Operations modes: +`-h' +`--help' + Print a summary of the command-line options to Bison and exit. + +`-V' +`--version' + Print the version number of Bison and exit. + +`--print-localedir' + Print the name of the directory containing locale-dependent data. + +`--print-datadir' + Print the name of the directory containing skeletons and XSLT. + +`-y' +`--yacc' + Act more like the traditional Yacc command. This can cause + different diagnostics to be generated, and may change behavior in + other minor ways. Most importantly, imitate Yacc's output file + name conventions, so that the parser output file is called + `y.tab.c', and the other outputs are called `y.output' and + `y.tab.h'. Also, if generating an LALR(1) parser in C, generate + `#define' statements in addition to an `enum' to associate token + numbers with token names. Thus, the following shell script can + substitute for Yacc, and the Bison distribution contains such a + script for compatibility with POSIX: + + #! /bin/sh + bison -y "$@" + + The `-y'/`--yacc' option is intended for use with traditional Yacc + grammars. If your grammar uses a Bison extension like + `%glr-parser', Bison might not be Yacc-compatible even if this + option is specified. + +`-W' +`--warnings' + Output warnings falling in CATEGORY. CATEGORY can be one of: + `midrule-values' + Warn about mid-rule values that are set but not used within + any of the actions of the parent rule. For example, warn + about unused `$2' in: + + exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; }; + + Also warn about mid-rule values that are used but not set. + For example, warn about unset `$$' in the mid-rule action in: + + exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; }; + + These warnings are not enabled by default since they + sometimes prove to be false alarms in existing grammars + employing the Yacc constructs `$0' or `$-N' (where N is some + positive integer). + + `yacc' + Incompatibilities with POSIX Yacc. + + `all' + All the warnings. + + `none' + Turn off all the warnings. + + `error' + Treat warnings as errors. + + A category can be turned off by prefixing its name with `no-'. For + instance, `-Wno-syntax' will hide the warnings about unused + variables. + +Tuning the parser: + +`-t' +`--debug' + In the parser file, define the macro `YYDEBUG' to 1 if it is not + already defined, so that the debugging facilities are compiled. + *Note Tracing Your Parser: Tracing. + +`-L LANGUAGE' +`--language=LANGUAGE' + Specify the programming language for the generated parser, as if + `%language' was specified (*note Bison Declaration Summary: Decl + Summary.). Currently supported languages include C, C++, and Java. + LANGUAGE is case-insensitive. + + This option is experimental and its effect may be modified in + future releases. + +`--locations' + Pretend that `%locations' was specified. *Note Decl Summary::. + +`-p PREFIX' +`--name-prefix=PREFIX' + Pretend that `%name-prefix "PREFIX"' was specified. *Note Decl + Summary::. + +`-l' +`--no-lines' + Don't put any `#line' preprocessor commands in the parser file. + Ordinarily Bison puts them in the parser file so that the C + compiler and debuggers will associate errors with your source + file, the grammar file. This option causes them to associate + errors with the parser file, treating it as an independent source + file in its own right. + +`-S FILE' +`--skeleton=FILE' + Specify the skeleton to use, similar to `%skeleton' (*note Bison + Declaration Summary: Decl Summary.). + + If FILE does not contain a `/', FILE is the name of a skeleton + file in the Bison installation directory. If it does, FILE is an + absolute file name or a file name relative to the current working + directory. This is similar to how most shells resolve commands. + +`-k' +`--token-table' + Pretend that `%token-table' was specified. *Note Decl Summary::. + +Adjust the output: + +`--defines[=FILE]' + Pretend that `%defines' was specified, i.e., write an extra output + file containing macro definitions for the token type names defined + in the grammar, as well as a few other declarations. *Note Decl + Summary::. + +`-d' + This is the same as `--defines' except `-d' does not accept a FILE + argument since POSIX Yacc requires that `-d' can be bundled with + other short options. + +`-b FILE-PREFIX' +`--file-prefix=PREFIX' + Pretend that `%file-prefix' was specified, i.e., specify prefix to + use for all Bison output file names. *Note Decl Summary::. + +`-r THINGS' +`--report=THINGS' + Write an extra output file containing verbose description of the + comma separated list of THINGS among: + + `state' + Description of the grammar, conflicts (resolved and + unresolved), and LALR automaton. + + `lookahead' + Implies `state' and augments the description of the automaton + with each rule's lookahead set. + + `itemset' + Implies `state' and augments the description of the automaton + with the full set of items for each state, instead of its + core only. + +`--report-file=FILE' + Specify the FILE for the verbose description. + +`-v' +`--verbose' + Pretend that `%verbose' was specified, i.e., write an extra output + file containing verbose descriptions of the grammar and parser. + *Note Decl Summary::. + +`-o FILE' +`--output=FILE' + Specify the FILE for the parser file. + + The other output files' names are constructed from FILE as + described under the `-v' and `-d' options. + +`-g[FILE]' +`--graph[=FILE]' + Output a graphical representation of the LALR(1) grammar automaton + computed by Bison, in Graphviz (http://www.graphviz.org/) DOT + (http://www.graphviz.org/doc/info/lang.html) format. `FILE' is + optional. If omitted and the grammar file is `foo.y', the output + file will be `foo.dot'. + +`-x[FILE]' +`--xml[=FILE]' + Output an XML report of the LALR(1) automaton computed by Bison. + `FILE' is optional. If omitted and the grammar file is `foo.y', + the output file will be `foo.xml'. (The current XML schema is + experimental and may evolve. More user feedback will help to + stabilize it.) + + +File: bison.info, Node: Option Cross Key, Next: Yacc Library, Prev: Bison Options, Up: Invocation + +9.2 Option Cross Key +==================== + +Here is a list of options, alphabetized by long option, to help you find +the corresponding short option. + +Long Option Short Option +------------------------------------------------- +`--debug' `-t' +`--defines=[FILE]' +`--file-prefix=PREFIX' `-b' PREFIX +`--graph=[FILE]' `-g' [FILE] +`--help' `-h' +`--language=LANGUAGE' `-L' LANGUAGE +`--locations' +`--name-prefix=PREFIX' `-p' PREFIX +`--no-lines' `-l' +`--output=FILE' `-o' FILE +`--print-datadir' +`--print-localedir' +`--report-file=FILE' +`--report=THINGS' `-r' THINGS +`--skeleton=FILE' `-S' FILE +`--token-table' `-k' +`--verbose' `-v' +`--version' `-V' +`--warnings' `-W' +`--xml=[FILE]' `-x' [FILE] +`--yacc' `-y' + + +File: bison.info, Node: Yacc Library, Prev: Option Cross Key, Up: Invocation + +9.3 Yacc Library +================ + +The Yacc library contains default implementations of the `yyerror' and +`main' functions. These default implementations are normally not +useful, but POSIX requires them. To use the Yacc library, link your +program with the `-ly' option. Note that Bison's implementation of the +Yacc library is distributed under the terms of the GNU General Public +License (*note Copying::). + + If you use the Yacc library's `yyerror' function, you should declare +`yyerror' as follows: + + int yyerror (char const *); + + Bison ignores the `int' value returned by this `yyerror'. If you +use the Yacc library's `main' function, your `yyparse' function should +have the following type signature: + + int yyparse (void); + + +File: bison.info, Node: Other Languages, Next: FAQ, Prev: Invocation, Up: Top + +10 Parsers Written In Other Languages +************************************* + +* Menu: + +* C++ Parsers:: The interface to generate C++ parser classes +* Java Parsers:: The interface to generate Java parser classes + + +File: bison.info, Node: C++ Parsers, Next: Java Parsers, Up: Other Languages + +10.1 C++ Parsers +================ + +* Menu: + +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Interface:: Instantiating and running the parser +* C++ Scanner Interface:: Exchanges between yylex and parse +* A Complete C++ Example:: Demonstrating their use + + +File: bison.info, Node: C++ Bison Interface, Next: C++ Semantic Values, Up: C++ Parsers + +10.1.1 C++ Bison Interface +-------------------------- + +The C++ LALR(1) parser is selected using the skeleton directive, +`%skeleton "lalr1.c"', or the synonymous command-line option +`--skeleton=lalr1.c'. *Note Decl Summary::. + + When run, `bison' will create several entities in the `yy' namespace. Use +the `%define namespace' directive to change the namespace name, see +*note Decl Summary::. The various classes are generated in the +following files: + +`position.hh' +`location.hh' + The definition of the classes `position' and `location', used for + location tracking. *Note C++ Location Values::. + +`stack.hh' + An auxiliary class `stack' used by the parser. + +`FILE.hh' +`FILE.cc' + (Assuming the extension of the input file was `.yy'.) The + declaration and implementation of the C++ parser class. The + basename and extension of these two files follow the same rules as + with regular C parsers (*note Invocation::). + + The header is _mandatory_; you must either pass `-d'/`--defines' + to `bison', or use the `%defines' directive. + + All these files are documented using Doxygen; run `doxygen' for a +complete and accurate documentation. + + +File: bison.info, Node: C++ Semantic Values, Next: C++ Location Values, Prev: C++ Bison Interface, Up: C++ Parsers + +10.1.2 C++ Semantic Values +-------------------------- + +The `%union' directive works as for C, see *note The Collection of +Value Types: Union Decl. In particular it produces a genuine +`union'(1), which have a few specific features in C++. + - The type `YYSTYPE' is defined but its use is discouraged: rather + you should refer to the parser's encapsulated type + `yy::parser::semantic_type'. + + - Non POD (Plain Old Data) types cannot be used. C++ forbids any + instance of classes with constructors in unions: only _pointers_ + to such objects are allowed. + + Because objects have to be stored via pointers, memory is not +reclaimed automatically: using the `%destructor' directive is the only +means to avoid leaks. *Note Freeing Discarded Symbols: Destructor Decl. + + ---------- Footnotes ---------- + + (1) In the future techniques to allow complex types within +pseudo-unions (similar to Boost variants) might be implemented to +alleviate these issues. + + +File: bison.info, Node: C++ Location Values, Next: C++ Parser Interface, Prev: C++ Semantic Values, Up: C++ Parsers + +10.1.3 C++ Location Values +-------------------------- + +When the directive `%locations' is used, the C++ parser supports +location tracking, see *note Locations Overview: Locations. Two +auxiliary classes define a `position', a single point in a file, and a +`location', a range composed of a pair of `position's (possibly +spanning several files). + + -- Method on position: std::string* file + The name of the file. It will always be handled as a pointer, the + parser will never duplicate nor deallocate it. As an experimental + feature you may change it to `TYPE*' using `%define filename_type + "TYPE"'. + + -- Method on position: unsigned int line + The line, starting at 1. + + -- Method on position: unsigned int lines (int HEIGHT = 1) + Advance by HEIGHT lines, resetting the column number. + + -- Method on position: unsigned int column + The column, starting at 0. + + -- Method on position: unsigned int columns (int WIDTH = 1) + Advance by WIDTH columns, without changing the line number. + + -- Method on position: position& operator+= (position& POS, int WIDTH) + -- Method on position: position operator+ (const position& POS, int + WIDTH) + -- Method on position: position& operator-= (const position& POS, int + WIDTH) + -- Method on position: position operator- (position& POS, int WIDTH) + Various forms of syntactic sugar for `columns'. + + -- Method on position: position operator<< (std::ostream O, const + position& P) + Report P on O like this: `FILE:LINE.COLUMN', or `LINE.COLUMN' if + FILE is null. + + -- Method on location: position begin + -- Method on location: position end + The first, inclusive, position of the range, and the first beyond. + + -- Method on location: unsigned int columns (int WIDTH = 1) + -- Method on location: unsigned int lines (int HEIGHT = 1) + Advance the `end' position. + + -- Method on location: location operator+ (const location& BEGIN, + const location& END) + -- Method on location: location operator+ (const location& BEGIN, int + WIDTH) + -- Method on location: location operator+= (const location& LOC, int + WIDTH) + Various forms of syntactic sugar. + + -- Method on location: void step () + Move `begin' onto `end'. + + +File: bison.info, Node: C++ Parser Interface, Next: C++ Scanner Interface, Prev: C++ Location Values, Up: C++ Parsers + +10.1.4 C++ Parser Interface +--------------------------- + +The output files `OUTPUT.hh' and `OUTPUT.cc' declare and define the +parser class in the namespace `yy'. The class name defaults to +`parser', but may be changed using `%define parser_class_name "NAME"'. +The interface of this class is detailed below. It can be extended +using the `%parse-param' feature: its semantics is slightly changed +since it describes an additional member of the parser class, and an +additional argument for its constructor. + + -- Type of parser: semantic_value_type + -- Type of parser: location_value_type + The types for semantics value and locations. + + -- Method on parser: parser (TYPE1 ARG1, ...) + Build a new parser object. There are no arguments by default, + unless `%parse-param {TYPE1 ARG1}' was used. + + -- Method on parser: int parse () + Run the syntactic analysis, and return 0 on success, 1 otherwise. + + -- Method on parser: std::ostream& debug_stream () + -- Method on parser: void set_debug_stream (std::ostream& O) + Get or set the stream used for tracing the parsing. It defaults to + `std::cerr'. + + -- Method on parser: debug_level_type debug_level () + -- Method on parser: void set_debug_level (debug_level L) + Get or set the tracing level. Currently its value is either 0, no + trace, or nonzero, full tracing. + + -- Method on parser: void error (const location_type& L, const + std::string& M) + The definition for this member function must be supplied by the + user: the parser uses it to report a parser error occurring at L, + described by M. + + +File: bison.info, Node: C++ Scanner Interface, Next: A Complete C++ Example, Prev: C++ Parser Interface, Up: C++ Parsers + +10.1.5 C++ Scanner Interface +---------------------------- + +The parser invokes the scanner by calling `yylex'. Contrary to C +parsers, C++ parsers are always pure: there is no point in using the +`%define api.pure' directive. Therefore the interface is as follows. + + -- Method on parser: int yylex (semantic_value_type& YYLVAL, + location_type& YYLLOC, TYPE1 ARG1, ...) + Return the next token. Its type is the return value, its semantic + value and location being YYLVAL and YYLLOC. Invocations of + `%lex-param {TYPE1 ARG1}' yield additional arguments. + + +File: bison.info, Node: A Complete C++ Example, Prev: C++ Scanner Interface, Up: C++ Parsers + +10.1.6 A Complete C++ Example +----------------------------- + +This section demonstrates the use of a C++ parser with a simple but +complete example. This example should be available on your system, +ready to compile, in the directory "../bison/examples/calc++". It +focuses on the use of Bison, therefore the design of the various C++ +classes is very naive: no accessors, no encapsulation of members etc. +We will use a Lex scanner, and more precisely, a Flex scanner, to +demonstrate the various interaction. A hand written scanner is +actually easier to interface with. + +* Menu: + +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band + + +File: bison.info, Node: Calc++ --- C++ Calculator, Next: Calc++ Parsing Driver, Up: A Complete C++ Example + +10.1.6.1 Calc++ -- C++ Calculator +................................. + +Of course the grammar is dedicated to arithmetics, a single expression, +possibly preceded by variable assignments. An environment containing +possibly predefined variables such as `one' and `two', is exchanged +with the parser. An example of valid input follows. + + three := 3 + seven := one + two * three + seven * seven + + +File: bison.info, Node: Calc++ Parsing Driver, Next: Calc++ Parser, Prev: Calc++ --- C++ Calculator, Up: A Complete C++ Example + +10.1.6.2 Calc++ Parsing Driver +.............................. + +To support a pure interface with the parser (and the scanner) the +technique of the "parsing context" is convenient: a structure +containing all the data to exchange. Since, in addition to simply +launch the parsing, there are several auxiliary tasks to execute (open +the file for parsing, instantiate the parser etc.), we recommend +transforming the simple parsing context structure into a fully blown +"parsing driver" class. + + The declaration of this driver class, `calc++-driver.hh', is as +follows. The first part includes the CPP guard and imports the +required standard library components, and the declaration of the parser +class. + + #ifndef CALCXX_DRIVER_HH + # define CALCXX_DRIVER_HH + # include + # include + # include "calc++-parser.hh" + +Then comes the declaration of the scanning function. Flex expects the +signature of `yylex' to be defined in the macro `YY_DECL', and the C++ +parser expects it to be declared. We can factor both as follows. + + // Tell Flex the lexer's prototype ... + # define YY_DECL \ + yy::calcxx_parser::token_type \ + yylex (yy::calcxx_parser::semantic_type* yylval, \ + yy::calcxx_parser::location_type* yylloc, \ + calcxx_driver& driver) + // ... and declare it for the parser's sake. + YY_DECL; + +The `calcxx_driver' class is then declared with its most obvious +members. + + // Conducting the whole scanning and parsing of Calc++. + class calcxx_driver + { + public: + calcxx_driver (); + virtual ~calcxx_driver (); + + std::map variables; + + int result; + +To encapsulate the coordination with the Flex scanner, it is useful to +have two members function to open and close the scanning phase. + + // Handling the scanner. + void scan_begin (); + void scan_end (); + bool trace_scanning; + +Similarly for the parser itself. + + // Run the parser. Return 0 on success. + int parse (const std::string& f); + std::string file; + bool trace_parsing; + +To demonstrate pure handling of parse errors, instead of simply dumping +them on the standard error output, we will pass them to the compiler +driver using the following two member functions. Finally, we close the +class declaration and CPP guard. + + // Error handling. + void error (const yy::location& l, const std::string& m); + void error (const std::string& m); + }; + #endif // ! CALCXX_DRIVER_HH + + The implementation of the driver is straightforward. The `parse' +member function deserves some attention. The `error' functions are +simple stubs, they should actually register the located error messages +and set error state. + + #include "calc++-driver.hh" + #include "calc++-parser.hh" + + calcxx_driver::calcxx_driver () + : trace_scanning (false), trace_parsing (false) + { + variables["one"] = 1; + variables["two"] = 2; + } + + calcxx_driver::~calcxx_driver () + { + } + + int + calcxx_driver::parse (const std::string &f) + { + file = f; + scan_begin (); + yy::calcxx_parser parser (*this); + parser.set_debug_level (trace_parsing); + int res = parser.parse (); + scan_end (); + return res; + } + + void + calcxx_driver::error (const yy::location& l, const std::string& m) + { + std::cerr << l << ": " << m << std::endl; + } + + void + calcxx_driver::error (const std::string& m) + { + std::cerr << m << std::endl; + } + + +File: bison.info, Node: Calc++ Parser, Next: Calc++ Scanner, Prev: Calc++ Parsing Driver, Up: A Complete C++ Example + +10.1.6.3 Calc++ Parser +...................... + +The parser definition file `calc++-parser.yy' starts by asking for the +C++ LALR(1) skeleton, the creation of the parser header file, and +specifies the name of the parser class. Because the C++ skeleton +changed several times, it is safer to require the version you designed +the grammar for. + + %skeleton "lalr1.cc" /* -*- C++ -*- */ + %require "2.4.1" + %defines + %define parser_class_name "calcxx_parser" + +Then come the declarations/inclusions needed to define the `%union'. +Because the parser uses the parsing driver and reciprocally, both +cannot include the header of the other. Because the driver's header +needs detailed knowledge about the parser class (in particular its +inner types), it is the parser's header which will simply use a forward +declaration of the driver. *Note %code: Decl Summary. + + %code requires { + # include + class calcxx_driver; + } + +The driver is passed by reference to the parser and to the scanner. +This provides a simple but effective pure interface, not relying on +global variables. + + // The parsing context. + %parse-param { calcxx_driver& driver } + %lex-param { calcxx_driver& driver } + +Then we request the location tracking feature, and initialize the first +location's file name. Afterwards new locations are computed relatively +to the previous locations: the file name will be automatically +propagated. + + %locations + %initial-action + { + // Initialize the initial location. + @$.begin.filename = @$.end.filename = &driver.file; + }; + +Use the two following directives to enable parser tracing and verbose +error messages. + + %debug + %error-verbose + +Semantic values cannot use "real" objects, but only pointers to them. + + // Symbols. + %union + { + int ival; + std::string *sval; + }; + +The code between `%code {' and `}' is output in the `*.cc' file; it +needs detailed knowledge about the driver. + + %code { + # include "calc++-driver.hh" + } + +The token numbered as 0 corresponds to end of file; the following line +allows for nicer error messages referring to "end of file" instead of +"$end". Similarly user friendly named are provided for each symbol. +Note that the tokens names are prefixed by `TOKEN_' to avoid name +clashes. + + %token END 0 "end of file" + %token ASSIGN ":=" + %token IDENTIFIER "identifier" + %token NUMBER "number" + %type exp + +To enable memory deallocation during error recovery, use `%destructor'. + + %printer { debug_stream () << *$$; } "identifier" + %destructor { delete $$; } "identifier" + + %printer { debug_stream () << $$; } + +The grammar itself is straightforward. + + %% + %start unit; + unit: assignments exp { driver.result = $2; }; + + assignments: assignments assignment {} + | /* Nothing. */ {}; + + assignment: + "identifier" ":=" exp + { driver.variables[*$1] = $3; delete $1; }; + + %left '+' '-'; + %left '*' '/'; + exp: exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp { $$ = $1 / $3; } + | "identifier" { $$ = driver.variables[*$1]; delete $1; } + | "number" { $$ = $1; }; + %% + +Finally the `error' member function registers the errors to the driver. + + void + yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l, + const std::string& m) + { + driver.error (l, m); + } + + +File: bison.info, Node: Calc++ Scanner, Next: Calc++ Top Level, Prev: Calc++ Parser, Up: A Complete C++ Example + +10.1.6.4 Calc++ Scanner +....................... + +The Flex scanner first includes the driver declaration, then the +parser's to get the set of defined tokens. + + %{ /* -*- C++ -*- */ + # include + # include + # include + # include + # include "calc++-driver.hh" + # include "calc++-parser.hh" + + /* Work around an incompatibility in flex (at least versions + 2.5.31 through 2.5.33): it generates code that does + not conform to C89. See Debian bug 333231 + . */ + # undef yywrap + # define yywrap() 1 + + /* By default yylex returns int, we use token_type. + Unfortunately yyterminate by default returns 0, which is + not of token_type. */ + #define yyterminate() return token::END + %} + +Because there is no `#include'-like feature we don't need `yywrap', we +don't need `unput' either, and we parse an actual file, this is not an +interactive session with the user. Finally we enable the scanner +tracing features. + + %option noyywrap nounput batch debug + +Abbreviations allow for more readable rules. + + id [a-zA-Z][a-zA-Z_0-9]* + int [0-9]+ + blank [ \t] + +The following paragraph suffices to track locations accurately. Each +time `yylex' is invoked, the begin position is moved onto the end +position. Then when a pattern is matched, the end position is advanced +of its width. In case it matched ends of lines, the end cursor is +adjusted, and each time blanks are matched, the begin cursor is moved +onto the end cursor to effectively ignore the blanks preceding tokens. +Comments would be treated equally. + + %{ + # define YY_USER_ACTION yylloc->columns (yyleng); + %} + %% + %{ + yylloc->step (); + %} + {blank}+ yylloc->step (); + [\n]+ yylloc->lines (yyleng); yylloc->step (); + +The rules are simple, just note the use of the driver to report errors. +It is convenient to use a typedef to shorten +`yy::calcxx_parser::token::identifier' into `token::identifier' for +instance. + + %{ + typedef yy::calcxx_parser::token token; + %} + /* Convert ints to the actual type of tokens. */ + [-+*/] return yy::calcxx_parser::token_type (yytext[0]); + ":=" return token::ASSIGN; + {int} { + errno = 0; + long n = strtol (yytext, NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + driver.error (*yylloc, "integer is out of range"); + yylval->ival = n; + return token::NUMBER; + } + {id} yylval->sval = new std::string (yytext); return token::IDENTIFIER; + . driver.error (*yylloc, "invalid character"); + %% + +Finally, because the scanner related driver's member function depend on +the scanner's data, it is simpler to implement them in this file. + + void + calcxx_driver::scan_begin () + { + yy_flex_debug = trace_scanning; + if (file == "-") + yyin = stdin; + else if (!(yyin = fopen (file.c_str (), "r"))) + { + error (std::string ("cannot open ") + file); + exit (1); + } + } + + void + calcxx_driver::scan_end () + { + fclose (yyin); + } + + +File: bison.info, Node: Calc++ Top Level, Prev: Calc++ Scanner, Up: A Complete C++ Example + +10.1.6.5 Calc++ Top Level +......................... + +The top level file, `calc++.cc', poses no problem. + + #include + #include "calc++-driver.hh" + + int + main (int argc, char *argv[]) + { + calcxx_driver driver; + for (++argv; argv[0]; ++argv) + if (*argv == std::string ("-p")) + driver.trace_parsing = true; + else if (*argv == std::string ("-s")) + driver.trace_scanning = true; + else if (!driver.parse (*argv)) + std::cout << driver.result << std::endl; + } + + +File: bison.info, Node: Java Parsers, Prev: C++ Parsers, Up: Other Languages + +10.2 Java Parsers +================= + +* Menu: + +* Java Bison Interface:: Asking for Java parser generation +* Java Semantic Values:: %type and %token vs. Java +* Java Location Values:: The position and location classes +* Java Parser Interface:: Instantiating and running the parser +* Java Scanner Interface:: Specifying the scanner for the parser +* Java Action Features:: Special features for use in actions +* Java Differences:: Differences between C/C++ and Java Grammars +* Java Declarations Summary:: List of Bison declarations used with Java + + +File: bison.info, Node: Java Bison Interface, Next: Java Semantic Values, Up: Java Parsers + +10.2.1 Java Bison Interface +--------------------------- + +(The current Java interface is experimental and may evolve. More user +feedback will help to stabilize it.) + + The Java parser skeletons are selected using the `%language "Java"' +directive or the `-L java'/`--language=java' option. + + When generating a Java parser, `bison BASENAME.y' will create a +single Java source file named `BASENAME.java'. Using an input file +without a `.y' suffix is currently broken. The basename of the output +file can be changed by the `%file-prefix' directive or the +`-p'/`--name-prefix' option. The entire output file name can be +changed by the `%output' directive or the `-o'/`--output' option. The +output file contains a single class for the parser. + + You can create documentation for generated parsers using Javadoc. + + Contrary to C parsers, Java parsers do not use global variables; the +state of the parser is always local to an instance of the parser class. +Therefore, all Java parsers are "pure", and the `%pure-parser' and +`%define api.pure' directives does not do anything when used in Java. + + Push parsers are currently unsupported in Java and `%define +api.push_pull' have no effect. + + GLR parsers are currently unsupported in Java. Do not use the +`glr-parser' directive. + + No header file can be generated for Java parsers. Do not use the +`%defines' directive or the `-d'/`--defines' options. + + Currently, support for debugging and verbose errors are always +compiled in. Thus the `%debug' and `%token-table' directives and the +`-t'/`--debug' and `-k'/`--token-table' options have no effect. This +may change in the future to eliminate unused code in the generated +parser, so use `%debug' and `%verbose-error' explicitly if needed. +Also, in the future the `%token-table' directive might enable a public +interface to access the token names and codes. + + +File: bison.info, Node: Java Semantic Values, Next: Java Location Values, Prev: Java Bison Interface, Up: Java Parsers + +10.2.2 Java Semantic Values +--------------------------- + +There is no `%union' directive in Java parsers. Instead, the semantic +values' types (class names) should be specified in the `%type' or +`%token' directive: + + %type expr assignment_expr term factor + %type number + + By default, the semantic stack is declared to have `Object' members, +which means that the class types you specify can be of any class. To +improve the type safety of the parser, you can declare the common +superclass of all the semantic values using the `%define stype' +directive. For example, after the following declaration: + + %define stype "ASTNode" + +any `%type' or `%token' specifying a semantic type which is not a +subclass of ASTNode, will cause a compile-time error. + + Types used in the directives may be qualified with a package name. +Primitive data types are accepted for Java version 1.5 or later. Note +that in this case the autoboxing feature of Java 1.5 will be used. +Generic types may not be used; this is due to a limitation in the +implementation of Bison, and may change in future releases. + + Java parsers do not support `%destructor', since the language adopts +garbage collection. The parser will try to hold references to semantic +values for as little time as needed. + + Java parsers do not support `%printer', as `toString()' can be used +to print the semantic values. This however may change (in a +backwards-compatible way) in future versions of Bison. + + +File: bison.info, Node: Java Location Values, Next: Java Parser Interface, Prev: Java Semantic Values, Up: Java Parsers + +10.2.3 Java Location Values +--------------------------- + +When the directive `%locations' is used, the Java parser supports +location tracking, see *note Locations Overview: Locations. An +auxiliary user-defined class defines a "position", a single point in a +file; Bison itself defines a class representing a "location", a range +composed of a pair of positions (possibly spanning several files). The +location class is an inner class of the parser; the name is `Location' +by default, and may also be renamed using `%define location_type +"CLASS-NAME'. + + The location class treats the position as a completely opaque value. +By default, the class name is `Position', but this can be changed with +`%define position_type "CLASS-NAME"'. This class must be supplied by +the user. + + -- Instance Variable of Location: Position begin + -- Instance Variable of Location: Position end + The first, inclusive, position of the range, and the first beyond. + + -- Constructor on Location: Location (Position LOC) + Create a `Location' denoting an empty range located at a given + point. + + -- Constructor on Location: Location (Position BEGIN, Position END) + Create a `Location' from the endpoints of the range. + + -- Method on Location: String toString () + Prints the range represented by the location. For this to work + properly, the position class should override the `equals' and + `toString' methods appropriately. + + +File: bison.info, Node: Java Parser Interface, Next: Java Scanner Interface, Prev: Java Location Values, Up: Java Parsers + +10.2.4 Java Parser Interface +---------------------------- + +The name of the generated parser class defaults to `YYParser'. The +`YY' prefix may be changed using the `%name-prefix' directive or the +`-p'/`--name-prefix' option. Alternatively, use `%define +parser_class_name "NAME"' to give a custom name to the class. The +interface of this class is detailed below. + + By default, the parser class has package visibility. A declaration +`%define public' will change to public visibility. Remember that, +according to the Java language specification, the name of the `.java' +file should match the name of the class in this case. Similarly, you +can use `abstract', `final' and `strictfp' with the `%define' +declaration to add other modifiers to the parser class. + + The Java package name of the parser class can be specified using the +`%define package' directive. The superclass and the implemented +interfaces of the parser class can be specified with the `%define +extends' and `%define implements' directives. + + The parser class defines an inner class, `Location', that is used +for location tracking (see *note Java Location Values::), and a inner +interface, `Lexer' (see *note Java Scanner Interface::). Other than +these inner class/interface, and the members described in the interface +below, all the other members and fields are preceded with a `yy' or +`YY' prefix to avoid clashes with user code. + + The parser class can be extended using the `%parse-param' directive. +Each occurrence of the directive will add a `protected final' field to +the parser class, and an argument to its constructor, which initialize +them automatically. + + Token names defined by `%token' and the predefined `EOF' token name +are added as constant fields to the parser class. + + -- Constructor on YYParser: YYParser (LEX_PARAM, ..., PARSE_PARAM, + ...) + Build a new parser object with embedded `%code lexer'. There are + no parameters, unless `%parse-param's and/or `%lex-param's are + used. + + -- Constructor on YYParser: YYParser (Lexer LEXER, PARSE_PARAM, ...) + Build a new parser object using the specified scanner. There are + no additional parameters unless `%parse-param's are used. + + If the scanner is defined by `%code lexer', this constructor is + declared `protected' and is called automatically with a scanner + created with the correct `%lex-param's. + + -- Method on YYParser: boolean parse () + Run the syntactic analysis, and return `true' on success, `false' + otherwise. + + -- Method on YYParser: boolean recovering () + During the syntactic analysis, return `true' if recovering from a + syntax error. *Note Error Recovery::. + + -- Method on YYParser: java.io.PrintStream getDebugStream () + -- Method on YYParser: void setDebugStream (java.io.printStream O) + Get or set the stream used for tracing the parsing. It defaults to + `System.err'. + + -- Method on YYParser: int getDebugLevel () + -- Method on YYParser: void setDebugLevel (int L) + Get or set the tracing level. Currently its value is either 0, no + trace, or nonzero, full tracing. + + +File: bison.info, Node: Java Scanner Interface, Next: Java Action Features, Prev: Java Parser Interface, Up: Java Parsers + +10.2.5 Java Scanner Interface +----------------------------- + +There are two possible ways to interface a Bison-generated Java parser +with a scanner: the scanner may be defined by `%code lexer', or defined +elsewhere. In either case, the scanner has to implement the `Lexer' +inner interface of the parser class. + + In the first case, the body of the scanner class is placed in `%code +lexer' blocks. If you want to pass parameters from the parser +constructor to the scanner constructor, specify them with `%lex-param'; +they are passed before `%parse-param's to the constructor. + + In the second case, the scanner has to implement the `Lexer' +interface, which is defined within the parser class (e.g., +`YYParser.Lexer'). The constructor of the parser object will then +accept an object implementing the interface; `%lex-param' is not used +in this case. + + In both cases, the scanner has to implement the following methods. + + -- Method on Lexer: void yyerror (Location LOC, String MSG) + This method is defined by the user to emit an error message. The + first parameter is omitted if location tracking is not active. + Its type can be changed using `%define location_type "CLASS-NAME".' + + -- Method on Lexer: int yylex () + Return the next token. Its type is the return value, its semantic + value and location are saved and returned by the ther methods in + the interface. + + Use `%define lex_throws' to specify any uncaught exceptions. + Default is `java.io.IOException'. + + -- Method on Lexer: Position getStartPos () + -- Method on Lexer: Position getEndPos () + Return respectively the first position of the last token that + `yylex' returned, and the first position beyond it. These methods + are not needed unless location tracking is active. + + The return type can be changed using `%define position_type + "CLASS-NAME".' + + -- Method on Lexer: Object getLVal () + Return the semantical value of the last token that yylex returned. + + The return type can be changed using `%define stype "CLASS-NAME".' + + +File: bison.info, Node: Java Action Features, Next: Java Differences, Prev: Java Scanner Interface, Up: Java Parsers + +10.2.6 Special Features for Use in Java Actions +----------------------------------------------- + +The following special constructs can be uses in Java actions. Other +analogous C action features are currently unavailable for Java. + + Use `%define throws' to specify any uncaught exceptions from parser +actions, and initial actions specified by `%initial-action'. + + -- Variable: $N + The semantic value for the Nth component of the current rule. + This may not be assigned to. *Note Java Semantic Values::. + + -- Variable: $N + Like `$N' but specifies a alternative type TYPEALT. *Note Java + Semantic Values::. + + -- Variable: $$ + The semantic value for the grouping made by the current rule. As a + value, this is in the base type (`Object' or as specified by + `%define stype') as in not cast to the declared subtype because + casts are not allowed on the left-hand side of Java assignments. + Use an explicit Java cast if the correct subtype is needed. *Note + Java Semantic Values::. + + -- Variable: $$ + Same as `$$' since Java always allow assigning to the base type. + Perhaps we should use this and `$<>$' for the value and `$$' for + setting the value but there is currently no easy way to distinguish + these constructs. *Note Java Semantic Values::. + + -- Variable: @N + The location information of the Nth component of the current rule. + This may not be assigned to. *Note Java Location Values::. + + -- Variable: @$ + The location information of the grouping made by the current rule. + *Note Java Location Values::. + + -- Statement: return YYABORT; + Return immediately from the parser, indicating failure. *Note + Java Parser Interface::. + + -- Statement: return YYACCEPT; + Return immediately from the parser, indicating success. *Note + Java Parser Interface::. + + -- Statement: return YYERROR; + Start error recovery without printing an error message. *Note + Error Recovery::. + + -- Statement: return YYFAIL; + Print an error message and start error recovery. *Note Error + Recovery::. + + -- Function: boolean recovering () + Return whether error recovery is being done. In this state, the + parser reads token until it reaches a known state, and then + restarts normal operation. *Note Error Recovery::. + + -- Function: protected void yyerror (String msg) + -- Function: protected void yyerror (Position pos, String msg) + -- Function: protected void yyerror (Location loc, String msg) + Print an error message using the `yyerror' method of the scanner + instance in use. + + +File: bison.info, Node: Java Differences, Next: Java Declarations Summary, Prev: Java Action Features, Up: Java Parsers + +10.2.7 Differences between C/C++ and Java Grammars +-------------------------------------------------- + +The different structure of the Java language forces several differences +between C/C++ grammars, and grammars designed for Java parsers. This +section summarizes these differences. + + * Java lacks a preprocessor, so the `YYERROR', `YYACCEPT', `YYABORT' + symbols (*note Table of Symbols::) cannot obviously be macros. + Instead, they should be preceded by `return' when they appear in + an action. The actual definition of these symbols is opaque to + the Bison grammar, and it might change in the future. The only + meaningful operation that you can do, is to return them. See + *note Java Action Features::. + + Note that of these three symbols, only `YYACCEPT' and `YYABORT' + will cause a return from the `yyparse' method(1). + + * Java lacks unions, so `%union' has no effect. Instead, semantic + values have a common base type: `Object' or as specified by + `%define stype'. Angle backets on `%token', `type', `$N' and `$$' + specify subtypes rather than fields of an union. The type of + `$$', even with angle brackets, is the base type since Java casts + are not allow on the left-hand side of assignments. Also, `$N' + and `@N' are not allowed on the left-hand side of assignments. See + *note Java Semantic Values:: and *note Java Action Features::. + + * The prolog declarations have a different meaning than in C/C++ + code. + `%code imports' + blocks are placed at the beginning of the Java source code. + They may include copyright notices. For a `package' + declarations, it is suggested to use `%define package' + instead. + + unqualified `%code' + blocks are placed inside the parser class. + + `%code lexer' + blocks, if specified, should include the implementation of the + scanner. If there is no such block, the scanner can be any + class that implements the appropriate interface (see *note + Java Scanner Interface::). + + Other `%code' blocks are not supported in Java parsers. In + particular, `%{ ... %}' blocks should not be used and may give an + error in future versions of Bison. + + The epilogue has the same meaning as in C/C++ code and it can be + used to define other classes used by the parser _outside_ the + parser class. + + ---------- Footnotes ---------- + + (1) Java parsers include the actions in a separate method than +`yyparse' in order to have an intuitive syntax that corresponds to +these C macros. + + +File: bison.info, Node: Java Declarations Summary, Prev: Java Differences, Up: Java Parsers + +10.2.8 Java Declarations Summary +-------------------------------- + +This summary only include declarations specific to Java or have special +meaning when used in a Java parser. + + -- Directive: %language "Java" + Generate a Java class for the parser. + + -- Directive: %lex-param {TYPE NAME} + A parameter for the lexer class defined by `%code lexer' _only_, + added as parameters to the lexer constructor and the parser + constructor that _creates_ a lexer. Default is none. *Note Java + Scanner Interface::. + + -- Directive: %name-prefix "PREFIX" + The prefix of the parser class name `PREFIXParser' if `%define + parser_class_name' is not used. Default is `YY'. *Note Java + Bison Interface::. + + -- Directive: %parse-param {TYPE NAME} + A parameter for the parser class added as parameters to + constructor(s) and as fields initialized by the constructor(s). + Default is none. *Note Java Parser Interface::. + + -- Directive: %token TOKEN ... + Declare tokens. Note that the angle brackets enclose a Java + _type_. *Note Java Semantic Values::. + + -- Directive: %type NONTERMINAL ... + Declare the type of nonterminals. Note that the angle brackets + enclose a Java _type_. *Note Java Semantic Values::. + + -- Directive: %code { CODE ... } + Code appended to the inside of the parser class. *Note Java + Differences::. + + -- Directive: %code imports { CODE ... } + Code inserted just after the `package' declaration. *Note Java + Differences::. + + -- Directive: %code lexer { CODE ... } + Code added to the body of a inner lexer class within the parser + class. *Note Java Scanner Interface::. + + -- Directive: %% CODE ... + Code (after the second `%%') appended to the end of the file, + _outside_ the parser class. *Note Java Differences::. + + -- Directive: %{ CODE ... %} + Not supported. Use `%code import' instead. *Note Java + Differences::. + + -- Directive: %define abstract + Whether the parser class is declared `abstract'. Default is false. + *Note Java Bison Interface::. + + -- Directive: %define extends "SUPERCLASS" + The superclass of the parser class. Default is none. *Note Java + Bison Interface::. + + -- Directive: %define final + Whether the parser class is declared `final'. Default is false. + *Note Java Bison Interface::. + + -- Directive: %define implements "INTERFACES" + The implemented interfaces of the parser class, a comma-separated + list. Default is none. *Note Java Bison Interface::. + + -- Directive: %define lex_throws "EXCEPTIONS" + The exceptions thrown by the `yylex' method of the lexer, a + comma-separated list. Default is `java.io.IOException'. *Note + Java Scanner Interface::. + + -- Directive: %define location_type "CLASS" + The name of the class used for locations (a range between two + positions). This class is generated as an inner class of the + parser class by `bison'. Default is `Location'. *Note Java + Location Values::. + + -- Directive: %define package "PACKAGE" + The package to put the parser class in. Default is none. *Note + Java Bison Interface::. + + -- Directive: %define parser_class_name "NAME" + The name of the parser class. Default is `YYParser' or + `NAME-PREFIXParser'. *Note Java Bison Interface::. + + -- Directive: %define position_type "CLASS" + The name of the class used for positions. This class must be + supplied by the user. Default is `Position'. *Note Java Location + Values::. + + -- Directive: %define public + Whether the parser class is declared `public'. Default is false. + *Note Java Bison Interface::. + + -- Directive: %define stype "CLASS" + The base type of semantic values. Default is `Object'. *Note + Java Semantic Values::. + + -- Directive: %define strictfp + Whether the parser class is declared `strictfp'. Default is false. + *Note Java Bison Interface::. + + -- Directive: %define throws "EXCEPTIONS" + The exceptions thrown by user-supplied parser actions and + `%initial-action', a comma-separated list. Default is none. + *Note Java Parser Interface::. + + +File: bison.info, Node: FAQ, Next: Table of Symbols, Prev: Other Languages, Up: Top + +11 Frequently Asked Questions +***************************** + +Several questions about Bison come up occasionally. Here some of them +are addressed. + +* Menu: + +* Memory Exhausted:: Breaking the Stack Limits +* How Can I Reset the Parser:: `yyparse' Keeps some State +* Strings are Destroyed:: `yylval' Loses Track of Strings +* Implementing Gotos/Loops:: Control Flow in the Calculator +* Multiple start-symbols:: Factoring closely related grammars +* Secure? Conform?:: Is Bison POSIX safe? +* I can't build Bison:: Troubleshooting +* Where can I find help?:: Troubleshouting +* Bug Reports:: Troublereporting +* More Languages:: Parsers in C++, Java, and so on +* Beta Testing:: Experimenting development versions +* Mailing Lists:: Meeting other Bison users + + +File: bison.info, Node: Memory Exhausted, Next: How Can I Reset the Parser, Up: FAQ + +11.1 Memory Exhausted +===================== + + My parser returns with error with a `memory exhausted' + message. What can I do? + + This question is already addressed elsewhere, *Note Recursive Rules: +Recursion. + + +File: bison.info, Node: How Can I Reset the Parser, Next: Strings are Destroyed, Prev: Memory Exhausted, Up: FAQ + +11.2 How Can I Reset the Parser +=============================== + +The following phenomenon has several symptoms, resulting in the +following typical questions: + + I invoke `yyparse' several times, and on correct input it works + properly; but when a parse error is found, all the other calls fail + too. How can I reset the error flag of `yyparse'? + +or + + My parser includes support for an `#include'-like feature, in + which case I run `yyparse' from `yyparse'. This fails + although I did specify `%define api.pure'. + + These problems typically come not from Bison itself, but from +Lex-generated scanners. Because these scanners use large buffers for +speed, they might not notice a change of input file. As a +demonstration, consider the following source file, `first-line.l': + + +%{ +#include +#include +%} +%% +.*\n ECHO; return 1; +%% +int +yyparse (char const *file) +{ + yyin = fopen (file, "r"); + if (!yyin) + exit (2); + /* One token only. */ + yylex (); + if (fclose (yyin) != 0) + exit (3); + return 0; +} + +int +main (void) +{ + yyparse ("input"); + yyparse ("input"); + return 0; +} + +If the file `input' contains + + +input:1: Hello, +input:2: World! + +then instead of getting the first line twice, you get: + + $ flex -ofirst-line.c first-line.l + $ gcc -ofirst-line first-line.c -ll + $ ./first-line + input:1: Hello, + input:2: World! + + Therefore, whenever you change `yyin', you must tell the +Lex-generated scanner to discard its current buffer and switch to the +new one. This depends upon your implementation of Lex; see its +documentation for more. For Flex, it suffices to call +`YY_FLUSH_BUFFER' after each change to `yyin'. If your Flex-generated +scanner needs to read from several input streams to handle features +like include files, you might consider using Flex functions like +`yy_switch_to_buffer' that manipulate multiple input buffers. + + If your Flex-generated scanner uses start conditions (*note Start +conditions: (flex)Start conditions.), you might also want to reset the +scanner's state, i.e., go back to the initial start condition, through +a call to `BEGIN (0)'. + + +File: bison.info, Node: Strings are Destroyed, Next: Implementing Gotos/Loops, Prev: How Can I Reset the Parser, Up: FAQ + +11.3 Strings are Destroyed +========================== + + My parser seems to destroy old strings, or maybe it loses track of + them. Instead of reporting `"foo", "bar"', it reports + `"bar", "bar"', or even `"foo\nbar", "bar"'. + + This error is probably the single most frequent "bug report" sent to +Bison lists, but is only concerned with a misunderstanding of the role +of the scanner. Consider the following Lex code: + + +%{ +#include +char *yylval = NULL; +%} +%% +.* yylval = yytext; return 1; +\n /* IGNORE */ +%% +int +main () +{ + /* Similar to using $1, $2 in a Bison action. */ + char *fst = (yylex (), yylval); + char *snd = (yylex (), yylval); + printf ("\"%s\", \"%s\"\n", fst, snd); + return 0; +} + + If you compile and run this code, you get: + + $ flex -osplit-lines.c split-lines.l + $ gcc -osplit-lines split-lines.c -ll + $ printf 'one\ntwo\n' | ./split-lines + "one + two", "two" + +this is because `yytext' is a buffer provided for _reading_ in the +action, but if you want to keep it, you have to duplicate it (e.g., +using `strdup'). Note that the output may depend on how your +implementation of Lex handles `yytext'. For instance, when given the +Lex compatibility option `-l' (which triggers the option `%array') Flex +generates a different behavior: + + $ flex -l -osplit-lines.c split-lines.l + $ gcc -osplit-lines split-lines.c -ll + $ printf 'one\ntwo\n' | ./split-lines + "two", "two" + + +File: bison.info, Node: Implementing Gotos/Loops, Next: Multiple start-symbols, Prev: Strings are Destroyed, Up: FAQ + +11.4 Implementing Gotos/Loops +============================= + + My simple calculator supports variables, assignments, and functions, + but how can I implement gotos, or loops? + + Although very pedagogical, the examples included in the document blur +the distinction to make between the parser--whose job is to recover the +structure of a text and to transmit it to subsequent modules of the +program--and the processing (such as the execution) of this structure. +This works well with so called straight line programs, i.e., precisely +those that have a straightforward execution model: execute simple +instructions one after the others. + + If you want a richer model, you will probably need to use the parser +to construct a tree that does represent the structure it has recovered; +this tree is usually called the "abstract syntax tree", or "AST" for +short. Then, walking through this tree, traversing it in various ways, +will enable treatments such as its execution or its translation, which +will result in an interpreter or a compiler. + + This topic is way beyond the scope of this manual, and the reader is +invited to consult the dedicated literature. + + +File: bison.info, Node: Multiple start-symbols, Next: Secure? Conform?, Prev: Implementing Gotos/Loops, Up: FAQ + +11.5 Multiple start-symbols +=========================== + + I have several closely related grammars, and I would like to share their + implementations. In fact, I could use a single grammar but with + multiple entry points. + + Bison does not support multiple start-symbols, but there is a very +simple means to simulate them. If `foo' and `bar' are the two pseudo +start-symbols, then introduce two new tokens, say `START_FOO' and +`START_BAR', and use them as switches from the real start-symbol: + + %token START_FOO START_BAR; + %start start; + start: START_FOO foo + | START_BAR bar; + + These tokens prevents the introduction of new conflicts. As far as +the parser goes, that is all that is needed. + + Now the difficult part is ensuring that the scanner will send these +tokens first. If your scanner is hand-written, that should be +straightforward. If your scanner is generated by Lex, them there is +simple means to do it: recall that anything between `%{ ... %}' after +the first `%%' is copied verbatim in the top of the generated `yylex' +function. Make sure a variable `start_token' is available in the +scanner (e.g., a global variable or using `%lex-param' etc.), and use +the following: + + /* Prologue. */ + %% + %{ + if (start_token) + { + int t = start_token; + start_token = 0; + return t; + } + %} + /* The rules. */ + + +File: bison.info, Node: Secure? Conform?, Next: I can't build Bison, Prev: Multiple start-symbols, Up: FAQ + +11.6 Secure? Conform? +====================== + + Is Bison secure? Does it conform to POSIX? + + If you're looking for a guarantee or certification, we don't provide +it. However, Bison is intended to be a reliable program that conforms +to the POSIX specification for Yacc. If you run into problems, please +send us a bug report. + + +File: bison.info, Node: I can't build Bison, Next: Where can I find help?, Prev: Secure? Conform?, Up: FAQ + +11.7 I can't build Bison +======================== + + I can't build Bison because `make' complains that + `msgfmt' is not found. + What should I do? + + Like most GNU packages with internationalization support, that +feature is turned on by default. If you have problems building in the +`po' subdirectory, it indicates that your system's internationalization +support is lacking. You can re-configure Bison with `--disable-nls' to +turn off this support, or you can install GNU gettext from +`ftp://ftp.gnu.org/gnu/gettext/' and re-configure Bison. See the file +`ABOUT-NLS' for more information. + + +File: bison.info, Node: Where can I find help?, Next: Bug Reports, Prev: I can't build Bison, Up: FAQ + +11.8 Where can I find help? +=========================== + + I'm having trouble using Bison. Where can I find help? + + First, read this fine manual. Beyond that, you can send mail to +. This mailing list is intended to be populated +with people who are willing to answer questions about using and +installing Bison. Please keep in mind that (most of) the people on the +list have aspects of their lives which are not related to Bison (!), so +you may not receive an answer to your question right away. This can be +frustrating, but please try not to honk them off; remember that any +help they provide is purely voluntary and out of the kindness of their +hearts. + + +File: bison.info, Node: Bug Reports, Next: More Languages, Prev: Where can I find help?, Up: FAQ + +11.9 Bug Reports +================ + + I found a bug. What should I include in the bug report? + + Before you send a bug report, make sure you are using the latest +version. Check `ftp://ftp.gnu.org/pub/gnu/bison/' or one of its +mirrors. Be sure to include the version number in your bug report. If +the bug is present in the latest version but not in a previous version, +try to determine the most recent version which did not contain the bug. + + If the bug is parser-related, you should include the smallest grammar +you can which demonstrates the bug. The grammar file should also be +complete (i.e., I should be able to run it through Bison without having +to edit or add anything). The smaller and simpler the grammar, the +easier it will be to fix the bug. + + Include information about your compilation environment, including +your operating system's name and version and your compiler's name and +version. If you have trouble compiling, you should also include a +transcript of the build session, starting with the invocation of +`configure'. Depending on the nature of the bug, you may be asked to +send additional files as well (such as `config.h' or `config.cache'). + + Patches are most welcome, but not required. That is, do not +hesitate to send a bug report just because you can not provide a fix. + + Send bug reports to . + + +File: bison.info, Node: More Languages, Next: Beta Testing, Prev: Bug Reports, Up: FAQ + +11.10 More Languages +==================== + + Will Bison ever have C++ and Java support? How about INSERT YOUR + FAVORITE LANGUAGE HERE? + + C++ and Java support is there now, and is documented. We'd love to +add other languages; contributions are welcome. + + +File: bison.info, Node: Beta Testing, Next: Mailing Lists, Prev: More Languages, Up: FAQ + +11.11 Beta Testing +================== + + What is involved in being a beta tester? + + It's not terribly involved. Basically, you would download a test +release, compile it, and use it to build and run a parser or two. After +that, you would submit either a bug report or a message saying that +everything is okay. It is important to report successes as well as +failures because test releases eventually become mainstream releases, +but only if they are adequately tested. If no one tests, development is +essentially halted. + + Beta testers are particularly needed for operating systems to which +the developers do not have easy access. They currently have easy +access to recent GNU/Linux and Solaris versions. Reports about other +operating systems are especially welcome. + + +File: bison.info, Node: Mailing Lists, Prev: Beta Testing, Up: FAQ + +11.12 Mailing Lists +=================== + + How do I join the help-bison and bug-bison mailing lists? + + See `http://lists.gnu.org/'. + + +File: bison.info, Node: Table of Symbols, Next: Glossary, Prev: FAQ, Up: Top + +Appendix A Bison Symbols +************************ + + -- Variable: @$ + In an action, the location of the left-hand side of the rule. + *Note Locations Overview: Locations. + + -- Variable: @N + In an action, the location of the N-th symbol of the right-hand + side of the rule. *Note Locations Overview: Locations. + + -- Variable: $$ + In an action, the semantic value of the left-hand side of the rule. + *Note Actions::. + + -- Variable: $N + In an action, the semantic value of the N-th symbol of the + right-hand side of the rule. *Note Actions::. + + -- Delimiter: %% + Delimiter used to separate the grammar rule section from the Bison + declarations section or the epilogue. *Note The Overall Layout of + a Bison Grammar: Grammar Layout. + + -- Delimiter: %{CODE%} + All code listed between `%{' and `%}' is copied directly to the + output file uninterpreted. Such code forms the prologue of the + input file. *Note Outline of a Bison Grammar: Grammar Outline. + + -- Construct: /*...*/ + Comment delimiters, as in C. + + -- Delimiter: : + Separates a rule's result from its components. *Note Syntax of + Grammar Rules: Rules. + + -- Delimiter: ; + Terminates a rule. *Note Syntax of Grammar Rules: Rules. + + -- Delimiter: | + Separates alternate rules for the same result nonterminal. *Note + Syntax of Grammar Rules: Rules. + + -- Directive: <*> + Used to define a default tagged `%destructor' or default tagged + `%printer'. + + This feature is experimental. More user feedback will help to + determine whether it should become a permanent feature. + + *Note Freeing Discarded Symbols: Destructor Decl. + + -- Directive: <> + Used to define a default tagless `%destructor' or default tagless + `%printer'. + + This feature is experimental. More user feedback will help to + determine whether it should become a permanent feature. + + *Note Freeing Discarded Symbols: Destructor Decl. + + -- Symbol: $accept + The predefined nonterminal whose only rule is `$accept: START + $end', where START is the start symbol. *Note The Start-Symbol: + Start Decl. It cannot be used in the grammar. + + -- Directive: %code {CODE} + -- Directive: %code QUALIFIER {CODE} + Insert CODE verbatim into output parser source. *Note %code: Decl + Summary. + + -- Directive: %debug + Equip the parser for debugging. *Note Decl Summary::. + + -- Directive: %debug + Equip the parser for debugging. *Note Decl Summary::. + + -- Directive: %define DEFINE-VARIABLE + -- Directive: %define DEFINE-VARIABLE VALUE + Define a variable to adjust Bison's behavior. *Note %define: Decl + Summary. + + -- Directive: %defines + Bison declaration to create a header file meant for the scanner. + *Note Decl Summary::. + + -- Directive: %defines DEFINES-FILE + Same as above, but save in the file DEFINES-FILE. *Note Decl + Summary::. + + -- Directive: %destructor + Specify how the parser should reclaim the memory associated to + discarded symbols. *Note Freeing Discarded Symbols: Destructor + Decl. + + -- Directive: %dprec + Bison declaration to assign a precedence to a rule that is used at + parse time to resolve reduce/reduce conflicts. *Note Writing GLR + Parsers: GLR Parsers. + + -- Symbol: $end + The predefined token marking the end of the token stream. It + cannot be used in the grammar. + + -- Symbol: error + A token name reserved for error recovery. This token may be used + in grammar rules so as to allow the Bison parser to recognize an + error in the grammar without halting the process. In effect, a + sentence containing an error may be recognized as valid. On a + syntax error, the token `error' becomes the current lookahead + token. Actions corresponding to `error' are then executed, and + the lookahead token is reset to the token that originally caused + the violation. *Note Error Recovery::. + + -- Directive: %error-verbose + Bison declaration to request verbose, specific error message + strings when `yyerror' is called. + + -- Directive: %file-prefix "PREFIX" + Bison declaration to set the prefix of the output files. *Note + Decl Summary::. + + -- Directive: %glr-parser + Bison declaration to produce a GLR parser. *Note Writing GLR + Parsers: GLR Parsers. + + -- Directive: %initial-action + Run user code before parsing. *Note Performing Actions before + Parsing: Initial Action Decl. + + -- Directive: %language + Specify the programming language for the generated parser. *Note + Decl Summary::. + + -- Directive: %left + Bison declaration to assign left associativity to token(s). *Note + Operator Precedence: Precedence Decl. + + -- Directive: %lex-param {ARGUMENT-DECLARATION} + Bison declaration to specifying an additional parameter that + `yylex' should accept. *Note Calling Conventions for Pure + Parsers: Pure Calling. + + -- Directive: %merge + Bison declaration to assign a merging function to a rule. If + there is a reduce/reduce conflict with a rule having the same + merging function, the function is applied to the two semantic + values to get a single result. *Note Writing GLR Parsers: GLR + Parsers. + + -- Directive: %name-prefix "PREFIX" + Bison declaration to rename the external symbols. *Note Decl + Summary::. + + -- Directive: %no-lines + Bison declaration to avoid generating `#line' directives in the + parser file. *Note Decl Summary::. + + -- Directive: %nonassoc + Bison declaration to assign nonassociativity to token(s). *Note + Operator Precedence: Precedence Decl. + + -- Directive: %output "FILE" + Bison declaration to set the name of the parser file. *Note Decl + Summary::. + + -- Directive: %parse-param {ARGUMENT-DECLARATION} + Bison declaration to specifying an additional parameter that + `yyparse' should accept. *Note The Parser Function `yyparse': + Parser Function. + + -- Directive: %prec + Bison declaration to assign a precedence to a specific rule. + *Note Context-Dependent Precedence: Contextual Precedence. + + -- Directive: %pure-parser + Deprecated version of `%define api.pure' (*note %define: Decl + Summary.), for which Bison is more careful to warn about + unreasonable usage. + + -- Directive: %require "VERSION" + Require version VERSION or higher of Bison. *Note Require a + Version of Bison: Require Decl. + + -- Directive: %right + Bison declaration to assign right associativity to token(s). + *Note Operator Precedence: Precedence Decl. + + -- Directive: %skeleton + Specify the skeleton to use; usually for development. *Note Decl + Summary::. + + -- Directive: %start + Bison declaration to specify the start symbol. *Note The + Start-Symbol: Start Decl. + + -- Directive: %token + Bison declaration to declare token(s) without specifying + precedence. *Note Token Type Names: Token Decl. + + -- Directive: %token-table + Bison declaration to include a token name table in the parser file. + *Note Decl Summary::. + + -- Directive: %type + Bison declaration to declare nonterminals. *Note Nonterminal + Symbols: Type Decl. + + -- Symbol: $undefined + The predefined token onto which all undefined values returned by + `yylex' are mapped. It cannot be used in the grammar, rather, use + `error'. + + -- Directive: %union + Bison declaration to specify several possible data types for + semantic values. *Note The Collection of Value Types: Union Decl. + + -- Macro: YYABORT + Macro to pretend that an unrecoverable syntax error has occurred, + by making `yyparse' return 1 immediately. The error reporting + function `yyerror' is not called. *Note The Parser Function + `yyparse': Parser Function. + + For Java parsers, this functionality is invoked using `return + YYABORT;' instead. + + -- Macro: YYACCEPT + Macro to pretend that a complete utterance of the language has been + read, by making `yyparse' return 0 immediately. *Note The Parser + Function `yyparse': Parser Function. + + For Java parsers, this functionality is invoked using `return + YYACCEPT;' instead. + + -- Macro: YYBACKUP + Macro to discard a value from the parser stack and fake a lookahead + token. *Note Special Features for Use in Actions: Action Features. + + -- Variable: yychar + External integer variable that contains the integer value of the + lookahead token. (In a pure parser, it is a local variable within + `yyparse'.) Error-recovery rule actions may examine this variable. + *Note Special Features for Use in Actions: Action Features. + + -- Variable: yyclearin + Macro used in error-recovery rule actions. It clears the previous + lookahead token. *Note Error Recovery::. + + -- Macro: YYDEBUG + Macro to define to equip the parser with tracing code. *Note + Tracing Your Parser: Tracing. + + -- Variable: yydebug + External integer variable set to zero by default. If `yydebug' is + given a nonzero value, the parser will output information on input + symbols and parser action. *Note Tracing Your Parser: Tracing. + + -- Macro: yyerrok + Macro to cause parser to recover immediately to its normal mode + after a syntax error. *Note Error Recovery::. + + -- Macro: YYERROR + Macro to pretend that a syntax error has just been detected: call + `yyerror' and then perform normal error recovery if possible + (*note Error Recovery::), or (if recovery is impossible) make + `yyparse' return 1. *Note Error Recovery::. + + For Java parsers, this functionality is invoked using `return + YYERROR;' instead. + + -- Function: yyerror + User-supplied function to be called by `yyparse' on error. *Note + The Error Reporting Function `yyerror': Error Reporting. + + -- Macro: YYERROR_VERBOSE + An obsolete macro that you define with `#define' in the prologue + to request verbose, specific error message strings when `yyerror' + is called. It doesn't matter what definition you use for + `YYERROR_VERBOSE', just whether you define it. Using + `%error-verbose' is preferred. + + -- Macro: YYINITDEPTH + Macro for specifying the initial size of the parser stack. *Note + Memory Management::. + + -- Function: yylex + User-supplied lexical analyzer function, called with no arguments + to get the next token. *Note The Lexical Analyzer Function + `yylex': Lexical. + + -- Macro: YYLEX_PARAM + An obsolete macro for specifying an extra argument (or list of + extra arguments) for `yyparse' to pass to `yylex'. The use of this + macro is deprecated, and is supported only for Yacc like parsers. + *Note Calling Conventions for Pure Parsers: Pure Calling. + + -- Variable: yylloc + External variable in which `yylex' should place the line and column + numbers associated with a token. (In a pure parser, it is a local + variable within `yyparse', and its address is passed to `yylex'.) + You can ignore this variable if you don't use the `@' feature in + the grammar actions. *Note Textual Locations of Tokens: Token + Locations. In semantic actions, it stores the location of the + lookahead token. *Note Actions and Locations: Actions and + Locations. + + -- Type: YYLTYPE + Data type of `yylloc'; by default, a structure with four members. + *Note Data Types of Locations: Location Type. + + -- Variable: yylval + External variable in which `yylex' should place the semantic value + associated with a token. (In a pure parser, it is a local + variable within `yyparse', and its address is passed to `yylex'.) + *Note Semantic Values of Tokens: Token Values. In semantic + actions, it stores the semantic value of the lookahead token. + *Note Actions: Actions. + + -- Macro: YYMAXDEPTH + Macro for specifying the maximum size of the parser stack. *Note + Memory Management::. + + -- Variable: yynerrs + Global variable which Bison increments each time it reports a + syntax error. (In a pure parser, it is a local variable within + `yyparse'. In a pure push parser, it is a member of yypstate.) + *Note The Error Reporting Function `yyerror': Error Reporting. + + -- Function: yyparse + The parser function produced by Bison; call this function to start + parsing. *Note The Parser Function `yyparse': Parser Function. + + -- Function: yypstate_delete + The function to delete a parser instance, produced by Bison in + push mode; call this function to delete the memory associated with + a parser. *Note The Parser Delete Function `yypstate_delete': + Parser Delete Function. (The current push parsing interface is + experimental and may evolve. More user feedback will help to + stabilize it.) + + -- Function: yypstate_new + The function to create a parser instance, produced by Bison in + push mode; call this function to create a new parser. *Note The + Parser Create Function `yypstate_new': Parser Create Function. + (The current push parsing interface is experimental and may evolve. + More user feedback will help to stabilize it.) + + -- Function: yypull_parse + The parser function produced by Bison in push mode; call this + function to parse the rest of the input stream. *Note The Pull + Parser Function `yypull_parse': Pull Parser Function. (The + current push parsing interface is experimental and may evolve. + More user feedback will help to stabilize it.) + + -- Function: yypush_parse + The parser function produced by Bison in push mode; call this + function to parse a single token. *Note The Push Parser Function + `yypush_parse': Push Parser Function. (The current push parsing + interface is experimental and may evolve. More user feedback will + help to stabilize it.) + + -- Macro: YYPARSE_PARAM + An obsolete macro for specifying the name of a parameter that + `yyparse' should accept. The use of this macro is deprecated, and + is supported only for Yacc like parsers. *Note Calling + Conventions for Pure Parsers: Pure Calling. + + -- Macro: YYRECOVERING + The expression `YYRECOVERING ()' yields 1 when the parser is + recovering from a syntax error, and 0 otherwise. *Note Special + Features for Use in Actions: Action Features. + + -- Macro: YYSTACK_USE_ALLOCA + Macro used to control the use of `alloca' when the C LALR(1) + parser needs to extend its stacks. If defined to 0, the parser + will use `malloc' to extend its stacks. If defined to 1, the + parser will use `alloca'. Values other than 0 and 1 are reserved + for future Bison extensions. If not defined, `YYSTACK_USE_ALLOCA' + defaults to 0. + + In the all-too-common case where your code may run on a host with a + limited stack and with unreliable stack-overflow checking, you + should set `YYMAXDEPTH' to a value that cannot possibly result in + unchecked stack overflow on any of your target hosts when `alloca' + is called. You can inspect the code that Bison generates in order + to determine the proper numeric values. This will require some + expertise in low-level implementation details. + + -- Type: YYSTYPE + Data type of semantic values; `int' by default. *Note Data Types + of Semantic Values: Value Type. + + +File: bison.info, Node: Glossary, Next: Copying This Manual, Prev: Table of Symbols, Up: Top + +Appendix B Glossary +******************* + +Backus-Naur Form (BNF; also called "Backus Normal Form") + Formal method of specifying context-free grammars originally + proposed by John Backus, and slightly improved by Peter Naur in + his 1960-01-02 committee document contributing to what became the + Algol 60 report. *Note Languages and Context-Free Grammars: + Language and Grammar. + +Context-free grammars + Grammars specified as rules that can be applied regardless of + context. Thus, if there is a rule which says that an integer can + be used as an expression, integers are allowed _anywhere_ an + expression is permitted. *Note Languages and Context-Free + Grammars: Language and Grammar. + +Dynamic allocation + Allocation of memory that occurs during execution, rather than at + compile time or on entry to a function. + +Empty string + Analogous to the empty set in set theory, the empty string is a + character string of length zero. + +Finite-state stack machine + A "machine" that has discrete states in which it is said to exist + at each instant in time. As input to the machine is processed, the + machine moves from state to state as specified by the logic of the + machine. In the case of the parser, the input is the language + being parsed, and the states correspond to various stages in the + grammar rules. *Note The Bison Parser Algorithm: Algorithm. + +Generalized LR (GLR) + A parsing algorithm that can handle all context-free grammars, + including those that are not LALR(1). It resolves situations that + Bison's usual LALR(1) algorithm cannot by effectively splitting + off multiple parsers, trying all possible parsers, and discarding + those that fail in the light of additional right context. *Note + Generalized LR Parsing: Generalized LR Parsing. + +Grouping + A language construct that is (in general) grammatically divisible; + for example, `expression' or `declaration' in C. *Note Languages + and Context-Free Grammars: Language and Grammar. + +Infix operator + An arithmetic operator that is placed between the operands on + which it performs some operation. + +Input stream + A continuous flow of data between devices or programs. + +Language construct + One of the typical usage schemas of the language. For example, + one of the constructs of the C language is the `if' statement. + *Note Languages and Context-Free Grammars: Language and Grammar. + +Left associativity + Operators having left associativity are analyzed from left to + right: `a+b+c' first computes `a+b' and then combines with `c'. + *Note Operator Precedence: Precedence. + +Left recursion + A rule whose result symbol is also its first component symbol; for + example, `expseq1 : expseq1 ',' exp;'. *Note Recursive Rules: + Recursion. + +Left-to-right parsing + Parsing a sentence of a language by analyzing it token by token + from left to right. *Note The Bison Parser Algorithm: Algorithm. + +Lexical analyzer (scanner) + A function that reads an input stream and returns tokens one by + one. *Note The Lexical Analyzer Function `yylex': Lexical. + +Lexical tie-in + A flag, set by actions in the grammar rules, which alters the way + tokens are parsed. *Note Lexical Tie-ins::. + +Literal string token + A token which consists of two or more fixed characters. *Note + Symbols::. + +Lookahead token + A token already read but not yet shifted. *Note Lookahead Tokens: + Lookahead. + +LALR(1) + The class of context-free grammars that Bison (like most other + parser generators) can handle; a subset of LR(1). *Note + Mysterious Reduce/Reduce Conflicts: Mystery Conflicts. + +LR(1) + The class of context-free grammars in which at most one token of + lookahead is needed to disambiguate the parsing of any piece of + input. + +Nonterminal symbol + A grammar symbol standing for a grammatical construct that can be + expressed through rules in terms of smaller constructs; in other + words, a construct that is not a token. *Note Symbols::. + +Parser + A function that recognizes valid sentences of a language by + analyzing the syntax structure of a set of tokens passed to it + from a lexical analyzer. + +Postfix operator + An arithmetic operator that is placed after the operands upon + which it performs some operation. + +Reduction + Replacing a string of nonterminals and/or terminals with a single + nonterminal, according to a grammar rule. *Note The Bison Parser + Algorithm: Algorithm. + +Reentrant + A reentrant subprogram is a subprogram which can be in invoked any + number of times in parallel, without interference between the + various invocations. *Note A Pure (Reentrant) Parser: Pure Decl. + +Reverse polish notation + A language in which all operators are postfix operators. + +Right recursion + A rule whose result symbol is also its last component symbol; for + example, `expseq1: exp ',' expseq1;'. *Note Recursive Rules: + Recursion. + +Semantics + In computer languages, the semantics are specified by the actions + taken for each instance of the language, i.e., the meaning of each + statement. *Note Defining Language Semantics: Semantics. + +Shift + A parser is said to shift when it makes the choice of analyzing + further input from the stream rather than reducing immediately some + already-recognized rule. *Note The Bison Parser Algorithm: + Algorithm. + +Single-character literal + A single character that is recognized and interpreted as is. + *Note From Formal Rules to Bison Input: Grammar in Bison. + +Start symbol + The nonterminal symbol that stands for a complete valid utterance + in the language being parsed. The start symbol is usually listed + as the first nonterminal symbol in a language specification. + *Note The Start-Symbol: Start Decl. + +Symbol table + A data structure where symbol names and associated data are stored + during parsing to allow for recognition and use of existing + information in repeated uses of a symbol. *Note Multi-function + Calc::. + +Syntax error + An error encountered during parsing of an input stream due to + invalid syntax. *Note Error Recovery::. + +Token + A basic, grammatically indivisible unit of a language. The symbol + that describes a token in the grammar is a terminal symbol. The + input of the Bison parser is a stream of tokens which comes from + the lexical analyzer. *Note Symbols::. + +Terminal symbol + A grammar symbol that has no rules in the grammar and therefore is + grammatically indivisible. The piece of text it represents is a + token. *Note Languages and Context-Free Grammars: Language and + Grammar. + + +File: bison.info, Node: Copying This Manual, Next: Index, Prev: Glossary, Up: Top + +Appendix C Copying This Manual +****************************** + + Version 1.2, November 2002 + + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document "free" in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it + can be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + "Document", below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as "you". You + accept the license if you copy, modify or distribute the work in a + way requiring permission under copyright law. + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document's overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. If a section does not fit the above definition of + Secondary then it is not allowed to be designated as Invariant. + The Document may contain zero Invariant Sections. If the Document + does not identify any Invariant Sections then there are none. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup, or absence of + markup, has been arranged to thwart or discourage subsequent + modification by readers is not Transparent. An image format is + not Transparent if used for any substantial amount of text. A + copy that is not "Transparent" is called "Opaque". + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML, PostScript or PDF designed for + human modification. Examples of transparent image formats include + PNG, XCF and JPG. Opaque formats include proprietary formats that + can be read and edited only by proprietary word processors, SGML or + XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML, PostScript or PDF + produced by some word processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in 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, preceding the beginning of the body of the text. + + A section "Entitled XYZ" means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + "Acknowledgements", "Dedications", "Endorsements", or "History".) + To "Preserve the Title" of such a section when you modify the + Document means that it remains a section "Entitled XYZ" according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document's license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a computer-network location from + which the general network-using public has access to download + using public-standard network protocols a complete Transparent + copy of the Document, free of added material. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of + previous versions (which should, if there were any, be listed + in the History section of the Document). You may use the + same title as a previous version if the original publisher of + that version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled "History", Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on + the Title Page. If there is no section Entitled "History" in + the Document, create one stating the title, year, authors, + and publisher of the Document as given on its Title Page, + then add an item describing the Modified Version as stated in + the previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in + the "History" section. You may omit a network location for a + work that was published at least four years before the + Document itself, or if the original publisher of the version + it refers to gives permission. + + K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the + section all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section + titles. + + M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + "Endorsements" or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section Entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties--for example, statements of peer review or that the text + has been approved by an organization as the authoritative + definition of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + "History" in the various original documents, forming one section + Entitled "History"; likewise combine any sections Entitled + "Acknowledgements", and any sections Entitled "Dedications". You + must delete all sections Entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, is called an "aggregate" if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation's users beyond what the individual + works permit. When the Document is included in an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document's Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled "Acknowledgements", + "Dedications", or "History", the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document is + void, and will automatically terminate your rights under this + License. However, parties who have received copies, or rights, + from you under this License will not have their licenses + terminated so long as such parties remain in full compliance. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + `http://www.gnu.org/copyleft/'. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of 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 Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + 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 + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + +File: bison.info, Node: Index, Prev: Copying This Manual, Up: Top + +Index +***** + +[index] +* Menu: + +* $ <1>: Table of Symbols. (line 19) +* $ <2>: Java Action Features. + (line 13) +* $: Action Features. (line 14) +* $$ <1>: Table of Symbols. (line 15) +* $$ <2>: Java Action Features. + (line 21) +* $$ <3>: Action Features. (line 10) +* $$: Actions. (line 6) +* $< <1>: Java Action Features. + (line 17) +* $<: Action Features. (line 18) +* $accept: Table of Symbols. (line 65) +* $end: Table of Symbols. (line 104) +* $N: Actions. (line 6) +* $undefined: Table of Symbols. (line 212) +* % <1>: Table of Symbols. (line 28) +* %: Java Declarations Summary. + (line 53) +* %% <1>: Table of Symbols. (line 23) +* %%: Java Declarations Summary. + (line 49) +* %code <1>: Table of Symbols. (line 70) +* %code <2>: Java Declarations Summary. + (line 37) +* %code <3>: Calc++ Parser. (line 64) +* %code <4>: Decl Summary. (line 46) +* %code: Prologue Alternatives. + (line 6) +* %code imports <1>: Java Declarations Summary. + (line 41) +* %code imports: Decl Summary. (line 115) +* %code lexer: Java Declarations Summary. + (line 45) +* %code provides <1>: Decl Summary. (line 86) +* %code provides: Prologue Alternatives. + (line 6) +* %code requires <1>: Calc++ Parser. (line 17) +* %code requires <2>: Decl Summary. (line 72) +* %code requires: Prologue Alternatives. + (line 6) +* %code top <1>: Decl Summary. (line 98) +* %code top: Prologue Alternatives. + (line 6) +* %debug <1>: Table of Symbols. (line 75) +* %debug <2>: Tracing. (line 23) +* %debug: Decl Summary. (line 134) +* %define <1>: Table of Symbols. (line 81) +* %define: Decl Summary. (line 139) +* %define abstract: Java Declarations Summary. + (line 57) +* %define api.pure <1>: Decl Summary. (line 166) +* %define api.pure: Pure Decl. (line 6) +* %define api.push_pull <1>: Decl Summary. (line 177) +* %define api.push_pull: Push Decl. (line 6) +* %define extends: Java Declarations Summary. + (line 61) +* %define final: Java Declarations Summary. + (line 65) +* %define implements: Java Declarations Summary. + (line 69) +* %define lex_throws: Java Declarations Summary. + (line 73) +* %define location_type: Java Declarations Summary. + (line 78) +* %define lr.keep_unreachable_states: Decl Summary. (line 190) +* %define namespace <1>: C++ Bison Interface. (line 10) +* %define namespace: Decl Summary. (line 232) +* %define package: Java Declarations Summary. + (line 84) +* %define parser_class_name: Java Declarations Summary. + (line 88) +* %define position_type: Java Declarations Summary. + (line 92) +* %define public: Java Declarations Summary. + (line 97) +* %define strictfp: Java Declarations Summary. + (line 105) +* %define stype: Java Declarations Summary. + (line 101) +* %define throws: Java Declarations Summary. + (line 109) +* %defines <1>: Table of Symbols. (line 86) +* %defines: Decl Summary. (line 274) +* %destructor <1>: Table of Symbols. (line 94) +* %destructor <2>: Decl Summary. (line 310) +* %destructor <3>: Destructor Decl. (line 6) +* %destructor: Mid-Rule Actions. (line 59) +* %dprec <1>: Table of Symbols. (line 99) +* %dprec: Merging GLR Parses. (line 6) +* %error-verbose <1>: Table of Symbols. (line 118) +* %error-verbose: Error Reporting. (line 17) +* %expect <1>: Decl Summary. (line 38) +* %expect: Expect Decl. (line 6) +* %expect-rr <1>: Expect Decl. (line 6) +* %expect-rr: Simple GLR Parsers. (line 6) +* %file-prefix <1>: Table of Symbols. (line 122) +* %file-prefix: Decl Summary. (line 315) +* %glr-parser <1>: Table of Symbols. (line 126) +* %glr-parser <2>: Simple GLR Parsers. (line 6) +* %glr-parser: GLR Parsers. (line 6) +* %initial-action <1>: Table of Symbols. (line 130) +* %initial-action: Initial Action Decl. (line 6) +* %language <1>: Table of Symbols. (line 134) +* %language: Decl Summary. (line 319) +* %language "Java": Java Declarations Summary. + (line 10) +* %left <1>: Table of Symbols. (line 138) +* %left <2>: Using Precedence. (line 6) +* %left: Decl Summary. (line 21) +* %lex-param <1>: Table of Symbols. (line 142) +* %lex-param <2>: Java Declarations Summary. + (line 13) +* %lex-param: Pure Calling. (line 31) +* %locations: Decl Summary. (line 327) +* %merge <1>: Table of Symbols. (line 147) +* %merge: Merging GLR Parses. (line 6) +* %name-prefix <1>: Table of Symbols. (line 154) +* %name-prefix <2>: Java Declarations Summary. + (line 19) +* %name-prefix: Decl Summary. (line 334) +* %no-lines <1>: Table of Symbols. (line 158) +* %no-lines: Decl Summary. (line 346) +* %nonassoc <1>: Table of Symbols. (line 162) +* %nonassoc <2>: Using Precedence. (line 6) +* %nonassoc: Decl Summary. (line 25) +* %output <1>: Table of Symbols. (line 166) +* %output: Decl Summary. (line 354) +* %parse-param <1>: Table of Symbols. (line 170) +* %parse-param <2>: Java Declarations Summary. + (line 24) +* %parse-param: Parser Function. (line 36) +* %prec <1>: Table of Symbols. (line 175) +* %prec: Contextual Precedence. + (line 6) +* %pure-parser <1>: Table of Symbols. (line 179) +* %pure-parser: Decl Summary. (line 357) +* %require <1>: Table of Symbols. (line 184) +* %require <2>: Decl Summary. (line 362) +* %require: Require Decl. (line 6) +* %right <1>: Table of Symbols. (line 188) +* %right <2>: Using Precedence. (line 6) +* %right: Decl Summary. (line 17) +* %skeleton <1>: Table of Symbols. (line 192) +* %skeleton: Decl Summary. (line 366) +* %start <1>: Table of Symbols. (line 196) +* %start <2>: Decl Summary. (line 34) +* %start: Start Decl. (line 6) +* %token <1>: Table of Symbols. (line 200) +* %token <2>: Java Declarations Summary. + (line 29) +* %token <3>: Decl Summary. (line 13) +* %token: Token Decl. (line 6) +* %token-table <1>: Table of Symbols. (line 204) +* %token-table: Decl Summary. (line 374) +* %type <1>: Table of Symbols. (line 208) +* %type <2>: Java Declarations Summary. + (line 33) +* %type <3>: Decl Summary. (line 30) +* %type: Type Decl. (line 6) +* %union <1>: Table of Symbols. (line 217) +* %union <2>: Decl Summary. (line 9) +* %union: Union Decl. (line 6) +* %verbose: Decl Summary. (line 407) +* %yacc: Decl Summary. (line 413) +* *yypstate_new: Parser Create Function. + (line 15) +* /*: Table of Symbols. (line 33) +* :: Table of Symbols. (line 36) +* ;: Table of Symbols. (line 40) +* <*> <1>: Table of Symbols. (line 47) +* <*>: Destructor Decl. (line 6) +* <> <1>: Table of Symbols. (line 56) +* <>: Destructor Decl. (line 6) +* @$ <1>: Table of Symbols. (line 7) +* @$ <2>: Java Action Features. + (line 39) +* @$ <3>: Action Features. (line 98) +* @$: Actions and Locations. + (line 6) +* @N <1>: Table of Symbols. (line 11) +* @N <2>: Java Action Features. + (line 35) +* @N <3>: Action Features. (line 104) +* @N: Actions and Locations. + (line 6) +* abstract syntax tree: Implementing Gotos/Loops. + (line 17) +* action: Actions. (line 6) +* action data types: Action Types. (line 6) +* action features summary: Action Features. (line 6) +* actions in mid-rule <1>: Destructor Decl. (line 88) +* actions in mid-rule: Mid-Rule Actions. (line 6) +* actions, location: Actions and Locations. + (line 6) +* actions, semantic: Semantic Actions. (line 6) +* additional C code section: Epilogue. (line 6) +* algorithm of parser: Algorithm. (line 6) +* ambiguous grammars <1>: Generalized LR Parsing. + (line 6) +* ambiguous grammars: Language and Grammar. + (line 33) +* associativity: Why Precedence. (line 33) +* AST: Implementing Gotos/Loops. + (line 17) +* Backus-Naur form: Language and Grammar. + (line 16) +* begin of Location: Java Location Values. + (line 21) +* begin on location: C++ Location Values. (line 44) +* Bison declaration summary: Decl Summary. (line 6) +* Bison declarations: Declarations. (line 6) +* Bison declarations (introduction): Bison Declarations. (line 6) +* Bison grammar: Grammar in Bison. (line 6) +* Bison invocation: Invocation. (line 6) +* Bison parser: Bison Parser. (line 6) +* Bison parser algorithm: Algorithm. (line 6) +* Bison symbols, table of: Table of Symbols. (line 6) +* Bison utility: Bison Parser. (line 6) +* bison-i18n.m4: Internationalization. + (line 20) +* bison-po: Internationalization. + (line 6) +* BISON_I18N: Internationalization. + (line 27) +* BISON_LOCALEDIR: Internationalization. + (line 27) +* BNF: Language and Grammar. + (line 16) +* braced code: Rules. (line 31) +* C code, section for additional: Epilogue. (line 6) +* C-language interface: Interface. (line 6) +* calc: Infix Calc. (line 6) +* calculator, infix notation: Infix Calc. (line 6) +* calculator, location tracking: Location Tracking Calc. + (line 6) +* calculator, multi-function: Multi-function Calc. (line 6) +* calculator, simple: RPN Calc. (line 6) +* character token: Symbols. (line 31) +* column on position: C++ Location Values. (line 25) +* columns on location: C++ Location Values. (line 48) +* columns on position: C++ Location Values. (line 28) +* compiling the parser: Rpcalc Compile. (line 6) +* conflicts <1>: Shift/Reduce. (line 6) +* conflicts <2>: Merging GLR Parses. (line 6) +* conflicts <3>: Simple GLR Parsers. (line 6) +* conflicts: GLR Parsers. (line 6) +* conflicts, reduce/reduce: Reduce/Reduce. (line 6) +* conflicts, suppressing warnings of: Expect Decl. (line 6) +* context-dependent precedence: Contextual Precedence. + (line 6) +* context-free grammar: Language and Grammar. + (line 6) +* controlling function: Rpcalc Main. (line 6) +* core, item set: Understanding. (line 129) +* dangling else: Shift/Reduce. (line 6) +* data type of locations: Location Type. (line 6) +* data types in actions: Action Types. (line 6) +* data types of semantic values: Value Type. (line 6) +* debug_level on parser: C++ Parser Interface. + (line 31) +* debug_stream on parser: C++ Parser Interface. + (line 26) +* debugging: Tracing. (line 6) +* declaration summary: Decl Summary. (line 6) +* declarations: Prologue. (line 6) +* declarations section: Prologue. (line 6) +* declarations, Bison: Declarations. (line 6) +* declarations, Bison (introduction): Bison Declarations. (line 6) +* declaring literal string tokens: Token Decl. (line 6) +* declaring operator precedence: Precedence Decl. (line 6) +* declaring the start symbol: Start Decl. (line 6) +* declaring token type names: Token Decl. (line 6) +* declaring value types: Union Decl. (line 6) +* declaring value types, nonterminals: Type Decl. (line 6) +* default action: Actions. (line 50) +* default data type: Value Type. (line 6) +* default location type: Location Type. (line 6) +* default stack limit: Memory Management. (line 30) +* default start symbol: Start Decl. (line 6) +* deferred semantic actions: GLR Semantic Actions. + (line 6) +* defining language semantics: Semantics. (line 6) +* discarded symbols: Destructor Decl. (line 98) +* discarded symbols, mid-rule actions: Mid-Rule Actions. (line 59) +* else, dangling: Shift/Reduce. (line 6) +* end of Location: Java Location Values. + (line 22) +* end on location: C++ Location Values. (line 45) +* epilogue: Epilogue. (line 6) +* error <1>: Table of Symbols. (line 108) +* error: Error Recovery. (line 20) +* error on parser: C++ Parser Interface. + (line 37) +* error recovery: Error Recovery. (line 6) +* error recovery, mid-rule actions: Mid-Rule Actions. (line 59) +* error recovery, simple: Simple Error Recovery. + (line 6) +* error reporting function: Error Reporting. (line 6) +* error reporting routine: Rpcalc Error. (line 6) +* examples, simple: Examples. (line 6) +* exercises: Exercises. (line 6) +* file format: Grammar Layout. (line 6) +* file on position: C++ Location Values. (line 13) +* finite-state machine: Parser States. (line 6) +* formal grammar: Grammar in Bison. (line 6) +* format of grammar file: Grammar Layout. (line 6) +* freeing discarded symbols: Destructor Decl. (line 6) +* frequently asked questions: FAQ. (line 6) +* generalized LR (GLR) parsing <1>: Generalized LR Parsing. + (line 6) +* generalized LR (GLR) parsing <2>: GLR Parsers. (line 6) +* generalized LR (GLR) parsing: Language and Grammar. + (line 33) +* generalized LR (GLR) parsing, ambiguous grammars: Merging GLR Parses. + (line 6) +* generalized LR (GLR) parsing, unambiguous grammars: Simple GLR Parsers. + (line 6) +* getDebugLevel on YYParser: Java Parser Interface. + (line 67) +* getDebugStream on YYParser: Java Parser Interface. + (line 62) +* getEndPos on Lexer: Java Scanner Interface. + (line 39) +* getLVal on Lexer: Java Scanner Interface. + (line 47) +* getStartPos on Lexer: Java Scanner Interface. + (line 38) +* gettext: Internationalization. + (line 6) +* glossary: Glossary. (line 6) +* GLR parsers and inline: Compiler Requirements. + (line 6) +* GLR parsers and yychar: GLR Semantic Actions. + (line 10) +* GLR parsers and yyclearin: GLR Semantic Actions. + (line 18) +* GLR parsers and YYERROR: GLR Semantic Actions. + (line 28) +* GLR parsers and yylloc: GLR Semantic Actions. + (line 10) +* GLR parsers and YYLLOC_DEFAULT: Location Default Action. + (line 6) +* GLR parsers and yylval: GLR Semantic Actions. + (line 10) +* GLR parsing <1>: Generalized LR Parsing. + (line 6) +* GLR parsing <2>: GLR Parsers. (line 6) +* GLR parsing: Language and Grammar. + (line 33) +* GLR parsing, ambiguous grammars: Merging GLR Parses. (line 6) +* GLR parsing, unambiguous grammars: Simple GLR Parsers. (line 6) +* grammar file: Grammar Layout. (line 6) +* grammar rule syntax: Rules. (line 6) +* grammar rules section: Grammar Rules. (line 6) +* grammar, Bison: Grammar in Bison. (line 6) +* grammar, context-free: Language and Grammar. + (line 6) +* grouping, syntactic: Language and Grammar. + (line 47) +* i18n: Internationalization. + (line 6) +* infix notation calculator: Infix Calc. (line 6) +* inline: Compiler Requirements. + (line 6) +* interface: Interface. (line 6) +* internationalization: Internationalization. + (line 6) +* introduction: Introduction. (line 6) +* invoking Bison: Invocation. (line 6) +* item: Understanding. (line 107) +* item set core: Understanding. (line 129) +* kernel, item set: Understanding. (line 129) +* LALR(1): Mystery Conflicts. (line 36) +* LALR(1) grammars: Language and Grammar. + (line 22) +* language semantics, defining: Semantics. (line 6) +* layout of Bison grammar: Grammar Layout. (line 6) +* left recursion: Recursion. (line 16) +* lex-param: Pure Calling. (line 31) +* lexical analyzer: Lexical. (line 6) +* lexical analyzer, purpose: Bison Parser. (line 6) +* lexical analyzer, writing: Rpcalc Lexer. (line 6) +* lexical tie-in: Lexical Tie-ins. (line 6) +* line on position: C++ Location Values. (line 19) +* lines on location: C++ Location Values. (line 49) +* lines on position: C++ Location Values. (line 22) +* literal string token: Symbols. (line 53) +* literal token: Symbols. (line 31) +* location <1>: Locations. (line 6) +* location: Locations Overview. (line 6) +* location actions: Actions and Locations. + (line 6) +* Location on Location: Java Location Values. + (line 25) +* location tracking calculator: Location Tracking Calc. + (line 6) +* location, textual <1>: Locations. (line 6) +* location, textual: Locations Overview. (line 6) +* location_value_type: C++ Parser Interface. + (line 16) +* lookahead token: Lookahead. (line 6) +* LR(1): Mystery Conflicts. (line 36) +* LR(1) grammars: Language and Grammar. + (line 22) +* ltcalc: Location Tracking Calc. + (line 6) +* main function in simple example: Rpcalc Main. (line 6) +* memory exhaustion: Memory Management. (line 6) +* memory management: Memory Management. (line 6) +* mfcalc: Multi-function Calc. (line 6) +* mid-rule actions <1>: Destructor Decl. (line 88) +* mid-rule actions: Mid-Rule Actions. (line 6) +* multi-function calculator: Multi-function Calc. (line 6) +* multicharacter literal: Symbols. (line 53) +* mutual recursion: Recursion. (line 32) +* NLS: Internationalization. + (line 6) +* nondeterministic parsing <1>: Generalized LR Parsing. + (line 6) +* nondeterministic parsing: Language and Grammar. + (line 33) +* nonterminal symbol: Symbols. (line 6) +* nonterminal, useless: Understanding. (line 62) +* operator precedence: Precedence. (line 6) +* operator precedence, declaring: Precedence Decl. (line 6) +* operator+ on location: C++ Location Values. (line 53) +* operator+ on position: C++ Location Values. (line 33) +* operator+= on location: C++ Location Values. (line 57) +* operator+= on position: C++ Location Values. (line 31) +* operator- on position: C++ Location Values. (line 36) +* operator-= on position: C++ Location Values. (line 35) +* operator<< on position: C++ Location Values. (line 40) +* options for invoking Bison: Invocation. (line 6) +* overflow of parser stack: Memory Management. (line 6) +* parse error: Error Reporting. (line 6) +* parse on parser: C++ Parser Interface. + (line 23) +* parse on YYParser: Java Parser Interface. + (line 54) +* parser: Bison Parser. (line 6) +* parser on parser: C++ Parser Interface. + (line 19) +* parser stack: Algorithm. (line 6) +* parser stack overflow: Memory Management. (line 6) +* parser state: Parser States. (line 6) +* pointed rule: Understanding. (line 107) +* polish notation calculator: RPN Calc. (line 6) +* precedence declarations: Precedence Decl. (line 6) +* precedence of operators: Precedence. (line 6) +* precedence, context-dependent: Contextual Precedence. + (line 6) +* precedence, unary operator: Contextual Precedence. + (line 6) +* preventing warnings about conflicts: Expect Decl. (line 6) +* Prologue <1>: Decl Summary. (line 50) +* Prologue: Prologue. (line 6) +* Prologue Alternatives: Prologue Alternatives. + (line 6) +* pure parser: Pure Decl. (line 6) +* push parser: Push Decl. (line 6) +* questions: FAQ. (line 6) +* recovering: Java Action Features. + (line 59) +* recovering on YYParser: Java Parser Interface. + (line 58) +* recovery from errors: Error Recovery. (line 6) +* recursive rule: Recursion. (line 6) +* reduce/reduce conflict: Reduce/Reduce. (line 6) +* reduce/reduce conflicts <1>: Merging GLR Parses. (line 6) +* reduce/reduce conflicts <2>: Simple GLR Parsers. (line 6) +* reduce/reduce conflicts: GLR Parsers. (line 6) +* reduction: Algorithm. (line 6) +* reentrant parser: Pure Decl. (line 6) +* requiring a version of Bison: Require Decl. (line 6) +* return YYABORT;: Java Action Features. + (line 43) +* return YYACCEPT;: Java Action Features. + (line 47) +* return YYERROR;: Java Action Features. + (line 51) +* return YYFAIL;: Java Action Features. + (line 55) +* reverse polish notation: RPN Calc. (line 6) +* right recursion: Recursion. (line 16) +* rpcalc: RPN Calc. (line 6) +* rule syntax: Rules. (line 6) +* rule, pointed: Understanding. (line 107) +* rule, useless: Understanding. (line 62) +* rules section for grammar: Grammar Rules. (line 6) +* running Bison (introduction): Rpcalc Generate. (line 6) +* semantic actions: Semantic Actions. (line 6) +* semantic value: Semantic Values. (line 6) +* semantic value type: Value Type. (line 6) +* semantic_value_type: C++ Parser Interface. + (line 15) +* set_debug_level on parser: C++ Parser Interface. + (line 32) +* set_debug_stream on parser: C++ Parser Interface. + (line 27) +* setDebugLevel on YYParser: Java Parser Interface. + (line 68) +* setDebugStream on YYParser: Java Parser Interface. + (line 63) +* shift/reduce conflicts <1>: Shift/Reduce. (line 6) +* shift/reduce conflicts <2>: Simple GLR Parsers. (line 6) +* shift/reduce conflicts: GLR Parsers. (line 6) +* shifting: Algorithm. (line 6) +* simple examples: Examples. (line 6) +* single-character literal: Symbols. (line 31) +* stack overflow: Memory Management. (line 6) +* stack, parser: Algorithm. (line 6) +* stages in using Bison: Stages. (line 6) +* start symbol: Language and Grammar. + (line 96) +* start symbol, declaring: Start Decl. (line 6) +* state (of parser): Parser States. (line 6) +* step on location: C++ Location Values. (line 60) +* string token: Symbols. (line 53) +* summary, action features: Action Features. (line 6) +* summary, Bison declaration: Decl Summary. (line 6) +* suppressing conflict warnings: Expect Decl. (line 6) +* symbol: Symbols. (line 6) +* symbol table example: Mfcalc Symbol Table. (line 6) +* symbols (abstract): Language and Grammar. + (line 47) +* symbols in Bison, table of: Table of Symbols. (line 6) +* syntactic grouping: Language and Grammar. + (line 47) +* syntax error: Error Reporting. (line 6) +* syntax of grammar rules: Rules. (line 6) +* terminal symbol: Symbols. (line 6) +* textual location <1>: Locations. (line 6) +* textual location: Locations Overview. (line 6) +* token: Language and Grammar. + (line 47) +* token type: Symbols. (line 6) +* token type names, declaring: Token Decl. (line 6) +* token, useless: Understanding. (line 62) +* toString on Location: Java Location Values. + (line 32) +* tracing the parser: Tracing. (line 6) +* unary operator precedence: Contextual Precedence. + (line 6) +* useless nonterminal: Understanding. (line 62) +* useless rule: Understanding. (line 62) +* useless token: Understanding. (line 62) +* using Bison: Stages. (line 6) +* value type, semantic: Value Type. (line 6) +* value types, declaring: Union Decl. (line 6) +* value types, nonterminals, declaring: Type Decl. (line 6) +* value, semantic: Semantic Values. (line 6) +* version requirement: Require Decl. (line 6) +* warnings, preventing: Expect Decl. (line 6) +* writing a lexical analyzer: Rpcalc Lexer. (line 6) +* YYABORT <1>: Table of Symbols. (line 221) +* YYABORT: Parser Function. (line 29) +* YYABORT;: Action Features. (line 28) +* YYACCEPT <1>: Table of Symbols. (line 230) +* YYACCEPT: Parser Function. (line 26) +* YYACCEPT;: Action Features. (line 32) +* YYBACKUP <1>: Table of Symbols. (line 238) +* YYBACKUP: Action Features. (line 36) +* yychar <1>: Table of Symbols. (line 242) +* yychar <2>: Lookahead. (line 47) +* yychar <3>: Action Features. (line 69) +* yychar: GLR Semantic Actions. + (line 10) +* yyclearin <1>: Table of Symbols. (line 248) +* yyclearin <2>: Error Recovery. (line 97) +* yyclearin: GLR Semantic Actions. + (line 18) +* yyclearin;: Action Features. (line 76) +* yydebug: Table of Symbols. (line 256) +* YYDEBUG <1>: Table of Symbols. (line 252) +* YYDEBUG: Tracing. (line 12) +* yydebug: Tracing. (line 6) +* YYEMPTY: Action Features. (line 49) +* YYENABLE_NLS: Internationalization. + (line 27) +* YYEOF: Action Features. (line 52) +* yyerrok <1>: Table of Symbols. (line 261) +* yyerrok: Error Recovery. (line 92) +* yyerrok;: Action Features. (line 81) +* yyerror: Table of Symbols. (line 274) +* YYERROR: Table of Symbols. (line 265) +* yyerror: Java Action Features. + (line 64) +* YYERROR: Action Features. (line 56) +* yyerror: Error Reporting. (line 6) +* YYERROR: GLR Semantic Actions. + (line 28) +* yyerror on Lexer: Java Scanner Interface. + (line 25) +* YYERROR;: Action Features. (line 56) +* YYERROR_VERBOSE: Table of Symbols. (line 278) +* YYINITDEPTH <1>: Table of Symbols. (line 285) +* YYINITDEPTH: Memory Management. (line 32) +* yylex <1>: Table of Symbols. (line 289) +* yylex: Lexical. (line 6) +* yylex on Lexer: Java Scanner Interface. + (line 30) +* yylex on parser: C++ Scanner Interface. + (line 12) +* YYLEX_PARAM: Table of Symbols. (line 294) +* yylloc <1>: Table of Symbols. (line 300) +* yylloc <2>: Lookahead. (line 47) +* yylloc <3>: Action Features. (line 86) +* yylloc <4>: Token Locations. (line 6) +* yylloc <5>: Actions and Locations. + (line 60) +* yylloc: GLR Semantic Actions. + (line 10) +* YYLLOC_DEFAULT: Location Default Action. + (line 6) +* YYLTYPE <1>: Table of Symbols. (line 310) +* YYLTYPE: Token Locations. (line 19) +* yylval <1>: Table of Symbols. (line 314) +* yylval <2>: Lookahead. (line 47) +* yylval <3>: Action Features. (line 92) +* yylval <4>: Token Values. (line 6) +* yylval <5>: Actions. (line 74) +* yylval: GLR Semantic Actions. + (line 10) +* YYMAXDEPTH <1>: Table of Symbols. (line 322) +* YYMAXDEPTH: Memory Management. (line 14) +* yynerrs <1>: Table of Symbols. (line 326) +* yynerrs: Error Reporting. (line 92) +* yyparse <1>: Table of Symbols. (line 332) +* yyparse: Parser Function. (line 6) +* YYPARSE_PARAM: Table of Symbols. (line 365) +* YYParser on YYParser: Java Parser Interface. + (line 41) +* YYPRINT: Tracing. (line 71) +* yypstate_delete <1>: Table of Symbols. (line 336) +* yypstate_delete: Parser Delete Function. + (line 6) +* yypstate_new <1>: Table of Symbols. (line 344) +* yypstate_new: Parser Create Function. + (line 6) +* yypull_parse <1>: Table of Symbols. (line 351) +* yypull_parse: Pull Parser Function. + (line 6) +* yypush_parse <1>: Table of Symbols. (line 358) +* yypush_parse: Push Parser Function. + (line 6) +* YYRECOVERING <1>: Table of Symbols. (line 371) +* YYRECOVERING <2>: Error Recovery. (line 109) +* YYRECOVERING: Action Features. (line 64) +* YYSTACK_USE_ALLOCA: Table of Symbols. (line 376) +* YYSTYPE: Table of Symbols. (line 392) +* | <1>: Table of Symbols. (line 43) +* |: Rules. (line 49) + + + +Tag Table: +Node: Top1120 +Node: Introduction13685 +Node: Conditions14948 +Node: Copying16839 +Node: Concepts54377 +Node: Language and Grammar55558 +Node: Grammar in Bison61447 +Node: Semantic Values63376 +Node: Semantic Actions65482 +Node: GLR Parsers66669 +Node: Simple GLR Parsers69416 +Node: Merging GLR Parses76068 +Node: GLR Semantic Actions80637 +Node: Compiler Requirements82527 +Node: Locations Overview83263 +Node: Bison Parser84716 +Node: Stages87656 +Node: Grammar Layout88944 +Node: Examples90276 +Node: RPN Calc91479 +Node: Rpcalc Declarations92479 +Node: Rpcalc Rules94407 +Node: Rpcalc Input96223 +Node: Rpcalc Line97698 +Node: Rpcalc Expr98826 +Node: Rpcalc Lexer100793 +Node: Rpcalc Main103387 +Node: Rpcalc Error103794 +Node: Rpcalc Generate104827 +Node: Rpcalc Compile105962 +Node: Infix Calc106841 +Node: Simple Error Recovery109604 +Node: Location Tracking Calc111499 +Node: Ltcalc Declarations112195 +Node: Ltcalc Rules113284 +Node: Ltcalc Lexer115300 +Node: Multi-function Calc117623 +Node: Mfcalc Declarations119199 +Node: Mfcalc Rules121246 +Node: Mfcalc Symbol Table122641 +Node: Exercises128817 +Node: Grammar File129331 +Node: Grammar Outline130180 +Node: Prologue131030 +Node: Prologue Alternatives132819 +Node: Bison Declarations142504 +Node: Grammar Rules142932 +Node: Epilogue143403 +Node: Symbols144419 +Node: Rules151122 +Node: Recursion153601 +Node: Semantics155319 +Node: Value Type156418 +Node: Multiple Types157253 +Node: Actions158420 +Node: Action Types161835 +Node: Mid-Rule Actions163147 +Node: Locations169612 +Node: Location Type170263 +Node: Actions and Locations171049 +Node: Location Default Action173510 +Node: Declarations177230 +Node: Require Decl178757 +Node: Token Decl179076 +Node: Precedence Decl181502 +Node: Union Decl183512 +Node: Type Decl185286 +Node: Initial Action Decl186212 +Node: Destructor Decl186983 +Node: Expect Decl192447 +Node: Start Decl194440 +Node: Pure Decl194828 +Node: Push Decl196578 +Node: Decl Summary201077 +Ref: Decl Summary-Footnote-1217963 +Node: Multiple Parsers218167 +Node: Interface219806 +Node: Parser Function221124 +Node: Push Parser Function223140 +Node: Pull Parser Function223950 +Node: Parser Create Function224601 +Node: Parser Delete Function225424 +Node: Lexical226195 +Node: Calling Convention227627 +Node: Token Values230587 +Node: Token Locations231751 +Node: Pure Calling232645 +Node: Error Reporting234526 +Node: Action Features238656 +Node: Internationalization242958 +Node: Algorithm245499 +Node: Lookahead247865 +Node: Shift/Reduce250074 +Node: Precedence252969 +Node: Why Precedence253625 +Node: Using Precedence255498 +Node: Precedence Examples256475 +Node: How Precedence257185 +Node: Contextual Precedence258342 +Node: Parser States260138 +Node: Reduce/Reduce261382 +Node: Mystery Conflicts264923 +Node: Generalized LR Parsing268630 +Node: Memory Management273249 +Node: Error Recovery275462 +Node: Context Dependency280765 +Node: Semantic Tokens281614 +Node: Lexical Tie-ins284684 +Node: Tie-in Recovery286261 +Node: Debugging288438 +Node: Understanding289104 +Node: Tracing300263 +Node: Invocation304365 +Node: Bison Options305764 +Node: Option Cross Key312768 +Node: Yacc Library313820 +Node: Other Languages314645 +Node: C++ Parsers314972 +Node: C++ Bison Interface315469 +Node: C++ Semantic Values316737 +Ref: C++ Semantic Values-Footnote-1317679 +Node: C++ Location Values317832 +Node: C++ Parser Interface320205 +Node: C++ Scanner Interface321922 +Node: A Complete C++ Example322624 +Node: Calc++ --- C++ Calculator323566 +Node: Calc++ Parsing Driver324080 +Node: Calc++ Parser327861 +Node: Calc++ Scanner331651 +Node: Calc++ Top Level335077 +Node: Java Parsers335726 +Node: Java Bison Interface336403 +Node: Java Semantic Values338366 +Node: Java Location Values339980 +Node: Java Parser Interface341536 +Node: Java Scanner Interface344774 +Node: Java Action Features346959 +Node: Java Differences349686 +Ref: Java Differences-Footnote-1352261 +Node: Java Declarations Summary352411 +Node: FAQ356659 +Node: Memory Exhausted357606 +Node: How Can I Reset the Parser357916 +Node: Strings are Destroyed360185 +Node: Implementing Gotos/Loops361774 +Node: Multiple start-symbols363057 +Node: Secure? Conform?364602 +Node: I can't build Bison365050 +Node: Where can I find help?365768 +Node: Bug Reports366561 +Node: More Languages368022 +Node: Beta Testing368380 +Node: Mailing Lists369254 +Node: Table of Symbols369465 +Node: Glossary384847 +Node: Copying This Manual391744 +Node: Index414137 + +End Tag Table diff --git a/doc/bison.texinfo b/doc/bison.texinfo new file mode 100644 index 0000000..d4a9cc3 --- /dev/null +++ b/doc/bison.texinfo @@ -0,0 +1,10385 @@ +\input texinfo @c -*-texinfo-*- +@comment %**start of header +@setfilename bison.info +@include version.texi +@settitle Bison @value{VERSION} +@setchapternewpage odd + +@finalout + +@c SMALL BOOK version +@c This edition has been formatted so that you can format and print it in +@c the smallbook format. +@c @smallbook + +@c Set following if you want to document %default-prec and %no-default-prec. +@c This feature is experimental and may change in future Bison versions. +@c @set defaultprec + +@ifnotinfo +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex tp cp +@end ifnotinfo +@ifinfo +@synindex fn cp +@synindex vr cp +@synindex tp cp +@end ifinfo +@comment %**end of header + +@copying + +This manual (@value{UPDATED}) is for @acronym{GNU} Bison (version +@value{VERSION}), the @acronym{GNU} parser generator. + +Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, +1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software +Foundation, Inc. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the @acronym{GNU} Free Documentation License, +Version 1.2 or any later version published by the Free Software +Foundation; with no Invariant Sections, with the Front-Cover texts +being ``A @acronym{GNU} Manual,'' and with the Back-Cover Texts as in +(a) below. A copy of the license is included in the section entitled +``@acronym{GNU} Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and +modify this @acronym{GNU} manual. Buying copies from the @acronym{FSF} +supports it in developing @acronym{GNU} and promoting software +freedom.'' +@end quotation +@end copying + +@dircategory Software development +@direntry +* bison: (bison). @acronym{GNU} parser generator (Yacc replacement). +@end direntry + +@titlepage +@title Bison +@subtitle The Yacc-compatible Parser Generator +@subtitle @value{UPDATED}, Bison Version @value{VERSION} + +@author by Charles Donnelly and Richard Stallman + +@page +@vskip 0pt plus 1filll +@insertcopying +@sp 2 +Published by the Free Software Foundation @* +51 Franklin Street, Fifth Floor @* +Boston, MA 02110-1301 USA @* +Printed copies are available from the Free Software Foundation.@* +@acronym{ISBN} 1-882114-44-2 +@sp 2 +Cover art by Etienne Suvasa. +@end titlepage + +@contents + +@ifnottex +@node Top +@top Bison +@insertcopying +@end ifnottex + +@menu +* Introduction:: +* Conditions:: +* Copying:: The @acronym{GNU} General Public License says + how you can copy and share Bison. + +Tutorial sections: +* Concepts:: Basic concepts for understanding Bison. +* Examples:: Three simple explained examples of using Bison. + +Reference sections: +* Grammar File:: Writing Bison declarations and rules. +* Interface:: C-language interface to the parser function @code{yyparse}. +* Algorithm:: How the Bison parser works at run-time. +* Error Recovery:: Writing rules for error recovery. +* Context Dependency:: What to do if your language syntax is too + messy for Bison to handle straightforwardly. +* Debugging:: Understanding or debugging Bison parsers. +* Invocation:: How to run Bison (to produce the parser source file). +* Other Languages:: Creating C++ and Java parsers. +* FAQ:: Frequently Asked Questions +* Table of Symbols:: All the keywords of the Bison language are explained. +* Glossary:: Basic concepts are explained. +* Copying This Manual:: License for copying this manual. +* Index:: Cross-references to the text. + +@detailmenu + --- The Detailed Node Listing --- + +The Concepts of Bison + +* Language and Grammar:: Languages and context-free grammars, + as mathematical ideas. +* Grammar in Bison:: How we represent grammars for Bison's sake. +* Semantic Values:: Each token or syntactic grouping can have + a semantic value (the value of an integer, + the name of an identifier, etc.). +* Semantic Actions:: Each rule can have an action containing C code. +* GLR Parsers:: Writing parsers for general context-free languages. +* Locations Overview:: Tracking Locations. +* Bison Parser:: What are Bison's input and output, + how is the output used? +* Stages:: Stages in writing and running Bison grammars. +* Grammar Layout:: Overall structure of a Bison grammar file. + +Writing @acronym{GLR} Parsers + +* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars. +* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities. +* GLR Semantic Actions:: Deferred semantic actions have special concerns. +* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler. + +Examples + +* RPN Calc:: Reverse polish notation calculator; + a first example with no operator precedence. +* Infix Calc:: Infix (algebraic) notation calculator. + Operator precedence is introduced. +* Simple Error Recovery:: Continuing after syntax errors. +* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$. +* Multi-function Calc:: Calculator with memory and trig functions. + It uses multiple data-types for semantic values. +* Exercises:: Ideas for improving the multi-function calculator. + +Reverse Polish Notation Calculator + +* Rpcalc Declarations:: Prologue (declarations) for rpcalc. +* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation. +* Rpcalc Lexer:: The lexical analyzer. +* Rpcalc Main:: The controlling function. +* Rpcalc Error:: The error reporting function. +* Rpcalc Generate:: Running Bison on the grammar file. +* Rpcalc Compile:: Run the C compiler on the output code. + +Grammar Rules for @code{rpcalc} + +* Rpcalc Input:: +* Rpcalc Line:: +* Rpcalc Expr:: + +Location Tracking Calculator: @code{ltcalc} + +* Ltcalc Declarations:: Bison and C declarations for ltcalc. +* Ltcalc Rules:: Grammar rules for ltcalc, with explanations. +* Ltcalc Lexer:: The lexical analyzer. + +Multi-Function Calculator: @code{mfcalc} + +* Mfcalc Declarations:: Bison declarations for multi-function calculator. +* Mfcalc Rules:: Grammar rules for the calculator. +* Mfcalc Symbol Table:: Symbol table management subroutines. + +Bison Grammar Files + +* Grammar Outline:: Overall layout of the grammar file. +* Symbols:: Terminal and nonterminal symbols. +* Rules:: How to write grammar rules. +* Recursion:: Writing recursive rules. +* Semantics:: Semantic values and actions. +* Locations:: Locations and actions. +* Declarations:: All kinds of Bison declarations are described here. +* Multiple Parsers:: Putting more than one Bison parser in one program. + +Outline of a Bison Grammar + +* Prologue:: Syntax and usage of the prologue. +* Prologue Alternatives:: Syntax and usage of alternatives to the prologue. +* Bison Declarations:: Syntax and usage of the Bison declarations section. +* Grammar Rules:: Syntax and usage of the grammar rules section. +* Epilogue:: Syntax and usage of the epilogue. + +Defining Language Semantics + +* Value Type:: Specifying one data type for all semantic values. +* Multiple Types:: Specifying several alternative data types. +* Actions:: An action is the semantic definition of a grammar rule. +* Action Types:: Specifying data types for actions to operate on. +* Mid-Rule Actions:: Most actions go at the end of a rule. + This says when, why and how to use the exceptional + action in the middle of a rule. + +Tracking Locations + +* Location Type:: Specifying a data type for locations. +* Actions and Locations:: Using locations in actions. +* Location Default Action:: Defining a general way to compute locations. + +Bison Declarations + +* Require Decl:: Requiring a Bison version. +* Token Decl:: Declaring terminal symbols. +* Precedence Decl:: Declaring terminals with precedence and associativity. +* Union Decl:: Declaring the set of all semantic value types. +* Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Initial Action Decl:: Code run before parsing starts. +* Destructor Decl:: Declaring how symbols are freed. +* Expect Decl:: Suppressing warnings about parsing conflicts. +* Start Decl:: Specifying the start symbol. +* Pure Decl:: Requesting a reentrant parser. +* Push Decl:: Requesting a push parser. +* Decl Summary:: Table of all Bison declarations. + +Parser C-Language Interface + +* Parser Function:: How to call @code{yyparse} and what it returns. +* Push Parser Function:: How to call @code{yypush_parse} and what it returns. +* Pull Parser Function:: How to call @code{yypull_parse} and what it returns. +* Parser Create Function:: How to call @code{yypstate_new} and what it returns. +* Parser Delete Function:: How to call @code{yypstate_delete} and what it returns. +* Lexical:: You must supply a function @code{yylex} + which reads tokens. +* Error Reporting:: You must supply a function @code{yyerror}. +* Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user's + native language. + +The Lexical Analyzer Function @code{yylex} + +* Calling Convention:: How @code{yyparse} calls @code{yylex}. +* Token Values:: How @code{yylex} must return the semantic value + of the token it has read. +* Token Locations:: How @code{yylex} must return the text location + (line number, etc.) of the token, if the + actions want that. +* Pure Calling:: How the calling convention differs in a pure parser + (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}). + +The Bison Parser Algorithm + +* Lookahead:: Parser looks one token ahead when deciding what to do. +* Shift/Reduce:: Conflicts: when either shifting or reduction is valid. +* Precedence:: Operator precedence works by resolving conflicts. +* Contextual Precedence:: When an operator's precedence depends on context. +* Parser States:: The parser is a finite-state-machine with stack. +* Reduce/Reduce:: When two rules are applicable in the same situation. +* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified. +* Generalized LR Parsing:: Parsing arbitrary context-free grammars. +* Memory Management:: What happens when memory is exhausted. How to avoid it. + +Operator Precedence + +* Why Precedence:: An example showing why precedence is needed. +* Using Precedence:: How to specify precedence in Bison grammars. +* Precedence Examples:: How these features are used in the previous example. +* How Precedence:: How they work. + +Handling Context Dependencies + +* Semantic Tokens:: Token parsing can depend on the semantic context. +* Lexical Tie-ins:: Token parsing can depend on the syntactic context. +* Tie-in Recovery:: Lexical tie-ins have implications for how + error recovery rules must be written. + +Debugging Your Parser + +* Understanding:: Understanding the structure of your parser. +* Tracing:: Tracing the execution of your parser. + +Invoking Bison + +* Bison Options:: All the options described in detail, + in alphabetical order by short options. +* Option Cross Key:: Alphabetical list of long options. +* Yacc Library:: Yacc-compatible @code{yylex} and @code{main}. + +Parsers Written In Other Languages + +* C++ Parsers:: The interface to generate C++ parser classes +* Java Parsers:: The interface to generate Java parser classes + +C++ Parsers + +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Interface:: Instantiating and running the parser +* C++ Scanner Interface:: Exchanges between yylex and parse +* A Complete C++ Example:: Demonstrating their use + +A Complete C++ Example + +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band + +Java Parsers + +* Java Bison Interface:: Asking for Java parser generation +* Java Semantic Values:: %type and %token vs. Java +* Java Location Values:: The position and location classes +* Java Parser Interface:: Instantiating and running the parser +* Java Scanner Interface:: Specifying the scanner for the parser +* Java Action Features:: Special features for use in actions +* Java Differences:: Differences between C/C++ and Java Grammars +* Java Declarations Summary:: List of Bison declarations used with Java + +Frequently Asked Questions + +* Memory Exhausted:: Breaking the Stack Limits +* How Can I Reset the Parser:: @code{yyparse} Keeps some State +* Strings are Destroyed:: @code{yylval} Loses Track of Strings +* Implementing Gotos/Loops:: Control Flow in the Calculator +* Multiple start-symbols:: Factoring closely related grammars +* Secure? Conform?:: Is Bison @acronym{POSIX} safe? +* I can't build Bison:: Troubleshooting +* Where can I find help?:: Troubleshouting +* Bug Reports:: Troublereporting +* More Languages:: Parsers in C++, Java, and so on +* Beta Testing:: Experimenting development versions +* Mailing Lists:: Meeting other Bison users + +Copying This Manual + +* Copying This Manual:: License for copying this manual. + +@end detailmenu +@end menu + +@node Introduction +@unnumbered Introduction +@cindex introduction + +@dfn{Bison} is a general-purpose parser generator that converts an +annotated context-free grammar into an @acronym{LALR}(1) or +@acronym{GLR} parser for that grammar. Once you are proficient with +Bison, you can use it to develop a wide range of language parsers, from those +used in simple desk calculators to complex programming languages. + +Bison is upward compatible with Yacc: all properly-written Yacc grammars +ought to work with Bison with no change. Anyone familiar with Yacc +should be able to use Bison with little trouble. You need to be fluent in +C or C++ programming in order to use Bison or to understand this manual. + +We begin with tutorial chapters that explain the basic concepts of using +Bison and show three explained examples, each building on the last. If you +don't know Bison or Yacc, start by reading these chapters. Reference +chapters follow which describe specific aspects of Bison in detail. + +Bison was written primarily by Robert Corbett; Richard Stallman made it +Yacc-compatible. Wilfred Hansen of Carnegie Mellon University added +multi-character string literals and other features. + +This edition corresponds to version @value{VERSION} of Bison. + +@node Conditions +@unnumbered Conditions for Using Bison + +The distribution terms for Bison-generated parsers permit using the +parsers in nonfree programs. Before Bison version 2.2, these extra +permissions applied only when Bison was generating @acronym{LALR}(1) +parsers in C@. And before Bison version 1.24, Bison-generated +parsers could be used only in programs that were free software. + +The other @acronym{GNU} programming tools, such as the @acronym{GNU} C +compiler, have never +had such a requirement. They could always be used for nonfree +software. The reason Bison was different was not due to a special +policy decision; it resulted from applying the usual General Public +License to all of the Bison source code. + +The output of the Bison utility---the Bison parser file---contains a +verbatim copy of a sizable piece of Bison, which is the code for the +parser's implementation. (The actions from your grammar are inserted +into this implementation at one point, but most of the rest of the +implementation is not changed.) When we applied the @acronym{GPL} +terms to the skeleton code for the parser's implementation, +the effect was to restrict the use of Bison output to free software. + +We didn't change the terms because of sympathy for people who want to +make software proprietary. @strong{Software should be free.} But we +concluded that limiting Bison's use to free software was doing little to +encourage people to make other software free. So we decided to make the +practical conditions for using Bison match the practical conditions for +using the other @acronym{GNU} tools. + +This exception applies when Bison is generating code for a parser. +You can tell whether the exception applies to a Bison output file by +inspecting the file for text beginning with ``As a special +exception@dots{}''. The text spells out the exact terms of the +exception. + +@node Copying +@unnumbered GNU GENERAL PUBLIC LICENSE +@include gpl-3.0.texi + +@node Concepts +@chapter The Concepts of Bison + +This chapter introduces many of the basic concepts without which the +details of Bison will not make sense. If you do not already know how to +use Bison or Yacc, we suggest you start by reading this chapter carefully. + +@menu +* Language and Grammar:: Languages and context-free grammars, + as mathematical ideas. +* Grammar in Bison:: How we represent grammars for Bison's sake. +* Semantic Values:: Each token or syntactic grouping can have + a semantic value (the value of an integer, + the name of an identifier, etc.). +* Semantic Actions:: Each rule can have an action containing C code. +* GLR Parsers:: Writing parsers for general context-free languages. +* Locations Overview:: Tracking Locations. +* Bison Parser:: What are Bison's input and output, + how is the output used? +* Stages:: Stages in writing and running Bison grammars. +* Grammar Layout:: Overall structure of a Bison grammar file. +@end menu + +@node Language and Grammar +@section Languages and Context-Free Grammars + +@cindex context-free grammar +@cindex grammar, context-free +In order for Bison to parse a language, it must be described by a +@dfn{context-free grammar}. This means that you specify one or more +@dfn{syntactic groupings} and give rules for constructing them from their +parts. For example, in the C language, one kind of grouping is called an +`expression'. One rule for making an expression might be, ``An expression +can be made of a minus sign and another expression''. Another would be, +``An expression can be an integer''. As you can see, rules are often +recursive, but there must be at least one rule which leads out of the +recursion. + +@cindex @acronym{BNF} +@cindex Backus-Naur form +The most common formal system for presenting such rules for humans to read +is @dfn{Backus-Naur Form} or ``@acronym{BNF}'', which was developed in +order to specify the language Algol 60. Any grammar expressed in +@acronym{BNF} is a context-free grammar. The input to Bison is +essentially machine-readable @acronym{BNF}. + +@cindex @acronym{LALR}(1) grammars +@cindex @acronym{LR}(1) grammars +There are various important subclasses of context-free grammar. Although it +can handle almost all context-free grammars, Bison is optimized for what +are called @acronym{LALR}(1) grammars. +In brief, in these grammars, it must be possible to +tell how to parse any portion of an input string with just a single +token of lookahead. Strictly speaking, that is a description of an +@acronym{LR}(1) grammar, and @acronym{LALR}(1) involves additional +restrictions that are +hard to explain simply; but it is rare in actual practice to find an +@acronym{LR}(1) grammar that fails to be @acronym{LALR}(1). +@xref{Mystery Conflicts, ,Mysterious Reduce/Reduce Conflicts}, for +more information on this. + +@cindex @acronym{GLR} parsing +@cindex generalized @acronym{LR} (@acronym{GLR}) parsing +@cindex ambiguous grammars +@cindex nondeterministic parsing + +Parsers for @acronym{LALR}(1) grammars are @dfn{deterministic}, meaning +roughly that the next grammar rule to apply at any point in the input is +uniquely determined by the preceding input and a fixed, finite portion +(called a @dfn{lookahead}) of the remaining input. A context-free +grammar can be @dfn{ambiguous}, meaning that there are multiple ways to +apply the grammar rules to get the same inputs. Even unambiguous +grammars can be @dfn{nondeterministic}, meaning that no fixed +lookahead always suffices to determine the next grammar rule to apply. +With the proper declarations, Bison is also able to parse these more +general context-free grammars, using a technique known as @acronym{GLR} +parsing (for Generalized @acronym{LR}). Bison's @acronym{GLR} parsers +are able to handle any context-free grammar for which the number of +possible parses of any given string is finite. + +@cindex symbols (abstract) +@cindex token +@cindex syntactic grouping +@cindex grouping, syntactic +In the formal grammatical rules for a language, each kind of syntactic +unit or grouping is named by a @dfn{symbol}. Those which are built by +grouping smaller constructs according to grammatical rules are called +@dfn{nonterminal symbols}; those which can't be subdivided are called +@dfn{terminal symbols} or @dfn{token types}. We call a piece of input +corresponding to a single terminal symbol a @dfn{token}, and a piece +corresponding to a single nonterminal symbol a @dfn{grouping}. + +We can use the C language as an example of what symbols, terminal and +nonterminal, mean. The tokens of C are identifiers, constants (numeric +and string), and the various keywords, arithmetic operators and +punctuation marks. So the terminal symbols of a grammar for C include +`identifier', `number', `string', plus one symbol for each keyword, +operator or punctuation mark: `if', `return', `const', `static', `int', +`char', `plus-sign', `open-brace', `close-brace', `comma' and many more. +(These tokens can be subdivided into characters, but that is a matter of +lexicography, not grammar.) + +Here is a simple C function subdivided into tokens: + +@ifinfo +@example +int /* @r{keyword `int'} */ +square (int x) /* @r{identifier, open-paren, keyword `int',} + @r{identifier, close-paren} */ +@{ /* @r{open-brace} */ + return x * x; /* @r{keyword `return', identifier, asterisk,} + @r{identifier, semicolon} */ +@} /* @r{close-brace} */ +@end example +@end ifinfo +@ifnotinfo +@example +int /* @r{keyword `int'} */ +square (int x) /* @r{identifier, open-paren, keyword `int', identifier, close-paren} */ +@{ /* @r{open-brace} */ + return x * x; /* @r{keyword `return', identifier, asterisk, identifier, semicolon} */ +@} /* @r{close-brace} */ +@end example +@end ifnotinfo + +The syntactic groupings of C include the expression, the statement, the +declaration, and the function definition. These are represented in the +grammar of C by nonterminal symbols `expression', `statement', +`declaration' and `function definition'. The full grammar uses dozens of +additional language constructs, each with its own nonterminal symbol, in +order to express the meanings of these four. The example above is a +function definition; it contains one declaration, and one statement. In +the statement, each @samp{x} is an expression and so is @samp{x * x}. + +Each nonterminal symbol must have grammatical rules showing how it is made +out of simpler constructs. For example, one kind of C statement is the +@code{return} statement; this would be described with a grammar rule which +reads informally as follows: + +@quotation +A `statement' can be made of a `return' keyword, an `expression' and a +`semicolon'. +@end quotation + +@noindent +There would be many other rules for `statement', one for each kind of +statement in C. + +@cindex start symbol +One nonterminal symbol must be distinguished as the special one which +defines a complete utterance in the language. It is called the @dfn{start +symbol}. In a compiler, this means a complete input program. In the C +language, the nonterminal symbol `sequence of definitions and declarations' +plays this role. + +For example, @samp{1 + 2} is a valid C expression---a valid part of a C +program---but it is not valid as an @emph{entire} C program. In the +context-free grammar of C, this follows from the fact that `expression' is +not the start symbol. + +The Bison parser reads a sequence of tokens as its input, and groups the +tokens using the grammar rules. If the input is valid, the end result is +that the entire token sequence reduces to a single grouping whose symbol is +the grammar's start symbol. If we use a grammar for C, the entire input +must be a `sequence of definitions and declarations'. If not, the parser +reports a syntax error. + +@node Grammar in Bison +@section From Formal Rules to Bison Input +@cindex Bison grammar +@cindex grammar, Bison +@cindex formal grammar + +A formal grammar is a mathematical construct. To define the language +for Bison, you must write a file expressing the grammar in Bison syntax: +a @dfn{Bison grammar} file. @xref{Grammar File, ,Bison Grammar Files}. + +A nonterminal symbol in the formal grammar is represented in Bison input +as an identifier, like an identifier in C@. By convention, it should be +in lower case, such as @code{expr}, @code{stmt} or @code{declaration}. + +The Bison representation for a terminal symbol is also called a @dfn{token +type}. Token types as well can be represented as C-like identifiers. By +convention, these identifiers should be upper case to distinguish them from +nonterminals: for example, @code{INTEGER}, @code{IDENTIFIER}, @code{IF} or +@code{RETURN}. A terminal symbol that stands for a particular keyword in +the language should be named after that keyword converted to upper case. +The terminal symbol @code{error} is reserved for error recovery. +@xref{Symbols}. + +A terminal symbol can also be represented as a character literal, just like +a C character constant. You should do this whenever a token is just a +single character (parenthesis, plus-sign, etc.): use that same character in +a literal as the terminal symbol for that token. + +A third way to represent a terminal symbol is with a C string constant +containing several characters. @xref{Symbols}, for more information. + +The grammar rules also have an expression in Bison syntax. For example, +here is the Bison rule for a C @code{return} statement. The semicolon in +quotes is a literal character token, representing part of the C syntax for +the statement; the naked semicolon, and the colon, are Bison punctuation +used in every rule. + +@example +stmt: RETURN expr ';' + ; +@end example + +@noindent +@xref{Rules, ,Syntax of Grammar Rules}. + +@node Semantic Values +@section Semantic Values +@cindex semantic value +@cindex value, semantic + +A formal grammar selects tokens only by their classifications: for example, +if a rule mentions the terminal symbol `integer constant', it means that +@emph{any} integer constant is grammatically valid in that position. The +precise value of the constant is irrelevant to how to parse the input: if +@samp{x+4} is grammatical then @samp{x+1} or @samp{x+3989} is equally +grammatical. + +But the precise value is very important for what the input means once it is +parsed. A compiler is useless if it fails to distinguish between 4, 1 and +3989 as constants in the program! Therefore, each token in a Bison grammar +has both a token type and a @dfn{semantic value}. @xref{Semantics, +,Defining Language Semantics}, +for details. + +The token type is a terminal symbol defined in the grammar, such as +@code{INTEGER}, @code{IDENTIFIER} or @code{','}. It tells everything +you need to know to decide where the token may validly appear and how to +group it with other tokens. The grammar rules know nothing about tokens +except their types. + +The semantic value has all the rest of the information about the +meaning of the token, such as the value of an integer, or the name of an +identifier. (A token such as @code{','} which is just punctuation doesn't +need to have any semantic value.) + +For example, an input token might be classified as token type +@code{INTEGER} and have the semantic value 4. Another input token might +have the same token type @code{INTEGER} but value 3989. When a grammar +rule says that @code{INTEGER} is allowed, either of these tokens is +acceptable because each is an @code{INTEGER}. When the parser accepts the +token, it keeps track of the token's semantic value. + +Each grouping can also have a semantic value as well as its nonterminal +symbol. For example, in a calculator, an expression typically has a +semantic value that is a number. In a compiler for a programming +language, an expression typically has a semantic value that is a tree +structure describing the meaning of the expression. + +@node Semantic Actions +@section Semantic Actions +@cindex semantic actions +@cindex actions, semantic + +In order to be useful, a program must do more than parse input; it must +also produce some output based on the input. In a Bison grammar, a grammar +rule can have an @dfn{action} made up of C statements. Each time the +parser recognizes a match for that rule, the action is executed. +@xref{Actions}. + +Most of the time, the purpose of an action is to compute the semantic value +of the whole construct from the semantic values of its parts. For example, +suppose we have a rule which says an expression can be the sum of two +expressions. When the parser recognizes such a sum, each of the +subexpressions has a semantic value which describes how it was built up. +The action for this rule should create a similar sort of value for the +newly recognized larger expression. + +For example, here is a rule that says an expression can be the sum of +two subexpressions: + +@example +expr: expr '+' expr @{ $$ = $1 + $3; @} + ; +@end example + +@noindent +The action says how to produce the semantic value of the sum expression +from the values of the two subexpressions. + +@node GLR Parsers +@section Writing @acronym{GLR} Parsers +@cindex @acronym{GLR} parsing +@cindex generalized @acronym{LR} (@acronym{GLR}) parsing +@findex %glr-parser +@cindex conflicts +@cindex shift/reduce conflicts +@cindex reduce/reduce conflicts + +In some grammars, Bison's standard +@acronym{LALR}(1) parsing algorithm cannot decide whether to apply a +certain grammar rule at a given point. That is, it may not be able to +decide (on the basis of the input read so far) which of two possible +reductions (applications of a grammar rule) applies, or whether to apply +a reduction or read more of the input and apply a reduction later in the +input. These are known respectively as @dfn{reduce/reduce} conflicts +(@pxref{Reduce/Reduce}), and @dfn{shift/reduce} conflicts +(@pxref{Shift/Reduce}). + +To use a grammar that is not easily modified to be @acronym{LALR}(1), a +more general parsing algorithm is sometimes necessary. If you include +@code{%glr-parser} among the Bison declarations in your file +(@pxref{Grammar Outline}), the result is a Generalized @acronym{LR} +(@acronym{GLR}) parser. These parsers handle Bison grammars that +contain no unresolved conflicts (i.e., after applying precedence +declarations) identically to @acronym{LALR}(1) parsers. However, when +faced with unresolved shift/reduce and reduce/reduce conflicts, +@acronym{GLR} parsers use the simple expedient of doing both, +effectively cloning the parser to follow both possibilities. Each of +the resulting parsers can again split, so that at any given time, there +can be any number of possible parses being explored. The parsers +proceed in lockstep; that is, all of them consume (shift) a given input +symbol before any of them proceed to the next. Each of the cloned +parsers eventually meets one of two possible fates: either it runs into +a parsing error, in which case it simply vanishes, or it merges with +another parser, because the two of them have reduced the input to an +identical set of symbols. + +During the time that there are multiple parsers, semantic actions are +recorded, but not performed. When a parser disappears, its recorded +semantic actions disappear as well, and are never performed. When a +reduction makes two parsers identical, causing them to merge, Bison +records both sets of semantic actions. Whenever the last two parsers +merge, reverting to the single-parser case, Bison resolves all the +outstanding actions either by precedences given to the grammar rules +involved, or by performing both actions, and then calling a designated +user-defined function on the resulting values to produce an arbitrary +merged result. + +@menu +* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars. +* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities. +* GLR Semantic Actions:: Deferred semantic actions have special concerns. +* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler. +@end menu + +@node Simple GLR Parsers +@subsection Using @acronym{GLR} on Unambiguous Grammars +@cindex @acronym{GLR} parsing, unambiguous grammars +@cindex generalized @acronym{LR} (@acronym{GLR}) parsing, unambiguous grammars +@findex %glr-parser +@findex %expect-rr +@cindex conflicts +@cindex reduce/reduce conflicts +@cindex shift/reduce conflicts + +In the simplest cases, you can use the @acronym{GLR} algorithm +to parse grammars that are unambiguous, but fail to be @acronym{LALR}(1). +Such grammars typically require more than one symbol of lookahead, +or (in rare cases) fall into the category of grammars in which the +@acronym{LALR}(1) algorithm throws away too much information (they are in +@acronym{LR}(1), but not @acronym{LALR}(1), @ref{Mystery Conflicts}). + +Consider a problem that +arises in the declaration of enumerated and subrange types in the +programming language Pascal. Here are some examples: + +@example +type subrange = lo .. hi; +type enum = (a, b, c); +@end example + +@noindent +The original language standard allows only numeric +literals and constant identifiers for the subrange bounds (@samp{lo} +and @samp{hi}), but Extended Pascal (@acronym{ISO}/@acronym{IEC} +10206) and many other +Pascal implementations allow arbitrary expressions there. This gives +rise to the following situation, containing a superfluous pair of +parentheses: + +@example +type subrange = (a) .. b; +@end example + +@noindent +Compare this to the following declaration of an enumerated +type with only one value: + +@example +type enum = (a); +@end example + +@noindent +(These declarations are contrived, but they are syntactically +valid, and more-complicated cases can come up in practical programs.) + +These two declarations look identical until the @samp{..} token. +With normal @acronym{LALR}(1) one-token lookahead it is not +possible to decide between the two forms when the identifier +@samp{a} is parsed. It is, however, desirable +for a parser to decide this, since in the latter case +@samp{a} must become a new identifier to represent the enumeration +value, while in the former case @samp{a} must be evaluated with its +current meaning, which may be a constant or even a function call. + +You could parse @samp{(a)} as an ``unspecified identifier in parentheses'', +to be resolved later, but this typically requires substantial +contortions in both semantic actions and large parts of the +grammar, where the parentheses are nested in the recursive rules for +expressions. + +You might think of using the lexer to distinguish between the two +forms by returning different tokens for currently defined and +undefined identifiers. But if these declarations occur in a local +scope, and @samp{a} is defined in an outer scope, then both forms +are possible---either locally redefining @samp{a}, or using the +value of @samp{a} from the outer scope. So this approach cannot +work. + +A simple solution to this problem is to declare the parser to +use the @acronym{GLR} algorithm. +When the @acronym{GLR} parser reaches the critical state, it +merely splits into two branches and pursues both syntax rules +simultaneously. Sooner or later, one of them runs into a parsing +error. If there is a @samp{..} token before the next +@samp{;}, the rule for enumerated types fails since it cannot +accept @samp{..} anywhere; otherwise, the subrange type rule +fails since it requires a @samp{..} token. So one of the branches +fails silently, and the other one continues normally, performing +all the intermediate actions that were postponed during the split. + +If the input is syntactically incorrect, both branches fail and the parser +reports a syntax error as usual. + +The effect of all this is that the parser seems to ``guess'' the +correct branch to take, or in other words, it seems to use more +lookahead than the underlying @acronym{LALR}(1) algorithm actually allows +for. In this example, @acronym{LALR}(2) would suffice, but also some cases +that are not @acronym{LALR}(@math{k}) for any @math{k} can be handled this way. + +In general, a @acronym{GLR} parser can take quadratic or cubic worst-case time, +and the current Bison parser even takes exponential time and space +for some grammars. In practice, this rarely happens, and for many +grammars it is possible to prove that it cannot happen. +The present example contains only one conflict between two +rules, and the type-declaration context containing the conflict +cannot be nested. So the number of +branches that can exist at any time is limited by the constant 2, +and the parsing time is still linear. + +Here is a Bison grammar corresponding to the example above. It +parses a vastly simplified form of Pascal type declarations. + +@example +%token TYPE DOTDOT ID + +@group +%left '+' '-' +%left '*' '/' +@end group + +%% + +@group +type_decl : TYPE ID '=' type ';' + ; +@end group + +@group +type : '(' id_list ')' + | expr DOTDOT expr + ; +@end group + +@group +id_list : ID + | id_list ',' ID + ; +@end group + +@group +expr : '(' expr ')' + | expr '+' expr + | expr '-' expr + | expr '*' expr + | expr '/' expr + | ID + ; +@end group +@end example + +When used as a normal @acronym{LALR}(1) grammar, Bison correctly complains +about one reduce/reduce conflict. In the conflicting situation the +parser chooses one of the alternatives, arbitrarily the one +declared first. Therefore the following correct input is not +recognized: + +@example +type t = (a) .. b; +@end example + +The parser can be turned into a @acronym{GLR} parser, while also telling Bison +to be silent about the one known reduce/reduce conflict, by +adding these two declarations to the Bison input file (before the first +@samp{%%}): + +@example +%glr-parser +%expect-rr 1 +@end example + +@noindent +No change in the grammar itself is required. Now the +parser recognizes all valid declarations, according to the +limited syntax above, transparently. In fact, the user does not even +notice when the parser splits. + +So here we have a case where we can use the benefits of @acronym{GLR}, +almost without disadvantages. Even in simple cases like this, however, +there are at least two potential problems to beware. First, always +analyze the conflicts reported by Bison to make sure that @acronym{GLR} +splitting is only done where it is intended. A @acronym{GLR} parser +splitting inadvertently may cause problems less obvious than an +@acronym{LALR} parser statically choosing the wrong alternative in a +conflict. Second, consider interactions with the lexer (@pxref{Semantic +Tokens}) with great care. Since a split parser consumes tokens without +performing any actions during the split, the lexer cannot obtain +information via parser actions. Some cases of lexer interactions can be +eliminated by using @acronym{GLR} to shift the complications from the +lexer to the parser. You must check the remaining cases for +correctness. + +In our example, it would be safe for the lexer to return tokens based on +their current meanings in some symbol table, because no new symbols are +defined in the middle of a type declaration. Though it is possible for +a parser to define the enumeration constants as they are parsed, before +the type declaration is completed, it actually makes no difference since +they cannot be used within the same enumerated type declaration. + +@node Merging GLR Parses +@subsection Using @acronym{GLR} to Resolve Ambiguities +@cindex @acronym{GLR} parsing, ambiguous grammars +@cindex generalized @acronym{LR} (@acronym{GLR}) parsing, ambiguous grammars +@findex %dprec +@findex %merge +@cindex conflicts +@cindex reduce/reduce conflicts + +Let's consider an example, vastly simplified from a C++ grammar. + +@example +%@{ + #include + #define YYSTYPE char const * + int yylex (void); + void yyerror (char const *); +%@} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%% + +prog : + | prog stmt @{ printf ("\n"); @} + ; + +stmt : expr ';' %dprec 1 + | decl %dprec 2 + ; + +expr : ID @{ printf ("%s ", $$); @} + | TYPENAME '(' expr ')' + @{ printf ("%s ", $1); @} + | expr '+' expr @{ printf ("+ "); @} + | expr '=' expr @{ printf ("= "); @} + ; + +decl : TYPENAME declarator ';' + @{ printf ("%s ", $1); @} + | TYPENAME declarator '=' expr ';' + @{ printf ("%s ", $1); @} + ; + +declarator : ID @{ printf ("\"%s\" ", $1); @} + | '(' declarator ')' + ; +@end example + +@noindent +This models a problematic part of the C++ grammar---the ambiguity between +certain declarations and statements. For example, + +@example +T (x) = y+z; +@end example + +@noindent +parses as either an @code{expr} or a @code{stmt} +(assuming that @samp{T} is recognized as a @code{TYPENAME} and +@samp{x} as an @code{ID}). +Bison detects this as a reduce/reduce conflict between the rules +@code{expr : ID} and @code{declarator : ID}, which it cannot resolve at the +time it encounters @code{x} in the example above. Since this is a +@acronym{GLR} parser, it therefore splits the problem into two parses, one for +each choice of resolving the reduce/reduce conflict. +Unlike the example from the previous section (@pxref{Simple GLR Parsers}), +however, neither of these parses ``dies,'' because the grammar as it stands is +ambiguous. One of the parsers eventually reduces @code{stmt : expr ';'} and +the other reduces @code{stmt : decl}, after which both parsers are in an +identical state: they've seen @samp{prog stmt} and have the same unprocessed +input remaining. We say that these parses have @dfn{merged.} + +At this point, the @acronym{GLR} parser requires a specification in the +grammar of how to choose between the competing parses. +In the example above, the two @code{%dprec} +declarations specify that Bison is to give precedence +to the parse that interprets the example as a +@code{decl}, which implies that @code{x} is a declarator. +The parser therefore prints + +@example +"x" y z + T +@end example + +The @code{%dprec} declarations only come into play when more than one +parse survives. Consider a different input string for this parser: + +@example +T (x) + y; +@end example + +@noindent +This is another example of using @acronym{GLR} to parse an unambiguous +construct, as shown in the previous section (@pxref{Simple GLR Parsers}). +Here, there is no ambiguity (this cannot be parsed as a declaration). +However, at the time the Bison parser encounters @code{x}, it does not +have enough information to resolve the reduce/reduce conflict (again, +between @code{x} as an @code{expr} or a @code{declarator}). In this +case, no precedence declaration is used. Again, the parser splits +into two, one assuming that @code{x} is an @code{expr}, and the other +assuming @code{x} is a @code{declarator}. The second of these parsers +then vanishes when it sees @code{+}, and the parser prints + +@example +x T y + +@end example + +Suppose that instead of resolving the ambiguity, you wanted to see all +the possibilities. For this purpose, you must merge the semantic +actions of the two possible parsers, rather than choosing one over the +other. To do so, you could change the declaration of @code{stmt} as +follows: + +@example +stmt : expr ';' %merge + | decl %merge + ; +@end example + +@noindent +and define the @code{stmtMerge} function as: + +@example +static YYSTYPE +stmtMerge (YYSTYPE x0, YYSTYPE x1) +@{ + printf (" "); + return ""; +@} +@end example + +@noindent +with an accompanying forward declaration +in the C declarations at the beginning of the file: + +@example +%@{ + #define YYSTYPE char const * + static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); +%@} +@end example + +@noindent +With these declarations, the resulting parser parses the first example +as both an @code{expr} and a @code{decl}, and prints + +@example +"x" y z + T x T y z + = +@end example + +Bison requires that all of the +productions that participate in any particular merge have identical +@samp{%merge} clauses. Otherwise, the ambiguity would be unresolvable, +and the parser will report an error during any parse that results in +the offending merge. + +@node GLR Semantic Actions +@subsection GLR Semantic Actions + +@cindex deferred semantic actions +By definition, a deferred semantic action is not performed at the same time as +the associated reduction. +This raises caveats for several Bison features you might use in a semantic +action in a @acronym{GLR} parser. + +@vindex yychar +@cindex @acronym{GLR} parsers and @code{yychar} +@vindex yylval +@cindex @acronym{GLR} parsers and @code{yylval} +@vindex yylloc +@cindex @acronym{GLR} parsers and @code{yylloc} +In any semantic action, you can examine @code{yychar} to determine the type of +the lookahead token present at the time of the associated reduction. +After checking that @code{yychar} is not set to @code{YYEMPTY} or @code{YYEOF}, +you can then examine @code{yylval} and @code{yylloc} to determine the +lookahead token's semantic value and location, if any. +In a nondeferred semantic action, you can also modify any of these variables to +influence syntax analysis. +@xref{Lookahead, ,Lookahead Tokens}. + +@findex yyclearin +@cindex @acronym{GLR} parsers and @code{yyclearin} +In a deferred semantic action, it's too late to influence syntax analysis. +In this case, @code{yychar}, @code{yylval}, and @code{yylloc} are set to +shallow copies of the values they had at the time of the associated reduction. +For this reason alone, modifying them is dangerous. +Moreover, the result of modifying them is undefined and subject to change with +future versions of Bison. +For example, if a semantic action might be deferred, you should never write it +to invoke @code{yyclearin} (@pxref{Action Features}) or to attempt to free +memory referenced by @code{yylval}. + +@findex YYERROR +@cindex @acronym{GLR} parsers and @code{YYERROR} +Another Bison feature requiring special consideration is @code{YYERROR} +(@pxref{Action Features}), which you can invoke in a semantic action to +initiate error recovery. +During deterministic @acronym{GLR} operation, the effect of @code{YYERROR} is +the same as its effect in an @acronym{LALR}(1) parser. +In a deferred semantic action, its effect is undefined. +@c The effect is probably a syntax error at the split point. + +Also, see @ref{Location Default Action, ,Default Action for Locations}, which +describes a special usage of @code{YYLLOC_DEFAULT} in @acronym{GLR} parsers. + +@node Compiler Requirements +@subsection Considerations when Compiling @acronym{GLR} Parsers +@cindex @code{inline} +@cindex @acronym{GLR} parsers and @code{inline} + +The @acronym{GLR} parsers require a compiler for @acronym{ISO} C89 or +later. In addition, they use the @code{inline} keyword, which is not +C89, but is C99 and is a common extension in pre-C99 compilers. It is +up to the user of these parsers to handle +portability issues. For instance, if using Autoconf and the Autoconf +macro @code{AC_C_INLINE}, a mere + +@example +%@{ + #include +%@} +@end example + +@noindent +will suffice. Otherwise, we suggest + +@example +%@{ + #if __STDC_VERSION__ < 199901 && ! defined __GNUC__ && ! defined inline + #define inline + #endif +%@} +@end example + +@node Locations Overview +@section Locations +@cindex location +@cindex textual location +@cindex location, textual + +Many applications, like interpreters or compilers, have to produce verbose +and useful error messages. To achieve this, one must be able to keep track of +the @dfn{textual location}, or @dfn{location}, of each syntactic construct. +Bison provides a mechanism for handling these locations. + +Each token has a semantic value. In a similar fashion, each token has an +associated location, but the type of locations is the same for all tokens and +groupings. Moreover, the output parser is equipped with a default data +structure for storing locations (@pxref{Locations}, for more details). + +Like semantic values, locations can be reached in actions using a dedicated +set of constructs. In the example above, the location of the whole grouping +is @code{@@$}, while the locations of the subexpressions are @code{@@1} and +@code{@@3}. + +When a rule is matched, a default action is used to compute the semantic value +of its left hand side (@pxref{Actions}). In the same way, another default +action is used for locations. However, the action for locations is general +enough for most cases, meaning there is usually no need to describe for each +rule how @code{@@$} should be formed. When building a new location for a given +grouping, the default behavior of the output parser is to take the beginning +of the first symbol, and the end of the last symbol. + +@node Bison Parser +@section Bison Output: the Parser File +@cindex Bison parser +@cindex Bison utility +@cindex lexical analyzer, purpose +@cindex parser + +When you run Bison, you give it a Bison grammar file as input. The output +is a C source file that parses the language described by the grammar. +This file is called a @dfn{Bison parser}. Keep in mind that the Bison +utility and the Bison parser are two distinct programs: the Bison utility +is a program whose output is the Bison parser that becomes part of your +program. + +The job of the Bison parser is to group tokens into groupings according to +the grammar rules---for example, to build identifiers and operators into +expressions. As it does this, it runs the actions for the grammar rules it +uses. + +The tokens come from a function called the @dfn{lexical analyzer} that +you must supply in some fashion (such as by writing it in C). The Bison +parser calls the lexical analyzer each time it wants a new token. It +doesn't know what is ``inside'' the tokens (though their semantic values +may reflect this). Typically the lexical analyzer makes the tokens by +parsing characters of text, but Bison does not depend on this. +@xref{Lexical, ,The Lexical Analyzer Function @code{yylex}}. + +The Bison parser file is C code which defines a function named +@code{yyparse} which implements that grammar. This function does not make +a complete C program: you must supply some additional functions. One is +the lexical analyzer. Another is an error-reporting function which the +parser calls to report an error. In addition, a complete C program must +start with a function called @code{main}; you have to provide this, and +arrange for it to call @code{yyparse} or the parser will never run. +@xref{Interface, ,Parser C-Language Interface}. + +Aside from the token type names and the symbols in the actions you +write, all symbols defined in the Bison parser file itself +begin with @samp{yy} or @samp{YY}. This includes interface functions +such as the lexical analyzer function @code{yylex}, the error reporting +function @code{yyerror} and the parser function @code{yyparse} itself. +This also includes numerous identifiers used for internal purposes. +Therefore, you should avoid using C identifiers starting with @samp{yy} +or @samp{YY} in the Bison grammar file except for the ones defined in +this manual. Also, you should avoid using the C identifiers +@samp{malloc} and @samp{free} for anything other than their usual +meanings. + +In some cases the Bison parser file includes system headers, and in +those cases your code should respect the identifiers reserved by those +headers. On some non-@acronym{GNU} hosts, @code{}, @code{}, +@code{}, and @code{} are included as needed to +declare memory allocators and related types. @code{} is +included if message translation is in use +(@pxref{Internationalization}). Other system headers may +be included if you define @code{YYDEBUG} to a nonzero value +(@pxref{Tracing, ,Tracing Your Parser}). + +@node Stages +@section Stages in Using Bison +@cindex stages in using Bison +@cindex using Bison + +The actual language-design process using Bison, from grammar specification +to a working compiler or interpreter, has these parts: + +@enumerate +@item +Formally specify the grammar in a form recognized by Bison +(@pxref{Grammar File, ,Bison Grammar Files}). For each grammatical rule +in the language, describe the action that is to be taken when an +instance of that rule is recognized. The action is described by a +sequence of C statements. + +@item +Write a lexical analyzer to process input and pass tokens to the parser. +The lexical analyzer may be written by hand in C (@pxref{Lexical, ,The +Lexical Analyzer Function @code{yylex}}). It could also be produced +using Lex, but the use of Lex is not discussed in this manual. + +@item +Write a controlling function that calls the Bison-produced parser. + +@item +Write error-reporting routines. +@end enumerate + +To turn this source code as written into a runnable program, you +must follow these steps: + +@enumerate +@item +Run Bison on the grammar to produce the parser. + +@item +Compile the code output by Bison, as well as any other source files. + +@item +Link the object files to produce the finished product. +@end enumerate + +@node Grammar Layout +@section The Overall Layout of a Bison Grammar +@cindex grammar file +@cindex file format +@cindex format of grammar file +@cindex layout of Bison grammar + +The input file for the Bison utility is a @dfn{Bison grammar file}. The +general form of a Bison grammar file is as follows: + +@example +%@{ +@var{Prologue} +%@} + +@var{Bison declarations} + +%% +@var{Grammar rules} +%% +@var{Epilogue} +@end example + +@noindent +The @samp{%%}, @samp{%@{} and @samp{%@}} are punctuation that appears +in every Bison grammar file to separate the sections. + +The prologue may define types and variables used in the actions. You can +also use preprocessor commands to define macros used there, and use +@code{#include} to include header files that do any of these things. +You need to declare the lexical analyzer @code{yylex} and the error +printer @code{yyerror} here, along with any other global identifiers +used by the actions in the grammar rules. + +The Bison declarations declare the names of the terminal and nonterminal +symbols, and may also describe operator precedence and the data types of +semantic values of various symbols. + +The grammar rules define how to construct each nonterminal symbol from its +parts. + +The epilogue can contain any code you want to use. Often the +definitions of functions declared in the prologue go here. In a +simple program, all the rest of the program can go here. + +@node Examples +@chapter Examples +@cindex simple examples +@cindex examples, simple + +Now we show and explain three sample programs written using Bison: a +reverse polish notation calculator, an algebraic (infix) notation +calculator, and a multi-function calculator. All three have been tested +under BSD Unix 4.3; each produces a usable, though limited, interactive +desk-top calculator. + +These examples are simple, but Bison grammars for real programming +languages are written the same way. You can copy these examples into a +source file to try them. + +@menu +* RPN Calc:: Reverse polish notation calculator; + a first example with no operator precedence. +* Infix Calc:: Infix (algebraic) notation calculator. + Operator precedence is introduced. +* Simple Error Recovery:: Continuing after syntax errors. +* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$. +* Multi-function Calc:: Calculator with memory and trig functions. + It uses multiple data-types for semantic values. +* Exercises:: Ideas for improving the multi-function calculator. +@end menu + +@node RPN Calc +@section Reverse Polish Notation Calculator +@cindex reverse polish notation +@cindex polish notation calculator +@cindex @code{rpcalc} +@cindex calculator, simple + +The first example is that of a simple double-precision @dfn{reverse polish +notation} calculator (a calculator using postfix operators). This example +provides a good starting point, since operator precedence is not an issue. +The second example will illustrate how operator precedence is handled. + +The source code for this calculator is named @file{rpcalc.y}. The +@samp{.y} extension is a convention used for Bison input files. + +@menu +* Rpcalc Declarations:: Prologue (declarations) for rpcalc. +* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation. +* Rpcalc Lexer:: The lexical analyzer. +* Rpcalc Main:: The controlling function. +* Rpcalc Error:: The error reporting function. +* Rpcalc Generate:: Running Bison on the grammar file. +* Rpcalc Compile:: Run the C compiler on the output code. +@end menu + +@node Rpcalc Declarations +@subsection Declarations for @code{rpcalc} + +Here are the C and Bison declarations for the reverse polish notation +calculator. As in C, comments are placed between @samp{/*@dots{}*/}. + +@example +/* Reverse polish notation calculator. */ + +%@{ + #define YYSTYPE double + #include + int yylex (void); + void yyerror (char const *); +%@} + +%token NUM + +%% /* Grammar rules and actions follow. */ +@end example + +The declarations section (@pxref{Prologue, , The prologue}) contains two +preprocessor directives and two forward declarations. + +The @code{#define} directive defines the macro @code{YYSTYPE}, thus +specifying the C data type for semantic values of both tokens and +groupings (@pxref{Value Type, ,Data Types of Semantic Values}). The +Bison parser will use whatever type @code{YYSTYPE} is defined as; if you +don't define it, @code{int} is the default. Because we specify +@code{double}, each token and each expression has an associated value, +which is a floating point number. + +The @code{#include} directive is used to declare the exponentiation +function @code{pow}. + +The forward declarations for @code{yylex} and @code{yyerror} are +needed because the C language requires that functions be declared +before they are used. These functions will be defined in the +epilogue, but the parser calls them so they must be declared in the +prologue. + +The second section, Bison declarations, provides information to Bison +about the token types (@pxref{Bison Declarations, ,The Bison +Declarations Section}). Each terminal symbol that is not a +single-character literal must be declared here. (Single-character +literals normally don't need to be declared.) In this example, all the +arithmetic operators are designated by single-character literals, so the +only terminal symbol that needs to be declared is @code{NUM}, the token +type for numeric constants. + +@node Rpcalc Rules +@subsection Grammar Rules for @code{rpcalc} + +Here are the grammar rules for the reverse polish notation calculator. + +@example +input: /* empty */ + | input line +; + +line: '\n' + | exp '\n' @{ printf ("\t%.10g\n", $1); @} +; + +exp: NUM @{ $$ = $1; @} + | exp exp '+' @{ $$ = $1 + $2; @} + | exp exp '-' @{ $$ = $1 - $2; @} + | exp exp '*' @{ $$ = $1 * $2; @} + | exp exp '/' @{ $$ = $1 / $2; @} + /* Exponentiation */ + | exp exp '^' @{ $$ = pow ($1, $2); @} + /* Unary minus */ + | exp 'n' @{ $$ = -$1; @} +; +%% +@end example + +The groupings of the rpcalc ``language'' defined here are the expression +(given the name @code{exp}), the line of input (@code{line}), and the +complete input transcript (@code{input}). Each of these nonterminal +symbols has several alternate rules, joined by the vertical bar @samp{|} +which is read as ``or''. The following sections explain what these rules +mean. + +The semantics of the language is determined by the actions taken when a +grouping is recognized. The actions are the C code that appears inside +braces. @xref{Actions}. + +You must specify these actions in C, but Bison provides the means for +passing semantic values between the rules. In each action, the +pseudo-variable @code{$$} stands for the semantic value for the grouping +that the rule is going to construct. Assigning a value to @code{$$} is the +main job of most actions. The semantic values of the components of the +rule are referred to as @code{$1}, @code{$2}, and so on. + +@menu +* Rpcalc Input:: +* Rpcalc Line:: +* Rpcalc Expr:: +@end menu + +@node Rpcalc Input +@subsubsection Explanation of @code{input} + +Consider the definition of @code{input}: + +@example +input: /* empty */ + | input line +; +@end example + +This definition reads as follows: ``A complete input is either an empty +string, or a complete input followed by an input line''. Notice that +``complete input'' is defined in terms of itself. This definition is said +to be @dfn{left recursive} since @code{input} appears always as the +leftmost symbol in the sequence. @xref{Recursion, ,Recursive Rules}. + +The first alternative is empty because there are no symbols between the +colon and the first @samp{|}; this means that @code{input} can match an +empty string of input (no tokens). We write the rules this way because it +is legitimate to type @kbd{Ctrl-d} right after you start the calculator. +It's conventional to put an empty alternative first and write the comment +@samp{/* empty */} in it. + +The second alternate rule (@code{input line}) handles all nontrivial input. +It means, ``After reading any number of lines, read one more line if +possible.'' The left recursion makes this rule into a loop. Since the +first alternative matches empty input, the loop can be executed zero or +more times. + +The parser function @code{yyparse} continues to process input until a +grammatical error is seen or the lexical analyzer says there are no more +input tokens; we will arrange for the latter to happen at end-of-input. + +@node Rpcalc Line +@subsubsection Explanation of @code{line} + +Now consider the definition of @code{line}: + +@example +line: '\n' + | exp '\n' @{ printf ("\t%.10g\n", $1); @} +; +@end example + +The first alternative is a token which is a newline character; this means +that rpcalc accepts a blank line (and ignores it, since there is no +action). The second alternative is an expression followed by a newline. +This is the alternative that makes rpcalc useful. The semantic value of +the @code{exp} grouping is the value of @code{$1} because the @code{exp} in +question is the first symbol in the alternative. The action prints this +value, which is the result of the computation the user asked for. + +This action is unusual because it does not assign a value to @code{$$}. As +a consequence, the semantic value associated with the @code{line} is +uninitialized (its value will be unpredictable). This would be a bug if +that value were ever used, but we don't use it: once rpcalc has printed the +value of the user's input line, that value is no longer needed. + +@node Rpcalc Expr +@subsubsection Explanation of @code{expr} + +The @code{exp} grouping has several rules, one for each kind of expression. +The first rule handles the simplest expressions: those that are just numbers. +The second handles an addition-expression, which looks like two expressions +followed by a plus-sign. The third handles subtraction, and so on. + +@example +exp: NUM + | exp exp '+' @{ $$ = $1 + $2; @} + | exp exp '-' @{ $$ = $1 - $2; @} + @dots{} + ; +@end example + +We have used @samp{|} to join all the rules for @code{exp}, but we could +equally well have written them separately: + +@example +exp: NUM ; +exp: exp exp '+' @{ $$ = $1 + $2; @} ; +exp: exp exp '-' @{ $$ = $1 - $2; @} ; + @dots{} +@end example + +Most of the rules have actions that compute the value of the expression in +terms of the value of its parts. For example, in the rule for addition, +@code{$1} refers to the first component @code{exp} and @code{$2} refers to +the second one. The third component, @code{'+'}, has no meaningful +associated semantic value, but if it had one you could refer to it as +@code{$3}. When @code{yyparse} recognizes a sum expression using this +rule, the sum of the two subexpressions' values is produced as the value of +the entire expression. @xref{Actions}. + +You don't have to give an action for every rule. When a rule has no +action, Bison by default copies the value of @code{$1} into @code{$$}. +This is what happens in the first rule (the one that uses @code{NUM}). + +The formatting shown here is the recommended convention, but Bison does +not require it. You can add or change white space as much as you wish. +For example, this: + +@example +exp : NUM | exp exp '+' @{$$ = $1 + $2; @} | @dots{} ; +@end example + +@noindent +means the same thing as this: + +@example +exp: NUM + | exp exp '+' @{ $$ = $1 + $2; @} + | @dots{} +; +@end example + +@noindent +The latter, however, is much more readable. + +@node Rpcalc Lexer +@subsection The @code{rpcalc} Lexical Analyzer +@cindex writing a lexical analyzer +@cindex lexical analyzer, writing + +The lexical analyzer's job is low-level parsing: converting characters +or sequences of characters into tokens. The Bison parser gets its +tokens by calling the lexical analyzer. @xref{Lexical, ,The Lexical +Analyzer Function @code{yylex}}. + +Only a simple lexical analyzer is needed for the @acronym{RPN} +calculator. This +lexical analyzer skips blanks and tabs, then reads in numbers as +@code{double} and returns them as @code{NUM} tokens. Any other character +that isn't part of a number is a separate token. Note that the token-code +for such a single-character token is the character itself. + +The return value of the lexical analyzer function is a numeric code which +represents a token type. The same text used in Bison rules to stand for +this token type is also a C expression for the numeric code for the type. +This works in two ways. If the token type is a character literal, then its +numeric code is that of the character; you can use the same +character literal in the lexical analyzer to express the number. If the +token type is an identifier, that identifier is defined by Bison as a C +macro whose definition is the appropriate number. In this example, +therefore, @code{NUM} becomes a macro for @code{yylex} to use. + +The semantic value of the token (if it has one) is stored into the +global variable @code{yylval}, which is where the Bison parser will look +for it. (The C data type of @code{yylval} is @code{YYSTYPE}, which was +defined at the beginning of the grammar; @pxref{Rpcalc Declarations, +,Declarations for @code{rpcalc}}.) + +A token type code of zero is returned if the end-of-input is encountered. +(Bison recognizes any nonpositive value as indicating end-of-input.) + +Here is the code for the lexical analyzer: + +@example +@group +/* The lexical analyzer returns a double floating point + number on the stack and the token NUM, or the numeric code + of the character read if not a number. It skips all blanks + and tabs, and returns 0 for end-of-input. */ + +#include +@end group + +@group +int +yylex (void) +@{ + int c; + + /* Skip white space. */ + while ((c = getchar ()) == ' ' || c == '\t') + ; +@end group +@group + /* Process numbers. */ + if (c == '.' || isdigit (c)) + @{ + ungetc (c, stdin); + scanf ("%lf", &yylval); + return NUM; + @} +@end group +@group + /* Return end-of-input. */ + if (c == EOF) + return 0; + /* Return a single char. */ + return c; +@} +@end group +@end example + +@node Rpcalc Main +@subsection The Controlling Function +@cindex controlling function +@cindex main function in simple example + +In keeping with the spirit of this example, the controlling function is +kept to the bare minimum. The only requirement is that it call +@code{yyparse} to start the process of parsing. + +@example +@group +int +main (void) +@{ + return yyparse (); +@} +@end group +@end example + +@node Rpcalc Error +@subsection The Error Reporting Routine +@cindex error reporting routine + +When @code{yyparse} detects a syntax error, it calls the error reporting +function @code{yyerror} to print an error message (usually but not +always @code{"syntax error"}). It is up to the programmer to supply +@code{yyerror} (@pxref{Interface, ,Parser C-Language Interface}), so +here is the definition we will use: + +@example +@group +#include + +/* Called by yyparse on error. */ +void +yyerror (char const *s) +@{ + fprintf (stderr, "%s\n", s); +@} +@end group +@end example + +After @code{yyerror} returns, the Bison parser may recover from the error +and continue parsing if the grammar contains a suitable error rule +(@pxref{Error Recovery}). Otherwise, @code{yyparse} returns nonzero. We +have not written any error rules in this example, so any invalid input will +cause the calculator program to exit. This is not clean behavior for a +real calculator, but it is adequate for the first example. + +@node Rpcalc Generate +@subsection Running Bison to Make the Parser +@cindex running Bison (introduction) + +Before running Bison to produce a parser, we need to decide how to +arrange all the source code in one or more source files. For such a +simple example, the easiest thing is to put everything in one file. The +definitions of @code{yylex}, @code{yyerror} and @code{main} go at the +end, in the epilogue of the file +(@pxref{Grammar Layout, ,The Overall Layout of a Bison Grammar}). + +For a large project, you would probably have several source files, and use +@code{make} to arrange to recompile them. + +With all the source in a single file, you use the following command to +convert it into a parser file: + +@example +bison @var{file}.y +@end example + +@noindent +In this example the file was called @file{rpcalc.y} (for ``Reverse Polish +@sc{calc}ulator''). Bison produces a file named @file{@var{file}.tab.c}, +removing the @samp{.y} from the original file name. The file output by +Bison contains the source code for @code{yyparse}. The additional +functions in the input file (@code{yylex}, @code{yyerror} and @code{main}) +are copied verbatim to the output. + +@node Rpcalc Compile +@subsection Compiling the Parser File +@cindex compiling the parser + +Here is how to compile and run the parser file: + +@example +@group +# @r{List files in current directory.} +$ @kbd{ls} +rpcalc.tab.c rpcalc.y +@end group + +@group +# @r{Compile the Bison parser.} +# @r{@samp{-lm} tells compiler to search math library for @code{pow}.} +$ @kbd{cc -lm -o rpcalc rpcalc.tab.c} +@end group + +@group +# @r{List files again.} +$ @kbd{ls} +rpcalc rpcalc.tab.c rpcalc.y +@end group +@end example + +The file @file{rpcalc} now contains the executable code. Here is an +example session using @code{rpcalc}. + +@example +$ @kbd{rpcalc} +@kbd{4 9 +} +13 +@kbd{3 7 + 3 4 5 *+-} +-13 +@kbd{3 7 + 3 4 5 * + - n} @r{Note the unary minus, @samp{n}} +13 +@kbd{5 6 / 4 n +} +-3.166666667 +@kbd{3 4 ^} @r{Exponentiation} +81 +@kbd{^D} @r{End-of-file indicator} +$ +@end example + +@node Infix Calc +@section Infix Notation Calculator: @code{calc} +@cindex infix notation calculator +@cindex @code{calc} +@cindex calculator, infix notation + +We now modify rpcalc to handle infix operators instead of postfix. Infix +notation involves the concept of operator precedence and the need for +parentheses nested to arbitrary depth. Here is the Bison code for +@file{calc.y}, an infix desk-top calculator. + +@example +/* Infix notation calculator. */ + +%@{ + #define YYSTYPE double + #include + #include + int yylex (void); + void yyerror (char const *); +%@} + +/* Bison declarations. */ +%token NUM +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +%% /* The grammar follows. */ +input: /* empty */ + | input line +; + +line: '\n' + | exp '\n' @{ printf ("\t%.10g\n", $1); @} +; + +exp: NUM @{ $$ = $1; @} + | exp '+' exp @{ $$ = $1 + $3; @} + | exp '-' exp @{ $$ = $1 - $3; @} + | exp '*' exp @{ $$ = $1 * $3; @} + | exp '/' exp @{ $$ = $1 / $3; @} + | '-' exp %prec NEG @{ $$ = -$2; @} + | exp '^' exp @{ $$ = pow ($1, $3); @} + | '(' exp ')' @{ $$ = $2; @} +; +%% +@end example + +@noindent +The functions @code{yylex}, @code{yyerror} and @code{main} can be the +same as before. + +There are two important new features shown in this code. + +In the second section (Bison declarations), @code{%left} declares token +types and says they are left-associative operators. The declarations +@code{%left} and @code{%right} (right associativity) take the place of +@code{%token} which is used to declare a token type name without +associativity. (These tokens are single-character literals, which +ordinarily don't need to be declared. We declare them here to specify +the associativity.) + +Operator precedence is determined by the line ordering of the +declarations; the higher the line number of the declaration (lower on +the page or screen), the higher the precedence. Hence, exponentiation +has the highest precedence, unary minus (@code{NEG}) is next, followed +by @samp{*} and @samp{/}, and so on. @xref{Precedence, ,Operator +Precedence}. + +The other important new feature is the @code{%prec} in the grammar +section for the unary minus operator. The @code{%prec} simply instructs +Bison that the rule @samp{| '-' exp} has the same precedence as +@code{NEG}---in this case the next-to-highest. @xref{Contextual +Precedence, ,Context-Dependent Precedence}. + +Here is a sample run of @file{calc.y}: + +@need 500 +@example +$ @kbd{calc} +@kbd{4 + 4.5 - (34/(8*3+-3))} +6.880952381 +@kbd{-56 + 2} +-54 +@kbd{3 ^ 2} +9 +@end example + +@node Simple Error Recovery +@section Simple Error Recovery +@cindex error recovery, simple + +Up to this point, this manual has not addressed the issue of @dfn{error +recovery}---how to continue parsing after the parser detects a syntax +error. All we have handled is error reporting with @code{yyerror}. +Recall that by default @code{yyparse} returns after calling +@code{yyerror}. This means that an erroneous input line causes the +calculator program to exit. Now we show how to rectify this deficiency. + +The Bison language itself includes the reserved word @code{error}, which +may be included in the grammar rules. In the example below it has +been added to one of the alternatives for @code{line}: + +@example +@group +line: '\n' + | exp '\n' @{ printf ("\t%.10g\n", $1); @} + | error '\n' @{ yyerrok; @} +; +@end group +@end example + +This addition to the grammar allows for simple error recovery in the +event of a syntax error. If an expression that cannot be evaluated is +read, the error will be recognized by the third rule for @code{line}, +and parsing will continue. (The @code{yyerror} function is still called +upon to print its message as well.) The action executes the statement +@code{yyerrok}, a macro defined automatically by Bison; its meaning is +that error recovery is complete (@pxref{Error Recovery}). Note the +difference between @code{yyerrok} and @code{yyerror}; neither one is a +misprint. + +This form of error recovery deals with syntax errors. There are other +kinds of errors; for example, division by zero, which raises an exception +signal that is normally fatal. A real calculator program must handle this +signal and use @code{longjmp} to return to @code{main} and resume parsing +input lines; it would also have to discard the rest of the current line of +input. We won't discuss this issue further because it is not specific to +Bison programs. + +@node Location Tracking Calc +@section Location Tracking Calculator: @code{ltcalc} +@cindex location tracking calculator +@cindex @code{ltcalc} +@cindex calculator, location tracking + +This example extends the infix notation calculator with location +tracking. This feature will be used to improve the error messages. For +the sake of clarity, this example is a simple integer calculator, since +most of the work needed to use locations will be done in the lexical +analyzer. + +@menu +* Ltcalc Declarations:: Bison and C declarations for ltcalc. +* Ltcalc Rules:: Grammar rules for ltcalc, with explanations. +* Ltcalc Lexer:: The lexical analyzer. +@end menu + +@node Ltcalc Declarations +@subsection Declarations for @code{ltcalc} + +The C and Bison declarations for the location tracking calculator are +the same as the declarations for the infix notation calculator. + +@example +/* Location tracking calculator. */ + +%@{ + #define YYSTYPE int + #include + int yylex (void); + void yyerror (char const *); +%@} + +/* Bison declarations. */ +%token NUM + +%left '-' '+' +%left '*' '/' +%left NEG +%right '^' + +%% /* The grammar follows. */ +@end example + +@noindent +Note there are no declarations specific to locations. Defining a data +type for storing locations is not needed: we will use the type provided +by default (@pxref{Location Type, ,Data Types of Locations}), which is a +four member structure with the following integer fields: +@code{first_line}, @code{first_column}, @code{last_line} and +@code{last_column}. By conventions, and in accordance with the GNU +Coding Standards and common practice, the line and column count both +start at 1. + +@node Ltcalc Rules +@subsection Grammar Rules for @code{ltcalc} + +Whether handling locations or not has no effect on the syntax of your +language. Therefore, grammar rules for this example will be very close +to those of the previous example: we will only modify them to benefit +from the new information. + +Here, we will use locations to report divisions by zero, and locate the +wrong expressions or subexpressions. + +@example +@group +input : /* empty */ + | input line +; +@end group + +@group +line : '\n' + | exp '\n' @{ printf ("%d\n", $1); @} +; +@end group + +@group +exp : NUM @{ $$ = $1; @} + | exp '+' exp @{ $$ = $1 + $3; @} + | exp '-' exp @{ $$ = $1 - $3; @} + | exp '*' exp @{ $$ = $1 * $3; @} +@end group +@group + | exp '/' exp + @{ + if ($3) + $$ = $1 / $3; + else + @{ + $$ = 1; + fprintf (stderr, "%d.%d-%d.%d: division by zero", + @@3.first_line, @@3.first_column, + @@3.last_line, @@3.last_column); + @} + @} +@end group +@group + | '-' exp %prec NEG @{ $$ = -$2; @} + | exp '^' exp @{ $$ = pow ($1, $3); @} + | '(' exp ')' @{ $$ = $2; @} +@end group +@end example + +This code shows how to reach locations inside of semantic actions, by +using the pseudo-variables @code{@@@var{n}} for rule components, and the +pseudo-variable @code{@@$} for groupings. + +We don't need to assign a value to @code{@@$}: the output parser does it +automatically. By default, before executing the C code of each action, +@code{@@$} is set to range from the beginning of @code{@@1} to the end +of @code{@@@var{n}}, for a rule with @var{n} components. This behavior +can be redefined (@pxref{Location Default Action, , Default Action for +Locations}), and for very specific rules, @code{@@$} can be computed by +hand. + +@node Ltcalc Lexer +@subsection The @code{ltcalc} Lexical Analyzer. + +Until now, we relied on Bison's defaults to enable location +tracking. The next step is to rewrite the lexical analyzer, and make it +able to feed the parser with the token locations, as it already does for +semantic values. + +To this end, we must take into account every single character of the +input text, to avoid the computed locations of being fuzzy or wrong: + +@example +@group +int +yylex (void) +@{ + int c; +@end group + +@group + /* Skip white space. */ + while ((c = getchar ()) == ' ' || c == '\t') + ++yylloc.last_column; +@end group + +@group + /* Step. */ + yylloc.first_line = yylloc.last_line; + yylloc.first_column = yylloc.last_column; +@end group + +@group + /* Process numbers. */ + if (isdigit (c)) + @{ + yylval = c - '0'; + ++yylloc.last_column; + while (isdigit (c = getchar ())) + @{ + ++yylloc.last_column; + yylval = yylval * 10 + c - '0'; + @} + ungetc (c, stdin); + return NUM; + @} +@end group + + /* Return end-of-input. */ + if (c == EOF) + return 0; + + /* Return a single char, and update location. */ + if (c == '\n') + @{ + ++yylloc.last_line; + yylloc.last_column = 0; + @} + else + ++yylloc.last_column; + return c; +@} +@end example + +Basically, the lexical analyzer performs the same processing as before: +it skips blanks and tabs, and reads numbers or single-character tokens. +In addition, it updates @code{yylloc}, the global variable (of type +@code{YYLTYPE}) containing the token's location. + +Now, each time this function returns a token, the parser has its number +as well as its semantic value, and its location in the text. The last +needed change is to initialize @code{yylloc}, for example in the +controlling function: + +@example +@group +int +main (void) +@{ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 0; + return yyparse (); +@} +@end group +@end example + +Remember that computing locations is not a matter of syntax. Every +character must be associated to a location update, whether it is in +valid input, in comments, in literal strings, and so on. + +@node Multi-function Calc +@section Multi-Function Calculator: @code{mfcalc} +@cindex multi-function calculator +@cindex @code{mfcalc} +@cindex calculator, multi-function + +Now that the basics of Bison have been discussed, it is time to move on to +a more advanced problem. The above calculators provided only five +functions, @samp{+}, @samp{-}, @samp{*}, @samp{/} and @samp{^}. It would +be nice to have a calculator that provides other mathematical functions such +as @code{sin}, @code{cos}, etc. + +It is easy to add new operators to the infix calculator as long as they are +only single-character literals. The lexical analyzer @code{yylex} passes +back all nonnumeric characters as tokens, so new grammar rules suffice for +adding a new operator. But we want something more flexible: built-in +functions whose syntax has this form: + +@example +@var{function_name} (@var{argument}) +@end example + +@noindent +At the same time, we will add memory to the calculator, by allowing you +to create named variables, store values in them, and use them later. +Here is a sample session with the multi-function calculator: + +@example +$ @kbd{mfcalc} +@kbd{pi = 3.141592653589} +3.1415926536 +@kbd{sin(pi)} +0.0000000000 +@kbd{alpha = beta1 = 2.3} +2.3000000000 +@kbd{alpha} +2.3000000000 +@kbd{ln(alpha)} +0.8329091229 +@kbd{exp(ln(beta1))} +2.3000000000 +$ +@end example + +Note that multiple assignment and nested function calls are permitted. + +@menu +* Mfcalc Declarations:: Bison declarations for multi-function calculator. +* Mfcalc Rules:: Grammar rules for the calculator. +* Mfcalc Symbol Table:: Symbol table management subroutines. +@end menu + +@node Mfcalc Declarations +@subsection Declarations for @code{mfcalc} + +Here are the C and Bison declarations for the multi-function calculator. + +@smallexample +@group +%@{ + #include /* For math functions, cos(), sin(), etc. */ + #include "calc.h" /* Contains definition of `symrec'. */ + int yylex (void); + void yyerror (char const *); +%@} +@end group +@group +%union @{ + double val; /* For returning numbers. */ + symrec *tptr; /* For returning symbol-table pointers. */ +@} +@end group +%token NUM /* Simple double precision number. */ +%token VAR FNCT /* Variable and Function. */ +%type exp + +@group +%right '=' +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ +@end group +%% /* The grammar follows. */ +@end smallexample + +The above grammar introduces only two new features of the Bison language. +These features allow semantic values to have various data types +(@pxref{Multiple Types, ,More Than One Value Type}). + +The @code{%union} declaration specifies the entire list of possible types; +this is instead of defining @code{YYSTYPE}. The allowable types are now +double-floats (for @code{exp} and @code{NUM}) and pointers to entries in +the symbol table. @xref{Union Decl, ,The Collection of Value Types}. + +Since values can now have various types, it is necessary to associate a +type with each grammar symbol whose semantic value is used. These symbols +are @code{NUM}, @code{VAR}, @code{FNCT}, and @code{exp}. Their +declarations are augmented with information about their data type (placed +between angle brackets). + +The Bison construct @code{%type} is used for declaring nonterminal +symbols, just as @code{%token} is used for declaring token types. We +have not used @code{%type} before because nonterminal symbols are +normally declared implicitly by the rules that define them. But +@code{exp} must be declared explicitly so we can specify its value type. +@xref{Type Decl, ,Nonterminal Symbols}. + +@node Mfcalc Rules +@subsection Grammar Rules for @code{mfcalc} + +Here are the grammar rules for the multi-function calculator. +Most of them are copied directly from @code{calc}; three rules, +those which mention @code{VAR} or @code{FNCT}, are new. + +@smallexample +@group +input: /* empty */ + | input line +; +@end group + +@group +line: + '\n' + | exp '\n' @{ printf ("\t%.10g\n", $1); @} + | error '\n' @{ yyerrok; @} +; +@end group + +@group +exp: NUM @{ $$ = $1; @} + | VAR @{ $$ = $1->value.var; @} + | VAR '=' exp @{ $$ = $3; $1->value.var = $3; @} + | FNCT '(' exp ')' @{ $$ = (*($1->value.fnctptr))($3); @} + | exp '+' exp @{ $$ = $1 + $3; @} + | exp '-' exp @{ $$ = $1 - $3; @} + | exp '*' exp @{ $$ = $1 * $3; @} + | exp '/' exp @{ $$ = $1 / $3; @} + | '-' exp %prec NEG @{ $$ = -$2; @} + | exp '^' exp @{ $$ = pow ($1, $3); @} + | '(' exp ')' @{ $$ = $2; @} +; +@end group +/* End of grammar. */ +%% +@end smallexample + +@node Mfcalc Symbol Table +@subsection The @code{mfcalc} Symbol Table +@cindex symbol table example + +The multi-function calculator requires a symbol table to keep track of the +names and meanings of variables and functions. This doesn't affect the +grammar rules (except for the actions) or the Bison declarations, but it +requires some additional C functions for support. + +The symbol table itself consists of a linked list of records. Its +definition, which is kept in the header @file{calc.h}, is as follows. It +provides for either functions or variables to be placed in the table. + +@smallexample +@group +/* Function type. */ +typedef double (*func_t) (double); +@end group + +@group +/* Data type for links in the chain of symbols. */ +struct symrec +@{ + char *name; /* name of symbol */ + int type; /* type of symbol: either VAR or FNCT */ + union + @{ + double var; /* value of a VAR */ + func_t fnctptr; /* value of a FNCT */ + @} value; + struct symrec *next; /* link field */ +@}; +@end group + +@group +typedef struct symrec symrec; + +/* The symbol table: a chain of `struct symrec'. */ +extern symrec *sym_table; + +symrec *putsym (char const *, int); +symrec *getsym (char const *); +@end group +@end smallexample + +The new version of @code{main} includes a call to @code{init_table}, a +function that initializes the symbol table. Here it is, and +@code{init_table} as well: + +@smallexample +#include + +@group +/* Called by yyparse on error. */ +void +yyerror (char const *s) +@{ + printf ("%s\n", s); +@} +@end group + +@group +struct init +@{ + char const *fname; + double (*fnct) (double); +@}; +@end group + +@group +struct init const arith_fncts[] = +@{ + "sin", sin, + "cos", cos, + "atan", atan, + "ln", log, + "exp", exp, + "sqrt", sqrt, + 0, 0 +@}; +@end group + +@group +/* The symbol table: a chain of `struct symrec'. */ +symrec *sym_table; +@end group + +@group +/* Put arithmetic functions in table. */ +void +init_table (void) +@{ + int i; + symrec *ptr; + for (i = 0; arith_fncts[i].fname != 0; i++) + @{ + ptr = putsym (arith_fncts[i].fname, FNCT); + ptr->value.fnctptr = arith_fncts[i].fnct; + @} +@} +@end group + +@group +int +main (void) +@{ + init_table (); + return yyparse (); +@} +@end group +@end smallexample + +By simply editing the initialization list and adding the necessary include +files, you can add additional functions to the calculator. + +Two important functions allow look-up and installation of symbols in the +symbol table. The function @code{putsym} is passed a name and the type +(@code{VAR} or @code{FNCT}) of the object to be installed. The object is +linked to the front of the list, and a pointer to the object is returned. +The function @code{getsym} is passed the name of the symbol to look up. If +found, a pointer to that symbol is returned; otherwise zero is returned. + +@smallexample +symrec * +putsym (char const *sym_name, int sym_type) +@{ + symrec *ptr; + ptr = (symrec *) malloc (sizeof (symrec)); + ptr->name = (char *) malloc (strlen (sym_name) + 1); + strcpy (ptr->name,sym_name); + ptr->type = sym_type; + ptr->value.var = 0; /* Set value to 0 even if fctn. */ + ptr->next = (struct symrec *)sym_table; + sym_table = ptr; + return ptr; +@} + +symrec * +getsym (char const *sym_name) +@{ + symrec *ptr; + for (ptr = sym_table; ptr != (symrec *) 0; + ptr = (symrec *)ptr->next) + if (strcmp (ptr->name,sym_name) == 0) + return ptr; + return 0; +@} +@end smallexample + +The function @code{yylex} must now recognize variables, numeric values, and +the single-character arithmetic operators. Strings of alphanumeric +characters with a leading letter are recognized as either variables or +functions depending on what the symbol table says about them. + +The string is passed to @code{getsym} for look up in the symbol table. If +the name appears in the table, a pointer to its location and its type +(@code{VAR} or @code{FNCT}) is returned to @code{yyparse}. If it is not +already in the table, then it is installed as a @code{VAR} using +@code{putsym}. Again, a pointer and its type (which must be @code{VAR}) is +returned to @code{yyparse}. + +No change is needed in the handling of numeric values and arithmetic +operators in @code{yylex}. + +@smallexample +@group +#include +@end group + +@group +int +yylex (void) +@{ + int c; + + /* Ignore white space, get first nonwhite character. */ + while ((c = getchar ()) == ' ' || c == '\t'); + + if (c == EOF) + return 0; +@end group + +@group + /* Char starts a number => parse the number. */ + if (c == '.' || isdigit (c)) + @{ + ungetc (c, stdin); + scanf ("%lf", &yylval.val); + return NUM; + @} +@end group + +@group + /* Char starts an identifier => read the name. */ + if (isalpha (c)) + @{ + symrec *s; + static char *symbuf = 0; + static int length = 0; + int i; +@end group + +@group + /* Initially make the buffer long enough + for a 40-character symbol name. */ + if (length == 0) + length = 40, symbuf = (char *)malloc (length + 1); + + i = 0; + do +@end group +@group + @{ + /* If buffer is full, make it bigger. */ + if (i == length) + @{ + length *= 2; + symbuf = (char *) realloc (symbuf, length + 1); + @} + /* Add this character to the buffer. */ + symbuf[i++] = c; + /* Get another character. */ + c = getchar (); + @} +@end group +@group + while (isalnum (c)); + + ungetc (c, stdin); + symbuf[i] = '\0'; +@end group + +@group + s = getsym (symbuf); + if (s == 0) + s = putsym (symbuf, VAR); + yylval.tptr = s; + return s->type; + @} + + /* Any other character is a token by itself. */ + return c; +@} +@end group +@end smallexample + +This program is both powerful and flexible. You may easily add new +functions, and it is a simple job to modify this code to install +predefined variables such as @code{pi} or @code{e} as well. + +@node Exercises +@section Exercises +@cindex exercises + +@enumerate +@item +Add some new functions from @file{math.h} to the initialization list. + +@item +Add another array that contains constants and their values. Then +modify @code{init_table} to add these constants to the symbol table. +It will be easiest to give the constants type @code{VAR}. + +@item +Make the program report an error if the user refers to an +uninitialized variable in any way except to store a value in it. +@end enumerate + +@node Grammar File +@chapter Bison Grammar Files + +Bison takes as input a context-free grammar specification and produces a +C-language function that recognizes correct instances of the grammar. + +The Bison grammar input file conventionally has a name ending in @samp{.y}. +@xref{Invocation, ,Invoking Bison}. + +@menu +* Grammar Outline:: Overall layout of the grammar file. +* Symbols:: Terminal and nonterminal symbols. +* Rules:: How to write grammar rules. +* Recursion:: Writing recursive rules. +* Semantics:: Semantic values and actions. +* Locations:: Locations and actions. +* Declarations:: All kinds of Bison declarations are described here. +* Multiple Parsers:: Putting more than one Bison parser in one program. +@end menu + +@node Grammar Outline +@section Outline of a Bison Grammar + +A Bison grammar file has four main sections, shown here with the +appropriate delimiters: + +@example +%@{ + @var{Prologue} +%@} + +@var{Bison declarations} + +%% +@var{Grammar rules} +%% + +@var{Epilogue} +@end example + +Comments enclosed in @samp{/* @dots{} */} may appear in any of the sections. +As a @acronym{GNU} extension, @samp{//} introduces a comment that +continues until end of line. + +@menu +* Prologue:: Syntax and usage of the prologue. +* Prologue Alternatives:: Syntax and usage of alternatives to the prologue. +* Bison Declarations:: Syntax and usage of the Bison declarations section. +* Grammar Rules:: Syntax and usage of the grammar rules section. +* Epilogue:: Syntax and usage of the epilogue. +@end menu + +@node Prologue +@subsection The prologue +@cindex declarations section +@cindex Prologue +@cindex declarations + +The @var{Prologue} section contains macro definitions and declarations +of functions and variables that are used in the actions in the grammar +rules. These are copied to the beginning of the parser file so that +they precede the definition of @code{yyparse}. You can use +@samp{#include} to get the declarations from a header file. If you +don't need any C declarations, you may omit the @samp{%@{} and +@samp{%@}} delimiters that bracket this section. + +The @var{Prologue} section is terminated by the first occurrence +of @samp{%@}} that is outside a comment, a string literal, or a +character constant. + +You may have more than one @var{Prologue} section, intermixed with the +@var{Bison declarations}. This allows you to have C and Bison +declarations that refer to each other. For example, the @code{%union} +declaration may use types defined in a header file, and you may wish to +prototype functions that take arguments of type @code{YYSTYPE}. This +can be done with two @var{Prologue} blocks, one before and one after the +@code{%union} declaration. + +@smallexample +%@{ + #define _GNU_SOURCE + #include + #include "ptypes.h" +%@} + +%union @{ + long int n; + tree t; /* @r{@code{tree} is defined in @file{ptypes.h}.} */ +@} + +%@{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) +%@} + +@dots{} +@end smallexample + +When in doubt, it is usually safer to put prologue code before all +Bison declarations, rather than after. For example, any definitions +of feature test macros like @code{_GNU_SOURCE} or +@code{_POSIX_C_SOURCE} should appear before all Bison declarations, as +feature test macros can affect the behavior of Bison-generated +@code{#include} directives. + +@node Prologue Alternatives +@subsection Prologue Alternatives +@cindex Prologue Alternatives + +@findex %code +@findex %code requires +@findex %code provides +@findex %code top +(The prologue alternatives described here are experimental. +More user feedback will help to determine whether they should become permanent +features.) + +The functionality of @var{Prologue} sections can often be subtle and +inflexible. +As an alternative, Bison provides a %code directive with an explicit qualifier +field, which identifies the purpose of the code and thus the location(s) where +Bison should generate it. +For C/C++, the qualifier can be omitted for the default location, or it can be +one of @code{requires}, @code{provides}, @code{top}. +@xref{Decl Summary,,%code}. + +Look again at the example of the previous section: + +@smallexample +%@{ + #define _GNU_SOURCE + #include + #include "ptypes.h" +%@} + +%union @{ + long int n; + tree t; /* @r{@code{tree} is defined in @file{ptypes.h}.} */ +@} + +%@{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) +%@} + +@dots{} +@end smallexample + +@noindent +Notice that there are two @var{Prologue} sections here, but there's a subtle +distinction between their functionality. +For example, if you decide to override Bison's default definition for +@code{YYLTYPE}, in which @var{Prologue} section should you write your new +definition? +You should write it in the first since Bison will insert that code into the +parser source code file @emph{before} the default @code{YYLTYPE} definition. +In which @var{Prologue} section should you prototype an internal function, +@code{trace_token}, that accepts @code{YYLTYPE} and @code{yytokentype} as +arguments? +You should prototype it in the second since Bison will insert that code +@emph{after} the @code{YYLTYPE} and @code{yytokentype} definitions. + +This distinction in functionality between the two @var{Prologue} sections is +established by the appearance of the @code{%union} between them. +This behavior raises a few questions. +First, why should the position of a @code{%union} affect definitions related to +@code{YYLTYPE} and @code{yytokentype}? +Second, what if there is no @code{%union}? +In that case, the second kind of @var{Prologue} section is not available. +This behavior is not intuitive. + +To avoid this subtle @code{%union} dependency, rewrite the example using a +@code{%code top} and an unqualified @code{%code}. +Let's go ahead and add the new @code{YYLTYPE} definition and the +@code{trace_token} prototype at the same time: + +@smallexample +%code top @{ + #define _GNU_SOURCE + #include + + /* WARNING: The following code really belongs + * in a `%code requires'; see below. */ + + #include "ptypes.h" + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + @{ + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + @} YYLTYPE; +@} + +%union @{ + long int n; + tree t; /* @r{@code{tree} is defined in @file{ptypes.h}.} */ +@} + +%code @{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) + static void trace_token (enum yytokentype token, YYLTYPE loc); +@} + +@dots{} +@end smallexample + +@noindent +In this way, @code{%code top} and the unqualified @code{%code} achieve the same +functionality as the two kinds of @var{Prologue} sections, but it's always +explicit which kind you intend. +Moreover, both kinds are always available even in the absence of @code{%union}. + +The @code{%code top} block above logically contains two parts. +The first two lines before the warning need to appear near the top of the +parser source code file. +The first line after the warning is required by @code{YYSTYPE} and thus also +needs to appear in the parser source code file. +However, if you've instructed Bison to generate a parser header file +(@pxref{Decl Summary, ,%defines}), you probably want that line to appear before +the @code{YYSTYPE} definition in that header file as well. +The @code{YYLTYPE} definition should also appear in the parser header file to +override the default @code{YYLTYPE} definition there. + +In other words, in the @code{%code top} block above, all but the first two +lines are dependency code required by the @code{YYSTYPE} and @code{YYLTYPE} +definitions. +Thus, they belong in one or more @code{%code requires}: + +@smallexample +%code top @{ + #define _GNU_SOURCE + #include +@} + +%code requires @{ + #include "ptypes.h" +@} +%union @{ + long int n; + tree t; /* @r{@code{tree} is defined in @file{ptypes.h}.} */ +@} + +%code requires @{ + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + @{ + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + @} YYLTYPE; +@} + +%code @{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) + static void trace_token (enum yytokentype token, YYLTYPE loc); +@} + +@dots{} +@end smallexample + +@noindent +Now Bison will insert @code{#include "ptypes.h"} and the new @code{YYLTYPE} +definition before the Bison-generated @code{YYSTYPE} and @code{YYLTYPE} +definitions in both the parser source code file and the parser header file. +(By the same reasoning, @code{%code requires} would also be the appropriate +place to write your own definition for @code{YYSTYPE}.) + +When you are writing dependency code for @code{YYSTYPE} and @code{YYLTYPE}, you +should prefer @code{%code requires} over @code{%code top} regardless of whether +you instruct Bison to generate a parser header file. +When you are writing code that you need Bison to insert only into the parser +source code file and that has no special need to appear at the top of that +file, you should prefer the unqualified @code{%code} over @code{%code top}. +These practices will make the purpose of each block of your code explicit to +Bison and to other developers reading your grammar file. +Following these practices, we expect the unqualified @code{%code} and +@code{%code requires} to be the most important of the four @var{Prologue} +alternatives. + +At some point while developing your parser, you might decide to provide +@code{trace_token} to modules that are external to your parser. +Thus, you might wish for Bison to insert the prototype into both the parser +header file and the parser source code file. +Since this function is not a dependency required by @code{YYSTYPE} or +@code{YYLTYPE}, it doesn't make sense to move its prototype to a +@code{%code requires}. +More importantly, since it depends upon @code{YYLTYPE} and @code{yytokentype}, +@code{%code requires} is not sufficient. +Instead, move its prototype from the unqualified @code{%code} to a +@code{%code provides}: + +@smallexample +%code top @{ + #define _GNU_SOURCE + #include +@} + +%code requires @{ + #include "ptypes.h" +@} +%union @{ + long int n; + tree t; /* @r{@code{tree} is defined in @file{ptypes.h}.} */ +@} + +%code requires @{ + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + @{ + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + @} YYLTYPE; +@} + +%code provides @{ + void trace_token (enum yytokentype token, YYLTYPE loc); +@} + +%code @{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(F, N, L) print_token_value (F, N, L) +@} + +@dots{} +@end smallexample + +@noindent +Bison will insert the @code{trace_token} prototype into both the parser header +file and the parser source code file after the definitions for +@code{yytokentype}, @code{YYLTYPE}, and @code{YYSTYPE}. + +The above examples are careful to write directives in an order that reflects +the layout of the generated parser source code and header files: +@code{%code top}, @code{%code requires}, @code{%code provides}, and then +@code{%code}. +While your grammar files may generally be easier to read if you also follow +this order, Bison does not require it. +Instead, Bison lets you choose an organization that makes sense to you. + +You may declare any of these directives multiple times in the grammar file. +In that case, Bison concatenates the contained code in declaration order. +This is the only way in which the position of one of these directives within +the grammar file affects its functionality. + +The result of the previous two properties is greater flexibility in how you may +organize your grammar file. +For example, you may organize semantic-type-related directives by semantic +type: + +@smallexample +%code requires @{ #include "type1.h" @} +%union @{ type1 field1; @} +%destructor @{ type1_free ($$); @} +%printer @{ type1_print ($$); @} + +%code requires @{ #include "type2.h" @} +%union @{ type2 field2; @} +%destructor @{ type2_free ($$); @} +%printer @{ type2_print ($$); @} +@end smallexample + +@noindent +You could even place each of the above directive groups in the rules section of +the grammar file next to the set of rules that uses the associated semantic +type. +(In the rules section, you must terminate each of those directives with a +semicolon.) +And you don't have to worry that some directive (like a @code{%union}) in the +definitions section is going to adversely affect their functionality in some +counter-intuitive manner just because it comes first. +Such an organization is not possible using @var{Prologue} sections. + +This section has been concerned with explaining the advantages of the four +@var{Prologue} alternatives over the original Yacc @var{Prologue}. +However, in most cases when using these directives, you shouldn't need to +think about all the low-level ordering issues discussed here. +Instead, you should simply use these directives to label each block of your +code according to its purpose and let Bison handle the ordering. +@code{%code} is the most generic label. +Move code to @code{%code requires}, @code{%code provides}, or @code{%code top} +as needed. + +@node Bison Declarations +@subsection The Bison Declarations Section +@cindex Bison declarations (introduction) +@cindex declarations, Bison (introduction) + +The @var{Bison declarations} section contains declarations that define +terminal and nonterminal symbols, specify precedence, and so on. +In some simple grammars you may not need any declarations. +@xref{Declarations, ,Bison Declarations}. + +@node Grammar Rules +@subsection The Grammar Rules Section +@cindex grammar rules section +@cindex rules section for grammar + +The @dfn{grammar rules} section contains one or more Bison grammar +rules, and nothing else. @xref{Rules, ,Syntax of Grammar Rules}. + +There must always be at least one grammar rule, and the first +@samp{%%} (which precedes the grammar rules) may never be omitted even +if it is the first thing in the file. + +@node Epilogue +@subsection The epilogue +@cindex additional C code section +@cindex epilogue +@cindex C code, section for additional + +The @var{Epilogue} is copied verbatim to the end of the parser file, just as +the @var{Prologue} is copied to the beginning. This is the most convenient +place to put anything that you want to have in the parser file but which need +not come before the definition of @code{yyparse}. For example, the +definitions of @code{yylex} and @code{yyerror} often go here. Because +C requires functions to be declared before being used, you often need +to declare functions like @code{yylex} and @code{yyerror} in the Prologue, +even if you define them in the Epilogue. +@xref{Interface, ,Parser C-Language Interface}. + +If the last section is empty, you may omit the @samp{%%} that separates it +from the grammar rules. + +The Bison parser itself contains many macros and identifiers whose names +start with @samp{yy} or @samp{YY}, so it is a good idea to avoid using +any such names (except those documented in this manual) in the epilogue +of the grammar file. + +@node Symbols +@section Symbols, Terminal and Nonterminal +@cindex nonterminal symbol +@cindex terminal symbol +@cindex token type +@cindex symbol + +@dfn{Symbols} in Bison grammars represent the grammatical classifications +of the language. + +A @dfn{terminal symbol} (also known as a @dfn{token type}) represents a +class of syntactically equivalent tokens. You use the symbol in grammar +rules to mean that a token in that class is allowed. The symbol is +represented in the Bison parser by a numeric code, and the @code{yylex} +function returns a token type code to indicate what kind of token has +been read. You don't need to know what the code value is; you can use +the symbol to stand for it. + +A @dfn{nonterminal symbol} stands for a class of syntactically +equivalent groupings. The symbol name is used in writing grammar rules. +By convention, it should be all lower case. + +Symbol names can contain letters, digits (not at the beginning), +underscores and periods. Periods make sense only in nonterminals. + +There are three ways of writing terminal symbols in the grammar: + +@itemize @bullet +@item +A @dfn{named token type} is written with an identifier, like an +identifier in C@. By convention, it should be all upper case. Each +such name must be defined with a Bison declaration such as +@code{%token}. @xref{Token Decl, ,Token Type Names}. + +@item +@cindex character token +@cindex literal token +@cindex single-character literal +A @dfn{character token type} (or @dfn{literal character token}) is +written in the grammar using the same syntax used in C for character +constants; for example, @code{'+'} is a character token type. A +character token type doesn't need to be declared unless you need to +specify its semantic value data type (@pxref{Value Type, ,Data Types of +Semantic Values}), associativity, or precedence (@pxref{Precedence, +,Operator Precedence}). + +By convention, a character token type is used only to represent a +token that consists of that particular character. Thus, the token +type @code{'+'} is used to represent the character @samp{+} as a +token. Nothing enforces this convention, but if you depart from it, +your program will confuse other readers. + +All the usual escape sequences used in character literals in C can be +used in Bison as well, but you must not use the null character as a +character literal because its numeric code, zero, signifies +end-of-input (@pxref{Calling Convention, ,Calling Convention +for @code{yylex}}). Also, unlike standard C, trigraphs have no +special meaning in Bison character literals, nor is backslash-newline +allowed. + +@item +@cindex string token +@cindex literal string token +@cindex multicharacter literal +A @dfn{literal string token} is written like a C string constant; for +example, @code{"<="} is a literal string token. A literal string token +doesn't need to be declared unless you need to specify its semantic +value data type (@pxref{Value Type}), associativity, or precedence +(@pxref{Precedence}). + +You can associate the literal string token with a symbolic name as an +alias, using the @code{%token} declaration (@pxref{Token Decl, ,Token +Declarations}). If you don't do that, the lexical analyzer has to +retrieve the token number for the literal string token from the +@code{yytname} table (@pxref{Calling Convention}). + +@strong{Warning}: literal string tokens do not work in Yacc. + +By convention, a literal string token is used only to represent a token +that consists of that particular string. Thus, you should use the token +type @code{"<="} to represent the string @samp{<=} as a token. Bison +does not enforce this convention, but if you depart from it, people who +read your program will be confused. + +All the escape sequences used in string literals in C can be used in +Bison as well, except that you must not use a null character within a +string literal. Also, unlike Standard C, trigraphs have no special +meaning in Bison string literals, nor is backslash-newline allowed. A +literal string token must contain two or more characters; for a token +containing just one character, use a character token (see above). +@end itemize + +How you choose to write a terminal symbol has no effect on its +grammatical meaning. That depends only on where it appears in rules and +on when the parser function returns that symbol. + +The value returned by @code{yylex} is always one of the terminal +symbols, except that a zero or negative value signifies end-of-input. +Whichever way you write the token type in the grammar rules, you write +it the same way in the definition of @code{yylex}. The numeric code +for a character token type is simply the positive numeric code of the +character, so @code{yylex} can use the identical value to generate the +requisite code, though you may need to convert it to @code{unsigned +char} to avoid sign-extension on hosts where @code{char} is signed. +Each named token type becomes a C macro in +the parser file, so @code{yylex} can use the name to stand for the code. +(This is why periods don't make sense in terminal symbols.) +@xref{Calling Convention, ,Calling Convention for @code{yylex}}. + +If @code{yylex} is defined in a separate file, you need to arrange for the +token-type macro definitions to be available there. Use the @samp{-d} +option when you run Bison, so that it will write these macro definitions +into a separate header file @file{@var{name}.tab.h} which you can include +in the other source files that need it. @xref{Invocation, ,Invoking Bison}. + +If you want to write a grammar that is portable to any Standard C +host, you must use only nonnull character tokens taken from the basic +execution character set of Standard C@. This set consists of the ten +digits, the 52 lower- and upper-case English letters, and the +characters in the following C-language string: + +@example +"\a\b\t\n\v\f\r !\"#%&'()*+,-./:;<=>?[\\]^_@{|@}~" +@end example + +The @code{yylex} function and Bison must use a consistent character set +and encoding for character tokens. For example, if you run Bison in an +@acronym{ASCII} environment, but then compile and run the resulting +program in an environment that uses an incompatible character set like +@acronym{EBCDIC}, the resulting program may not work because the tables +generated by Bison will assume @acronym{ASCII} numeric values for +character tokens. It is standard practice for software distributions to +contain C source files that were generated by Bison in an +@acronym{ASCII} environment, so installers on platforms that are +incompatible with @acronym{ASCII} must rebuild those files before +compiling them. + +The symbol @code{error} is a terminal symbol reserved for error recovery +(@pxref{Error Recovery}); you shouldn't use it for any other purpose. +In particular, @code{yylex} should never return this value. The default +value of the error token is 256, unless you explicitly assigned 256 to +one of your tokens with a @code{%token} declaration. + +@node Rules +@section Syntax of Grammar Rules +@cindex rule syntax +@cindex grammar rule syntax +@cindex syntax of grammar rules + +A Bison grammar rule has the following general form: + +@example +@group +@var{result}: @var{components}@dots{} + ; +@end group +@end example + +@noindent +where @var{result} is the nonterminal symbol that this rule describes, +and @var{components} are various terminal and nonterminal symbols that +are put together by this rule (@pxref{Symbols}). + +For example, + +@example +@group +exp: exp '+' exp + ; +@end group +@end example + +@noindent +says that two groupings of type @code{exp}, with a @samp{+} token in between, +can be combined into a larger grouping of type @code{exp}. + +White space in rules is significant only to separate symbols. You can add +extra white space as you wish. + +Scattered among the components can be @var{actions} that determine +the semantics of the rule. An action looks like this: + +@example +@{@var{C statements}@} +@end example + +@noindent +@cindex braced code +This is an example of @dfn{braced code}, that is, C code surrounded by +braces, much like a compound statement in C@. Braced code can contain +any sequence of C tokens, so long as its braces are balanced. Bison +does not check the braced code for correctness directly; it merely +copies the code to the output file, where the C compiler can check it. + +Within braced code, the balanced-brace count is not affected by braces +within comments, string literals, or character constants, but it is +affected by the C digraphs @samp{<%} and @samp{%>} that represent +braces. At the top level braced code must be terminated by @samp{@}} +and not by a digraph. Bison does not look for trigraphs, so if braced +code uses trigraphs you should ensure that they do not affect the +nesting of braces or the boundaries of comments, string literals, or +character constants. + +Usually there is only one action and it follows the components. +@xref{Actions}. + +@findex | +Multiple rules for the same @var{result} can be written separately or can +be joined with the vertical-bar character @samp{|} as follows: + +@example +@group +@var{result}: @var{rule1-components}@dots{} + | @var{rule2-components}@dots{} + @dots{} + ; +@end group +@end example + +@noindent +They are still considered distinct rules even when joined in this way. + +If @var{components} in a rule is empty, it means that @var{result} can +match the empty string. For example, here is how to define a +comma-separated sequence of zero or more @code{exp} groupings: + +@example +@group +expseq: /* empty */ + | expseq1 + ; +@end group + +@group +expseq1: exp + | expseq1 ',' exp + ; +@end group +@end example + +@noindent +It is customary to write a comment @samp{/* empty */} in each rule +with no components. + +@node Recursion +@section Recursive Rules +@cindex recursive rule + +A rule is called @dfn{recursive} when its @var{result} nonterminal +appears also on its right hand side. Nearly all Bison grammars need to +use recursion, because that is the only way to define a sequence of any +number of a particular thing. Consider this recursive definition of a +comma-separated sequence of one or more expressions: + +@example +@group +expseq1: exp + | expseq1 ',' exp + ; +@end group +@end example + +@cindex left recursion +@cindex right recursion +@noindent +Since the recursive use of @code{expseq1} is the leftmost symbol in the +right hand side, we call this @dfn{left recursion}. By contrast, here +the same construct is defined using @dfn{right recursion}: + +@example +@group +expseq1: exp + | exp ',' expseq1 + ; +@end group +@end example + +@noindent +Any kind of sequence can be defined using either left recursion or right +recursion, but you should always use left recursion, because it can +parse a sequence of any number of elements with bounded stack space. +Right recursion uses up space on the Bison stack in proportion to the +number of elements in the sequence, because all the elements must be +shifted onto the stack before the rule can be applied even once. +@xref{Algorithm, ,The Bison Parser Algorithm}, for further explanation +of this. + +@cindex mutual recursion +@dfn{Indirect} or @dfn{mutual} recursion occurs when the result of the +rule does not appear directly on its right hand side, but does appear +in rules for other nonterminals which do appear on its right hand +side. + +For example: + +@example +@group +expr: primary + | primary '+' primary + ; +@end group + +@group +primary: constant + | '(' expr ')' + ; +@end group +@end example + +@noindent +defines two mutually-recursive nonterminals, since each refers to the +other. + +@node Semantics +@section Defining Language Semantics +@cindex defining language semantics +@cindex language semantics, defining + +The grammar rules for a language determine only the syntax. The semantics +are determined by the semantic values associated with various tokens and +groupings, and by the actions taken when various groupings are recognized. + +For example, the calculator calculates properly because the value +associated with each expression is the proper number; it adds properly +because the action for the grouping @w{@samp{@var{x} + @var{y}}} is to add +the numbers associated with @var{x} and @var{y}. + +@menu +* Value Type:: Specifying one data type for all semantic values. +* Multiple Types:: Specifying several alternative data types. +* Actions:: An action is the semantic definition of a grammar rule. +* Action Types:: Specifying data types for actions to operate on. +* Mid-Rule Actions:: Most actions go at the end of a rule. + This says when, why and how to use the exceptional + action in the middle of a rule. +@end menu + +@node Value Type +@subsection Data Types of Semantic Values +@cindex semantic value type +@cindex value type, semantic +@cindex data types of semantic values +@cindex default data type + +In a simple program it may be sufficient to use the same data type for +the semantic values of all language constructs. This was true in the +@acronym{RPN} and infix calculator examples (@pxref{RPN Calc, ,Reverse Polish +Notation Calculator}). + +Bison normally uses the type @code{int} for semantic values if your +program uses the same data type for all language constructs. To +specify some other type, define @code{YYSTYPE} as a macro, like this: + +@example +#define YYSTYPE double +@end example + +@noindent +@code{YYSTYPE}'s replacement list should be a type name +that does not contain parentheses or square brackets. +This macro definition must go in the prologue of the grammar file +(@pxref{Grammar Outline, ,Outline of a Bison Grammar}). + +@node Multiple Types +@subsection More Than One Value Type + +In most programs, you will need different data types for different kinds +of tokens and groupings. For example, a numeric constant may need type +@code{int} or @code{long int}, while a string constant needs type +@code{char *}, and an identifier might need a pointer to an entry in the +symbol table. + +To use more than one data type for semantic values in one parser, Bison +requires you to do two things: + +@itemize @bullet +@item +Specify the entire collection of possible data types, either by using the +@code{%union} Bison declaration (@pxref{Union Decl, ,The Collection of +Value Types}), or by using a @code{typedef} or a @code{#define} to +define @code{YYSTYPE} to be a union type whose member names are +the type tags. + +@item +Choose one of those types for each symbol (terminal or nonterminal) for +which semantic values are used. This is done for tokens with the +@code{%token} Bison declaration (@pxref{Token Decl, ,Token Type Names}) +and for groupings with the @code{%type} Bison declaration (@pxref{Type +Decl, ,Nonterminal Symbols}). +@end itemize + +@node Actions +@subsection Actions +@cindex action +@vindex $$ +@vindex $@var{n} + +An action accompanies a syntactic rule and contains C code to be executed +each time an instance of that rule is recognized. The task of most actions +is to compute a semantic value for the grouping built by the rule from the +semantic values associated with tokens or smaller groupings. + +An action consists of braced code containing C statements, and can be +placed at any position in the rule; +it is executed at that position. Most rules have just one action at the +end of the rule, following all the components. Actions in the middle of +a rule are tricky and used only for special purposes (@pxref{Mid-Rule +Actions, ,Actions in Mid-Rule}). + +The C code in an action can refer to the semantic values of the components +matched by the rule with the construct @code{$@var{n}}, which stands for +the value of the @var{n}th component. The semantic value for the grouping +being constructed is @code{$$}. Bison translates both of these +constructs into expressions of the appropriate type when it copies the +actions into the parser file. @code{$$} is translated to a modifiable +lvalue, so it can be assigned to. + +Here is a typical example: + +@example +@group +exp: @dots{} + | exp '+' exp + @{ $$ = $1 + $3; @} +@end group +@end example + +@noindent +This rule constructs an @code{exp} from two smaller @code{exp} groupings +connected by a plus-sign token. In the action, @code{$1} and @code{$3} +refer to the semantic values of the two component @code{exp} groupings, +which are the first and third symbols on the right hand side of the rule. +The sum is stored into @code{$$} so that it becomes the semantic value of +the addition-expression just recognized by the rule. If there were a +useful semantic value associated with the @samp{+} token, it could be +referred to as @code{$2}. + +Note that the vertical-bar character @samp{|} is really a rule +separator, and actions are attached to a single rule. This is a +difference with tools like Flex, for which @samp{|} stands for either +``or'', or ``the same action as that of the next rule''. In the +following example, the action is triggered only when @samp{b} is found: + +@example +@group +a-or-b: 'a'|'b' @{ a_or_b_found = 1; @}; +@end group +@end example + +@cindex default action +If you don't specify an action for a rule, Bison supplies a default: +@w{@code{$$ = $1}.} Thus, the value of the first symbol in the rule +becomes the value of the whole rule. Of course, the default action is +valid only if the two data types match. There is no meaningful default +action for an empty rule; every empty rule must have an explicit action +unless the rule's value does not matter. + +@code{$@var{n}} with @var{n} zero or negative is allowed for reference +to tokens and groupings on the stack @emph{before} those that match the +current rule. This is a very risky practice, and to use it reliably +you must be certain of the context in which the rule is applied. Here +is a case in which you can use this reliably: + +@example +@group +foo: expr bar '+' expr @{ @dots{} @} + | expr bar '-' expr @{ @dots{} @} + ; +@end group + +@group +bar: /* empty */ + @{ previous_expr = $0; @} + ; +@end group +@end example + +As long as @code{bar} is used only in the fashion shown here, @code{$0} +always refers to the @code{expr} which precedes @code{bar} in the +definition of @code{foo}. + +@vindex yylval +It is also possible to access the semantic value of the lookahead token, if +any, from a semantic action. +This semantic value is stored in @code{yylval}. +@xref{Action Features, ,Special Features for Use in Actions}. + +@node Action Types +@subsection Data Types of Values in Actions +@cindex action data types +@cindex data types in actions + +If you have chosen a single data type for semantic values, the @code{$$} +and @code{$@var{n}} constructs always have that data type. + +If you have used @code{%union} to specify a variety of data types, then you +must declare a choice among these types for each terminal or nonterminal +symbol that can have a semantic value. Then each time you use @code{$$} or +@code{$@var{n}}, its data type is determined by which symbol it refers to +in the rule. In this example, + +@example +@group +exp: @dots{} + | exp '+' exp + @{ $$ = $1 + $3; @} +@end group +@end example + +@noindent +@code{$1} and @code{$3} refer to instances of @code{exp}, so they all +have the data type declared for the nonterminal symbol @code{exp}. If +@code{$2} were used, it would have the data type declared for the +terminal symbol @code{'+'}, whatever that might be. + +Alternatively, you can specify the data type when you refer to the value, +by inserting @samp{<@var{type}>} after the @samp{$} at the beginning of the +reference. For example, if you have defined types as shown here: + +@example +@group +%union @{ + int itype; + double dtype; +@} +@end group +@end example + +@noindent +then you can write @code{$1} to refer to the first subunit of the +rule as an integer, or @code{$1} to refer to it as a double. + +@node Mid-Rule Actions +@subsection Actions in Mid-Rule +@cindex actions in mid-rule +@cindex mid-rule actions + +Occasionally it is useful to put an action in the middle of a rule. +These actions are written just like usual end-of-rule actions, but they +are executed before the parser even recognizes the following components. + +A mid-rule action may refer to the components preceding it using +@code{$@var{n}}, but it may not refer to subsequent components because +it is run before they are parsed. + +The mid-rule action itself counts as one of the components of the rule. +This makes a difference when there is another action later in the same rule +(and usually there is another at the end): you have to count the actions +along with the symbols when working out which number @var{n} to use in +@code{$@var{n}}. + +The mid-rule action can also have a semantic value. The action can set +its value with an assignment to @code{$$}, and actions later in the rule +can refer to the value using @code{$@var{n}}. Since there is no symbol +to name the action, there is no way to declare a data type for the value +in advance, so you must use the @samp{$<@dots{}>@var{n}} construct to +specify a data type each time you refer to this value. + +There is no way to set the value of the entire rule with a mid-rule +action, because assignments to @code{$$} do not have that effect. The +only way to set the value for the entire rule is with an ordinary action +at the end of the rule. + +Here is an example from a hypothetical compiler, handling a @code{let} +statement that looks like @samp{let (@var{variable}) @var{statement}} and +serves to create a variable named @var{variable} temporarily for the +duration of @var{statement}. To parse this construct, we must put +@var{variable} into the symbol table while @var{statement} is parsed, then +remove it afterward. Here is how it is done: + +@example +@group +stmt: LET '(' var ')' + @{ $$ = push_context (); + declare_variable ($3); @} + stmt @{ $$ = $6; + pop_context ($5); @} +@end group +@end example + +@noindent +As soon as @samp{let (@var{variable})} has been recognized, the first +action is run. It saves a copy of the current semantic context (the +list of accessible variables) as its semantic value, using alternative +@code{context} in the data-type union. Then it calls +@code{declare_variable} to add the new variable to that list. Once the +first action is finished, the embedded statement @code{stmt} can be +parsed. Note that the mid-rule action is component number 5, so the +@samp{stmt} is component number 6. + +After the embedded statement is parsed, its semantic value becomes the +value of the entire @code{let}-statement. Then the semantic value from the +earlier action is used to restore the prior list of variables. This +removes the temporary @code{let}-variable from the list so that it won't +appear to exist while the rest of the program is parsed. + +@findex %destructor +@cindex discarded symbols, mid-rule actions +@cindex error recovery, mid-rule actions +In the above example, if the parser initiates error recovery (@pxref{Error +Recovery}) while parsing the tokens in the embedded statement @code{stmt}, +it might discard the previous semantic context @code{$5} without +restoring it. +Thus, @code{$5} needs a destructor (@pxref{Destructor Decl, , Freeing +Discarded Symbols}). +However, Bison currently provides no means to declare a destructor specific to +a particular mid-rule action's semantic value. + +One solution is to bury the mid-rule action inside a nonterminal symbol and to +declare a destructor for that symbol: + +@example +@group +%type let +%destructor @{ pop_context ($$); @} let + +%% + +stmt: let stmt + @{ $$ = $2; + pop_context ($1); @} + ; + +let: LET '(' var ')' + @{ $$ = push_context (); + declare_variable ($3); @} + ; + +@end group +@end example + +@noindent +Note that the action is now at the end of its rule. +Any mid-rule action can be converted to an end-of-rule action in this way, and +this is what Bison actually does to implement mid-rule actions. + +Taking action before a rule is completely recognized often leads to +conflicts since the parser must commit to a parse in order to execute the +action. For example, the following two rules, without mid-rule actions, +can coexist in a working parser because the parser can shift the open-brace +token and look at what follows before deciding whether there is a +declaration or not: + +@example +@group +compound: '@{' declarations statements '@}' + | '@{' statements '@}' + ; +@end group +@end example + +@noindent +But when we add a mid-rule action as follows, the rules become nonfunctional: + +@example +@group +compound: @{ prepare_for_local_variables (); @} + '@{' declarations statements '@}' +@end group +@group + | '@{' statements '@}' + ; +@end group +@end example + +@noindent +Now the parser is forced to decide whether to run the mid-rule action +when it has read no farther than the open-brace. In other words, it +must commit to using one rule or the other, without sufficient +information to do it correctly. (The open-brace token is what is called +the @dfn{lookahead} token at this time, since the parser is still +deciding what to do about it. @xref{Lookahead, ,Lookahead Tokens}.) + +You might think that you could correct the problem by putting identical +actions into the two rules, like this: + +@example +@group +compound: @{ prepare_for_local_variables (); @} + '@{' declarations statements '@}' + | @{ prepare_for_local_variables (); @} + '@{' statements '@}' + ; +@end group +@end example + +@noindent +But this does not help, because Bison does not realize that the two actions +are identical. (Bison never tries to understand the C code in an action.) + +If the grammar is such that a declaration can be distinguished from a +statement by the first token (which is true in C), then one solution which +does work is to put the action after the open-brace, like this: + +@example +@group +compound: '@{' @{ prepare_for_local_variables (); @} + declarations statements '@}' + | '@{' statements '@}' + ; +@end group +@end example + +@noindent +Now the first token of the following declaration or statement, +which would in any case tell Bison which rule to use, can still do so. + +Another solution is to bury the action inside a nonterminal symbol which +serves as a subroutine: + +@example +@group +subroutine: /* empty */ + @{ prepare_for_local_variables (); @} + ; + +@end group + +@group +compound: subroutine + '@{' declarations statements '@}' + | subroutine + '@{' statements '@}' + ; +@end group +@end example + +@noindent +Now Bison can execute the action in the rule for @code{subroutine} without +deciding which rule for @code{compound} it will eventually use. + +@node Locations +@section Tracking Locations +@cindex location +@cindex textual location +@cindex location, textual + +Though grammar rules and semantic actions are enough to write a fully +functional parser, it can be useful to process some additional information, +especially symbol locations. + +The way locations are handled is defined by providing a data type, and +actions to take when rules are matched. + +@menu +* Location Type:: Specifying a data type for locations. +* Actions and Locations:: Using locations in actions. +* Location Default Action:: Defining a general way to compute locations. +@end menu + +@node Location Type +@subsection Data Type of Locations +@cindex data type of locations +@cindex default location type + +Defining a data type for locations is much simpler than for semantic values, +since all tokens and groupings always use the same type. + +You can specify the type of locations by defining a macro called +@code{YYLTYPE}, just as you can specify the semantic value type by +defining a @code{YYSTYPE} macro (@pxref{Value Type}). +When @code{YYLTYPE} is not defined, Bison uses a default structure type with +four members: + +@example +typedef struct YYLTYPE +@{ + int first_line; + int first_column; + int last_line; + int last_column; +@} YYLTYPE; +@end example + +At the beginning of the parsing, Bison initializes all these fields to 1 +for @code{yylloc}. + +@node Actions and Locations +@subsection Actions and Locations +@cindex location actions +@cindex actions, location +@vindex @@$ +@vindex @@@var{n} + +Actions are not only useful for defining language semantics, but also for +describing the behavior of the output parser with locations. + +The most obvious way for building locations of syntactic groupings is very +similar to the way semantic values are computed. In a given rule, several +constructs can be used to access the locations of the elements being matched. +The location of the @var{n}th component of the right hand side is +@code{@@@var{n}}, while the location of the left hand side grouping is +@code{@@$}. + +Here is a basic example using the default data type for locations: + +@example +@group +exp: @dots{} + | exp '/' exp + @{ + @@$.first_column = @@1.first_column; + @@$.first_line = @@1.first_line; + @@$.last_column = @@3.last_column; + @@$.last_line = @@3.last_line; + if ($3) + $$ = $1 / $3; + else + @{ + $$ = 1; + fprintf (stderr, + "Division by zero, l%d,c%d-l%d,c%d", + @@3.first_line, @@3.first_column, + @@3.last_line, @@3.last_column); + @} + @} +@end group +@end example + +As for semantic values, there is a default action for locations that is +run each time a rule is matched. It sets the beginning of @code{@@$} to the +beginning of the first symbol, and the end of @code{@@$} to the end of the +last symbol. + +With this default action, the location tracking can be fully automatic. The +example above simply rewrites this way: + +@example +@group +exp: @dots{} + | exp '/' exp + @{ + if ($3) + $$ = $1 / $3; + else + @{ + $$ = 1; + fprintf (stderr, + "Division by zero, l%d,c%d-l%d,c%d", + @@3.first_line, @@3.first_column, + @@3.last_line, @@3.last_column); + @} + @} +@end group +@end example + +@vindex yylloc +It is also possible to access the location of the lookahead token, if any, +from a semantic action. +This location is stored in @code{yylloc}. +@xref{Action Features, ,Special Features for Use in Actions}. + +@node Location Default Action +@subsection Default Action for Locations +@vindex YYLLOC_DEFAULT +@cindex @acronym{GLR} parsers and @code{YYLLOC_DEFAULT} + +Actually, actions are not the best place to compute locations. Since +locations are much more general than semantic values, there is room in +the output parser to redefine the default action to take for each +rule. The @code{YYLLOC_DEFAULT} macro is invoked each time a rule is +matched, before the associated action is run. It is also invoked +while processing a syntax error, to compute the error's location. +Before reporting an unresolvable syntactic ambiguity, a @acronym{GLR} +parser invokes @code{YYLLOC_DEFAULT} recursively to compute the location +of that ambiguity. + +Most of the time, this macro is general enough to suppress location +dedicated code from semantic actions. + +The @code{YYLLOC_DEFAULT} macro takes three parameters. The first one is +the location of the grouping (the result of the computation). When a +rule is matched, the second parameter identifies locations of +all right hand side elements of the rule being matched, and the third +parameter is the size of the rule's right hand side. +When a @acronym{GLR} parser reports an ambiguity, which of multiple candidate +right hand sides it passes to @code{YYLLOC_DEFAULT} is undefined. +When processing a syntax error, the second parameter identifies locations +of the symbols that were discarded during error processing, and the third +parameter is the number of discarded symbols. + +By default, @code{YYLLOC_DEFAULT} is defined this way: + +@smallexample +@group +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + @{ \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + @} \ + else \ + @{ \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + @} \ + while (0) +@end group +@end smallexample + +where @code{YYRHSLOC (rhs, k)} is the location of the @var{k}th symbol +in @var{rhs} when @var{k} is positive, and the location of the symbol +just before the reduction when @var{k} and @var{n} are both zero. + +When defining @code{YYLLOC_DEFAULT}, you should consider that: + +@itemize @bullet +@item +All arguments are free of side-effects. However, only the first one (the +result) should be modified by @code{YYLLOC_DEFAULT}. + +@item +For consistency with semantic actions, valid indexes within the +right hand side range from 1 to @var{n}. When @var{n} is zero, only 0 is a +valid index, and it refers to the symbol just before the reduction. +During error processing @var{n} is always positive. + +@item +Your macro should parenthesize its arguments, if need be, since the +actual arguments may not be surrounded by parentheses. Also, your +macro should expand to something that can be used as a single +statement when it is followed by a semicolon. +@end itemize + +@node Declarations +@section Bison Declarations +@cindex declarations, Bison +@cindex Bison declarations + +The @dfn{Bison declarations} section of a Bison grammar defines the symbols +used in formulating the grammar and the data types of semantic values. +@xref{Symbols}. + +All token type names (but not single-character literal tokens such as +@code{'+'} and @code{'*'}) must be declared. Nonterminal symbols must be +declared if you need to specify which data type to use for the semantic +value (@pxref{Multiple Types, ,More Than One Value Type}). + +The first rule in the file also specifies the start symbol, by default. +If you want some other symbol to be the start symbol, you must declare +it explicitly (@pxref{Language and Grammar, ,Languages and Context-Free +Grammars}). + +@menu +* Require Decl:: Requiring a Bison version. +* Token Decl:: Declaring terminal symbols. +* Precedence Decl:: Declaring terminals with precedence and associativity. +* Union Decl:: Declaring the set of all semantic value types. +* Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Initial Action Decl:: Code run before parsing starts. +* Destructor Decl:: Declaring how symbols are freed. +* Expect Decl:: Suppressing warnings about parsing conflicts. +* Start Decl:: Specifying the start symbol. +* Pure Decl:: Requesting a reentrant parser. +* Push Decl:: Requesting a push parser. +* Decl Summary:: Table of all Bison declarations. +@end menu + +@node Require Decl +@subsection Require a Version of Bison +@cindex version requirement +@cindex requiring a version of Bison +@findex %require + +You may require the minimum version of Bison to process the grammar. If +the requirement is not met, @command{bison} exits with an error (exit +status 63). + +@example +%require "@var{version}" +@end example + +@node Token Decl +@subsection Token Type Names +@cindex declaring token type names +@cindex token type names, declaring +@cindex declaring literal string tokens +@findex %token + +The basic way to declare a token type name (terminal symbol) is as follows: + +@example +%token @var{name} +@end example + +Bison will convert this into a @code{#define} directive in +the parser, so that the function @code{yylex} (if it is in this file) +can use the name @var{name} to stand for this token type's code. + +Alternatively, you can use @code{%left}, @code{%right}, or +@code{%nonassoc} instead of @code{%token}, if you wish to specify +associativity and precedence. @xref{Precedence Decl, ,Operator +Precedence}. + +You can explicitly specify the numeric code for a token type by appending +a nonnegative decimal or hexadecimal integer value in the field immediately +following the token name: + +@example +%token NUM 300 +%token XNUM 0x12d // a GNU extension +@end example + +@noindent +It is generally best, however, to let Bison choose the numeric codes for +all token types. Bison will automatically select codes that don't conflict +with each other or with normal characters. + +In the event that the stack type is a union, you must augment the +@code{%token} or other token declaration to include the data type +alternative delimited by angle-brackets (@pxref{Multiple Types, ,More +Than One Value Type}). + +For example: + +@example +@group +%union @{ /* define stack type */ + double val; + symrec *tptr; +@} +%token NUM /* define token NUM and its type */ +@end group +@end example + +You can associate a literal string token with a token type name by +writing the literal string at the end of a @code{%token} +declaration which declares the name. For example: + +@example +%token arrow "=>" +@end example + +@noindent +For example, a grammar for the C language might specify these names with +equivalent literal string tokens: + +@example +%token OR "||" +%token LE 134 "<=" +%left OR "<=" +@end example + +@noindent +Once you equate the literal string and the token name, you can use them +interchangeably in further declarations or the grammar rules. The +@code{yylex} function can use the token name or the literal string to +obtain the token type code number (@pxref{Calling Convention}). +Syntax error messages passed to @code{yyerror} from the parser will reference +the literal string instead of the token name. + +The token numbered as 0 corresponds to end of file; the following line +allows for nicer error messages referring to ``end of file'' instead +of ``$end'': + +@example +%token END 0 "end of file" +@end example + +@node Precedence Decl +@subsection Operator Precedence +@cindex precedence declarations +@cindex declaring operator precedence +@cindex operator precedence, declaring + +Use the @code{%left}, @code{%right} or @code{%nonassoc} declaration to +declare a token and specify its precedence and associativity, all at +once. These are called @dfn{precedence declarations}. +@xref{Precedence, ,Operator Precedence}, for general information on +operator precedence. + +The syntax of a precedence declaration is nearly the same as that of +@code{%token}: either + +@example +%left @var{symbols}@dots{} +@end example + +@noindent +or + +@example +%left <@var{type}> @var{symbols}@dots{} +@end example + +And indeed any of these declarations serves the purposes of @code{%token}. +But in addition, they specify the associativity and relative precedence for +all the @var{symbols}: + +@itemize @bullet +@item +The associativity of an operator @var{op} determines how repeated uses +of the operator nest: whether @samp{@var{x} @var{op} @var{y} @var{op} +@var{z}} is parsed by grouping @var{x} with @var{y} first or by +grouping @var{y} with @var{z} first. @code{%left} specifies +left-associativity (grouping @var{x} with @var{y} first) and +@code{%right} specifies right-associativity (grouping @var{y} with +@var{z} first). @code{%nonassoc} specifies no associativity, which +means that @samp{@var{x} @var{op} @var{y} @var{op} @var{z}} is +considered a syntax error. + +@item +The precedence of an operator determines how it nests with other operators. +All the tokens declared in a single precedence declaration have equal +precedence and nest together according to their associativity. +When two tokens declared in different precedence declarations associate, +the one declared later has the higher precedence and is grouped first. +@end itemize + +For backward compatibility, there is a confusing difference between the +argument lists of @code{%token} and precedence declarations. +Only a @code{%token} can associate a literal string with a token type name. +A precedence declaration always interprets a literal string as a reference to a +separate token. +For example: + +@example +%left OR "<=" // Does not declare an alias. +%left OR 134 "<=" 135 // Declares 134 for OR and 135 for "<=". +@end example + +@node Union Decl +@subsection The Collection of Value Types +@cindex declaring value types +@cindex value types, declaring +@findex %union + +The @code{%union} declaration specifies the entire collection of +possible data types for semantic values. The keyword @code{%union} is +followed by braced code containing the same thing that goes inside a +@code{union} in C@. + +For example: + +@example +@group +%union @{ + double val; + symrec *tptr; +@} +@end group +@end example + +@noindent +This says that the two alternative types are @code{double} and @code{symrec +*}. They are given names @code{val} and @code{tptr}; these names are used +in the @code{%token} and @code{%type} declarations to pick one of the types +for a terminal or nonterminal symbol (@pxref{Type Decl, ,Nonterminal Symbols}). + +As an extension to @acronym{POSIX}, a tag is allowed after the +@code{union}. For example: + +@example +@group +%union value @{ + double val; + symrec *tptr; +@} +@end group +@end example + +@noindent +specifies the union tag @code{value}, so the corresponding C type is +@code{union value}. If you do not specify a tag, it defaults to +@code{YYSTYPE}. + +As another extension to @acronym{POSIX}, you may specify multiple +@code{%union} declarations; their contents are concatenated. However, +only the first @code{%union} declaration can specify a tag. + +Note that, unlike making a @code{union} declaration in C, you need not write +a semicolon after the closing brace. + +Instead of @code{%union}, you can define and use your own union type +@code{YYSTYPE} if your grammar contains at least one +@samp{<@var{type}>} tag. For example, you can put the following into +a header file @file{parser.h}: + +@example +@group +union YYSTYPE @{ + double val; + symrec *tptr; +@}; +typedef union YYSTYPE YYSTYPE; +@end group +@end example + +@noindent +and then your grammar can use the following +instead of @code{%union}: + +@example +@group +%@{ +#include "parser.h" +%@} +%type expr +%token ID +@end group +@end example + +@node Type Decl +@subsection Nonterminal Symbols +@cindex declaring value types, nonterminals +@cindex value types, nonterminals, declaring +@findex %type + +@noindent +When you use @code{%union} to specify multiple value types, you must +declare the value type of each nonterminal symbol for which values are +used. This is done with a @code{%type} declaration, like this: + +@example +%type <@var{type}> @var{nonterminal}@dots{} +@end example + +@noindent +Here @var{nonterminal} is the name of a nonterminal symbol, and +@var{type} is the name given in the @code{%union} to the alternative +that you want (@pxref{Union Decl, ,The Collection of Value Types}). You +can give any number of nonterminal symbols in the same @code{%type} +declaration, if they have the same value type. Use spaces to separate +the symbol names. + +You can also declare the value type of a terminal symbol. To do this, +use the same @code{<@var{type}>} construction in a declaration for the +terminal symbol. All kinds of token declarations allow +@code{<@var{type}>}. + +@node Initial Action Decl +@subsection Performing Actions before Parsing +@findex %initial-action + +Sometimes your parser needs to perform some initializations before +parsing. The @code{%initial-action} directive allows for such arbitrary +code. + +@deffn {Directive} %initial-action @{ @var{code} @} +@findex %initial-action +Declare that the braced @var{code} must be invoked before parsing each time +@code{yyparse} is called. The @var{code} may use @code{$$} and +@code{@@$} --- initial value and location of the lookahead --- and the +@code{%parse-param}. +@end deffn + +For instance, if your locations use a file name, you may use + +@example +%parse-param @{ char const *file_name @}; +%initial-action +@{ + @@$.initialize (file_name); +@}; +@end example + + +@node Destructor Decl +@subsection Freeing Discarded Symbols +@cindex freeing discarded symbols +@findex %destructor +@findex <*> +@findex <> +During error recovery (@pxref{Error Recovery}), symbols already pushed +on the stack and tokens coming from the rest of the file are discarded +until the parser falls on its feet. If the parser runs out of memory, +or if it returns via @code{YYABORT} or @code{YYACCEPT}, all the +symbols on the stack must be discarded. Even if the parser succeeds, it +must discard the start symbol. + +When discarded symbols convey heap based information, this memory is +lost. While this behavior can be tolerable for batch parsers, such as +in traditional compilers, it is unacceptable for programs like shells or +protocol implementations that may parse and execute indefinitely. + +The @code{%destructor} directive defines code that is called when a +symbol is automatically discarded. + +@deffn {Directive} %destructor @{ @var{code} @} @var{symbols} +@findex %destructor +Invoke the braced @var{code} whenever the parser discards one of the +@var{symbols}. +Within @var{code}, @code{$$} designates the semantic value associated +with the discarded symbol, and @code{@@$} designates its location. +The additional parser parameters are also available (@pxref{Parser Function, , +The Parser Function @code{yyparse}}). + +When a symbol is listed among @var{symbols}, its @code{%destructor} is called a +per-symbol @code{%destructor}. +You may also define a per-type @code{%destructor} by listing a semantic type +tag among @var{symbols}. +In that case, the parser will invoke this @var{code} whenever it discards any +grammar symbol that has that semantic type tag unless that symbol has its own +per-symbol @code{%destructor}. + +Finally, you can define two different kinds of default @code{%destructor}s. +(These default forms are experimental. +More user feedback will help to determine whether they should become permanent +features.) +You can place each of @code{<*>} and @code{<>} in the @var{symbols} list of +exactly one @code{%destructor} declaration in your grammar file. +The parser will invoke the @var{code} associated with one of these whenever it +discards any user-defined grammar symbol that has no per-symbol and no per-type +@code{%destructor}. +The parser uses the @var{code} for @code{<*>} in the case of such a grammar +symbol for which you have formally declared a semantic type tag (@code{%type} +counts as such a declaration, but @code{$$} does not). +The parser uses the @var{code} for @code{<>} in the case of such a grammar +symbol that has no declared semantic type tag. +@end deffn + +@noindent +For example: + +@smallexample +%union @{ char *string; @} +%token STRING1 +%token STRING2 +%type string1 +%type string2 +%union @{ char character; @} +%token CHR +%type chr +%token TAGLESS + +%destructor @{ @} +%destructor @{ free ($$); @} <*> +%destructor @{ free ($$); printf ("%d", @@$.first_line); @} STRING1 string1 +%destructor @{ printf ("Discarding tagless symbol.\n"); @} <> +@end smallexample + +@noindent +guarantees that, when the parser discards any user-defined symbol that has a +semantic type tag other than @code{}, it passes its semantic value +to @code{free} by default. +However, when the parser discards a @code{STRING1} or a @code{string1}, it also +prints its line number to @code{stdout}. +It performs only the second @code{%destructor} in this case, so it invokes +@code{free} only once. +Finally, the parser merely prints a message whenever it discards any symbol, +such as @code{TAGLESS}, that has no semantic type tag. + +A Bison-generated parser invokes the default @code{%destructor}s only for +user-defined as opposed to Bison-defined symbols. +For example, the parser will not invoke either kind of default +@code{%destructor} for the special Bison-defined symbols @code{$accept}, +@code{$undefined}, or @code{$end} (@pxref{Table of Symbols, ,Bison Symbols}), +none of which you can reference in your grammar. +It also will not invoke either for the @code{error} token (@pxref{Table of +Symbols, ,error}), which is always defined by Bison regardless of whether you +reference it in your grammar. +However, it may invoke one of them for the end token (token 0) if you +redefine it from @code{$end} to, for example, @code{END}: + +@smallexample +%token END 0 +@end smallexample + +@cindex actions in mid-rule +@cindex mid-rule actions +Finally, Bison will never invoke a @code{%destructor} for an unreferenced +mid-rule semantic value (@pxref{Mid-Rule Actions,,Actions in Mid-Rule}). +That is, Bison does not consider a mid-rule to have a semantic value if you do +not reference @code{$$} in the mid-rule's action or @code{$@var{n}} (where +@var{n} is the RHS symbol position of the mid-rule) in any later action in that +rule. +However, if you do reference either, the Bison-generated parser will invoke the +@code{<>} @code{%destructor} whenever it discards the mid-rule symbol. + +@ignore +@noindent +In the future, it may be possible to redefine the @code{error} token as a +nonterminal that captures the discarded symbols. +In that case, the parser will invoke the default destructor for it as well. +@end ignore + +@sp 1 + +@cindex discarded symbols +@dfn{Discarded symbols} are the following: + +@itemize +@item +stacked symbols popped during the first phase of error recovery, +@item +incoming terminals during the second phase of error recovery, +@item +the current lookahead and the entire stack (except the current +right-hand side symbols) when the parser returns immediately, and +@item +the start symbol, when the parser succeeds. +@end itemize + +The parser can @dfn{return immediately} because of an explicit call to +@code{YYABORT} or @code{YYACCEPT}, or failed error recovery, or memory +exhaustion. + +Right-hand side symbols of a rule that explicitly triggers a syntax +error via @code{YYERROR} are not discarded automatically. As a rule +of thumb, destructors are invoked only when user actions cannot manage +the memory. + +@node Expect Decl +@subsection Suppressing Conflict Warnings +@cindex suppressing conflict warnings +@cindex preventing warnings about conflicts +@cindex warnings, preventing +@cindex conflicts, suppressing warnings of +@findex %expect +@findex %expect-rr + +Bison normally warns if there are any conflicts in the grammar +(@pxref{Shift/Reduce, ,Shift/Reduce Conflicts}), but most real grammars +have harmless shift/reduce conflicts which are resolved in a predictable +way and would be difficult to eliminate. It is desirable to suppress +the warning about these conflicts unless the number of conflicts +changes. You can do this with the @code{%expect} declaration. + +The declaration looks like this: + +@example +%expect @var{n} +@end example + +Here @var{n} is a decimal integer. The declaration says there should +be @var{n} shift/reduce conflicts and no reduce/reduce conflicts. +Bison reports an error if the number of shift/reduce conflicts differs +from @var{n}, or if there are any reduce/reduce conflicts. + +For normal @acronym{LALR}(1) parsers, reduce/reduce conflicts are more +serious, and should be eliminated entirely. Bison will always report +reduce/reduce conflicts for these parsers. With @acronym{GLR} +parsers, however, both kinds of conflicts are routine; otherwise, +there would be no need to use @acronym{GLR} parsing. Therefore, it is +also possible to specify an expected number of reduce/reduce conflicts +in @acronym{GLR} parsers, using the declaration: + +@example +%expect-rr @var{n} +@end example + +In general, using @code{%expect} involves these steps: + +@itemize @bullet +@item +Compile your grammar without @code{%expect}. Use the @samp{-v} option +to get a verbose list of where the conflicts occur. Bison will also +print the number of conflicts. + +@item +Check each of the conflicts to make sure that Bison's default +resolution is what you really want. If not, rewrite the grammar and +go back to the beginning. + +@item +Add an @code{%expect} declaration, copying the number @var{n} from the +number which Bison printed. With @acronym{GLR} parsers, add an +@code{%expect-rr} declaration as well. +@end itemize + +Now Bison will warn you if you introduce an unexpected conflict, but +will keep silent otherwise. + +@node Start Decl +@subsection The Start-Symbol +@cindex declaring the start symbol +@cindex start symbol, declaring +@cindex default start symbol +@findex %start + +Bison assumes by default that the start symbol for the grammar is the first +nonterminal specified in the grammar specification section. The programmer +may override this restriction with the @code{%start} declaration as follows: + +@example +%start @var{symbol} +@end example + +@node Pure Decl +@subsection A Pure (Reentrant) Parser +@cindex reentrant parser +@cindex pure parser +@findex %define api.pure + +A @dfn{reentrant} program is one which does not alter in the course of +execution; in other words, it consists entirely of @dfn{pure} (read-only) +code. Reentrancy is important whenever asynchronous execution is possible; +for example, a nonreentrant program may not be safe to call from a signal +handler. In systems with multiple threads of control, a nonreentrant +program must be called only within interlocks. + +Normally, Bison generates a parser which is not reentrant. This is +suitable for most uses, and it permits compatibility with Yacc. (The +standard Yacc interfaces are inherently nonreentrant, because they use +statically allocated variables for communication with @code{yylex}, +including @code{yylval} and @code{yylloc}.) + +Alternatively, you can generate a pure, reentrant parser. The Bison +declaration @code{%define api.pure} says that you want the parser to be +reentrant. It looks like this: + +@example +%define api.pure +@end example + +The result is that the communication variables @code{yylval} and +@code{yylloc} become local variables in @code{yyparse}, and a different +calling convention is used for the lexical analyzer function +@code{yylex}. @xref{Pure Calling, ,Calling Conventions for Pure +Parsers}, for the details of this. The variable @code{yynerrs} +becomes local in @code{yyparse} in pull mode but it becomes a member +of yypstate in push mode. (@pxref{Error Reporting, ,The Error +Reporting Function @code{yyerror}}). The convention for calling +@code{yyparse} itself is unchanged. + +Whether the parser is pure has nothing to do with the grammar rules. +You can generate either a pure parser or a nonreentrant parser from any +valid grammar. + +@node Push Decl +@subsection A Push Parser +@cindex push parser +@cindex push parser +@findex %define api.push_pull + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + +A pull parser is called once and it takes control until all its input +is completely parsed. A push parser, on the other hand, is called +each time a new token is made available. + +A push parser is typically useful when the parser is part of a +main event loop in the client's application. This is typically +a requirement of a GUI, when the main event loop needs to be triggered +within a certain time period. + +Normally, Bison generates a pull parser. +The following Bison declaration says that you want the parser to be a push +parser (@pxref{Decl Summary,,%define api.push_pull}): + +@example +%define api.push_pull "push" +@end example + +In almost all cases, you want to ensure that your push parser is also +a pure parser (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}). The only +time you should create an impure push parser is to have backwards +compatibility with the impure Yacc pull mode interface. Unless you know +what you are doing, your declarations should look like this: + +@example +%define api.pure +%define api.push_pull "push" +@end example + +There is a major notable functional difference between the pure push parser +and the impure push parser. It is acceptable for a pure push parser to have +many parser instances, of the same type of parser, in memory at the same time. +An impure push parser should only use one parser at a time. + +When a push parser is selected, Bison will generate some new symbols in +the generated parser. @code{yypstate} is a structure that the generated +parser uses to store the parser's state. @code{yypstate_new} is the +function that will create a new parser instance. @code{yypstate_delete} +will free the resources associated with the corresponding parser instance. +Finally, @code{yypush_parse} is the function that should be called whenever a +token is available to provide the parser. A trivial example +of using a pure push parser would look like this: + +@example +int status; +yypstate *ps = yypstate_new (); +do @{ + status = yypush_parse (ps, yylex (), NULL); +@} while (status == YYPUSH_MORE); +yypstate_delete (ps); +@end example + +If the user decided to use an impure push parser, a few things about +the generated parser will change. The @code{yychar} variable becomes +a global variable instead of a variable in the @code{yypush_parse} function. +For this reason, the signature of the @code{yypush_parse} function is +changed to remove the token as a parameter. A nonreentrant push parser +example would thus look like this: + +@example +extern int yychar; +int status; +yypstate *ps = yypstate_new (); +do @{ + yychar = yylex (); + status = yypush_parse (ps); +@} while (status == YYPUSH_MORE); +yypstate_delete (ps); +@end example + +That's it. Notice the next token is put into the global variable @code{yychar} +for use by the next invocation of the @code{yypush_parse} function. + +Bison also supports both the push parser interface along with the pull parser +interface in the same generated parser. In order to get this functionality, +you should replace the @code{%define api.push_pull "push"} declaration with the +@code{%define api.push_pull "both"} declaration. Doing this will create all of +the symbols mentioned earlier along with the two extra symbols, @code{yyparse} +and @code{yypull_parse}. @code{yyparse} can be used exactly as it normally +would be used. However, the user should note that it is implemented in the +generated parser by calling @code{yypull_parse}. +This makes the @code{yyparse} function that is generated with the +@code{%define api.push_pull "both"} declaration slower than the normal +@code{yyparse} function. If the user +calls the @code{yypull_parse} function it will parse the rest of the input +stream. It is possible to @code{yypush_parse} tokens to select a subgrammar +and then @code{yypull_parse} the rest of the input stream. If you would like +to switch back and forth between between parsing styles, you would have to +write your own @code{yypull_parse} function that knows when to quit looking +for input. An example of using the @code{yypull_parse} function would look +like this: + +@example +yypstate *ps = yypstate_new (); +yypull_parse (ps); /* Will call the lexer */ +yypstate_delete (ps); +@end example + +Adding the @code{%define api.pure} declaration does exactly the same thing to +the generated parser with @code{%define api.push_pull "both"} as it did for +@code{%define api.push_pull "push"}. + +@node Decl Summary +@subsection Bison Declaration Summary +@cindex Bison declaration summary +@cindex declaration summary +@cindex summary, Bison declaration + +Here is a summary of the declarations used to define a grammar: + +@deffn {Directive} %union +Declare the collection of data types that semantic values may have +(@pxref{Union Decl, ,The Collection of Value Types}). +@end deffn + +@deffn {Directive} %token +Declare a terminal symbol (token type name) with no precedence +or associativity specified (@pxref{Token Decl, ,Token Type Names}). +@end deffn + +@deffn {Directive} %right +Declare a terminal symbol (token type name) that is right-associative +(@pxref{Precedence Decl, ,Operator Precedence}). +@end deffn + +@deffn {Directive} %left +Declare a terminal symbol (token type name) that is left-associative +(@pxref{Precedence Decl, ,Operator Precedence}). +@end deffn + +@deffn {Directive} %nonassoc +Declare a terminal symbol (token type name) that is nonassociative +(@pxref{Precedence Decl, ,Operator Precedence}). +Using it in a way that would be associative is a syntax error. +@end deffn + +@ifset defaultprec +@deffn {Directive} %default-prec +Assign a precedence to rules lacking an explicit @code{%prec} modifier +(@pxref{Contextual Precedence, ,Context-Dependent Precedence}). +@end deffn +@end ifset + +@deffn {Directive} %type +Declare the type of semantic values for a nonterminal symbol +(@pxref{Type Decl, ,Nonterminal Symbols}). +@end deffn + +@deffn {Directive} %start +Specify the grammar's start symbol (@pxref{Start Decl, ,The +Start-Symbol}). +@end deffn + +@deffn {Directive} %expect +Declare the expected number of shift-reduce conflicts +(@pxref{Expect Decl, ,Suppressing Conflict Warnings}). +@end deffn + + +@sp 1 +@noindent +In order to change the behavior of @command{bison}, use the following +directives: + +@deffn {Directive} %code @{@var{code}@} +@findex %code +This is the unqualified form of the @code{%code} directive. +It inserts @var{code} verbatim at a language-dependent default location in the +output@footnote{The default location is actually skeleton-dependent; + writers of non-standard skeletons however should choose the default location + consistently with the behavior of the standard Bison skeletons.}. + +@cindex Prologue +For C/C++, the default location is the parser source code +file after the usual contents of the parser header file. +Thus, @code{%code} replaces the traditional Yacc prologue, +@code{%@{@var{code}%@}}, for most purposes. +For a detailed discussion, see @ref{Prologue Alternatives}. + +For Java, the default location is inside the parser class. + +(Like all the Yacc prologue alternatives, this directive is experimental. +More user feedback will help to determine whether it should become a permanent +feature.) +@end deffn + +@deffn {Directive} %code @var{qualifier} @{@var{code}@} +This is the qualified form of the @code{%code} directive. +If you need to specify location-sensitive verbatim @var{code} that does not +belong at the default location selected by the unqualified @code{%code} form, +use this form instead. + +@var{qualifier} identifies the purpose of @var{code} and thus the location(s) +where Bison should generate it. +Not all values of @var{qualifier} are available for all target languages: + +@itemize @bullet +@item requires +@findex %code requires + +@itemize @bullet +@item Language(s): C, C++ + +@item Purpose: This is the best place to write dependency code required for +@code{YYSTYPE} and @code{YYLTYPE}. +In other words, it's the best place to define types referenced in @code{%union} +directives, and it's the best place to override Bison's default @code{YYSTYPE} +and @code{YYLTYPE} definitions. + +@item Location(s): The parser header file and the parser source code file +before the Bison-generated @code{YYSTYPE} and @code{YYLTYPE} definitions. +@end itemize + +@item provides +@findex %code provides + +@itemize @bullet +@item Language(s): C, C++ + +@item Purpose: This is the best place to write additional definitions and +declarations that should be provided to other modules. + +@item Location(s): The parser header file and the parser source code file after +the Bison-generated @code{YYSTYPE}, @code{YYLTYPE}, and token definitions. +@end itemize + +@item top +@findex %code top + +@itemize @bullet +@item Language(s): C, C++ + +@item Purpose: The unqualified @code{%code} or @code{%code requires} should +usually be more appropriate than @code{%code top}. +However, occasionally it is necessary to insert code much nearer the top of the +parser source code file. +For example: + +@smallexample +%code top @{ + #define _GNU_SOURCE + #include +@} +@end smallexample + +@item Location(s): Near the top of the parser source code file. +@end itemize + +@item imports +@findex %code imports + +@itemize @bullet +@item Language(s): Java + +@item Purpose: This is the best place to write Java import directives. + +@item Location(s): The parser Java file after any Java package directive and +before any class definitions. +@end itemize +@end itemize + +(Like all the Yacc prologue alternatives, this directive is experimental. +More user feedback will help to determine whether it should become a permanent +feature.) + +@cindex Prologue +For a detailed discussion of how to use @code{%code} in place of the +traditional Yacc prologue for C/C++, see @ref{Prologue Alternatives}. +@end deffn + +@deffn {Directive} %debug +In the parser file, define the macro @code{YYDEBUG} to 1 if it is not +already defined, so that the debugging facilities are compiled. +@end deffn +@xref{Tracing, ,Tracing Your Parser}. + +@deffn {Directive} %define @var{variable} +@deffnx {Directive} %define @var{variable} "@var{value}" +Define a variable to adjust Bison's behavior. +The possible choices for @var{variable}, as well as their meanings, depend on +the selected target language and/or the parser skeleton (@pxref{Decl +Summary,,%language}, @pxref{Decl Summary,,%skeleton}). + +Bison will warn if a @var{variable} is defined multiple times. + +Omitting @code{"@var{value}"} is always equivalent to specifying it as +@code{""}. + +Some @var{variable}s may be used as Booleans. +In this case, Bison will complain if the variable definition does not meet one +of the following four conditions: + +@enumerate +@item @code{"@var{value}"} is @code{"true"} + +@item @code{"@var{value}"} is omitted (or is @code{""}). +This is equivalent to @code{"true"}. + +@item @code{"@var{value}"} is @code{"false"}. + +@item @var{variable} is never defined. +In this case, Bison selects a default value, which may depend on the selected +target language and/or parser skeleton. +@end enumerate + +Some of the accepted @var{variable}s are: + +@itemize @bullet +@item api.pure +@findex %define api.pure + +@itemize @bullet +@item Language(s): C + +@item Purpose: Request a pure (reentrant) parser program. +@xref{Pure Decl, ,A Pure (Reentrant) Parser}. + +@item Accepted Values: Boolean + +@item Default Value: @code{"false"} +@end itemize + +@item api.push_pull +@findex %define api.push_pull + +@itemize @bullet +@item Language(s): C (LALR(1) only) + +@item Purpose: Requests a pull parser, a push parser, or both. +@xref{Push Decl, ,A Push Parser}. +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + +@item Accepted Values: @code{"pull"}, @code{"push"}, @code{"both"} + +@item Default Value: @code{"pull"} +@end itemize + +@item lr.keep_unreachable_states +@findex %define lr.keep_unreachable_states + +@itemize @bullet +@item Language(s): all + +@item Purpose: Requests that Bison allow unreachable parser states to remain in +the parser tables. +Bison considers a state to be unreachable if there exists no sequence of +transitions from the start state to that state. +A state can become unreachable during conflict resolution if Bison disables a +shift action leading to it from a predecessor state. +Keeping unreachable states is sometimes useful for analysis purposes, but they +are useless in the generated parser. + +@item Accepted Values: Boolean + +@item Default Value: @code{"false"} + +@item Caveats: + +@itemize @bullet + +@item Unreachable states may contain conflicts and may use rules not used in +any other state. +Thus, keeping unreachable states may induce warnings that are irrelevant to +your parser's behavior, and it may eliminate warnings that are relevant. +Of course, the change in warnings may actually be relevant to a parser table +analysis that wants to keep unreachable states, so this behavior will likely +remain in future Bison releases. + +@item While Bison is able to remove unreachable states, it is not guaranteed to +remove other kinds of useless states. +Specifically, when Bison disables reduce actions during conflict resolution, +some goto actions may become useless, and thus some additional states may +become useless. +If Bison were to compute which goto actions were useless and then disable those +actions, it could identify such states as unreachable and then remove those +states. +However, Bison does not compute which goto actions are useless. +@end itemize +@end itemize + +@item namespace +@findex %define namespace + +@itemize +@item Languages(s): C++ + +@item Purpose: Specifies the namespace for the parser class. +For example, if you specify: + +@smallexample +%define namespace "foo::bar" +@end smallexample + +Bison uses @code{foo::bar} verbatim in references such as: + +@smallexample +foo::bar::parser::semantic_type +@end smallexample + +However, to open a namespace, Bison removes any leading @code{::} and then +splits on any remaining occurrences: + +@smallexample +namespace foo @{ namespace bar @{ + class position; + class location; +@} @} +@end smallexample + +@item Accepted Values: Any absolute or relative C++ namespace reference without +a trailing @code{"::"}. +For example, @code{"foo"} or @code{"::foo::bar"}. + +@item Default Value: The value specified by @code{%name-prefix}, which defaults +to @code{yy}. +This usage of @code{%name-prefix} is for backward compatibility and can be +confusing since @code{%name-prefix} also specifies the textual prefix for the +lexical analyzer function. +Thus, if you specify @code{%name-prefix}, it is best to also specify +@code{%define namespace} so that @code{%name-prefix} @emph{only} affects the +lexical analyzer function. +For example, if you specify: + +@smallexample +%define namespace "foo" +%name-prefix "bar::" +@end smallexample + +The parser namespace is @code{foo} and @code{yylex} is referenced as +@code{bar::lex}. +@end itemize +@end itemize + +@end deffn + +@deffn {Directive} %defines +Write a header file containing macro definitions for the token type +names defined in the grammar as well as a few other declarations. +If the parser output file is named @file{@var{name}.c} then this file +is named @file{@var{name}.h}. + +For C parsers, the output header declares @code{YYSTYPE} unless +@code{YYSTYPE} is already defined as a macro or you have used a +@code{<@var{type}>} tag without using @code{%union}. +Therefore, if you are using a @code{%union} +(@pxref{Multiple Types, ,More Than One Value Type}) with components that +require other definitions, or if you have defined a @code{YYSTYPE} macro +or type definition +(@pxref{Value Type, ,Data Types of Semantic Values}), you need to +arrange for these definitions to be propagated to all modules, e.g., by +putting them in a prerequisite header that is included both by your +parser and by any other module that needs @code{YYSTYPE}. + +Unless your parser is pure, the output header declares @code{yylval} +as an external variable. @xref{Pure Decl, ,A Pure (Reentrant) +Parser}. + +If you have also used locations, the output header declares +@code{YYLTYPE} and @code{yylloc} using a protocol similar to that of +the @code{YYSTYPE} macro and @code{yylval}. @xref{Locations, ,Tracking +Locations}. + +This output file is normally essential if you wish to put the definition +of @code{yylex} in a separate source file, because @code{yylex} +typically needs to be able to refer to the above-mentioned declarations +and to the token type codes. @xref{Token Values, ,Semantic Values of +Tokens}. + +@findex %code requires +@findex %code provides +If you have declared @code{%code requires} or @code{%code provides}, the output +header also contains their code. +@xref{Decl Summary, ,%code}. +@end deffn + +@deffn {Directive} %defines @var{defines-file} +Same as above, but save in the file @var{defines-file}. +@end deffn + +@deffn {Directive} %destructor +Specify how the parser should reclaim the memory associated to +discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. +@end deffn + +@deffn {Directive} %file-prefix "@var{prefix}" +Specify a prefix to use for all Bison output file names. The names are +chosen as if the input file were named @file{@var{prefix}.y}. +@end deffn + +@deffn {Directive} %language "@var{language}" +Specify the programming language for the generated parser. Currently +supported languages include C, C++, and Java. +@var{language} is case-insensitive. + +This directive is experimental and its effect may be modified in future +releases. +@end deffn + +@deffn {Directive} %locations +Generate the code processing the locations (@pxref{Action Features, +,Special Features for Use in Actions}). This mode is enabled as soon as +the grammar uses the special @samp{@@@var{n}} tokens, but if your +grammar does not use it, using @samp{%locations} allows for more +accurate syntax error messages. +@end deffn + +@deffn {Directive} %name-prefix "@var{prefix}" +Rename the external symbols used in the parser so that they start with +@var{prefix} instead of @samp{yy}. The precise list of symbols renamed +in C parsers +is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs}, +@code{yylval}, @code{yychar}, @code{yydebug}, and +(if locations are used) @code{yylloc}. If you use a push parser, +@code{yypush_parse}, @code{yypull_parse}, @code{yypstate}, +@code{yypstate_new} and @code{yypstate_delete} will +also be renamed. For example, if you use @samp{%name-prefix "c_"}, the +names become @code{c_parse}, @code{c_lex}, and so on. +For C++ parsers, see the @code{%define namespace} documentation in this +section. +@xref{Multiple Parsers, ,Multiple Parsers in the Same Program}. +@end deffn + +@ifset defaultprec +@deffn {Directive} %no-default-prec +Do not assign a precedence to rules lacking an explicit @code{%prec} +modifier (@pxref{Contextual Precedence, ,Context-Dependent +Precedence}). +@end deffn +@end ifset + +@deffn {Directive} %no-lines +Don't generate any @code{#line} preprocessor commands in the parser +file. Ordinarily Bison writes these commands in the parser file so that +the C compiler and debuggers will associate errors and object code with +your source file (the grammar file). This directive causes them to +associate errors with the parser file, treating it an independent source +file in its own right. +@end deffn + +@deffn {Directive} %output "@var{file}" +Specify @var{file} for the parser file. +@end deffn + +@deffn {Directive} %pure-parser +Deprecated version of @code{%define api.pure} (@pxref{Decl Summary, ,%define}), +for which Bison is more careful to warn about unreasonable usage. +@end deffn + +@deffn {Directive} %require "@var{version}" +Require version @var{version} or higher of Bison. @xref{Require Decl, , +Require a Version of Bison}. +@end deffn + +@deffn {Directive} %skeleton "@var{file}" +Specify the skeleton to use. + +@c You probably don't need this option unless you are developing Bison. +@c You should use @code{%language} if you want to specify the skeleton for a +@c different language, because it is clearer and because it will always choose the +@c correct skeleton for non-deterministic or push parsers. + +If @var{file} does not contain a @code{/}, @var{file} is the name of a skeleton +file in the Bison installation directory. +If it does, @var{file} is an absolute file name or a file name relative to the +directory of the grammar file. +This is similar to how most shells resolve commands. +@end deffn + +@deffn {Directive} %token-table +Generate an array of token names in the parser file. The name of the +array is @code{yytname}; @code{yytname[@var{i}]} is the name of the +token whose internal Bison token code number is @var{i}. The first +three elements of @code{yytname} correspond to the predefined tokens +@code{"$end"}, +@code{"error"}, and @code{"$undefined"}; after these come the symbols +defined in the grammar file. + +The name in the table includes all the characters needed to represent +the token in Bison. For single-character literals and literal +strings, this includes the surrounding quoting characters and any +escape sequences. For example, the Bison single-character literal +@code{'+'} corresponds to a three-character name, represented in C as +@code{"'+'"}; and the Bison two-character literal string @code{"\\/"} +corresponds to a five-character name, represented in C as +@code{"\"\\\\/\""}. + +When you specify @code{%token-table}, Bison also generates macro +definitions for macros @code{YYNTOKENS}, @code{YYNNTS}, and +@code{YYNRULES}, and @code{YYNSTATES}: + +@table @code +@item YYNTOKENS +The highest token number, plus one. +@item YYNNTS +The number of nonterminal symbols. +@item YYNRULES +The number of grammar rules, +@item YYNSTATES +The number of parser states (@pxref{Parser States}). +@end table +@end deffn + +@deffn {Directive} %verbose +Write an extra output file containing verbose descriptions of the +parser states and what is done for each type of lookahead token in +that state. @xref{Understanding, , Understanding Your Parser}, for more +information. +@end deffn + +@deffn {Directive} %yacc +Pretend the option @option{--yacc} was given, i.e., imitate Yacc, +including its naming conventions. @xref{Bison Options}, for more. +@end deffn + + +@node Multiple Parsers +@section Multiple Parsers in the Same Program + +Most programs that use Bison parse only one language and therefore contain +only one Bison parser. But what if you want to parse more than one +language with the same program? Then you need to avoid a name conflict +between different definitions of @code{yyparse}, @code{yylval}, and so on. + +The easy way to do this is to use the option @samp{-p @var{prefix}} +(@pxref{Invocation, ,Invoking Bison}). This renames the interface +functions and variables of the Bison parser to start with @var{prefix} +instead of @samp{yy}. You can use this to give each parser distinct +names that do not conflict. + +The precise list of symbols renamed is @code{yyparse}, @code{yylex}, +@code{yyerror}, @code{yynerrs}, @code{yylval}, @code{yylloc}, +@code{yychar} and @code{yydebug}. If you use a push parser, +@code{yypush_parse}, @code{yypull_parse}, @code{yypstate}, +@code{yypstate_new} and @code{yypstate_delete} will also be renamed. +For example, if you use @samp{-p c}, the names become @code{cparse}, +@code{clex}, and so on. + +@strong{All the other variables and macros associated with Bison are not +renamed.} These others are not global; there is no conflict if the same +name is used in different parsers. For example, @code{YYSTYPE} is not +renamed, but defining this in different ways in different parsers causes +no trouble (@pxref{Value Type, ,Data Types of Semantic Values}). + +The @samp{-p} option works by adding macro definitions to the beginning +of the parser source file, defining @code{yyparse} as +@code{@var{prefix}parse}, and so on. This effectively substitutes one +name for the other in the entire parser file. + +@node Interface +@chapter Parser C-Language Interface +@cindex C-language interface +@cindex interface + +The Bison parser is actually a C function named @code{yyparse}. Here we +describe the interface conventions of @code{yyparse} and the other +functions that it needs to use. + +Keep in mind that the parser uses many C identifiers starting with +@samp{yy} and @samp{YY} for internal purposes. If you use such an +identifier (aside from those in this manual) in an action or in epilogue +in the grammar file, you are likely to run into trouble. + +@menu +* Parser Function:: How to call @code{yyparse} and what it returns. +* Push Parser Function:: How to call @code{yypush_parse} and what it returns. +* Pull Parser Function:: How to call @code{yypull_parse} and what it returns. +* Parser Create Function:: How to call @code{yypstate_new} and what it returns. +* Parser Delete Function:: How to call @code{yypstate_delete} and what it returns. +* Lexical:: You must supply a function @code{yylex} + which reads tokens. +* Error Reporting:: You must supply a function @code{yyerror}. +* Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user's + native language. +@end menu + +@node Parser Function +@section The Parser Function @code{yyparse} +@findex yyparse + +You call the function @code{yyparse} to cause parsing to occur. This +function reads tokens, executes actions, and ultimately returns when it +encounters end-of-input or an unrecoverable syntax error. You can also +write an action which directs @code{yyparse} to return immediately +without reading further. + + +@deftypefun int yyparse (void) +The value returned by @code{yyparse} is 0 if parsing was successful (return +is due to end-of-input). + +The value is 1 if parsing failed because of invalid input, i.e., input +that contains a syntax error or that causes @code{YYABORT} to be +invoked. + +The value is 2 if parsing failed due to memory exhaustion. +@end deftypefun + +In an action, you can cause immediate return from @code{yyparse} by using +these macros: + +@defmac YYACCEPT +@findex YYACCEPT +Return immediately with value 0 (to report success). +@end defmac + +@defmac YYABORT +@findex YYABORT +Return immediately with value 1 (to report failure). +@end defmac + +If you use a reentrant parser, you can optionally pass additional +parameter information to it in a reentrant way. To do so, use the +declaration @code{%parse-param}: + +@deffn {Directive} %parse-param @{@var{argument-declaration}@} +@findex %parse-param +Declare that an argument declared by the braced-code +@var{argument-declaration} is an additional @code{yyparse} argument. +The @var{argument-declaration} is used when declaring +functions or prototypes. The last identifier in +@var{argument-declaration} must be the argument name. +@end deffn + +Here's an example. Write this in the parser: + +@example +%parse-param @{int *nastiness@} +%parse-param @{int *randomness@} +@end example + +@noindent +Then call the parser like this: + +@example +@{ + int nastiness, randomness; + @dots{} /* @r{Store proper data in @code{nastiness} and @code{randomness}.} */ + value = yyparse (&nastiness, &randomness); + @dots{} +@} +@end example + +@noindent +In the grammar actions, use expressions like this to refer to the data: + +@example +exp: @dots{} @{ @dots{}; *randomness += 1; @dots{} @} +@end example + +@node Push Parser Function +@section The Push Parser Function @code{yypush_parse} +@findex yypush_parse + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + +You call the function @code{yypush_parse} to parse a single token. This +function is available if either the @code{%define api.push_pull "push"} or +@code{%define api.push_pull "both"} declaration is used. +@xref{Push Decl, ,A Push Parser}. + +@deftypefun int yypush_parse (yypstate *yyps) +The value returned by @code{yypush_parse} is the same as for yyparse with the +following exception. @code{yypush_parse} will return YYPUSH_MORE if more input +is required to finish parsing the grammar. +@end deftypefun + +@node Pull Parser Function +@section The Pull Parser Function @code{yypull_parse} +@findex yypull_parse + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + +You call the function @code{yypull_parse} to parse the rest of the input +stream. This function is available if the @code{%define api.push_pull "both"} +declaration is used. +@xref{Push Decl, ,A Push Parser}. + +@deftypefun int yypull_parse (yypstate *yyps) +The value returned by @code{yypull_parse} is the same as for @code{yyparse}. +@end deftypefun + +@node Parser Create Function +@section The Parser Create Function @code{yystate_new} +@findex yypstate_new + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + +You call the function @code{yypstate_new} to create a new parser instance. +This function is available if either the @code{%define api.push_pull "push"} or +@code{%define api.push_pull "both"} declaration is used. +@xref{Push Decl, ,A Push Parser}. + +@deftypefun yypstate *yypstate_new (void) +The fuction will return a valid parser instance if there was memory available +or 0 if no memory was available. +In impure mode, it will also return 0 if a parser instance is currently +allocated. +@end deftypefun + +@node Parser Delete Function +@section The Parser Delete Function @code{yystate_delete} +@findex yypstate_delete + +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) + +You call the function @code{yypstate_delete} to delete a parser instance. +function is available if either the @code{%define api.push_pull "push"} or +@code{%define api.push_pull "both"} declaration is used. +@xref{Push Decl, ,A Push Parser}. + +@deftypefun void yypstate_delete (yypstate *yyps) +This function will reclaim the memory associated with a parser instance. +After this call, you should no longer attempt to use the parser instance. +@end deftypefun + +@node Lexical +@section The Lexical Analyzer Function @code{yylex} +@findex yylex +@cindex lexical analyzer + +The @dfn{lexical analyzer} function, @code{yylex}, recognizes tokens from +the input stream and returns them to the parser. Bison does not create +this function automatically; you must write it so that @code{yyparse} can +call it. The function is sometimes referred to as a lexical scanner. + +In simple programs, @code{yylex} is often defined at the end of the Bison +grammar file. If @code{yylex} is defined in a separate source file, you +need to arrange for the token-type macro definitions to be available there. +To do this, use the @samp{-d} option when you run Bison, so that it will +write these macro definitions into a separate header file +@file{@var{name}.tab.h} which you can include in the other source files +that need it. @xref{Invocation, ,Invoking Bison}. + +@menu +* Calling Convention:: How @code{yyparse} calls @code{yylex}. +* Token Values:: How @code{yylex} must return the semantic value + of the token it has read. +* Token Locations:: How @code{yylex} must return the text location + (line number, etc.) of the token, if the + actions want that. +* Pure Calling:: How the calling convention differs in a pure parser + (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}). +@end menu + +@node Calling Convention +@subsection Calling Convention for @code{yylex} + +The value that @code{yylex} returns must be the positive numeric code +for the type of token it has just found; a zero or negative value +signifies end-of-input. + +When a token is referred to in the grammar rules by a name, that name +in the parser file becomes a C macro whose definition is the proper +numeric code for that token type. So @code{yylex} can use the name +to indicate that type. @xref{Symbols}. + +When a token is referred to in the grammar rules by a character literal, +the numeric code for that character is also the code for the token type. +So @code{yylex} can simply return that character code, possibly converted +to @code{unsigned char} to avoid sign-extension. The null character +must not be used this way, because its code is zero and that +signifies end-of-input. + +Here is an example showing these things: + +@example +int +yylex (void) +@{ + @dots{} + if (c == EOF) /* Detect end-of-input. */ + return 0; + @dots{} + if (c == '+' || c == '-') + return c; /* Assume token type for `+' is '+'. */ + @dots{} + return INT; /* Return the type of the token. */ + @dots{} +@} +@end example + +@noindent +This interface has been designed so that the output from the @code{lex} +utility can be used without change as the definition of @code{yylex}. + +If the grammar uses literal string tokens, there are two ways that +@code{yylex} can determine the token type codes for them: + +@itemize @bullet +@item +If the grammar defines symbolic token names as aliases for the +literal string tokens, @code{yylex} can use these symbolic names like +all others. In this case, the use of the literal string tokens in +the grammar file has no effect on @code{yylex}. + +@item +@code{yylex} can find the multicharacter token in the @code{yytname} +table. The index of the token in the table is the token type's code. +The name of a multicharacter token is recorded in @code{yytname} with a +double-quote, the token's characters, and another double-quote. The +token's characters are escaped as necessary to be suitable as input +to Bison. + +Here's code for looking up a multicharacter token in @code{yytname}, +assuming that the characters of the token are stored in +@code{token_buffer}, and assuming that the token does not contain any +characters like @samp{"} that require escaping. + +@smallexample +for (i = 0; i < YYNTOKENS; i++) + @{ + if (yytname[i] != 0 + && yytname[i][0] == '"' + && ! strncmp (yytname[i] + 1, token_buffer, + strlen (token_buffer)) + && yytname[i][strlen (token_buffer) + 1] == '"' + && yytname[i][strlen (token_buffer) + 2] == 0) + break; + @} +@end smallexample + +The @code{yytname} table is generated only if you use the +@code{%token-table} declaration. @xref{Decl Summary}. +@end itemize + +@node Token Values +@subsection Semantic Values of Tokens + +@vindex yylval +In an ordinary (nonreentrant) parser, the semantic value of the token must +be stored into the global variable @code{yylval}. When you are using +just one data type for semantic values, @code{yylval} has that type. +Thus, if the type is @code{int} (the default), you might write this in +@code{yylex}: + +@example +@group + @dots{} + yylval = value; /* Put value onto Bison stack. */ + return INT; /* Return the type of the token. */ + @dots{} +@end group +@end example + +When you are using multiple data types, @code{yylval}'s type is a union +made from the @code{%union} declaration (@pxref{Union Decl, ,The +Collection of Value Types}). So when you store a token's value, you +must use the proper member of the union. If the @code{%union} +declaration looks like this: + +@example +@group +%union @{ + int intval; + double val; + symrec *tptr; +@} +@end group +@end example + +@noindent +then the code in @code{yylex} might look like this: + +@example +@group + @dots{} + yylval.intval = value; /* Put value onto Bison stack. */ + return INT; /* Return the type of the token. */ + @dots{} +@end group +@end example + +@node Token Locations +@subsection Textual Locations of Tokens + +@vindex yylloc +If you are using the @samp{@@@var{n}}-feature (@pxref{Locations, , +Tracking Locations}) in actions to keep track of the textual locations +of tokens and groupings, then you must provide this information in +@code{yylex}. The function @code{yyparse} expects to find the textual +location of a token just parsed in the global variable @code{yylloc}. +So @code{yylex} must store the proper data in that variable. + +By default, the value of @code{yylloc} is a structure and you need only +initialize the members that are going to be used by the actions. The +four members are called @code{first_line}, @code{first_column}, +@code{last_line} and @code{last_column}. Note that the use of this +feature makes the parser noticeably slower. + +@tindex YYLTYPE +The data type of @code{yylloc} has the name @code{YYLTYPE}. + +@node Pure Calling +@subsection Calling Conventions for Pure Parsers + +When you use the Bison declaration @code{%define api.pure} to request a +pure, reentrant parser, the global communication variables @code{yylval} +and @code{yylloc} cannot be used. (@xref{Pure Decl, ,A Pure (Reentrant) +Parser}.) In such parsers the two global variables are replaced by +pointers passed as arguments to @code{yylex}. You must declare them as +shown here, and pass the information back by storing it through those +pointers. + +@example +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +@{ + @dots{} + *lvalp = value; /* Put value onto Bison stack. */ + return INT; /* Return the type of the token. */ + @dots{} +@} +@end example + +If the grammar file does not use the @samp{@@} constructs to refer to +textual locations, then the type @code{YYLTYPE} will not be defined. In +this case, omit the second argument; @code{yylex} will be called with +only one argument. + + +If you wish to pass the additional parameter data to @code{yylex}, use +@code{%lex-param} just like @code{%parse-param} (@pxref{Parser +Function}). + +@deffn {Directive} lex-param @{@var{argument-declaration}@} +@findex %lex-param +Declare that the braced-code @var{argument-declaration} is an +additional @code{yylex} argument declaration. +@end deffn + +For instance: + +@example +%parse-param @{int *nastiness@} +%lex-param @{int *nastiness@} +%parse-param @{int *randomness@} +@end example + +@noindent +results in the following signature: + +@example +int yylex (int *nastiness); +int yyparse (int *nastiness, int *randomness); +@end example + +If @code{%define api.pure} is added: + +@example +int yylex (YYSTYPE *lvalp, int *nastiness); +int yyparse (int *nastiness, int *randomness); +@end example + +@noindent +and finally, if both @code{%define api.pure} and @code{%locations} are used: + +@example +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness); +int yyparse (int *nastiness, int *randomness); +@end example + +@node Error Reporting +@section The Error Reporting Function @code{yyerror} +@cindex error reporting function +@findex yyerror +@cindex parse error +@cindex syntax error + +The Bison parser detects a @dfn{syntax error} or @dfn{parse error} +whenever it reads a token which cannot satisfy any syntax rule. An +action in the grammar can also explicitly proclaim an error, using the +macro @code{YYERROR} (@pxref{Action Features, ,Special Features for Use +in Actions}). + +The Bison parser expects to report the error by calling an error +reporting function named @code{yyerror}, which you must supply. It is +called by @code{yyparse} whenever a syntax error is found, and it +receives one argument. For a syntax error, the string is normally +@w{@code{"syntax error"}}. + +@findex %error-verbose +If you invoke the directive @code{%error-verbose} in the Bison +declarations section (@pxref{Bison Declarations, ,The Bison Declarations +Section}), then Bison provides a more verbose and specific error message +string instead of just plain @w{@code{"syntax error"}}. + +The parser can detect one other kind of error: memory exhaustion. This +can happen when the input contains constructions that are very deeply +nested. It isn't likely you will encounter this, since the Bison +parser normally extends its stack automatically up to a very large limit. But +if memory is exhausted, @code{yyparse} calls @code{yyerror} in the usual +fashion, except that the argument string is @w{@code{"memory exhausted"}}. + +In some cases diagnostics like @w{@code{"syntax error"}} are +translated automatically from English to some other language before +they are passed to @code{yyerror}. @xref{Internationalization}. + +The following definition suffices in simple programs: + +@example +@group +void +yyerror (char const *s) +@{ +@end group +@group + fprintf (stderr, "%s\n", s); +@} +@end group +@end example + +After @code{yyerror} returns to @code{yyparse}, the latter will attempt +error recovery if you have written suitable error recovery grammar rules +(@pxref{Error Recovery}). If recovery is impossible, @code{yyparse} will +immediately return 1. + +Obviously, in location tracking pure parsers, @code{yyerror} should have +an access to the current location. +This is indeed the case for the @acronym{GLR} +parsers, but not for the Yacc parser, for historical reasons. I.e., if +@samp{%locations %define api.pure} is passed then the prototypes for +@code{yyerror} are: + +@example +void yyerror (char const *msg); /* Yacc parsers. */ +void yyerror (YYLTYPE *locp, char const *msg); /* GLR parsers. */ +@end example + +If @samp{%parse-param @{int *nastiness@}} is used, then: + +@example +void yyerror (int *nastiness, char const *msg); /* Yacc parsers. */ +void yyerror (int *nastiness, char const *msg); /* GLR parsers. */ +@end example + +Finally, @acronym{GLR} and Yacc parsers share the same @code{yyerror} calling +convention for absolutely pure parsers, i.e., when the calling +convention of @code{yylex} @emph{and} the calling convention of +@code{%define api.pure} are pure. +I.e.: + +@example +/* Location tracking. */ +%locations +/* Pure yylex. */ +%define api.pure +%lex-param @{int *nastiness@} +/* Pure yyparse. */ +%parse-param @{int *nastiness@} +%parse-param @{int *randomness@} +@end example + +@noindent +results in the following signatures for all the parser kinds: + +@example +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness); +int yyparse (int *nastiness, int *randomness); +void yyerror (YYLTYPE *locp, + int *nastiness, int *randomness, + char const *msg); +@end example + +@noindent +The prototypes are only indications of how the code produced by Bison +uses @code{yyerror}. Bison-generated code always ignores the returned +value, so @code{yyerror} can return any type, including @code{void}. +Also, @code{yyerror} can be a variadic function; that is why the +message is always passed last. + +Traditionally @code{yyerror} returns an @code{int} that is always +ignored, but this is purely for historical reasons, and @code{void} is +preferable since it more accurately describes the return type for +@code{yyerror}. + +@vindex yynerrs +The variable @code{yynerrs} contains the number of syntax errors +reported so far. Normally this variable is global; but if you +request a pure parser (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}) +then it is a local variable which only the actions can access. + +@node Action Features +@section Special Features for Use in Actions +@cindex summary, action features +@cindex action features summary + +Here is a table of Bison constructs, variables and macros that +are useful in actions. + +@deffn {Variable} $$ +Acts like a variable that contains the semantic value for the +grouping made by the current rule. @xref{Actions}. +@end deffn + +@deffn {Variable} $@var{n} +Acts like a variable that contains the semantic value for the +@var{n}th component of the current rule. @xref{Actions}. +@end deffn + +@deffn {Variable} $<@var{typealt}>$ +Like @code{$$} but specifies alternative @var{typealt} in the union +specified by the @code{%union} declaration. @xref{Action Types, ,Data +Types of Values in Actions}. +@end deffn + +@deffn {Variable} $<@var{typealt}>@var{n} +Like @code{$@var{n}} but specifies alternative @var{typealt} in the +union specified by the @code{%union} declaration. +@xref{Action Types, ,Data Types of Values in Actions}. +@end deffn + +@deffn {Macro} YYABORT; +Return immediately from @code{yyparse}, indicating failure. +@xref{Parser Function, ,The Parser Function @code{yyparse}}. +@end deffn + +@deffn {Macro} YYACCEPT; +Return immediately from @code{yyparse}, indicating success. +@xref{Parser Function, ,The Parser Function @code{yyparse}}. +@end deffn + +@deffn {Macro} YYBACKUP (@var{token}, @var{value}); +@findex YYBACKUP +Unshift a token. This macro is allowed only for rules that reduce +a single value, and only when there is no lookahead token. +It is also disallowed in @acronym{GLR} parsers. +It installs a lookahead token with token type @var{token} and +semantic value @var{value}; then it discards the value that was +going to be reduced by this rule. + +If the macro is used when it is not valid, such as when there is +a lookahead token already, then it reports a syntax error with +a message @samp{cannot back up} and performs ordinary error +recovery. + +In either case, the rest of the action is not executed. +@end deffn + +@deffn {Macro} YYEMPTY +@vindex YYEMPTY +Value stored in @code{yychar} when there is no lookahead token. +@end deffn + +@deffn {Macro} YYEOF +@vindex YYEOF +Value stored in @code{yychar} when the lookahead is the end of the input +stream. +@end deffn + +@deffn {Macro} YYERROR; +@findex YYERROR +Cause an immediate syntax error. This statement initiates error +recovery just as if the parser itself had detected an error; however, it +does not call @code{yyerror}, and does not print any message. If you +want to print an error message, call @code{yyerror} explicitly before +the @samp{YYERROR;} statement. @xref{Error Recovery}. +@end deffn + +@deffn {Macro} YYRECOVERING +@findex YYRECOVERING +The expression @code{YYRECOVERING ()} yields 1 when the parser +is recovering from a syntax error, and 0 otherwise. +@xref{Error Recovery}. +@end deffn + +@deffn {Variable} yychar +Variable containing either the lookahead token, or @code{YYEOF} when the +lookahead is the end of the input stream, or @code{YYEMPTY} when no lookahead +has been performed so the next token is not yet known. +Do not modify @code{yychar} in a deferred semantic action (@pxref{GLR Semantic +Actions}). +@xref{Lookahead, ,Lookahead Tokens}. +@end deffn + +@deffn {Macro} yyclearin; +Discard the current lookahead token. This is useful primarily in +error rules. +Do not invoke @code{yyclearin} in a deferred semantic action (@pxref{GLR +Semantic Actions}). +@xref{Error Recovery}. +@end deffn + +@deffn {Macro} yyerrok; +Resume generating error messages immediately for subsequent syntax +errors. This is useful primarily in error rules. +@xref{Error Recovery}. +@end deffn + +@deffn {Variable} yylloc +Variable containing the lookahead token location when @code{yychar} is not set +to @code{YYEMPTY} or @code{YYEOF}. +Do not modify @code{yylloc} in a deferred semantic action (@pxref{GLR Semantic +Actions}). +@xref{Actions and Locations, ,Actions and Locations}. +@end deffn + +@deffn {Variable} yylval +Variable containing the lookahead token semantic value when @code{yychar} is +not set to @code{YYEMPTY} or @code{YYEOF}. +Do not modify @code{yylval} in a deferred semantic action (@pxref{GLR Semantic +Actions}). +@xref{Actions, ,Actions}. +@end deffn + +@deffn {Value} @@$ +@findex @@$ +Acts like a structure variable containing information on the textual location +of the grouping made by the current rule. @xref{Locations, , +Tracking Locations}. + +@c Check if those paragraphs are still useful or not. + +@c @example +@c struct @{ +@c int first_line, last_line; +@c int first_column, last_column; +@c @}; +@c @end example + +@c Thus, to get the starting line number of the third component, you would +@c use @samp{@@3.first_line}. + +@c In order for the members of this structure to contain valid information, +@c you must make @code{yylex} supply this information about each token. +@c If you need only certain members, then @code{yylex} need only fill in +@c those members. + +@c The use of this feature makes the parser noticeably slower. +@end deffn + +@deffn {Value} @@@var{n} +@findex @@@var{n} +Acts like a structure variable containing information on the textual location +of the @var{n}th component of the current rule. @xref{Locations, , +Tracking Locations}. +@end deffn + +@node Internationalization +@section Parser Internationalization +@cindex internationalization +@cindex i18n +@cindex NLS +@cindex gettext +@cindex bison-po + +A Bison-generated parser can print diagnostics, including error and +tracing messages. By default, they appear in English. However, Bison +also supports outputting diagnostics in the user's native language. To +make this work, the user should set the usual environment variables. +@xref{Users, , The User's View, gettext, GNU @code{gettext} utilities}. +For example, the shell command @samp{export LC_ALL=fr_CA.UTF-8} might +set the user's locale to French Canadian using the @acronym{UTF}-8 +encoding. The exact set of available locales depends on the user's +installation. + +The maintainer of a package that uses a Bison-generated parser enables +the internationalization of the parser's output through the following +steps. Here we assume a package that uses @acronym{GNU} Autoconf and +@acronym{GNU} Automake. + +@enumerate +@item +@cindex bison-i18n.m4 +Into the directory containing the @acronym{GNU} Autoconf macros used +by the package---often called @file{m4}---copy the +@file{bison-i18n.m4} file installed by Bison under +@samp{share/aclocal/bison-i18n.m4} in Bison's installation directory. +For example: + +@example +cp /usr/local/share/aclocal/bison-i18n.m4 m4/bison-i18n.m4 +@end example + +@item +@findex BISON_I18N +@vindex BISON_LOCALEDIR +@vindex YYENABLE_NLS +In the top-level @file{configure.ac}, after the @code{AM_GNU_GETTEXT} +invocation, add an invocation of @code{BISON_I18N}. This macro is +defined in the file @file{bison-i18n.m4} that you copied earlier. It +causes @samp{configure} to find the value of the +@code{BISON_LOCALEDIR} variable, and it defines the source-language +symbol @code{YYENABLE_NLS} to enable translations in the +Bison-generated parser. + +@item +In the @code{main} function of your program, designate the directory +containing Bison's runtime message catalog, through a call to +@samp{bindtextdomain} with domain name @samp{bison-runtime}. +For example: + +@example +bindtextdomain ("bison-runtime", BISON_LOCALEDIR); +@end example + +Typically this appears after any other call @code{bindtextdomain +(PACKAGE, LOCALEDIR)} that your package already has. Here we rely on +@samp{BISON_LOCALEDIR} to be defined as a string through the +@file{Makefile}. + +@item +In the @file{Makefile.am} that controls the compilation of the @code{main} +function, make @samp{BISON_LOCALEDIR} available as a C preprocessor macro, +either in @samp{DEFS} or in @samp{AM_CPPFLAGS}. For example: + +@example +DEFS = @@DEFS@@ -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' +@end example + +or: + +@example +AM_CPPFLAGS = -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' +@end example + +@item +Finally, invoke the command @command{autoreconf} to generate the build +infrastructure. +@end enumerate + + +@node Algorithm +@chapter The Bison Parser Algorithm +@cindex Bison parser algorithm +@cindex algorithm of parser +@cindex shifting +@cindex reduction +@cindex parser stack +@cindex stack, parser + +As Bison reads tokens, it pushes them onto a stack along with their +semantic values. The stack is called the @dfn{parser stack}. Pushing a +token is traditionally called @dfn{shifting}. + +For example, suppose the infix calculator has read @samp{1 + 5 *}, with a +@samp{3} to come. The stack will have four elements, one for each token +that was shifted. + +But the stack does not always have an element for each token read. When +the last @var{n} tokens and groupings shifted match the components of a +grammar rule, they can be combined according to that rule. This is called +@dfn{reduction}. Those tokens and groupings are replaced on the stack by a +single grouping whose symbol is the result (left hand side) of that rule. +Running the rule's action is part of the process of reduction, because this +is what computes the semantic value of the resulting grouping. + +For example, if the infix calculator's parser stack contains this: + +@example +1 + 5 * 3 +@end example + +@noindent +and the next input token is a newline character, then the last three +elements can be reduced to 15 via the rule: + +@example +expr: expr '*' expr; +@end example + +@noindent +Then the stack contains just these three elements: + +@example +1 + 15 +@end example + +@noindent +At this point, another reduction can be made, resulting in the single value +16. Then the newline token can be shifted. + +The parser tries, by shifts and reductions, to reduce the entire input down +to a single grouping whose symbol is the grammar's start-symbol +(@pxref{Language and Grammar, ,Languages and Context-Free Grammars}). + +This kind of parser is known in the literature as a bottom-up parser. + +@menu +* Lookahead:: Parser looks one token ahead when deciding what to do. +* Shift/Reduce:: Conflicts: when either shifting or reduction is valid. +* Precedence:: Operator precedence works by resolving conflicts. +* Contextual Precedence:: When an operator's precedence depends on context. +* Parser States:: The parser is a finite-state-machine with stack. +* Reduce/Reduce:: When two rules are applicable in the same situation. +* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified. +* Generalized LR Parsing:: Parsing arbitrary context-free grammars. +* Memory Management:: What happens when memory is exhausted. How to avoid it. +@end menu + +@node Lookahead +@section Lookahead Tokens +@cindex lookahead token + +The Bison parser does @emph{not} always reduce immediately as soon as the +last @var{n} tokens and groupings match a rule. This is because such a +simple strategy is inadequate to handle most languages. Instead, when a +reduction is possible, the parser sometimes ``looks ahead'' at the next +token in order to decide what to do. + +When a token is read, it is not immediately shifted; first it becomes the +@dfn{lookahead token}, which is not on the stack. Now the parser can +perform one or more reductions of tokens and groupings on the stack, while +the lookahead token remains off to the side. When no more reductions +should take place, the lookahead token is shifted onto the stack. This +does not mean that all possible reductions have been done; depending on the +token type of the lookahead token, some rules may choose to delay their +application. + +Here is a simple case where lookahead is needed. These three rules define +expressions which contain binary addition operators and postfix unary +factorial operators (@samp{!}), and allow parentheses for grouping. + +@example +@group +expr: term '+' expr + | term + ; +@end group + +@group +term: '(' expr ')' + | term '!' + | NUMBER + ; +@end group +@end example + +Suppose that the tokens @w{@samp{1 + 2}} have been read and shifted; what +should be done? If the following token is @samp{)}, then the first three +tokens must be reduced to form an @code{expr}. This is the only valid +course, because shifting the @samp{)} would produce a sequence of symbols +@w{@code{term ')'}}, and no rule allows this. + +If the following token is @samp{!}, then it must be shifted immediately so +that @w{@samp{2 !}} can be reduced to make a @code{term}. If instead the +parser were to reduce before shifting, @w{@samp{1 + 2}} would become an +@code{expr}. It would then be impossible to shift the @samp{!} because +doing so would produce on the stack the sequence of symbols @code{expr +'!'}. No rule allows that sequence. + +@vindex yychar +@vindex yylval +@vindex yylloc +The lookahead token is stored in the variable @code{yychar}. +Its semantic value and location, if any, are stored in the variables +@code{yylval} and @code{yylloc}. +@xref{Action Features, ,Special Features for Use in Actions}. + +@node Shift/Reduce +@section Shift/Reduce Conflicts +@cindex conflicts +@cindex shift/reduce conflicts +@cindex dangling @code{else} +@cindex @code{else}, dangling + +Suppose we are parsing a language which has if-then and if-then-else +statements, with a pair of rules like this: + +@example +@group +if_stmt: + IF expr THEN stmt + | IF expr THEN stmt ELSE stmt + ; +@end group +@end example + +@noindent +Here we assume that @code{IF}, @code{THEN} and @code{ELSE} are +terminal symbols for specific keyword tokens. + +When the @code{ELSE} token is read and becomes the lookahead token, the +contents of the stack (assuming the input is valid) are just right for +reduction by the first rule. But it is also legitimate to shift the +@code{ELSE}, because that would lead to eventual reduction by the second +rule. + +This situation, where either a shift or a reduction would be valid, is +called a @dfn{shift/reduce conflict}. Bison is designed to resolve +these conflicts by choosing to shift, unless otherwise directed by +operator precedence declarations. To see the reason for this, let's +contrast it with the other alternative. + +Since the parser prefers to shift the @code{ELSE}, the result is to attach +the else-clause to the innermost if-statement, making these two inputs +equivalent: + +@example +if x then if y then win (); else lose; + +if x then do; if y then win (); else lose; end; +@end example + +But if the parser chose to reduce when possible rather than shift, the +result would be to attach the else-clause to the outermost if-statement, +making these two inputs equivalent: + +@example +if x then if y then win (); else lose; + +if x then do; if y then win (); end; else lose; +@end example + +The conflict exists because the grammar as written is ambiguous: either +parsing of the simple nested if-statement is legitimate. The established +convention is that these ambiguities are resolved by attaching the +else-clause to the innermost if-statement; this is what Bison accomplishes +by choosing to shift rather than reduce. (It would ideally be cleaner to +write an unambiguous grammar, but that is very hard to do in this case.) +This particular ambiguity was first encountered in the specifications of +Algol 60 and is called the ``dangling @code{else}'' ambiguity. + +To avoid warnings from Bison about predictable, legitimate shift/reduce +conflicts, use the @code{%expect @var{n}} declaration. There will be no +warning as long as the number of shift/reduce conflicts is exactly @var{n}. +@xref{Expect Decl, ,Suppressing Conflict Warnings}. + +The definition of @code{if_stmt} above is solely to blame for the +conflict, but the conflict does not actually appear without additional +rules. Here is a complete Bison input file that actually manifests the +conflict: + +@example +@group +%token IF THEN ELSE variable +%% +@end group +@group +stmt: expr + | if_stmt + ; +@end group + +@group +if_stmt: + IF expr THEN stmt + | IF expr THEN stmt ELSE stmt + ; +@end group + +expr: variable + ; +@end example + +@node Precedence +@section Operator Precedence +@cindex operator precedence +@cindex precedence of operators + +Another situation where shift/reduce conflicts appear is in arithmetic +expressions. Here shifting is not always the preferred resolution; the +Bison declarations for operator precedence allow you to specify when to +shift and when to reduce. + +@menu +* Why Precedence:: An example showing why precedence is needed. +* Using Precedence:: How to specify precedence in Bison grammars. +* Precedence Examples:: How these features are used in the previous example. +* How Precedence:: How they work. +@end menu + +@node Why Precedence +@subsection When Precedence is Needed + +Consider the following ambiguous grammar fragment (ambiguous because the +input @w{@samp{1 - 2 * 3}} can be parsed in two different ways): + +@example +@group +expr: expr '-' expr + | expr '*' expr + | expr '<' expr + | '(' expr ')' + @dots{} + ; +@end group +@end example + +@noindent +Suppose the parser has seen the tokens @samp{1}, @samp{-} and @samp{2}; +should it reduce them via the rule for the subtraction operator? It +depends on the next token. Of course, if the next token is @samp{)}, we +must reduce; shifting is invalid because no single rule can reduce the +token sequence @w{@samp{- 2 )}} or anything starting with that. But if +the next token is @samp{*} or @samp{<}, we have a choice: either +shifting or reduction would allow the parse to complete, but with +different results. + +To decide which one Bison should do, we must consider the results. If +the next operator token @var{op} is shifted, then it must be reduced +first in order to permit another opportunity to reduce the difference. +The result is (in effect) @w{@samp{1 - (2 @var{op} 3)}}. On the other +hand, if the subtraction is reduced before shifting @var{op}, the result +is @w{@samp{(1 - 2) @var{op} 3}}. Clearly, then, the choice of shift or +reduce should depend on the relative precedence of the operators +@samp{-} and @var{op}: @samp{*} should be shifted first, but not +@samp{<}. + +@cindex associativity +What about input such as @w{@samp{1 - 2 - 5}}; should this be +@w{@samp{(1 - 2) - 5}} or should it be @w{@samp{1 - (2 - 5)}}? For most +operators we prefer the former, which is called @dfn{left association}. +The latter alternative, @dfn{right association}, is desirable for +assignment operators. The choice of left or right association is a +matter of whether the parser chooses to shift or reduce when the stack +contains @w{@samp{1 - 2}} and the lookahead token is @samp{-}: shifting +makes right-associativity. + +@node Using Precedence +@subsection Specifying Operator Precedence +@findex %left +@findex %right +@findex %nonassoc + +Bison allows you to specify these choices with the operator precedence +declarations @code{%left} and @code{%right}. Each such declaration +contains a list of tokens, which are operators whose precedence and +associativity is being declared. The @code{%left} declaration makes all +those operators left-associative and the @code{%right} declaration makes +them right-associative. A third alternative is @code{%nonassoc}, which +declares that it is a syntax error to find the same operator twice ``in a +row''. + +The relative precedence of different operators is controlled by the +order in which they are declared. The first @code{%left} or +@code{%right} declaration in the file declares the operators whose +precedence is lowest, the next such declaration declares the operators +whose precedence is a little higher, and so on. + +@node Precedence Examples +@subsection Precedence Examples + +In our example, we would want the following declarations: + +@example +%left '<' +%left '-' +%left '*' +@end example + +In a more complete example, which supports other operators as well, we +would declare them in groups of equal precedence. For example, @code{'+'} is +declared with @code{'-'}: + +@example +%left '<' '>' '=' NE LE GE +%left '+' '-' +%left '*' '/' +@end example + +@noindent +(Here @code{NE} and so on stand for the operators for ``not equal'' +and so on. We assume that these tokens are more than one character long +and therefore are represented by names, not character literals.) + +@node How Precedence +@subsection How Precedence Works + +The first effect of the precedence declarations is to assign precedence +levels to the terminal symbols declared. The second effect is to assign +precedence levels to certain rules: each rule gets its precedence from +the last terminal symbol mentioned in the components. (You can also +specify explicitly the precedence of a rule. @xref{Contextual +Precedence, ,Context-Dependent Precedence}.) + +Finally, the resolution of conflicts works by comparing the precedence +of the rule being considered with that of the lookahead token. If the +token's precedence is higher, the choice is to shift. If the rule's +precedence is higher, the choice is to reduce. If they have equal +precedence, the choice is made based on the associativity of that +precedence level. The verbose output file made by @samp{-v} +(@pxref{Invocation, ,Invoking Bison}) says how each conflict was +resolved. + +Not all rules and not all tokens have precedence. If either the rule or +the lookahead token has no precedence, then the default is to shift. + +@node Contextual Precedence +@section Context-Dependent Precedence +@cindex context-dependent precedence +@cindex unary operator precedence +@cindex precedence, context-dependent +@cindex precedence, unary operator +@findex %prec + +Often the precedence of an operator depends on the context. This sounds +outlandish at first, but it is really very common. For example, a minus +sign typically has a very high precedence as a unary operator, and a +somewhat lower precedence (lower than multiplication) as a binary operator. + +The Bison precedence declarations, @code{%left}, @code{%right} and +@code{%nonassoc}, can only be used once for a given token; so a token has +only one precedence declared in this way. For context-dependent +precedence, you need to use an additional mechanism: the @code{%prec} +modifier for rules. + +The @code{%prec} modifier declares the precedence of a particular rule by +specifying a terminal symbol whose precedence should be used for that rule. +It's not necessary for that symbol to appear otherwise in the rule. The +modifier's syntax is: + +@example +%prec @var{terminal-symbol} +@end example + +@noindent +and it is written after the components of the rule. Its effect is to +assign the rule the precedence of @var{terminal-symbol}, overriding +the precedence that would be deduced for it in the ordinary way. The +altered rule precedence then affects how conflicts involving that rule +are resolved (@pxref{Precedence, ,Operator Precedence}). + +Here is how @code{%prec} solves the problem of unary minus. First, declare +a precedence for a fictitious terminal symbol named @code{UMINUS}. There +are no tokens of this type, but the symbol serves to stand for its +precedence: + +@example +@dots{} +%left '+' '-' +%left '*' +%left UMINUS +@end example + +Now the precedence of @code{UMINUS} can be used in specific rules: + +@example +@group +exp: @dots{} + | exp '-' exp + @dots{} + | '-' exp %prec UMINUS +@end group +@end example + +@ifset defaultprec +If you forget to append @code{%prec UMINUS} to the rule for unary +minus, Bison silently assumes that minus has its usual precedence. +This kind of problem can be tricky to debug, since one typically +discovers the mistake only by testing the code. + +The @code{%no-default-prec;} declaration makes it easier to discover +this kind of problem systematically. It causes rules that lack a +@code{%prec} modifier to have no precedence, even if the last terminal +symbol mentioned in their components has a declared precedence. + +If @code{%no-default-prec;} is in effect, you must specify @code{%prec} +for all rules that participate in precedence conflict resolution. +Then you will see any shift/reduce conflict until you tell Bison how +to resolve it, either by changing your grammar or by adding an +explicit precedence. This will probably add declarations to the +grammar, but it helps to protect against incorrect rule precedences. + +The effect of @code{%no-default-prec;} can be reversed by giving +@code{%default-prec;}, which is the default. +@end ifset + +@node Parser States +@section Parser States +@cindex finite-state machine +@cindex parser state +@cindex state (of parser) + +The function @code{yyparse} is implemented using a finite-state machine. +The values pushed on the parser stack are not simply token type codes; they +represent the entire sequence of terminal and nonterminal symbols at or +near the top of the stack. The current state collects all the information +about previous input which is relevant to deciding what to do next. + +Each time a lookahead token is read, the current parser state together +with the type of lookahead token are looked up in a table. This table +entry can say, ``Shift the lookahead token.'' In this case, it also +specifies the new parser state, which is pushed onto the top of the +parser stack. Or it can say, ``Reduce using rule number @var{n}.'' +This means that a certain number of tokens or groupings are taken off +the top of the stack, and replaced by one grouping. In other words, +that number of states are popped from the stack, and one new state is +pushed. + +There is one other alternative: the table can say that the lookahead token +is erroneous in the current state. This causes error processing to begin +(@pxref{Error Recovery}). + +@node Reduce/Reduce +@section Reduce/Reduce Conflicts +@cindex reduce/reduce conflict +@cindex conflicts, reduce/reduce + +A reduce/reduce conflict occurs if there are two or more rules that apply +to the same sequence of input. This usually indicates a serious error +in the grammar. + +For example, here is an erroneous attempt to define a sequence +of zero or more @code{word} groupings. + +@example +sequence: /* empty */ + @{ printf ("empty sequence\n"); @} + | maybeword + | sequence word + @{ printf ("added word %s\n", $2); @} + ; + +maybeword: /* empty */ + @{ printf ("empty maybeword\n"); @} + | word + @{ printf ("single word %s\n", $1); @} + ; +@end example + +@noindent +The error is an ambiguity: there is more than one way to parse a single +@code{word} into a @code{sequence}. It could be reduced to a +@code{maybeword} and then into a @code{sequence} via the second rule. +Alternatively, nothing-at-all could be reduced into a @code{sequence} +via the first rule, and this could be combined with the @code{word} +using the third rule for @code{sequence}. + +There is also more than one way to reduce nothing-at-all into a +@code{sequence}. This can be done directly via the first rule, +or indirectly via @code{maybeword} and then the second rule. + +You might think that this is a distinction without a difference, because it +does not change whether any particular input is valid or not. But it does +affect which actions are run. One parsing order runs the second rule's +action; the other runs the first rule's action and the third rule's action. +In this example, the output of the program changes. + +Bison resolves a reduce/reduce conflict by choosing to use the rule that +appears first in the grammar, but it is very risky to rely on this. Every +reduce/reduce conflict must be studied and usually eliminated. Here is the +proper way to define @code{sequence}: + +@example +sequence: /* empty */ + @{ printf ("empty sequence\n"); @} + | sequence word + @{ printf ("added word %s\n", $2); @} + ; +@end example + +Here is another common error that yields a reduce/reduce conflict: + +@example +sequence: /* empty */ + | sequence words + | sequence redirects + ; + +words: /* empty */ + | words word + ; + +redirects:/* empty */ + | redirects redirect + ; +@end example + +@noindent +The intention here is to define a sequence which can contain either +@code{word} or @code{redirect} groupings. The individual definitions of +@code{sequence}, @code{words} and @code{redirects} are error-free, but the +three together make a subtle ambiguity: even an empty input can be parsed +in infinitely many ways! + +Consider: nothing-at-all could be a @code{words}. Or it could be two +@code{words} in a row, or three, or any number. It could equally well be a +@code{redirects}, or two, or any number. Or it could be a @code{words} +followed by three @code{redirects} and another @code{words}. And so on. + +Here are two ways to correct these rules. First, to make it a single level +of sequence: + +@example +sequence: /* empty */ + | sequence word + | sequence redirect + ; +@end example + +Second, to prevent either a @code{words} or a @code{redirects} +from being empty: + +@example +sequence: /* empty */ + | sequence words + | sequence redirects + ; + +words: word + | words word + ; + +redirects:redirect + | redirects redirect + ; +@end example + +@node Mystery Conflicts +@section Mysterious Reduce/Reduce Conflicts + +Sometimes reduce/reduce conflicts can occur that don't look warranted. +Here is an example: + +@example +@group +%token ID + +%% +def: param_spec return_spec ',' + ; +param_spec: + type + | name_list ':' type + ; +@end group +@group +return_spec: + type + | name ':' type + ; +@end group +@group +type: ID + ; +@end group +@group +name: ID + ; +name_list: + name + | name ',' name_list + ; +@end group +@end example + +It would seem that this grammar can be parsed with only a single token +of lookahead: when a @code{param_spec} is being read, an @code{ID} is +a @code{name} if a comma or colon follows, or a @code{type} if another +@code{ID} follows. In other words, this grammar is @acronym{LR}(1). + +@cindex @acronym{LR}(1) +@cindex @acronym{LALR}(1) +However, Bison, like most parser generators, cannot actually handle all +@acronym{LR}(1) grammars. In this grammar, two contexts, that after +an @code{ID} +at the beginning of a @code{param_spec} and likewise at the beginning of +a @code{return_spec}, are similar enough that Bison assumes they are the +same. They appear similar because the same set of rules would be +active---the rule for reducing to a @code{name} and that for reducing to +a @code{type}. Bison is unable to determine at that stage of processing +that the rules would require different lookahead tokens in the two +contexts, so it makes a single parser state for them both. Combining +the two contexts causes a conflict later. In parser terminology, this +occurrence means that the grammar is not @acronym{LALR}(1). + +In general, it is better to fix deficiencies than to document them. But +this particular deficiency is intrinsically hard to fix; parser +generators that can handle @acronym{LR}(1) grammars are hard to write +and tend to +produce parsers that are very large. In practice, Bison is more useful +as it is now. + +When the problem arises, you can often fix it by identifying the two +parser states that are being confused, and adding something to make them +look distinct. In the above example, adding one rule to +@code{return_spec} as follows makes the problem go away: + +@example +@group +%token BOGUS +@dots{} +%% +@dots{} +return_spec: + type + | name ':' type + /* This rule is never used. */ + | ID BOGUS + ; +@end group +@end example + +This corrects the problem because it introduces the possibility of an +additional active rule in the context after the @code{ID} at the beginning of +@code{return_spec}. This rule is not active in the corresponding context +in a @code{param_spec}, so the two contexts receive distinct parser states. +As long as the token @code{BOGUS} is never generated by @code{yylex}, +the added rule cannot alter the way actual input is parsed. + +In this particular example, there is another way to solve the problem: +rewrite the rule for @code{return_spec} to use @code{ID} directly +instead of via @code{name}. This also causes the two confusing +contexts to have different sets of active rules, because the one for +@code{return_spec} activates the altered rule for @code{return_spec} +rather than the one for @code{name}. + +@example +param_spec: + type + | name_list ':' type + ; +return_spec: + type + | ID ':' type + ; +@end example + +For a more detailed exposition of @acronym{LALR}(1) parsers and parser +generators, please see: +Frank DeRemer and Thomas Pennello, Efficient Computation of +@acronym{LALR}(1) Look-Ahead Sets, @cite{@acronym{ACM} Transactions on +Programming Languages and Systems}, Vol.@: 4, No.@: 4 (October 1982), +pp.@: 615--649 @uref{http://doi.acm.org/10.1145/69622.357187}. + +@node Generalized LR Parsing +@section Generalized @acronym{LR} (@acronym{GLR}) Parsing +@cindex @acronym{GLR} parsing +@cindex generalized @acronym{LR} (@acronym{GLR}) parsing +@cindex ambiguous grammars +@cindex nondeterministic parsing + +Bison produces @emph{deterministic} parsers that choose uniquely +when to reduce and which reduction to apply +based on a summary of the preceding input and on one extra token of lookahead. +As a result, normal Bison handles a proper subset of the family of +context-free languages. +Ambiguous grammars, since they have strings with more than one possible +sequence of reductions cannot have deterministic parsers in this sense. +The same is true of languages that require more than one symbol of +lookahead, since the parser lacks the information necessary to make a +decision at the point it must be made in a shift-reduce parser. +Finally, as previously mentioned (@pxref{Mystery Conflicts}), +there are languages where Bison's particular choice of how to +summarize the input seen so far loses necessary information. + +When you use the @samp{%glr-parser} declaration in your grammar file, +Bison generates a parser that uses a different algorithm, called +Generalized @acronym{LR} (or @acronym{GLR}). A Bison @acronym{GLR} +parser uses the same basic +algorithm for parsing as an ordinary Bison parser, but behaves +differently in cases where there is a shift-reduce conflict that has not +been resolved by precedence rules (@pxref{Precedence}) or a +reduce-reduce conflict. When a @acronym{GLR} parser encounters such a +situation, it +effectively @emph{splits} into a several parsers, one for each possible +shift or reduction. These parsers then proceed as usual, consuming +tokens in lock-step. Some of the stacks may encounter other conflicts +and split further, with the result that instead of a sequence of states, +a Bison @acronym{GLR} parsing stack is what is in effect a tree of states. + +In effect, each stack represents a guess as to what the proper parse +is. Additional input may indicate that a guess was wrong, in which case +the appropriate stack silently disappears. Otherwise, the semantics +actions generated in each stack are saved, rather than being executed +immediately. When a stack disappears, its saved semantic actions never +get executed. When a reduction causes two stacks to become equivalent, +their sets of semantic actions are both saved with the state that +results from the reduction. We say that two stacks are equivalent +when they both represent the same sequence of states, +and each pair of corresponding states represents a +grammar symbol that produces the same segment of the input token +stream. + +Whenever the parser makes a transition from having multiple +states to having one, it reverts to the normal @acronym{LALR}(1) parsing +algorithm, after resolving and executing the saved-up actions. +At this transition, some of the states on the stack will have semantic +values that are sets (actually multisets) of possible actions. The +parser tries to pick one of the actions by first finding one whose rule +has the highest dynamic precedence, as set by the @samp{%dprec} +declaration. Otherwise, if the alternative actions are not ordered by +precedence, but there the same merging function is declared for both +rules by the @samp{%merge} declaration, +Bison resolves and evaluates both and then calls the merge function on +the result. Otherwise, it reports an ambiguity. + +It is possible to use a data structure for the @acronym{GLR} parsing tree that +permits the processing of any @acronym{LALR}(1) grammar in linear time (in the +size of the input), any unambiguous (not necessarily +@acronym{LALR}(1)) grammar in +quadratic worst-case time, and any general (possibly ambiguous) +context-free grammar in cubic worst-case time. However, Bison currently +uses a simpler data structure that requires time proportional to the +length of the input times the maximum number of stacks required for any +prefix of the input. Thus, really ambiguous or nondeterministic +grammars can require exponential time and space to process. Such badly +behaving examples, however, are not generally of practical interest. +Usually, nondeterminism in a grammar is local---the parser is ``in +doubt'' only for a few tokens at a time. Therefore, the current data +structure should generally be adequate. On @acronym{LALR}(1) portions of a +grammar, in particular, it is only slightly slower than with the default +Bison parser. + +For a more detailed exposition of @acronym{GLR} parsers, please see: Elizabeth +Scott, Adrian Johnstone and Shamsa Sadaf Hussain, Tomita-Style +Generalised @acronym{LR} Parsers, Royal Holloway, University of +London, Department of Computer Science, TR-00-12, +@uref{http://www.cs.rhul.ac.uk/research/languages/publications/tomita_style_1.ps}, +(2000-12-24). + +@node Memory Management +@section Memory Management, and How to Avoid Memory Exhaustion +@cindex memory exhaustion +@cindex memory management +@cindex stack overflow +@cindex parser stack overflow +@cindex overflow of parser stack + +The Bison parser stack can run out of memory if too many tokens are shifted and +not reduced. When this happens, the parser function @code{yyparse} +calls @code{yyerror} and then returns 2. + +Because Bison parsers have growing stacks, hitting the upper limit +usually results from using a right recursion instead of a left +recursion, @xref{Recursion, ,Recursive Rules}. + +@vindex YYMAXDEPTH +By defining the macro @code{YYMAXDEPTH}, you can control how deep the +parser stack can become before memory is exhausted. Define the +macro with a value that is an integer. This value is the maximum number +of tokens that can be shifted (and not reduced) before overflow. + +The stack space allowed is not necessarily allocated. If you specify a +large value for @code{YYMAXDEPTH}, the parser normally allocates a small +stack at first, and then makes it bigger by stages as needed. This +increasing allocation happens automatically and silently. Therefore, +you do not need to make @code{YYMAXDEPTH} painfully small merely to save +space for ordinary inputs that do not need much stack. + +However, do not allow @code{YYMAXDEPTH} to be a value so large that +arithmetic overflow could occur when calculating the size of the stack +space. Also, do not allow @code{YYMAXDEPTH} to be less than +@code{YYINITDEPTH}. + +@cindex default stack limit +The default value of @code{YYMAXDEPTH}, if you do not define it, is +10000. + +@vindex YYINITDEPTH +You can control how much stack is allocated initially by defining the +macro @code{YYINITDEPTH} to a positive integer. For the C +@acronym{LALR}(1) parser, this value must be a compile-time constant +unless you are assuming C99 or some other target language or compiler +that allows variable-length arrays. The default is 200. + +Do not allow @code{YYINITDEPTH} to be greater than @code{YYMAXDEPTH}. + +@c FIXME: C++ output. +Because of semantical differences between C and C++, the +@acronym{LALR}(1) parsers in C produced by Bison cannot grow when compiled +by C++ compilers. In this precise case (compiling a C parser as C++) you are +suggested to grow @code{YYINITDEPTH}. The Bison maintainers hope to fix +this deficiency in a future release. + +@node Error Recovery +@chapter Error Recovery +@cindex error recovery +@cindex recovery from errors + +It is not usually acceptable to have a program terminate on a syntax +error. For example, a compiler should recover sufficiently to parse the +rest of the input file and check it for errors; a calculator should accept +another expression. + +In a simple interactive command parser where each input is one line, it may +be sufficient to allow @code{yyparse} to return 1 on error and have the +caller ignore the rest of the input line when that happens (and then call +@code{yyparse} again). But this is inadequate for a compiler, because it +forgets all the syntactic context leading up to the error. A syntax error +deep within a function in the compiler input should not cause the compiler +to treat the following line like the beginning of a source file. + +@findex error +You can define how to recover from a syntax error by writing rules to +recognize the special token @code{error}. This is a terminal symbol that +is always defined (you need not declare it) and reserved for error +handling. The Bison parser generates an @code{error} token whenever a +syntax error happens; if you have provided a rule to recognize this token +in the current context, the parse can continue. + +For example: + +@example +stmnts: /* empty string */ + | stmnts '\n' + | stmnts exp '\n' + | stmnts error '\n' +@end example + +The fourth rule in this example says that an error followed by a newline +makes a valid addition to any @code{stmnts}. + +What happens if a syntax error occurs in the middle of an @code{exp}? The +error recovery rule, interpreted strictly, applies to the precise sequence +of a @code{stmnts}, an @code{error} and a newline. If an error occurs in +the middle of an @code{exp}, there will probably be some additional tokens +and subexpressions on the stack after the last @code{stmnts}, and there +will be tokens to read before the next newline. So the rule is not +applicable in the ordinary way. + +But Bison can force the situation to fit the rule, by discarding part of +the semantic context and part of the input. First it discards states +and objects from the stack until it gets back to a state in which the +@code{error} token is acceptable. (This means that the subexpressions +already parsed are discarded, back to the last complete @code{stmnts}.) +At this point the @code{error} token can be shifted. Then, if the old +lookahead token is not acceptable to be shifted next, the parser reads +tokens and discards them until it finds a token which is acceptable. In +this example, Bison reads and discards input until the next newline so +that the fourth rule can apply. Note that discarded symbols are +possible sources of memory leaks, see @ref{Destructor Decl, , Freeing +Discarded Symbols}, for a means to reclaim this memory. + +The choice of error rules in the grammar is a choice of strategies for +error recovery. A simple and useful strategy is simply to skip the rest of +the current input line or current statement if an error is detected: + +@example +stmnt: error ';' /* On error, skip until ';' is read. */ +@end example + +It is also useful to recover to the matching close-delimiter of an +opening-delimiter that has already been parsed. Otherwise the +close-delimiter will probably appear to be unmatched, and generate another, +spurious error message: + +@example +primary: '(' expr ')' + | '(' error ')' + @dots{} + ; +@end example + +Error recovery strategies are necessarily guesses. When they guess wrong, +one syntax error often leads to another. In the above example, the error +recovery rule guesses that an error is due to bad input within one +@code{stmnt}. Suppose that instead a spurious semicolon is inserted in the +middle of a valid @code{stmnt}. After the error recovery rule recovers +from the first error, another syntax error will be found straightaway, +since the text following the spurious semicolon is also an invalid +@code{stmnt}. + +To prevent an outpouring of error messages, the parser will output no error +message for another syntax error that happens shortly after the first; only +after three consecutive input tokens have been successfully shifted will +error messages resume. + +Note that rules which accept the @code{error} token may have actions, just +as any other rules can. + +@findex yyerrok +You can make error messages resume immediately by using the macro +@code{yyerrok} in an action. If you do this in the error rule's action, no +error messages will be suppressed. This macro requires no arguments; +@samp{yyerrok;} is a valid C statement. + +@findex yyclearin +The previous lookahead token is reanalyzed immediately after an error. If +this is unacceptable, then the macro @code{yyclearin} may be used to clear +this token. Write the statement @samp{yyclearin;} in the error rule's +action. +@xref{Action Features, ,Special Features for Use in Actions}. + +For example, suppose that on a syntax error, an error handling routine is +called that advances the input stream to some point where parsing should +once again commence. The next symbol returned by the lexical scanner is +probably correct. The previous lookahead token ought to be discarded +with @samp{yyclearin;}. + +@vindex YYRECOVERING +The expression @code{YYRECOVERING ()} yields 1 when the parser +is recovering from a syntax error, and 0 otherwise. +Syntax error diagnostics are suppressed while recovering from a syntax +error. + +@node Context Dependency +@chapter Handling Context Dependencies + +The Bison paradigm is to parse tokens first, then group them into larger +syntactic units. In many languages, the meaning of a token is affected by +its context. Although this violates the Bison paradigm, certain techniques +(known as @dfn{kludges}) may enable you to write Bison parsers for such +languages. + +@menu +* Semantic Tokens:: Token parsing can depend on the semantic context. +* Lexical Tie-ins:: Token parsing can depend on the syntactic context. +* Tie-in Recovery:: Lexical tie-ins have implications for how + error recovery rules must be written. +@end menu + +(Actually, ``kludge'' means any technique that gets its job done but is +neither clean nor robust.) + +@node Semantic Tokens +@section Semantic Info in Token Types + +The C language has a context dependency: the way an identifier is used +depends on what its current meaning is. For example, consider this: + +@example +foo (x); +@end example + +This looks like a function call statement, but if @code{foo} is a typedef +name, then this is actually a declaration of @code{x}. How can a Bison +parser for C decide how to parse this input? + +The method used in @acronym{GNU} C is to have two different token types, +@code{IDENTIFIER} and @code{TYPENAME}. When @code{yylex} finds an +identifier, it looks up the current declaration of the identifier in order +to decide which token type to return: @code{TYPENAME} if the identifier is +declared as a typedef, @code{IDENTIFIER} otherwise. + +The grammar rules can then express the context dependency by the choice of +token type to recognize. @code{IDENTIFIER} is accepted as an expression, +but @code{TYPENAME} is not. @code{TYPENAME} can start a declaration, but +@code{IDENTIFIER} cannot. In contexts where the meaning of the identifier +is @emph{not} significant, such as in declarations that can shadow a +typedef name, either @code{TYPENAME} or @code{IDENTIFIER} is +accepted---there is one rule for each of the two token types. + +This technique is simple to use if the decision of which kinds of +identifiers to allow is made at a place close to where the identifier is +parsed. But in C this is not always so: C allows a declaration to +redeclare a typedef name provided an explicit type has been specified +earlier: + +@example +typedef int foo, bar; +int baz (void) +@{ + static bar (bar); /* @r{redeclare @code{bar} as static variable} */ + extern foo foo (foo); /* @r{redeclare @code{foo} as function} */ + return foo (bar); +@} +@end example + +Unfortunately, the name being declared is separated from the declaration +construct itself by a complicated syntactic structure---the ``declarator''. + +As a result, part of the Bison parser for C needs to be duplicated, with +all the nonterminal names changed: once for parsing a declaration in +which a typedef name can be redefined, and once for parsing a +declaration in which that can't be done. Here is a part of the +duplication, with actions omitted for brevity: + +@example +initdcl: + declarator maybeasm '=' + init + | declarator maybeasm + ; + +notype_initdcl: + notype_declarator maybeasm '=' + init + | notype_declarator maybeasm + ; +@end example + +@noindent +Here @code{initdcl} can redeclare a typedef name, but @code{notype_initdcl} +cannot. The distinction between @code{declarator} and +@code{notype_declarator} is the same sort of thing. + +There is some similarity between this technique and a lexical tie-in +(described next), in that information which alters the lexical analysis is +changed during parsing by other parts of the program. The difference is +here the information is global, and is used for other purposes in the +program. A true lexical tie-in has a special-purpose flag controlled by +the syntactic context. + +@node Lexical Tie-ins +@section Lexical Tie-ins +@cindex lexical tie-in + +One way to handle context-dependency is the @dfn{lexical tie-in}: a flag +which is set by Bison actions, whose purpose is to alter the way tokens are +parsed. + +For example, suppose we have a language vaguely like C, but with a special +construct @samp{hex (@var{hex-expr})}. After the keyword @code{hex} comes +an expression in parentheses in which all integers are hexadecimal. In +particular, the token @samp{a1b} must be treated as an integer rather than +as an identifier if it appears in that context. Here is how you can do it: + +@example +@group +%@{ + int hexflag; + int yylex (void); + void yyerror (char const *); +%@} +%% +@dots{} +@end group +@group +expr: IDENTIFIER + | constant + | HEX '(' + @{ hexflag = 1; @} + expr ')' + @{ hexflag = 0; + $$ = $4; @} + | expr '+' expr + @{ $$ = make_sum ($1, $3); @} + @dots{} + ; +@end group + +@group +constant: + INTEGER + | STRING + ; +@end group +@end example + +@noindent +Here we assume that @code{yylex} looks at the value of @code{hexflag}; when +it is nonzero, all integers are parsed in hexadecimal, and tokens starting +with letters are parsed as integers if possible. + +The declaration of @code{hexflag} shown in the prologue of the parser file +is needed to make it accessible to the actions (@pxref{Prologue, ,The Prologue}). +You must also write the code in @code{yylex} to obey the flag. + +@node Tie-in Recovery +@section Lexical Tie-ins and Error Recovery + +Lexical tie-ins make strict demands on any error recovery rules you have. +@xref{Error Recovery}. + +The reason for this is that the purpose of an error recovery rule is to +abort the parsing of one construct and resume in some larger construct. +For example, in C-like languages, a typical error recovery rule is to skip +tokens until the next semicolon, and then start a new statement, like this: + +@example +stmt: expr ';' + | IF '(' expr ')' stmt @{ @dots{} @} + @dots{} + error ';' + @{ hexflag = 0; @} + ; +@end example + +If there is a syntax error in the middle of a @samp{hex (@var{expr})} +construct, this error rule will apply, and then the action for the +completed @samp{hex (@var{expr})} will never run. So @code{hexflag} would +remain set for the entire rest of the input, or until the next @code{hex} +keyword, causing identifiers to be misinterpreted as integers. + +To avoid this problem the error recovery rule itself clears @code{hexflag}. + +There may also be an error recovery rule that works within expressions. +For example, there could be a rule which applies within parentheses +and skips to the close-parenthesis: + +@example +@group +expr: @dots{} + | '(' expr ')' + @{ $$ = $2; @} + | '(' error ')' + @dots{} +@end group +@end example + +If this rule acts within the @code{hex} construct, it is not going to abort +that construct (since it applies to an inner level of parentheses within +the construct). Therefore, it should not clear the flag: the rest of +the @code{hex} construct should be parsed with the flag still in effect. + +What if there is an error recovery rule which might abort out of the +@code{hex} construct or might not, depending on circumstances? There is no +way you can write the action to determine whether a @code{hex} construct is +being aborted or not. So if you are using a lexical tie-in, you had better +make sure your error recovery rules are not of this kind. Each rule must +be such that you can be sure that it always will, or always won't, have to +clear the flag. + +@c ================================================== Debugging Your Parser + +@node Debugging +@chapter Debugging Your Parser + +Developing a parser can be a challenge, especially if you don't +understand the algorithm (@pxref{Algorithm, ,The Bison Parser +Algorithm}). Even so, sometimes a detailed description of the automaton +can help (@pxref{Understanding, , Understanding Your Parser}), or +tracing the execution of the parser can give some insight on why it +behaves improperly (@pxref{Tracing, , Tracing Your Parser}). + +@menu +* Understanding:: Understanding the structure of your parser. +* Tracing:: Tracing the execution of your parser. +@end menu + +@node Understanding +@section Understanding Your Parser + +As documented elsewhere (@pxref{Algorithm, ,The Bison Parser Algorithm}) +Bison parsers are @dfn{shift/reduce automata}. In some cases (much more +frequent than one would hope), looking at this automaton is required to +tune or simply fix a parser. Bison provides two different +representation of it, either textually or graphically (as a DOT file). + +The textual file is generated when the options @option{--report} or +@option{--verbose} are specified, see @xref{Invocation, , Invoking +Bison}. Its name is made by removing @samp{.tab.c} or @samp{.c} from +the parser output file name, and adding @samp{.output} instead. +Therefore, if the input file is @file{foo.y}, then the parser file is +called @file{foo.tab.c} by default. As a consequence, the verbose +output file is called @file{foo.output}. + +The following grammar file, @file{calc.y}, will be used in the sequel: + +@example +%token NUM STR +%left '+' '-' +%left '*' +%% +exp: exp '+' exp + | exp '-' exp + | exp '*' exp + | exp '/' exp + | NUM + ; +useless: STR; +%% +@end example + +@command{bison} reports: + +@example +calc.y: warning: 1 nonterminal and 1 rule useless in grammar +calc.y:11.1-7: warning: nonterminal useless in grammar: useless +calc.y:11.10-12: warning: rule useless in grammar: useless: STR +calc.y: conflicts: 7 shift/reduce +@end example + +When given @option{--report=state}, in addition to @file{calc.tab.c}, it +creates a file @file{calc.output} with contents detailed below. The +order of the output and the exact presentation might vary, but the +interpretation is the same. + +The first section includes details on conflicts that were solved thanks +to precedence and/or associativity: + +@example +Conflict in state 8 between rule 2 and token '+' resolved as reduce. +Conflict in state 8 between rule 2 and token '-' resolved as reduce. +Conflict in state 8 between rule 2 and token '*' resolved as shift. +@exdent @dots{} +@end example + +@noindent +The next section lists states that still have conflicts. + +@example +State 8 conflicts: 1 shift/reduce +State 9 conflicts: 1 shift/reduce +State 10 conflicts: 1 shift/reduce +State 11 conflicts: 4 shift/reduce +@end example + +@noindent +@cindex token, useless +@cindex useless token +@cindex nonterminal, useless +@cindex useless nonterminal +@cindex rule, useless +@cindex useless rule +The next section reports useless tokens, nonterminal and rules. Useless +nonterminals and rules are removed in order to produce a smaller parser, +but useless tokens are preserved, since they might be used by the +scanner (note the difference between ``useless'' and ``unused'' +below): + +@example +Nonterminals useless in grammar: + useless + +Terminals unused in grammar: + STR + +Rules useless in grammar: +#6 useless: STR; +@end example + +@noindent +The next section reproduces the exact grammar that Bison used: + +@example +Grammar + + Number, Line, Rule + 0 5 $accept -> exp $end + 1 5 exp -> exp '+' exp + 2 6 exp -> exp '-' exp + 3 7 exp -> exp '*' exp + 4 8 exp -> exp '/' exp + 5 9 exp -> NUM +@end example + +@noindent +and reports the uses of the symbols: + +@example +Terminals, with rules where they appear + +$end (0) 0 +'*' (42) 3 +'+' (43) 1 +'-' (45) 2 +'/' (47) 4 +error (256) +NUM (258) 5 + +Nonterminals, with rules where they appear + +$accept (8) + on left: 0 +exp (9) + on left: 1 2 3 4 5, on right: 0 1 2 3 4 +@end example + +@noindent +@cindex item +@cindex pointed rule +@cindex rule, pointed +Bison then proceeds onto the automaton itself, describing each state +with it set of @dfn{items}, also known as @dfn{pointed rules}. Each +item is a production rule together with a point (marked by @samp{.}) +that the input cursor. + +@example +state 0 + + $accept -> . exp $ (rule 0) + + NUM shift, and go to state 1 + + exp go to state 2 +@end example + +This reads as follows: ``state 0 corresponds to being at the very +beginning of the parsing, in the initial rule, right before the start +symbol (here, @code{exp}). When the parser returns to this state right +after having reduced a rule that produced an @code{exp}, the control +flow jumps to state 2. If there is no such transition on a nonterminal +symbol, and the lookahead is a @code{NUM}, then this token is shifted on +the parse stack, and the control flow jumps to state 1. Any other +lookahead triggers a syntax error.'' + +@cindex core, item set +@cindex item set core +@cindex kernel, item set +@cindex item set core +Even though the only active rule in state 0 seems to be rule 0, the +report lists @code{NUM} as a lookahead token because @code{NUM} can be +at the beginning of any rule deriving an @code{exp}. By default Bison +reports the so-called @dfn{core} or @dfn{kernel} of the item set, but if +you want to see more detail you can invoke @command{bison} with +@option{--report=itemset} to list all the items, include those that can +be derived: + +@example +state 0 + + $accept -> . exp $ (rule 0) + exp -> . exp '+' exp (rule 1) + exp -> . exp '-' exp (rule 2) + exp -> . exp '*' exp (rule 3) + exp -> . exp '/' exp (rule 4) + exp -> . NUM (rule 5) + + NUM shift, and go to state 1 + + exp go to state 2 +@end example + +@noindent +In the state 1... + +@example +state 1 + + exp -> NUM . (rule 5) + + $default reduce using rule 5 (exp) +@end example + +@noindent +the rule 5, @samp{exp: NUM;}, is completed. Whatever the lookahead token +(@samp{$default}), the parser will reduce it. If it was coming from +state 0, then, after this reduction it will return to state 0, and will +jump to state 2 (@samp{exp: go to state 2}). + +@example +state 2 + + $accept -> exp . $ (rule 0) + exp -> exp . '+' exp (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + + $ shift, and go to state 3 + '+' shift, and go to state 4 + '-' shift, and go to state 5 + '*' shift, and go to state 6 + '/' shift, and go to state 7 +@end example + +@noindent +In state 2, the automaton can only shift a symbol. For instance, +because of the item @samp{exp -> exp . '+' exp}, if the lookahead if +@samp{+}, it will be shifted on the parse stack, and the automaton +control will jump to state 4, corresponding to the item @samp{exp -> exp +'+' . exp}. Since there is no default action, any other token than +those listed above will trigger a syntax error. + +The state 3 is named the @dfn{final state}, or the @dfn{accepting +state}: + +@example +state 3 + + $accept -> exp $ . (rule 0) + + $default accept +@end example + +@noindent +the initial rule is completed (the start symbol and the end +of input were read), the parsing exits successfully. + +The interpretation of states 4 to 7 is straightforward, and is left to +the reader. + +@example +state 4 + + exp -> exp '+' . exp (rule 1) + + NUM shift, and go to state 1 + + exp go to state 8 + +state 5 + + exp -> exp '-' . exp (rule 2) + + NUM shift, and go to state 1 + + exp go to state 9 + +state 6 + + exp -> exp '*' . exp (rule 3) + + NUM shift, and go to state 1 + + exp go to state 10 + +state 7 + + exp -> exp '/' . exp (rule 4) + + NUM shift, and go to state 1 + + exp go to state 11 +@end example + +As was announced in beginning of the report, @samp{State 8 conflicts: +1 shift/reduce}: + +@example +state 8 + + exp -> exp . '+' exp (rule 1) + exp -> exp '+' exp . (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) +@end example + +Indeed, there are two actions associated to the lookahead @samp{/}: +either shifting (and going to state 7), or reducing rule 1. The +conflict means that either the grammar is ambiguous, or the parser lacks +information to make the right decision. Indeed the grammar is +ambiguous, as, since we did not specify the precedence of @samp{/}, the +sentence @samp{NUM + NUM / NUM} can be parsed as @samp{NUM + (NUM / +NUM)}, which corresponds to shifting @samp{/}, or as @samp{(NUM + NUM) / +NUM}, which corresponds to reducing rule 1. + +Because in @acronym{LALR}(1) parsing a single decision can be made, Bison +arbitrarily chose to disable the reduction, see @ref{Shift/Reduce, , +Shift/Reduce Conflicts}. Discarded actions are reported in between +square brackets. + +Note that all the previous states had a single possible action: either +shifting the next token and going to the corresponding state, or +reducing a single rule. In the other cases, i.e., when shifting +@emph{and} reducing is possible or when @emph{several} reductions are +possible, the lookahead is required to select the action. State 8 is +one such state: if the lookahead is @samp{*} or @samp{/} then the action +is shifting, otherwise the action is reducing rule 1. In other words, +the first two items, corresponding to rule 1, are not eligible when the +lookahead token is @samp{*}, since we specified that @samp{*} has higher +precedence than @samp{+}. More generally, some items are eligible only +with some set of possible lookahead tokens. When run with +@option{--report=lookahead}, Bison specifies these lookahead tokens: + +@example +state 8 + + exp -> exp . '+' exp (rule 1) + exp -> exp '+' exp . [$, '+', '-', '/'] (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) +@end example + +The remaining states are similar: + +@example +state 9 + + exp -> exp . '+' exp (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp '-' exp . (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 2 (exp)] + $default reduce using rule 2 (exp) + +state 10 + + exp -> exp . '+' exp (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp '*' exp . (rule 3) + exp -> exp . '/' exp (rule 4) + + '/' shift, and go to state 7 + + '/' [reduce using rule 3 (exp)] + $default reduce using rule 3 (exp) + +state 11 + + exp -> exp . '+' exp (rule 1) + exp -> exp . '-' exp (rule 2) + exp -> exp . '*' exp (rule 3) + exp -> exp . '/' exp (rule 4) + exp -> exp '/' exp . (rule 4) + + '+' shift, and go to state 4 + '-' shift, and go to state 5 + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '+' [reduce using rule 4 (exp)] + '-' [reduce using rule 4 (exp)] + '*' [reduce using rule 4 (exp)] + '/' [reduce using rule 4 (exp)] + $default reduce using rule 4 (exp) +@end example + +@noindent +Observe that state 11 contains conflicts not only due to the lack of +precedence of @samp{/} with respect to @samp{+}, @samp{-}, and +@samp{*}, but also because the +associativity of @samp{/} is not specified. + + +@node Tracing +@section Tracing Your Parser +@findex yydebug +@cindex debugging +@cindex tracing the parser + +If a Bison grammar compiles properly but doesn't do what you want when it +runs, the @code{yydebug} parser-trace feature can help you figure out why. + +There are several means to enable compilation of trace facilities: + +@table @asis +@item the macro @code{YYDEBUG} +@findex YYDEBUG +Define the macro @code{YYDEBUG} to a nonzero value when you compile the +parser. This is compliant with @acronym{POSIX} Yacc. You could use +@samp{-DYYDEBUG=1} as a compiler option or you could put @samp{#define +YYDEBUG 1} in the prologue of the grammar file (@pxref{Prologue, , The +Prologue}). + +@item the option @option{-t}, @option{--debug} +Use the @samp{-t} option when you run Bison (@pxref{Invocation, +,Invoking Bison}). This is @acronym{POSIX} compliant too. + +@item the directive @samp{%debug} +@findex %debug +Add the @code{%debug} directive (@pxref{Decl Summary, ,Bison +Declaration Summary}). This is a Bison extension, which will prove +useful when Bison will output parsers for languages that don't use a +preprocessor. Unless @acronym{POSIX} and Yacc portability matter to +you, this is +the preferred solution. +@end table + +We suggest that you always enable the debug option so that debugging is +always possible. + +The trace facility outputs messages with macro calls of the form +@code{YYFPRINTF (stderr, @var{format}, @var{args})} where +@var{format} and @var{args} are the usual @code{printf} format and variadic +arguments. If you define @code{YYDEBUG} to a nonzero value but do not +define @code{YYFPRINTF}, @code{} is automatically included +and @code{YYFPRINTF} is defined to @code{fprintf}. + +Once you have compiled the program with trace facilities, the way to +request a trace is to store a nonzero value in the variable @code{yydebug}. +You can do this by making the C code do it (in @code{main}, perhaps), or +you can alter the value with a C debugger. + +Each step taken by the parser when @code{yydebug} is nonzero produces a +line or two of trace information, written on @code{stderr}. The trace +messages tell you these things: + +@itemize @bullet +@item +Each time the parser calls @code{yylex}, what kind of token was read. + +@item +Each time a token is shifted, the depth and complete contents of the +state stack (@pxref{Parser States}). + +@item +Each time a rule is reduced, which rule it is, and the complete contents +of the state stack afterward. +@end itemize + +To make sense of this information, it helps to refer to the listing file +produced by the Bison @samp{-v} option (@pxref{Invocation, ,Invoking +Bison}). This file shows the meaning of each state in terms of +positions in various rules, and also what each state will do with each +possible input token. As you read the successive trace messages, you +can see that the parser is functioning according to its specification in +the listing file. Eventually you will arrive at the place where +something undesirable happens, and you will see which parts of the +grammar are to blame. + +The parser file is a C program and you can use C debuggers on it, but it's +not easy to interpret what it is doing. The parser function is a +finite-state machine interpreter, and aside from the actions it executes +the same code over and over. Only the values of variables show where in +the grammar it is working. + +@findex YYPRINT +The debugging information normally gives the token type of each token +read, but not its semantic value. You can optionally define a macro +named @code{YYPRINT} to provide a way to print the value. If you define +@code{YYPRINT}, it should take three arguments. The parser will pass a +standard I/O stream, the numeric code for the token type, and the token +value (from @code{yylval}). + +Here is an example of @code{YYPRINT} suitable for the multi-function +calculator (@pxref{Mfcalc Declarations, ,Declarations for @code{mfcalc}}): + +@smallexample +%@{ + static void print_token_value (FILE *, int, YYSTYPE); + #define YYPRINT(file, type, value) print_token_value (file, type, value) +%@} + +@dots{} %% @dots{} %% @dots{} + +static void +print_token_value (FILE *file, int type, YYSTYPE value) +@{ + if (type == VAR) + fprintf (file, "%s", value.tptr->name); + else if (type == NUM) + fprintf (file, "%d", value.val); +@} +@end smallexample + +@c ================================================= Invoking Bison + +@node Invocation +@chapter Invoking Bison +@cindex invoking Bison +@cindex Bison invocation +@cindex options for invoking Bison + +The usual way to invoke Bison is as follows: + +@example +bison @var{infile} +@end example + +Here @var{infile} is the grammar file name, which usually ends in +@samp{.y}. The parser file's name is made by replacing the @samp{.y} +with @samp{.tab.c} and removing any leading directory. Thus, the +@samp{bison foo.y} file name yields +@file{foo.tab.c}, and the @samp{bison hack/foo.y} file name yields +@file{foo.tab.c}. It's also possible, in case you are writing +C++ code instead of C in your grammar file, to name it @file{foo.ypp} +or @file{foo.y++}. Then, the output files will take an extension like +the given one as input (respectively @file{foo.tab.cpp} and +@file{foo.tab.c++}). +This feature takes effect with all options that manipulate file names like +@samp{-o} or @samp{-d}. + +For example : + +@example +bison -d @var{infile.yxx} +@end example +@noindent +will produce @file{infile.tab.cxx} and @file{infile.tab.hxx}, and + +@example +bison -d -o @var{output.c++} @var{infile.y} +@end example +@noindent +will produce @file{output.c++} and @file{outfile.h++}. + +For compatibility with @acronym{POSIX}, the standard Bison +distribution also contains a shell script called @command{yacc} that +invokes Bison with the @option{-y} option. + +@menu +* Bison Options:: All the options described in detail, + in alphabetical order by short options. +* Option Cross Key:: Alphabetical list of long options. +* Yacc Library:: Yacc-compatible @code{yylex} and @code{main}. +@end menu + +@node Bison Options +@section Bison Options + +Bison supports both traditional single-letter options and mnemonic long +option names. Long option names are indicated with @samp{--} instead of +@samp{-}. Abbreviations for option names are allowed as long as they +are unique. When a long option takes an argument, like +@samp{--file-prefix}, connect the option name and the argument with +@samp{=}. + +Here is a list of options that can be used with Bison, alphabetized by +short option. It is followed by a cross key alphabetized by long +option. + +@c Please, keep this ordered as in `bison --help'. +@noindent +Operations modes: +@table @option +@item -h +@itemx --help +Print a summary of the command-line options to Bison and exit. + +@item -V +@itemx --version +Print the version number of Bison and exit. + +@item --print-localedir +Print the name of the directory containing locale-dependent data. + +@item --print-datadir +Print the name of the directory containing skeletons and XSLT. + +@item -y +@itemx --yacc +Act more like the traditional Yacc command. This can cause +different diagnostics to be generated, and may change behavior in +other minor ways. Most importantly, imitate Yacc's output +file name conventions, so that the parser output file is called +@file{y.tab.c}, and the other outputs are called @file{y.output} and +@file{y.tab.h}. +Also, if generating an @acronym{LALR}(1) parser in C, generate @code{#define} +statements in addition to an @code{enum} to associate token numbers with token +names. +Thus, the following shell script can substitute for Yacc, and the Bison +distribution contains such a script for compatibility with @acronym{POSIX}: + +@example +#! /bin/sh +bison -y "$@@" +@end example + +The @option{-y}/@option{--yacc} option is intended for use with +traditional Yacc grammars. If your grammar uses a Bison extension +like @samp{%glr-parser}, Bison might not be Yacc-compatible even if +this option is specified. + +@item -W +@itemx --warnings +Output warnings falling in @var{category}. @var{category} can be one +of: +@table @code +@item midrule-values +Warn about mid-rule values that are set but not used within any of the actions +of the parent rule. +For example, warn about unused @code{$2} in: + +@example +exp: '1' @{ $$ = 1; @} '+' exp @{ $$ = $1 + $4; @}; +@end example + +Also warn about mid-rule values that are used but not set. +For example, warn about unset @code{$$} in the mid-rule action in: + +@example + exp: '1' @{ $1 = 1; @} '+' exp @{ $$ = $2 + $4; @}; +@end example + +These warnings are not enabled by default since they sometimes prove to +be false alarms in existing grammars employing the Yacc constructs +@code{$0} or @code{$-@var{n}} (where @var{n} is some positive integer). + + +@item yacc +Incompatibilities with @acronym{POSIX} Yacc. + +@item all +All the warnings. +@item none +Turn off all the warnings. +@item error +Treat warnings as errors. +@end table + +A category can be turned off by prefixing its name with @samp{no-}. For +instance, @option{-Wno-syntax} will hide the warnings about unused +variables. +@end table + +@noindent +Tuning the parser: + +@table @option +@item -t +@itemx --debug +In the parser file, define the macro @code{YYDEBUG} to 1 if it is not +already defined, so that the debugging facilities are compiled. +@xref{Tracing, ,Tracing Your Parser}. + +@item -L @var{language} +@itemx --language=@var{language} +Specify the programming language for the generated parser, as if +@code{%language} was specified (@pxref{Decl Summary, , Bison Declaration +Summary}). Currently supported languages include C, C++, and Java. +@var{language} is case-insensitive. + +This option is experimental and its effect may be modified in future +releases. + +@item --locations +Pretend that @code{%locations} was specified. @xref{Decl Summary}. + +@item -p @var{prefix} +@itemx --name-prefix=@var{prefix} +Pretend that @code{%name-prefix "@var{prefix}"} was specified. +@xref{Decl Summary}. + +@item -l +@itemx --no-lines +Don't put any @code{#line} preprocessor commands in the parser file. +Ordinarily Bison puts them in the parser file so that the C compiler +and debuggers will associate errors with your source file, the +grammar file. This option causes them to associate errors with the +parser file, treating it as an independent source file in its own right. + +@item -S @var{file} +@itemx --skeleton=@var{file} +Specify the skeleton to use, similar to @code{%skeleton} +(@pxref{Decl Summary, , Bison Declaration Summary}). + +@c You probably don't need this option unless you are developing Bison. +@c You should use @option{--language} if you want to specify the skeleton for a +@c different language, because it is clearer and because it will always +@c choose the correct skeleton for non-deterministic or push parsers. + +If @var{file} does not contain a @code{/}, @var{file} is the name of a skeleton +file in the Bison installation directory. +If it does, @var{file} is an absolute file name or a file name relative to the +current working directory. +This is similar to how most shells resolve commands. + +@item -k +@itemx --token-table +Pretend that @code{%token-table} was specified. @xref{Decl Summary}. +@end table + +@noindent +Adjust the output: + +@table @option +@item --defines[=@var{file}] +Pretend that @code{%defines} was specified, i.e., write an extra output +file containing macro definitions for the token type names defined in +the grammar, as well as a few other declarations. @xref{Decl Summary}. + +@item -d +This is the same as @code{--defines} except @code{-d} does not accept a +@var{file} argument since POSIX Yacc requires that @code{-d} can be bundled +with other short options. + +@item -b @var{file-prefix} +@itemx --file-prefix=@var{prefix} +Pretend that @code{%file-prefix} was specified, i.e., specify prefix to use +for all Bison output file names. @xref{Decl Summary}. + +@item -r @var{things} +@itemx --report=@var{things} +Write an extra output file containing verbose description of the comma +separated list of @var{things} among: + +@table @code +@item state +Description of the grammar, conflicts (resolved and unresolved), and +@acronym{LALR} automaton. + +@item lookahead +Implies @code{state} and augments the description of the automaton with +each rule's lookahead set. + +@item itemset +Implies @code{state} and augments the description of the automaton with +the full set of items for each state, instead of its core only. +@end table + +@item --report-file=@var{file} +Specify the @var{file} for the verbose description. + +@item -v +@itemx --verbose +Pretend that @code{%verbose} was specified, i.e., write an extra output +file containing verbose descriptions of the grammar and +parser. @xref{Decl Summary}. + +@item -o @var{file} +@itemx --output=@var{file} +Specify the @var{file} for the parser file. + +The other output files' names are constructed from @var{file} as +described under the @samp{-v} and @samp{-d} options. + +@item -g[@var{file}] +@itemx --graph[=@var{file}] +Output a graphical representation of the @acronym{LALR}(1) grammar +automaton computed by Bison, in @uref{http://www.graphviz.org/, Graphviz} +@uref{http://www.graphviz.org/doc/info/lang.html, @acronym{DOT}} format. +@code{@var{file}} is optional. +If omitted and the grammar file is @file{foo.y}, the output file will be +@file{foo.dot}. + +@item -x[@var{file}] +@itemx --xml[=@var{file}] +Output an XML report of the @acronym{LALR}(1) automaton computed by Bison. +@code{@var{file}} is optional. +If omitted and the grammar file is @file{foo.y}, the output file will be +@file{foo.xml}. +(The current XML schema is experimental and may evolve. +More user feedback will help to stabilize it.) +@end table + +@node Option Cross Key +@section Option Cross Key + +@c FIXME: How about putting the directives too? +Here is a list of options, alphabetized by long option, to help you find +the corresponding short option. + +@multitable {@option{--defines=@var{defines-file}}} {@option{-b @var{file-prefix}XXX}} +@headitem Long Option @tab Short Option +@include cross-options.texi +@end multitable + +@node Yacc Library +@section Yacc Library + +The Yacc library contains default implementations of the +@code{yyerror} and @code{main} functions. These default +implementations are normally not useful, but @acronym{POSIX} requires +them. To use the Yacc library, link your program with the +@option{-ly} option. Note that Bison's implementation of the Yacc +library is distributed under the terms of the @acronym{GNU} General +Public License (@pxref{Copying}). + +If you use the Yacc library's @code{yyerror} function, you should +declare @code{yyerror} as follows: + +@example +int yyerror (char const *); +@end example + +Bison ignores the @code{int} value returned by this @code{yyerror}. +If you use the Yacc library's @code{main} function, your +@code{yyparse} function should have the following type signature: + +@example +int yyparse (void); +@end example + +@c ================================================= C++ Bison + +@node Other Languages +@chapter Parsers Written In Other Languages + +@menu +* C++ Parsers:: The interface to generate C++ parser classes +* Java Parsers:: The interface to generate Java parser classes +@end menu + +@node C++ Parsers +@section C++ Parsers + +@menu +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Interface:: Instantiating and running the parser +* C++ Scanner Interface:: Exchanges between yylex and parse +* A Complete C++ Example:: Demonstrating their use +@end menu + +@node C++ Bison Interface +@subsection C++ Bison Interface +@c - %skeleton "lalr1.cc" +@c - Always pure +@c - initial action + +The C++ @acronym{LALR}(1) parser is selected using the skeleton directive, +@samp{%skeleton "lalr1.c"}, or the synonymous command-line option +@option{--skeleton=lalr1.c}. +@xref{Decl Summary}. + +When run, @command{bison} will create several entities in the @samp{yy} +namespace. +@findex %define namespace +Use the @samp{%define namespace} directive to change the namespace name, see +@ref{Decl Summary}. +The various classes are generated in the following files: + +@table @file +@item position.hh +@itemx location.hh +The definition of the classes @code{position} and @code{location}, +used for location tracking. @xref{C++ Location Values}. + +@item stack.hh +An auxiliary class @code{stack} used by the parser. + +@item @var{file}.hh +@itemx @var{file}.cc +(Assuming the extension of the input file was @samp{.yy}.) The +declaration and implementation of the C++ parser class. The basename +and extension of these two files follow the same rules as with regular C +parsers (@pxref{Invocation}). + +The header is @emph{mandatory}; you must either pass +@option{-d}/@option{--defines} to @command{bison}, or use the +@samp{%defines} directive. +@end table + +All these files are documented using Doxygen; run @command{doxygen} +for a complete and accurate documentation. + +@node C++ Semantic Values +@subsection C++ Semantic Values +@c - No objects in unions +@c - YYSTYPE +@c - Printer and destructor + +The @code{%union} directive works as for C, see @ref{Union Decl, ,The +Collection of Value Types}. In particular it produces a genuine +@code{union}@footnote{In the future techniques to allow complex types +within pseudo-unions (similar to Boost variants) might be implemented to +alleviate these issues.}, which have a few specific features in C++. +@itemize @minus +@item +The type @code{YYSTYPE} is defined but its use is discouraged: rather +you should refer to the parser's encapsulated type +@code{yy::parser::semantic_type}. +@item +Non POD (Plain Old Data) types cannot be used. C++ forbids any +instance of classes with constructors in unions: only @emph{pointers} +to such objects are allowed. +@end itemize + +Because objects have to be stored via pointers, memory is not +reclaimed automatically: using the @code{%destructor} directive is the +only means to avoid leaks. @xref{Destructor Decl, , Freeing Discarded +Symbols}. + + +@node C++ Location Values +@subsection C++ Location Values +@c - %locations +@c - class Position +@c - class Location +@c - %define filename_type "const symbol::Symbol" + +When the directive @code{%locations} is used, the C++ parser supports +location tracking, see @ref{Locations, , Locations Overview}. Two +auxiliary classes define a @code{position}, a single point in a file, +and a @code{location}, a range composed of a pair of +@code{position}s (possibly spanning several files). + +@deftypemethod {position} {std::string*} file +The name of the file. It will always be handled as a pointer, the +parser will never duplicate nor deallocate it. As an experimental +feature you may change it to @samp{@var{type}*} using @samp{%define +filename_type "@var{type}"}. +@end deftypemethod + +@deftypemethod {position} {unsigned int} line +The line, starting at 1. +@end deftypemethod + +@deftypemethod {position} {unsigned int} lines (int @var{height} = 1) +Advance by @var{height} lines, resetting the column number. +@end deftypemethod + +@deftypemethod {position} {unsigned int} column +The column, starting at 0. +@end deftypemethod + +@deftypemethod {position} {unsigned int} columns (int @var{width} = 1) +Advance by @var{width} columns, without changing the line number. +@end deftypemethod + +@deftypemethod {position} {position&} operator+= (position& @var{pos}, int @var{width}) +@deftypemethodx {position} {position} operator+ (const position& @var{pos}, int @var{width}) +@deftypemethodx {position} {position&} operator-= (const position& @var{pos}, int @var{width}) +@deftypemethodx {position} {position} operator- (position& @var{pos}, int @var{width}) +Various forms of syntactic sugar for @code{columns}. +@end deftypemethod + +@deftypemethod {position} {position} operator<< (std::ostream @var{o}, const position& @var{p}) +Report @var{p} on @var{o} like this: +@samp{@var{file}:@var{line}.@var{column}}, or +@samp{@var{line}.@var{column}} if @var{file} is null. +@end deftypemethod + +@deftypemethod {location} {position} begin +@deftypemethodx {location} {position} end +The first, inclusive, position of the range, and the first beyond. +@end deftypemethod + +@deftypemethod {location} {unsigned int} columns (int @var{width} = 1) +@deftypemethodx {location} {unsigned int} lines (int @var{height} = 1) +Advance the @code{end} position. +@end deftypemethod + +@deftypemethod {location} {location} operator+ (const location& @var{begin}, const location& @var{end}) +@deftypemethodx {location} {location} operator+ (const location& @var{begin}, int @var{width}) +@deftypemethodx {location} {location} operator+= (const location& @var{loc}, int @var{width}) +Various forms of syntactic sugar. +@end deftypemethod + +@deftypemethod {location} {void} step () +Move @code{begin} onto @code{end}. +@end deftypemethod + + +@node C++ Parser Interface +@subsection C++ Parser Interface +@c - define parser_class_name +@c - Ctor +@c - parse, error, set_debug_level, debug_level, set_debug_stream, +@c debug_stream. +@c - Reporting errors + +The output files @file{@var{output}.hh} and @file{@var{output}.cc} +declare and define the parser class in the namespace @code{yy}. The +class name defaults to @code{parser}, but may be changed using +@samp{%define parser_class_name "@var{name}"}. The interface of +this class is detailed below. It can be extended using the +@code{%parse-param} feature: its semantics is slightly changed since +it describes an additional member of the parser class, and an +additional argument for its constructor. + +@defcv {Type} {parser} {semantic_value_type} +@defcvx {Type} {parser} {location_value_type} +The types for semantics value and locations. +@end defcv + +@deftypemethod {parser} {} parser (@var{type1} @var{arg1}, ...) +Build a new parser object. There are no arguments by default, unless +@samp{%parse-param @{@var{type1} @var{arg1}@}} was used. +@end deftypemethod + +@deftypemethod {parser} {int} parse () +Run the syntactic analysis, and return 0 on success, 1 otherwise. +@end deftypemethod + +@deftypemethod {parser} {std::ostream&} debug_stream () +@deftypemethodx {parser} {void} set_debug_stream (std::ostream& @var{o}) +Get or set the stream used for tracing the parsing. It defaults to +@code{std::cerr}. +@end deftypemethod + +@deftypemethod {parser} {debug_level_type} debug_level () +@deftypemethodx {parser} {void} set_debug_level (debug_level @var{l}) +Get or set the tracing level. Currently its value is either 0, no trace, +or nonzero, full tracing. +@end deftypemethod + +@deftypemethod {parser} {void} error (const location_type& @var{l}, const std::string& @var{m}) +The definition for this member function must be supplied by the user: +the parser uses it to report a parser error occurring at @var{l}, +described by @var{m}. +@end deftypemethod + + +@node C++ Scanner Interface +@subsection C++ Scanner Interface +@c - prefix for yylex. +@c - Pure interface to yylex +@c - %lex-param + +The parser invokes the scanner by calling @code{yylex}. Contrary to C +parsers, C++ parsers are always pure: there is no point in using the +@code{%define api.pure} directive. Therefore the interface is as follows. + +@deftypemethod {parser} {int} yylex (semantic_value_type& @var{yylval}, location_type& @var{yylloc}, @var{type1} @var{arg1}, ...) +Return the next token. Its type is the return value, its semantic +value and location being @var{yylval} and @var{yylloc}. Invocations of +@samp{%lex-param @{@var{type1} @var{arg1}@}} yield additional arguments. +@end deftypemethod + + +@node A Complete C++ Example +@subsection A Complete C++ Example + +This section demonstrates the use of a C++ parser with a simple but +complete example. This example should be available on your system, +ready to compile, in the directory @dfn{../bison/examples/calc++}. It +focuses on the use of Bison, therefore the design of the various C++ +classes is very naive: no accessors, no encapsulation of members etc. +We will use a Lex scanner, and more precisely, a Flex scanner, to +demonstrate the various interaction. A hand written scanner is +actually easier to interface with. + +@menu +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band +@end menu + +@node Calc++ --- C++ Calculator +@subsubsection Calc++ --- C++ Calculator + +Of course the grammar is dedicated to arithmetics, a single +expression, possibly preceded by variable assignments. An +environment containing possibly predefined variables such as +@code{one} and @code{two}, is exchanged with the parser. An example +of valid input follows. + +@example +three := 3 +seven := one + two * three +seven * seven +@end example + +@node Calc++ Parsing Driver +@subsubsection Calc++ Parsing Driver +@c - An env +@c - A place to store error messages +@c - A place for the result + +To support a pure interface with the parser (and the scanner) the +technique of the ``parsing context'' is convenient: a structure +containing all the data to exchange. Since, in addition to simply +launch the parsing, there are several auxiliary tasks to execute (open +the file for parsing, instantiate the parser etc.), we recommend +transforming the simple parsing context structure into a fully blown +@dfn{parsing driver} class. + +The declaration of this driver class, @file{calc++-driver.hh}, is as +follows. The first part includes the CPP guard and imports the +required standard library components, and the declaration of the parser +class. + +@comment file: calc++-driver.hh +@example +#ifndef CALCXX_DRIVER_HH +# define CALCXX_DRIVER_HH +# include +# include +# include "calc++-parser.hh" +@end example + + +@noindent +Then comes the declaration of the scanning function. Flex expects +the signature of @code{yylex} to be defined in the macro +@code{YY_DECL}, and the C++ parser expects it to be declared. We can +factor both as follows. + +@comment file: calc++-driver.hh +@example +// Tell Flex the lexer's prototype ... +# define YY_DECL \ + yy::calcxx_parser::token_type \ + yylex (yy::calcxx_parser::semantic_type* yylval, \ + yy::calcxx_parser::location_type* yylloc, \ + calcxx_driver& driver) +// ... and declare it for the parser's sake. +YY_DECL; +@end example + +@noindent +The @code{calcxx_driver} class is then declared with its most obvious +members. + +@comment file: calc++-driver.hh +@example +// Conducting the whole scanning and parsing of Calc++. +class calcxx_driver +@{ +public: + calcxx_driver (); + virtual ~calcxx_driver (); + + std::map variables; + + int result; +@end example + +@noindent +To encapsulate the coordination with the Flex scanner, it is useful to +have two members function to open and close the scanning phase. + +@comment file: calc++-driver.hh +@example + // Handling the scanner. + void scan_begin (); + void scan_end (); + bool trace_scanning; +@end example + +@noindent +Similarly for the parser itself. + +@comment file: calc++-driver.hh +@example + // Run the parser. Return 0 on success. + int parse (const std::string& f); + std::string file; + bool trace_parsing; +@end example + +@noindent +To demonstrate pure handling of parse errors, instead of simply +dumping them on the standard error output, we will pass them to the +compiler driver using the following two member functions. Finally, we +close the class declaration and CPP guard. + +@comment file: calc++-driver.hh +@example + // Error handling. + void error (const yy::location& l, const std::string& m); + void error (const std::string& m); +@}; +#endif // ! CALCXX_DRIVER_HH +@end example + +The implementation of the driver is straightforward. The @code{parse} +member function deserves some attention. The @code{error} functions +are simple stubs, they should actually register the located error +messages and set error state. + +@comment file: calc++-driver.cc +@example +#include "calc++-driver.hh" +#include "calc++-parser.hh" + +calcxx_driver::calcxx_driver () + : trace_scanning (false), trace_parsing (false) +@{ + variables["one"] = 1; + variables["two"] = 2; +@} + +calcxx_driver::~calcxx_driver () +@{ +@} + +int +calcxx_driver::parse (const std::string &f) +@{ + file = f; + scan_begin (); + yy::calcxx_parser parser (*this); + parser.set_debug_level (trace_parsing); + int res = parser.parse (); + scan_end (); + return res; +@} + +void +calcxx_driver::error (const yy::location& l, const std::string& m) +@{ + std::cerr << l << ": " << m << std::endl; +@} + +void +calcxx_driver::error (const std::string& m) +@{ + std::cerr << m << std::endl; +@} +@end example + +@node Calc++ Parser +@subsubsection Calc++ Parser + +The parser definition file @file{calc++-parser.yy} starts by asking for +the C++ LALR(1) skeleton, the creation of the parser header file, and +specifies the name of the parser class. Because the C++ skeleton +changed several times, it is safer to require the version you designed +the grammar for. + +@comment file: calc++-parser.yy +@example +%skeleton "lalr1.cc" /* -*- C++ -*- */ +%require "@value{VERSION}" +%defines +%define parser_class_name "calcxx_parser" +@end example + +@noindent +@findex %code requires +Then come the declarations/inclusions needed to define the +@code{%union}. Because the parser uses the parsing driver and +reciprocally, both cannot include the header of the other. Because the +driver's header needs detailed knowledge about the parser class (in +particular its inner types), it is the parser's header which will simply +use a forward declaration of the driver. +@xref{Decl Summary, ,%code}. + +@comment file: calc++-parser.yy +@example +%code requires @{ +# include +class calcxx_driver; +@} +@end example + +@noindent +The driver is passed by reference to the parser and to the scanner. +This provides a simple but effective pure interface, not relying on +global variables. + +@comment file: calc++-parser.yy +@example +// The parsing context. +%parse-param @{ calcxx_driver& driver @} +%lex-param @{ calcxx_driver& driver @} +@end example + +@noindent +Then we request the location tracking feature, and initialize the +first location's file name. Afterwards new locations are computed +relatively to the previous locations: the file name will be +automatically propagated. + +@comment file: calc++-parser.yy +@example +%locations +%initial-action +@{ + // Initialize the initial location. + @@$.begin.filename = @@$.end.filename = &driver.file; +@}; +@end example + +@noindent +Use the two following directives to enable parser tracing and verbose +error messages. + +@comment file: calc++-parser.yy +@example +%debug +%error-verbose +@end example + +@noindent +Semantic values cannot use ``real'' objects, but only pointers to +them. + +@comment file: calc++-parser.yy +@example +// Symbols. +%union +@{ + int ival; + std::string *sval; +@}; +@end example + +@noindent +@findex %code +The code between @samp{%code @{} and @samp{@}} is output in the +@file{*.cc} file; it needs detailed knowledge about the driver. + +@comment file: calc++-parser.yy +@example +%code @{ +# include "calc++-driver.hh" +@} +@end example + + +@noindent +The token numbered as 0 corresponds to end of file; the following line +allows for nicer error messages referring to ``end of file'' instead +of ``$end''. Similarly user friendly named are provided for each +symbol. Note that the tokens names are prefixed by @code{TOKEN_} to +avoid name clashes. + +@comment file: calc++-parser.yy +@example +%token END 0 "end of file" +%token ASSIGN ":=" +%token IDENTIFIER "identifier" +%token NUMBER "number" +%type exp +@end example + +@noindent +To enable memory deallocation during error recovery, use +@code{%destructor}. + +@c FIXME: Document %printer, and mention that it takes a braced-code operand. +@comment file: calc++-parser.yy +@example +%printer @{ debug_stream () << *$$; @} "identifier" +%destructor @{ delete $$; @} "identifier" + +%printer @{ debug_stream () << $$; @} +@end example + +@noindent +The grammar itself is straightforward. + +@comment file: calc++-parser.yy +@example +%% +%start unit; +unit: assignments exp @{ driver.result = $2; @}; + +assignments: assignments assignment @{@} + | /* Nothing. */ @{@}; + +assignment: + "identifier" ":=" exp + @{ driver.variables[*$1] = $3; delete $1; @}; + +%left '+' '-'; +%left '*' '/'; +exp: exp '+' exp @{ $$ = $1 + $3; @} + | exp '-' exp @{ $$ = $1 - $3; @} + | exp '*' exp @{ $$ = $1 * $3; @} + | exp '/' exp @{ $$ = $1 / $3; @} + | "identifier" @{ $$ = driver.variables[*$1]; delete $1; @} + | "number" @{ $$ = $1; @}; +%% +@end example + +@noindent +Finally the @code{error} member function registers the errors to the +driver. + +@comment file: calc++-parser.yy +@example +void +yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l, + const std::string& m) +@{ + driver.error (l, m); +@} +@end example + +@node Calc++ Scanner +@subsubsection Calc++ Scanner + +The Flex scanner first includes the driver declaration, then the +parser's to get the set of defined tokens. + +@comment file: calc++-scanner.ll +@example +%@{ /* -*- C++ -*- */ +# include +# include +# include +# include +# include "calc++-driver.hh" +# include "calc++-parser.hh" + +/* Work around an incompatibility in flex (at least versions + 2.5.31 through 2.5.33): it generates code that does + not conform to C89. See Debian bug 333231 + . */ +# undef yywrap +# define yywrap() 1 + +/* By default yylex returns int, we use token_type. + Unfortunately yyterminate by default returns 0, which is + not of token_type. */ +#define yyterminate() return token::END +%@} +@end example + +@noindent +Because there is no @code{#include}-like feature we don't need +@code{yywrap}, we don't need @code{unput} either, and we parse an +actual file, this is not an interactive session with the user. +Finally we enable the scanner tracing features. + +@comment file: calc++-scanner.ll +@example +%option noyywrap nounput batch debug +@end example + +@noindent +Abbreviations allow for more readable rules. + +@comment file: calc++-scanner.ll +@example +id [a-zA-Z][a-zA-Z_0-9]* +int [0-9]+ +blank [ \t] +@end example + +@noindent +The following paragraph suffices to track locations accurately. Each +time @code{yylex} is invoked, the begin position is moved onto the end +position. Then when a pattern is matched, the end position is +advanced of its width. In case it matched ends of lines, the end +cursor is adjusted, and each time blanks are matched, the begin cursor +is moved onto the end cursor to effectively ignore the blanks +preceding tokens. Comments would be treated equally. + +@comment file: calc++-scanner.ll +@example +%@{ +# define YY_USER_ACTION yylloc->columns (yyleng); +%@} +%% +%@{ + yylloc->step (); +%@} +@{blank@}+ yylloc->step (); +[\n]+ yylloc->lines (yyleng); yylloc->step (); +@end example + +@noindent +The rules are simple, just note the use of the driver to report errors. +It is convenient to use a typedef to shorten +@code{yy::calcxx_parser::token::identifier} into +@code{token::identifier} for instance. + +@comment file: calc++-scanner.ll +@example +%@{ + typedef yy::calcxx_parser::token token; +%@} + /* Convert ints to the actual type of tokens. */ +[-+*/] return yy::calcxx_parser::token_type (yytext[0]); +":=" return token::ASSIGN; +@{int@} @{ + errno = 0; + long n = strtol (yytext, NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + driver.error (*yylloc, "integer is out of range"); + yylval->ival = n; + return token::NUMBER; +@} +@{id@} yylval->sval = new std::string (yytext); return token::IDENTIFIER; +. driver.error (*yylloc, "invalid character"); +%% +@end example + +@noindent +Finally, because the scanner related driver's member function depend +on the scanner's data, it is simpler to implement them in this file. + +@comment file: calc++-scanner.ll +@example +void +calcxx_driver::scan_begin () +@{ + yy_flex_debug = trace_scanning; + if (file == "-") + yyin = stdin; + else if (!(yyin = fopen (file.c_str (), "r"))) + @{ + error (std::string ("cannot open ") + file); + exit (1); + @} +@} + +void +calcxx_driver::scan_end () +@{ + fclose (yyin); +@} +@end example + +@node Calc++ Top Level +@subsubsection Calc++ Top Level + +The top level file, @file{calc++.cc}, poses no problem. + +@comment file: calc++.cc +@example +#include +#include "calc++-driver.hh" + +int +main (int argc, char *argv[]) +@{ + calcxx_driver driver; + for (++argv; argv[0]; ++argv) + if (*argv == std::string ("-p")) + driver.trace_parsing = true; + else if (*argv == std::string ("-s")) + driver.trace_scanning = true; + else if (!driver.parse (*argv)) + std::cout << driver.result << std::endl; +@} +@end example + +@node Java Parsers +@section Java Parsers + +@menu +* Java Bison Interface:: Asking for Java parser generation +* Java Semantic Values:: %type and %token vs. Java +* Java Location Values:: The position and location classes +* Java Parser Interface:: Instantiating and running the parser +* Java Scanner Interface:: Specifying the scanner for the parser +* Java Action Features:: Special features for use in actions +* Java Differences:: Differences between C/C++ and Java Grammars +* Java Declarations Summary:: List of Bison declarations used with Java +@end menu + +@node Java Bison Interface +@subsection Java Bison Interface +@c - %language "Java" + +(The current Java interface is experimental and may evolve. +More user feedback will help to stabilize it.) + +The Java parser skeletons are selected using the @code{%language "Java"} +directive or the @option{-L java}/@option{--language=java} option. + +@c FIXME: Documented bug. +When generating a Java parser, @code{bison @var{basename}.y} will create +a single Java source file named @file{@var{basename}.java}. Using an +input file without a @file{.y} suffix is currently broken. The basename +of the output file can be changed by the @code{%file-prefix} directive +or the @option{-p}/@option{--name-prefix} option. The entire output file +name can be changed by the @code{%output} directive or the +@option{-o}/@option{--output} option. The output file contains a single +class for the parser. + +You can create documentation for generated parsers using Javadoc. + +Contrary to C parsers, Java parsers do not use global variables; the +state of the parser is always local to an instance of the parser class. +Therefore, all Java parsers are ``pure'', and the @code{%pure-parser} +and @code{%define api.pure} directives does not do anything when used in +Java. + +Push parsers are currently unsupported in Java and @code{%define +api.push_pull} have no effect. + +@acronym{GLR} parsers are currently unsupported in Java. Do not use the +@code{glr-parser} directive. + +No header file can be generated for Java parsers. Do not use the +@code{%defines} directive or the @option{-d}/@option{--defines} options. + +@c FIXME: Possible code change. +Currently, support for debugging and verbose errors are always compiled +in. Thus the @code{%debug} and @code{%token-table} directives and the +@option{-t}/@option{--debug} and @option{-k}/@option{--token-table} +options have no effect. This may change in the future to eliminate +unused code in the generated parser, so use @code{%debug} and +@code{%verbose-error} explicitly if needed. Also, in the future the +@code{%token-table} directive might enable a public interface to +access the token names and codes. + +@node Java Semantic Values +@subsection Java Semantic Values +@c - No %union, specify type in %type/%token. +@c - YYSTYPE +@c - Printer and destructor + +There is no @code{%union} directive in Java parsers. Instead, the +semantic values' types (class names) should be specified in the +@code{%type} or @code{%token} directive: + +@example +%type expr assignment_expr term factor +%type number +@end example + +By default, the semantic stack is declared to have @code{Object} members, +which means that the class types you specify can be of any class. +To improve the type safety of the parser, you can declare the common +superclass of all the semantic values using the @code{%define stype} +directive. For example, after the following declaration: + +@example +%define stype "ASTNode" +@end example + +@noindent +any @code{%type} or @code{%token} specifying a semantic type which +is not a subclass of ASTNode, will cause a compile-time error. + +@c FIXME: Documented bug. +Types used in the directives may be qualified with a package name. +Primitive data types are accepted for Java version 1.5 or later. Note +that in this case the autoboxing feature of Java 1.5 will be used. +Generic types may not be used; this is due to a limitation in the +implementation of Bison, and may change in future releases. + +Java parsers do not support @code{%destructor}, since the language +adopts garbage collection. The parser will try to hold references +to semantic values for as little time as needed. + +Java parsers do not support @code{%printer}, as @code{toString()} +can be used to print the semantic values. This however may change +(in a backwards-compatible way) in future versions of Bison. + + +@node Java Location Values +@subsection Java Location Values +@c - %locations +@c - class Position +@c - class Location + +When the directive @code{%locations} is used, the Java parser +supports location tracking, see @ref{Locations, , Locations Overview}. +An auxiliary user-defined class defines a @dfn{position}, a single point +in a file; Bison itself defines a class representing a @dfn{location}, +a range composed of a pair of positions (possibly spanning several +files). The location class is an inner class of the parser; the name +is @code{Location} by default, and may also be renamed using +@code{%define location_type "@var{class-name}}. + +The location class treats the position as a completely opaque value. +By default, the class name is @code{Position}, but this can be changed +with @code{%define position_type "@var{class-name}"}. This class must +be supplied by the user. + + +@deftypeivar {Location} {Position} begin +@deftypeivarx {Location} {Position} end +The first, inclusive, position of the range, and the first beyond. +@end deftypeivar + +@deftypeop {Constructor} {Location} {} Location (Position @var{loc}) +Create a @code{Location} denoting an empty range located at a given point. +@end deftypeop + +@deftypeop {Constructor} {Location} {} Location (Position @var{begin}, Position @var{end}) +Create a @code{Location} from the endpoints of the range. +@end deftypeop + +@deftypemethod {Location} {String} toString () +Prints the range represented by the location. For this to work +properly, the position class should override the @code{equals} and +@code{toString} methods appropriately. +@end deftypemethod + + +@node Java Parser Interface +@subsection Java Parser Interface +@c - define parser_class_name +@c - Ctor +@c - parse, error, set_debug_level, debug_level, set_debug_stream, +@c debug_stream. +@c - Reporting errors + +The name of the generated parser class defaults to @code{YYParser}. The +@code{YY} prefix may be changed using the @code{%name-prefix} directive +or the @option{-p}/@option{--name-prefix} option. Alternatively, use +@code{%define parser_class_name "@var{name}"} to give a custom name to +the class. The interface of this class is detailed below. + +By default, the parser class has package visibility. A declaration +@code{%define public} will change to public visibility. Remember that, +according to the Java language specification, the name of the @file{.java} +file should match the name of the class in this case. Similarly, you can +use @code{abstract}, @code{final} and @code{strictfp} with the +@code{%define} declaration to add other modifiers to the parser class. + +The Java package name of the parser class can be specified using the +@code{%define package} directive. The superclass and the implemented +interfaces of the parser class can be specified with the @code{%define +extends} and @code{%define implements} directives. + +The parser class defines an inner class, @code{Location}, that is used +for location tracking (see @ref{Java Location Values}), and a inner +interface, @code{Lexer} (see @ref{Java Scanner Interface}). Other than +these inner class/interface, and the members described in the interface +below, all the other members and fields are preceded with a @code{yy} or +@code{YY} prefix to avoid clashes with user code. + +@c FIXME: The following constants and variables are still undocumented: +@c @code{bisonVersion}, @code{bisonSkeleton} and @code{errorVerbose}. + +The parser class can be extended using the @code{%parse-param} +directive. Each occurrence of the directive will add a @code{protected +final} field to the parser class, and an argument to its constructor, +which initialize them automatically. + +Token names defined by @code{%token} and the predefined @code{EOF} token +name are added as constant fields to the parser class. + +@deftypeop {Constructor} {YYParser} {} YYParser (@var{lex_param}, @dots{}, @var{parse_param}, @dots{}) +Build a new parser object with embedded @code{%code lexer}. There are +no parameters, unless @code{%parse-param}s and/or @code{%lex-param}s are +used. +@end deftypeop + +@deftypeop {Constructor} {YYParser} {} YYParser (Lexer @var{lexer}, @var{parse_param}, @dots{}) +Build a new parser object using the specified scanner. There are no +additional parameters unless @code{%parse-param}s are used. + +If the scanner is defined by @code{%code lexer}, this constructor is +declared @code{protected} and is called automatically with a scanner +created with the correct @code{%lex-param}s. +@end deftypeop + +@deftypemethod {YYParser} {boolean} parse () +Run the syntactic analysis, and return @code{true} on success, +@code{false} otherwise. +@end deftypemethod + +@deftypemethod {YYParser} {boolean} recovering () +During the syntactic analysis, return @code{true} if recovering +from a syntax error. +@xref{Error Recovery}. +@end deftypemethod + +@deftypemethod {YYParser} {java.io.PrintStream} getDebugStream () +@deftypemethodx {YYParser} {void} setDebugStream (java.io.printStream @var{o}) +Get or set the stream used for tracing the parsing. It defaults to +@code{System.err}. +@end deftypemethod + +@deftypemethod {YYParser} {int} getDebugLevel () +@deftypemethodx {YYParser} {void} setDebugLevel (int @var{l}) +Get or set the tracing level. Currently its value is either 0, no trace, +or nonzero, full tracing. +@end deftypemethod + + +@node Java Scanner Interface +@subsection Java Scanner Interface +@c - %code lexer +@c - %lex-param +@c - Lexer interface + +There are two possible ways to interface a Bison-generated Java parser +with a scanner: the scanner may be defined by @code{%code lexer}, or +defined elsewhere. In either case, the scanner has to implement the +@code{Lexer} inner interface of the parser class. + +In the first case, the body of the scanner class is placed in +@code{%code lexer} blocks. If you want to pass parameters from the +parser constructor to the scanner constructor, specify them with +@code{%lex-param}; they are passed before @code{%parse-param}s to the +constructor. + +In the second case, the scanner has to implement the @code{Lexer} interface, +which is defined within the parser class (e.g., @code{YYParser.Lexer}). +The constructor of the parser object will then accept an object +implementing the interface; @code{%lex-param} is not used in this +case. + +In both cases, the scanner has to implement the following methods. + +@deftypemethod {Lexer} {void} yyerror (Location @var{loc}, String @var{msg}) +This method is defined by the user to emit an error message. The first +parameter is omitted if location tracking is not active. Its type can be +changed using @code{%define location_type "@var{class-name}".} +@end deftypemethod + +@deftypemethod {Lexer} {int} yylex () +Return the next token. Its type is the return value, its semantic +value and location are saved and returned by the ther methods in the +interface. + +Use @code{%define lex_throws} to specify any uncaught exceptions. +Default is @code{java.io.IOException}. +@end deftypemethod + +@deftypemethod {Lexer} {Position} getStartPos () +@deftypemethodx {Lexer} {Position} getEndPos () +Return respectively the first position of the last token that +@code{yylex} returned, and the first position beyond it. These +methods are not needed unless location tracking is active. + +The return type can be changed using @code{%define position_type +"@var{class-name}".} +@end deftypemethod + +@deftypemethod {Lexer} {Object} getLVal () +Return the semantical value of the last token that yylex returned. + +The return type can be changed using @code{%define stype +"@var{class-name}".} +@end deftypemethod + + +@node Java Action Features +@subsection Special Features for Use in Java Actions + +The following special constructs can be uses in Java actions. +Other analogous C action features are currently unavailable for Java. + +Use @code{%define throws} to specify any uncaught exceptions from parser +actions, and initial actions specified by @code{%initial-action}. + +@defvar $@var{n} +The semantic value for the @var{n}th component of the current rule. +This may not be assigned to. +@xref{Java Semantic Values}. +@end defvar + +@defvar $<@var{typealt}>@var{n} +Like @code{$@var{n}} but specifies a alternative type @var{typealt}. +@xref{Java Semantic Values}. +@end defvar + +@defvar $$ +The semantic value for the grouping made by the current rule. As a +value, this is in the base type (@code{Object} or as specified by +@code{%define stype}) as in not cast to the declared subtype because +casts are not allowed on the left-hand side of Java assignments. +Use an explicit Java cast if the correct subtype is needed. +@xref{Java Semantic Values}. +@end defvar + +@defvar $<@var{typealt}>$ +Same as @code{$$} since Java always allow assigning to the base type. +Perhaps we should use this and @code{$<>$} for the value and @code{$$} +for setting the value but there is currently no easy way to distinguish +these constructs. +@xref{Java Semantic Values}. +@end defvar + +@defvar @@@var{n} +The location information of the @var{n}th component of the current rule. +This may not be assigned to. +@xref{Java Location Values}. +@end defvar + +@defvar @@$ +The location information of the grouping made by the current rule. +@xref{Java Location Values}. +@end defvar + +@deffn {Statement} {return YYABORT;} +Return immediately from the parser, indicating failure. +@xref{Java Parser Interface}. +@end deffn + +@deffn {Statement} {return YYACCEPT;} +Return immediately from the parser, indicating success. +@xref{Java Parser Interface}. +@end deffn + +@deffn {Statement} {return YYERROR;} +Start error recovery without printing an error message. +@xref{Error Recovery}. +@end deffn + +@deffn {Statement} {return YYFAIL;} +Print an error message and start error recovery. +@xref{Error Recovery}. +@end deffn + +@deftypefn {Function} {boolean} recovering () +Return whether error recovery is being done. In this state, the parser +reads token until it reaches a known state, and then restarts normal +operation. +@xref{Error Recovery}. +@end deftypefn + +@deftypefn {Function} {protected void} yyerror (String msg) +@deftypefnx {Function} {protected void} yyerror (Position pos, String msg) +@deftypefnx {Function} {protected void} yyerror (Location loc, String msg) +Print an error message using the @code{yyerror} method of the scanner +instance in use. +@end deftypefn + + +@node Java Differences +@subsection Differences between C/C++ and Java Grammars + +The different structure of the Java language forces several differences +between C/C++ grammars, and grammars designed for Java parsers. This +section summarizes these differences. + +@itemize +@item +Java lacks a preprocessor, so the @code{YYERROR}, @code{YYACCEPT}, +@code{YYABORT} symbols (@pxref{Table of Symbols}) cannot obviously be +macros. Instead, they should be preceded by @code{return} when they +appear in an action. The actual definition of these symbols is +opaque to the Bison grammar, and it might change in the future. The +only meaningful operation that you can do, is to return them. +See @pxref{Java Action Features}. + +Note that of these three symbols, only @code{YYACCEPT} and +@code{YYABORT} will cause a return from the @code{yyparse} +method@footnote{Java parsers include the actions in a separate +method than @code{yyparse} in order to have an intuitive syntax that +corresponds to these C macros.}. + +@item +Java lacks unions, so @code{%union} has no effect. Instead, semantic +values have a common base type: @code{Object} or as specified by +@code{%define stype}. Angle backets on @code{%token}, @code{type}, +@code{$@var{n}} and @code{$$} specify subtypes rather than fields of +an union. The type of @code{$$}, even with angle brackets, is the base +type since Java casts are not allow on the left-hand side of assignments. +Also, @code{$@var{n}} and @code{@@@var{n}} are not allowed on the +left-hand side of assignments. See @pxref{Java Semantic Values} and +@pxref{Java Action Features}. + +@item +The prolog declarations have a different meaning than in C/C++ code. +@table @asis +@item @code{%code imports} +blocks are placed at the beginning of the Java source code. They may +include copyright notices. For a @code{package} declarations, it is +suggested to use @code{%define package} instead. + +@item unqualified @code{%code} +blocks are placed inside the parser class. + +@item @code{%code lexer} +blocks, if specified, should include the implementation of the +scanner. If there is no such block, the scanner can be any class +that implements the appropriate interface (see @pxref{Java Scanner +Interface}). +@end table + +Other @code{%code} blocks are not supported in Java parsers. +In particular, @code{%@{ @dots{} %@}} blocks should not be used +and may give an error in future versions of Bison. + +The epilogue has the same meaning as in C/C++ code and it can +be used to define other classes used by the parser @emph{outside} +the parser class. +@end itemize + + +@node Java Declarations Summary +@subsection Java Declarations Summary + +This summary only include declarations specific to Java or have special +meaning when used in a Java parser. + +@deffn {Directive} {%language "Java"} +Generate a Java class for the parser. +@end deffn + +@deffn {Directive} %lex-param @{@var{type} @var{name}@} +A parameter for the lexer class defined by @code{%code lexer} +@emph{only}, added as parameters to the lexer constructor and the parser +constructor that @emph{creates} a lexer. Default is none. +@xref{Java Scanner Interface}. +@end deffn + +@deffn {Directive} %name-prefix "@var{prefix}" +The prefix of the parser class name @code{@var{prefix}Parser} if +@code{%define parser_class_name} is not used. Default is @code{YY}. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} %parse-param @{@var{type} @var{name}@} +A parameter for the parser class added as parameters to constructor(s) +and as fields initialized by the constructor(s). Default is none. +@xref{Java Parser Interface}. +@end deffn + +@deffn {Directive} %token <@var{type}> @var{token} @dots{} +Declare tokens. Note that the angle brackets enclose a Java @emph{type}. +@xref{Java Semantic Values}. +@end deffn + +@deffn {Directive} %type <@var{type}> @var{nonterminal} @dots{} +Declare the type of nonterminals. Note that the angle brackets enclose +a Java @emph{type}. +@xref{Java Semantic Values}. +@end deffn + +@deffn {Directive} %code @{ @var{code} @dots{} @} +Code appended to the inside of the parser class. +@xref{Java Differences}. +@end deffn + +@deffn {Directive} {%code imports} @{ @var{code} @dots{} @} +Code inserted just after the @code{package} declaration. +@xref{Java Differences}. +@end deffn + +@deffn {Directive} {%code lexer} @{ @var{code} @dots{} @} +Code added to the body of a inner lexer class within the parser class. +@xref{Java Scanner Interface}. +@end deffn + +@deffn {Directive} %% @var{code} @dots{} +Code (after the second @code{%%}) appended to the end of the file, +@emph{outside} the parser class. +@xref{Java Differences}. +@end deffn + +@deffn {Directive} %@{ @var{code} @dots{} %@} +Not supported. Use @code{%code import} instead. +@xref{Java Differences}. +@end deffn + +@deffn {Directive} {%define abstract} +Whether the parser class is declared @code{abstract}. Default is false. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} {%define extends} "@var{superclass}" +The superclass of the parser class. Default is none. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} {%define final} +Whether the parser class is declared @code{final}. Default is false. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} {%define implements} "@var{interfaces}" +The implemented interfaces of the parser class, a comma-separated list. +Default is none. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} {%define lex_throws} "@var{exceptions}" +The exceptions thrown by the @code{yylex} method of the lexer, a +comma-separated list. Default is @code{java.io.IOException}. +@xref{Java Scanner Interface}. +@end deffn + +@deffn {Directive} {%define location_type} "@var{class}" +The name of the class used for locations (a range between two +positions). This class is generated as an inner class of the parser +class by @command{bison}. Default is @code{Location}. +@xref{Java Location Values}. +@end deffn + +@deffn {Directive} {%define package} "@var{package}" +The package to put the parser class in. Default is none. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} {%define parser_class_name} "@var{name}" +The name of the parser class. Default is @code{YYParser} or +@code{@var{name-prefix}Parser}. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} {%define position_type} "@var{class}" +The name of the class used for positions. This class must be supplied by +the user. Default is @code{Position}. +@xref{Java Location Values}. +@end deffn + +@deffn {Directive} {%define public} +Whether the parser class is declared @code{public}. Default is false. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} {%define stype} "@var{class}" +The base type of semantic values. Default is @code{Object}. +@xref{Java Semantic Values}. +@end deffn + +@deffn {Directive} {%define strictfp} +Whether the parser class is declared @code{strictfp}. Default is false. +@xref{Java Bison Interface}. +@end deffn + +@deffn {Directive} {%define throws} "@var{exceptions}" +The exceptions thrown by user-supplied parser actions and +@code{%initial-action}, a comma-separated list. Default is none. +@xref{Java Parser Interface}. +@end deffn + + +@c ================================================= FAQ + +@node FAQ +@chapter Frequently Asked Questions +@cindex frequently asked questions +@cindex questions + +Several questions about Bison come up occasionally. Here some of them +are addressed. + +@menu +* Memory Exhausted:: Breaking the Stack Limits +* How Can I Reset the Parser:: @code{yyparse} Keeps some State +* Strings are Destroyed:: @code{yylval} Loses Track of Strings +* Implementing Gotos/Loops:: Control Flow in the Calculator +* Multiple start-symbols:: Factoring closely related grammars +* Secure? Conform?:: Is Bison @acronym{POSIX} safe? +* I can't build Bison:: Troubleshooting +* Where can I find help?:: Troubleshouting +* Bug Reports:: Troublereporting +* More Languages:: Parsers in C++, Java, and so on +* Beta Testing:: Experimenting development versions +* Mailing Lists:: Meeting other Bison users +@end menu + +@node Memory Exhausted +@section Memory Exhausted + +@display +My parser returns with error with a @samp{memory exhausted} +message. What can I do? +@end display + +This question is already addressed elsewhere, @xref{Recursion, +,Recursive Rules}. + +@node How Can I Reset the Parser +@section How Can I Reset the Parser + +The following phenomenon has several symptoms, resulting in the +following typical questions: + +@display +I invoke @code{yyparse} several times, and on correct input it works +properly; but when a parse error is found, all the other calls fail +too. How can I reset the error flag of @code{yyparse}? +@end display + +@noindent +or + +@display +My parser includes support for an @samp{#include}-like feature, in +which case I run @code{yyparse} from @code{yyparse}. This fails +although I did specify @code{%define api.pure}. +@end display + +These problems typically come not from Bison itself, but from +Lex-generated scanners. Because these scanners use large buffers for +speed, they might not notice a change of input file. As a +demonstration, consider the following source file, +@file{first-line.l}: + +@verbatim +%{ +#include +#include +%} +%% +.*\n ECHO; return 1; +%% +int +yyparse (char const *file) +{ + yyin = fopen (file, "r"); + if (!yyin) + exit (2); + /* One token only. */ + yylex (); + if (fclose (yyin) != 0) + exit (3); + return 0; +} + +int +main (void) +{ + yyparse ("input"); + yyparse ("input"); + return 0; +} +@end verbatim + +@noindent +If the file @file{input} contains + +@verbatim +input:1: Hello, +input:2: World! +@end verbatim + +@noindent +then instead of getting the first line twice, you get: + +@example +$ @kbd{flex -ofirst-line.c first-line.l} +$ @kbd{gcc -ofirst-line first-line.c -ll} +$ @kbd{./first-line} +input:1: Hello, +input:2: World! +@end example + +Therefore, whenever you change @code{yyin}, you must tell the +Lex-generated scanner to discard its current buffer and switch to the +new one. This depends upon your implementation of Lex; see its +documentation for more. For Flex, it suffices to call +@samp{YY_FLUSH_BUFFER} after each change to @code{yyin}. If your +Flex-generated scanner needs to read from several input streams to +handle features like include files, you might consider using Flex +functions like @samp{yy_switch_to_buffer} that manipulate multiple +input buffers. + +If your Flex-generated scanner uses start conditions (@pxref{Start +conditions, , Start conditions, flex, The Flex Manual}), you might +also want to reset the scanner's state, i.e., go back to the initial +start condition, through a call to @samp{BEGIN (0)}. + +@node Strings are Destroyed +@section Strings are Destroyed + +@display +My parser seems to destroy old strings, or maybe it loses track of +them. Instead of reporting @samp{"foo", "bar"}, it reports +@samp{"bar", "bar"}, or even @samp{"foo\nbar", "bar"}. +@end display + +This error is probably the single most frequent ``bug report'' sent to +Bison lists, but is only concerned with a misunderstanding of the role +of the scanner. Consider the following Lex code: + +@verbatim +%{ +#include +char *yylval = NULL; +%} +%% +.* yylval = yytext; return 1; +\n /* IGNORE */ +%% +int +main () +{ + /* Similar to using $1, $2 in a Bison action. */ + char *fst = (yylex (), yylval); + char *snd = (yylex (), yylval); + printf ("\"%s\", \"%s\"\n", fst, snd); + return 0; +} +@end verbatim + +If you compile and run this code, you get: + +@example +$ @kbd{flex -osplit-lines.c split-lines.l} +$ @kbd{gcc -osplit-lines split-lines.c -ll} +$ @kbd{printf 'one\ntwo\n' | ./split-lines} +"one +two", "two" +@end example + +@noindent +this is because @code{yytext} is a buffer provided for @emph{reading} +in the action, but if you want to keep it, you have to duplicate it +(e.g., using @code{strdup}). Note that the output may depend on how +your implementation of Lex handles @code{yytext}. For instance, when +given the Lex compatibility option @option{-l} (which triggers the +option @samp{%array}) Flex generates a different behavior: + +@example +$ @kbd{flex -l -osplit-lines.c split-lines.l} +$ @kbd{gcc -osplit-lines split-lines.c -ll} +$ @kbd{printf 'one\ntwo\n' | ./split-lines} +"two", "two" +@end example + + +@node Implementing Gotos/Loops +@section Implementing Gotos/Loops + +@display +My simple calculator supports variables, assignments, and functions, +but how can I implement gotos, or loops? +@end display + +Although very pedagogical, the examples included in the document blur +the distinction to make between the parser---whose job is to recover +the structure of a text and to transmit it to subsequent modules of +the program---and the processing (such as the execution) of this +structure. This works well with so called straight line programs, +i.e., precisely those that have a straightforward execution model: +execute simple instructions one after the others. + +@cindex abstract syntax tree +@cindex @acronym{AST} +If you want a richer model, you will probably need to use the parser +to construct a tree that does represent the structure it has +recovered; this tree is usually called the @dfn{abstract syntax tree}, +or @dfn{@acronym{AST}} for short. Then, walking through this tree, +traversing it in various ways, will enable treatments such as its +execution or its translation, which will result in an interpreter or a +compiler. + +This topic is way beyond the scope of this manual, and the reader is +invited to consult the dedicated literature. + + +@node Multiple start-symbols +@section Multiple start-symbols + +@display +I have several closely related grammars, and I would like to share their +implementations. In fact, I could use a single grammar but with +multiple entry points. +@end display + +Bison does not support multiple start-symbols, but there is a very +simple means to simulate them. If @code{foo} and @code{bar} are the two +pseudo start-symbols, then introduce two new tokens, say +@code{START_FOO} and @code{START_BAR}, and use them as switches from the +real start-symbol: + +@example +%token START_FOO START_BAR; +%start start; +start: START_FOO foo + | START_BAR bar; +@end example + +These tokens prevents the introduction of new conflicts. As far as the +parser goes, that is all that is needed. + +Now the difficult part is ensuring that the scanner will send these +tokens first. If your scanner is hand-written, that should be +straightforward. If your scanner is generated by Lex, them there is +simple means to do it: recall that anything between @samp{%@{ ... %@}} +after the first @code{%%} is copied verbatim in the top of the generated +@code{yylex} function. Make sure a variable @code{start_token} is +available in the scanner (e.g., a global variable or using +@code{%lex-param} etc.), and use the following: + +@example + /* @r{Prologue.} */ +%% +%@{ + if (start_token) + @{ + int t = start_token; + start_token = 0; + return t; + @} +%@} + /* @r{The rules.} */ +@end example + + +@node Secure? Conform? +@section Secure? Conform? + +@display +Is Bison secure? Does it conform to POSIX? +@end display + +If you're looking for a guarantee or certification, we don't provide it. +However, Bison is intended to be a reliable program that conforms to the +@acronym{POSIX} specification for Yacc. If you run into problems, +please send us a bug report. + +@node I can't build Bison +@section I can't build Bison + +@display +I can't build Bison because @command{make} complains that +@code{msgfmt} is not found. +What should I do? +@end display + +Like most GNU packages with internationalization support, that feature +is turned on by default. If you have problems building in the @file{po} +subdirectory, it indicates that your system's internationalization +support is lacking. You can re-configure Bison with +@option{--disable-nls} to turn off this support, or you can install GNU +gettext from @url{ftp://ftp.gnu.org/gnu/gettext/} and re-configure +Bison. See the file @file{ABOUT-NLS} for more information. + + +@node Where can I find help? +@section Where can I find help? + +@display +I'm having trouble using Bison. Where can I find help? +@end display + +First, read this fine manual. Beyond that, you can send mail to +@email{help-bison@@gnu.org}. This mailing list is intended to be +populated with people who are willing to answer questions about using +and installing Bison. Please keep in mind that (most of) the people on +the list have aspects of their lives which are not related to Bison (!), +so you may not receive an answer to your question right away. This can +be frustrating, but please try not to honk them off; remember that any +help they provide is purely voluntary and out of the kindness of their +hearts. + +@node Bug Reports +@section Bug Reports + +@display +I found a bug. What should I include in the bug report? +@end display + +Before you send a bug report, make sure you are using the latest +version. Check @url{ftp://ftp.gnu.org/pub/gnu/bison/} or one of its +mirrors. Be sure to include the version number in your bug report. If +the bug is present in the latest version but not in a previous version, +try to determine the most recent version which did not contain the bug. + +If the bug is parser-related, you should include the smallest grammar +you can which demonstrates the bug. The grammar file should also be +complete (i.e., I should be able to run it through Bison without having +to edit or add anything). The smaller and simpler the grammar, the +easier it will be to fix the bug. + +Include information about your compilation environment, including your +operating system's name and version and your compiler's name and +version. If you have trouble compiling, you should also include a +transcript of the build session, starting with the invocation of +`configure'. Depending on the nature of the bug, you may be asked to +send additional files as well (such as `config.h' or `config.cache'). + +Patches are most welcome, but not required. That is, do not hesitate to +send a bug report just because you can not provide a fix. + +Send bug reports to @email{bug-bison@@gnu.org}. + +@node More Languages +@section More Languages + +@display +Will Bison ever have C++ and Java support? How about @var{insert your +favorite language here}? +@end display + +C++ and Java support is there now, and is documented. We'd love to add other +languages; contributions are welcome. + +@node Beta Testing +@section Beta Testing + +@display +What is involved in being a beta tester? +@end display + +It's not terribly involved. Basically, you would download a test +release, compile it, and use it to build and run a parser or two. After +that, you would submit either a bug report or a message saying that +everything is okay. It is important to report successes as well as +failures because test releases eventually become mainstream releases, +but only if they are adequately tested. If no one tests, development is +essentially halted. + +Beta testers are particularly needed for operating systems to which the +developers do not have easy access. They currently have easy access to +recent GNU/Linux and Solaris versions. Reports about other operating +systems are especially welcome. + +@node Mailing Lists +@section Mailing Lists + +@display +How do I join the help-bison and bug-bison mailing lists? +@end display + +See @url{http://lists.gnu.org/}. + +@c ================================================= Table of Symbols + +@node Table of Symbols +@appendix Bison Symbols +@cindex Bison symbols, table of +@cindex symbols in Bison, table of + +@deffn {Variable} @@$ +In an action, the location of the left-hand side of the rule. +@xref{Locations, , Locations Overview}. +@end deffn + +@deffn {Variable} @@@var{n} +In an action, the location of the @var{n}-th symbol of the right-hand +side of the rule. @xref{Locations, , Locations Overview}. +@end deffn + +@deffn {Variable} $$ +In an action, the semantic value of the left-hand side of the rule. +@xref{Actions}. +@end deffn + +@deffn {Variable} $@var{n} +In an action, the semantic value of the @var{n}-th symbol of the +right-hand side of the rule. @xref{Actions}. +@end deffn + +@deffn {Delimiter} %% +Delimiter used to separate the grammar rule section from the +Bison declarations section or the epilogue. +@xref{Grammar Layout, ,The Overall Layout of a Bison Grammar}. +@end deffn + +@c Don't insert spaces, or check the DVI output. +@deffn {Delimiter} %@{@var{code}%@} +All code listed between @samp{%@{} and @samp{%@}} is copied directly to +the output file uninterpreted. Such code forms the prologue of the input +file. @xref{Grammar Outline, ,Outline of a Bison +Grammar}. +@end deffn + +@deffn {Construct} /*@dots{}*/ +Comment delimiters, as in C. +@end deffn + +@deffn {Delimiter} : +Separates a rule's result from its components. @xref{Rules, ,Syntax of +Grammar Rules}. +@end deffn + +@deffn {Delimiter} ; +Terminates a rule. @xref{Rules, ,Syntax of Grammar Rules}. +@end deffn + +@deffn {Delimiter} | +Separates alternate rules for the same result nonterminal. +@xref{Rules, ,Syntax of Grammar Rules}. +@end deffn + +@deffn {Directive} <*> +Used to define a default tagged @code{%destructor} or default tagged +@code{%printer}. + +This feature is experimental. +More user feedback will help to determine whether it should become a permanent +feature. + +@xref{Destructor Decl, , Freeing Discarded Symbols}. +@end deffn + +@deffn {Directive} <> +Used to define a default tagless @code{%destructor} or default tagless +@code{%printer}. + +This feature is experimental. +More user feedback will help to determine whether it should become a permanent +feature. + +@xref{Destructor Decl, , Freeing Discarded Symbols}. +@end deffn + +@deffn {Symbol} $accept +The predefined nonterminal whose only rule is @samp{$accept: @var{start} +$end}, where @var{start} is the start symbol. @xref{Start Decl, , The +Start-Symbol}. It cannot be used in the grammar. +@end deffn + +@deffn {Directive} %code @{@var{code}@} +@deffnx {Directive} %code @var{qualifier} @{@var{code}@} +Insert @var{code} verbatim into output parser source. +@xref{Decl Summary,,%code}. +@end deffn + +@deffn {Directive} %debug +Equip the parser for debugging. @xref{Decl Summary}. +@end deffn + +@deffn {Directive} %debug +Equip the parser for debugging. @xref{Decl Summary}. +@end deffn + +@ifset defaultprec +@deffn {Directive} %default-prec +Assign a precedence to rules that lack an explicit @samp{%prec} +modifier. @xref{Contextual Precedence, ,Context-Dependent +Precedence}. +@end deffn +@end ifset + +@deffn {Directive} %define @var{define-variable} +@deffnx {Directive} %define @var{define-variable} @var{value} +Define a variable to adjust Bison's behavior. +@xref{Decl Summary,,%define}. +@end deffn + +@deffn {Directive} %defines +Bison declaration to create a header file meant for the scanner. +@xref{Decl Summary}. +@end deffn + +@deffn {Directive} %defines @var{defines-file} +Same as above, but save in the file @var{defines-file}. +@xref{Decl Summary}. +@end deffn + +@deffn {Directive} %destructor +Specify how the parser should reclaim the memory associated to +discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. +@end deffn + +@deffn {Directive} %dprec +Bison declaration to assign a precedence to a rule that is used at parse +time to resolve reduce/reduce conflicts. @xref{GLR Parsers, ,Writing +@acronym{GLR} Parsers}. +@end deffn + +@deffn {Symbol} $end +The predefined token marking the end of the token stream. It cannot be +used in the grammar. +@end deffn + +@deffn {Symbol} error +A token name reserved for error recovery. This token may be used in +grammar rules so as to allow the Bison parser to recognize an error in +the grammar without halting the process. In effect, a sentence +containing an error may be recognized as valid. On a syntax error, the +token @code{error} becomes the current lookahead token. Actions +corresponding to @code{error} are then executed, and the lookahead +token is reset to the token that originally caused the violation. +@xref{Error Recovery}. +@end deffn + +@deffn {Directive} %error-verbose +Bison declaration to request verbose, specific error message strings +when @code{yyerror} is called. +@end deffn + +@deffn {Directive} %file-prefix "@var{prefix}" +Bison declaration to set the prefix of the output files. @xref{Decl +Summary}. +@end deffn + +@deffn {Directive} %glr-parser +Bison declaration to produce a @acronym{GLR} parser. @xref{GLR +Parsers, ,Writing @acronym{GLR} Parsers}. +@end deffn + +@deffn {Directive} %initial-action +Run user code before parsing. @xref{Initial Action Decl, , Performing Actions before Parsing}. +@end deffn + +@deffn {Directive} %language +Specify the programming language for the generated parser. +@xref{Decl Summary}. +@end deffn + +@deffn {Directive} %left +Bison declaration to assign left associativity to token(s). +@xref{Precedence Decl, ,Operator Precedence}. +@end deffn + +@deffn {Directive} %lex-param @{@var{argument-declaration}@} +Bison declaration to specifying an additional parameter that +@code{yylex} should accept. @xref{Pure Calling,, Calling Conventions +for Pure Parsers}. +@end deffn + +@deffn {Directive} %merge +Bison declaration to assign a merging function to a rule. If there is a +reduce/reduce conflict with a rule having the same merging function, the +function is applied to the two semantic values to get a single result. +@xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}. +@end deffn + +@deffn {Directive} %name-prefix "@var{prefix}" +Bison declaration to rename the external symbols. @xref{Decl Summary}. +@end deffn + +@ifset defaultprec +@deffn {Directive} %no-default-prec +Do not assign a precedence to rules that lack an explicit @samp{%prec} +modifier. @xref{Contextual Precedence, ,Context-Dependent +Precedence}. +@end deffn +@end ifset + +@deffn {Directive} %no-lines +Bison declaration to avoid generating @code{#line} directives in the +parser file. @xref{Decl Summary}. +@end deffn + +@deffn {Directive} %nonassoc +Bison declaration to assign nonassociativity to token(s). +@xref{Precedence Decl, ,Operator Precedence}. +@end deffn + +@deffn {Directive} %output "@var{file}" +Bison declaration to set the name of the parser file. @xref{Decl +Summary}. +@end deffn + +@deffn {Directive} %parse-param @{@var{argument-declaration}@} +Bison declaration to specifying an additional parameter that +@code{yyparse} should accept. @xref{Parser Function,, The Parser +Function @code{yyparse}}. +@end deffn + +@deffn {Directive} %prec +Bison declaration to assign a precedence to a specific rule. +@xref{Contextual Precedence, ,Context-Dependent Precedence}. +@end deffn + +@deffn {Directive} %pure-parser +Deprecated version of @code{%define api.pure} (@pxref{Decl Summary, ,%define}), +for which Bison is more careful to warn about unreasonable usage. +@end deffn + +@deffn {Directive} %require "@var{version}" +Require version @var{version} or higher of Bison. @xref{Require Decl, , +Require a Version of Bison}. +@end deffn + +@deffn {Directive} %right +Bison declaration to assign right associativity to token(s). +@xref{Precedence Decl, ,Operator Precedence}. +@end deffn + +@deffn {Directive} %skeleton +Specify the skeleton to use; usually for development. +@xref{Decl Summary}. +@end deffn + +@deffn {Directive} %start +Bison declaration to specify the start symbol. @xref{Start Decl, ,The +Start-Symbol}. +@end deffn + +@deffn {Directive} %token +Bison declaration to declare token(s) without specifying precedence. +@xref{Token Decl, ,Token Type Names}. +@end deffn + +@deffn {Directive} %token-table +Bison declaration to include a token name table in the parser file. +@xref{Decl Summary}. +@end deffn + +@deffn {Directive} %type +Bison declaration to declare nonterminals. @xref{Type Decl, +,Nonterminal Symbols}. +@end deffn + +@deffn {Symbol} $undefined +The predefined token onto which all undefined values returned by +@code{yylex} are mapped. It cannot be used in the grammar, rather, use +@code{error}. +@end deffn + +@deffn {Directive} %union +Bison declaration to specify several possible data types for semantic +values. @xref{Union Decl, ,The Collection of Value Types}. +@end deffn + +@deffn {Macro} YYABORT +Macro to pretend that an unrecoverable syntax error has occurred, by +making @code{yyparse} return 1 immediately. The error reporting +function @code{yyerror} is not called. @xref{Parser Function, ,The +Parser Function @code{yyparse}}. + +For Java parsers, this functionality is invoked using @code{return YYABORT;} +instead. +@end deffn + +@deffn {Macro} YYACCEPT +Macro to pretend that a complete utterance of the language has been +read, by making @code{yyparse} return 0 immediately. +@xref{Parser Function, ,The Parser Function @code{yyparse}}. + +For Java parsers, this functionality is invoked using @code{return YYACCEPT;} +instead. +@end deffn + +@deffn {Macro} YYBACKUP +Macro to discard a value from the parser stack and fake a lookahead +token. @xref{Action Features, ,Special Features for Use in Actions}. +@end deffn + +@deffn {Variable} yychar +External integer variable that contains the integer value of the +lookahead token. (In a pure parser, it is a local variable within +@code{yyparse}.) Error-recovery rule actions may examine this variable. +@xref{Action Features, ,Special Features for Use in Actions}. +@end deffn + +@deffn {Variable} yyclearin +Macro used in error-recovery rule actions. It clears the previous +lookahead token. @xref{Error Recovery}. +@end deffn + +@deffn {Macro} YYDEBUG +Macro to define to equip the parser with tracing code. @xref{Tracing, +,Tracing Your Parser}. +@end deffn + +@deffn {Variable} yydebug +External integer variable set to zero by default. If @code{yydebug} +is given a nonzero value, the parser will output information on input +symbols and parser action. @xref{Tracing, ,Tracing Your Parser}. +@end deffn + +@deffn {Macro} yyerrok +Macro to cause parser to recover immediately to its normal mode +after a syntax error. @xref{Error Recovery}. +@end deffn + +@deffn {Macro} YYERROR +Macro to pretend that a syntax error has just been detected: call +@code{yyerror} and then perform normal error recovery if possible +(@pxref{Error Recovery}), or (if recovery is impossible) make +@code{yyparse} return 1. @xref{Error Recovery}. + +For Java parsers, this functionality is invoked using @code{return YYERROR;} +instead. +@end deffn + +@deffn {Function} yyerror +User-supplied function to be called by @code{yyparse} on error. +@xref{Error Reporting, ,The Error +Reporting Function @code{yyerror}}. +@end deffn + +@deffn {Macro} YYERROR_VERBOSE +An obsolete macro that you define with @code{#define} in the prologue +to request verbose, specific error message strings +when @code{yyerror} is called. It doesn't matter what definition you +use for @code{YYERROR_VERBOSE}, just whether you define it. Using +@code{%error-verbose} is preferred. +@end deffn + +@deffn {Macro} YYINITDEPTH +Macro for specifying the initial size of the parser stack. +@xref{Memory Management}. +@end deffn + +@deffn {Function} yylex +User-supplied lexical analyzer function, called with no arguments to get +the next token. @xref{Lexical, ,The Lexical Analyzer Function +@code{yylex}}. +@end deffn + +@deffn {Macro} YYLEX_PARAM +An obsolete macro for specifying an extra argument (or list of extra +arguments) for @code{yyparse} to pass to @code{yylex}. The use of this +macro is deprecated, and is supported only for Yacc like parsers. +@xref{Pure Calling,, Calling Conventions for Pure Parsers}. +@end deffn + +@deffn {Variable} yylloc +External variable in which @code{yylex} should place the line and column +numbers associated with a token. (In a pure parser, it is a local +variable within @code{yyparse}, and its address is passed to +@code{yylex}.) +You can ignore this variable if you don't use the @samp{@@} feature in the +grammar actions. +@xref{Token Locations, ,Textual Locations of Tokens}. +In semantic actions, it stores the location of the lookahead token. +@xref{Actions and Locations, ,Actions and Locations}. +@end deffn + +@deffn {Type} YYLTYPE +Data type of @code{yylloc}; by default, a structure with four +members. @xref{Location Type, , Data Types of Locations}. +@end deffn + +@deffn {Variable} yylval +External variable in which @code{yylex} should place the semantic +value associated with a token. (In a pure parser, it is a local +variable within @code{yyparse}, and its address is passed to +@code{yylex}.) +@xref{Token Values, ,Semantic Values of Tokens}. +In semantic actions, it stores the semantic value of the lookahead token. +@xref{Actions, ,Actions}. +@end deffn + +@deffn {Macro} YYMAXDEPTH +Macro for specifying the maximum size of the parser stack. @xref{Memory +Management}. +@end deffn + +@deffn {Variable} yynerrs +Global variable which Bison increments each time it reports a syntax error. +(In a pure parser, it is a local variable within @code{yyparse}. In a +pure push parser, it is a member of yypstate.) +@xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}. +@end deffn + +@deffn {Function} yyparse +The parser function produced by Bison; call this function to start +parsing. @xref{Parser Function, ,The Parser Function @code{yyparse}}. +@end deffn + +@deffn {Function} yypstate_delete +The function to delete a parser instance, produced by Bison in push mode; +call this function to delete the memory associated with a parser. +@xref{Parser Delete Function, ,The Parser Delete Function +@code{yypstate_delete}}. +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) +@end deffn + +@deffn {Function} yypstate_new +The function to create a parser instance, produced by Bison in push mode; +call this function to create a new parser. +@xref{Parser Create Function, ,The Parser Create Function +@code{yypstate_new}}. +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) +@end deffn + +@deffn {Function} yypull_parse +The parser function produced by Bison in push mode; call this function to +parse the rest of the input stream. +@xref{Pull Parser Function, ,The Pull Parser Function +@code{yypull_parse}}. +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) +@end deffn + +@deffn {Function} yypush_parse +The parser function produced by Bison in push mode; call this function to +parse a single token. @xref{Push Parser Function, ,The Push Parser Function +@code{yypush_parse}}. +(The current push parsing interface is experimental and may evolve. +More user feedback will help to stabilize it.) +@end deffn + +@deffn {Macro} YYPARSE_PARAM +An obsolete macro for specifying the name of a parameter that +@code{yyparse} should accept. The use of this macro is deprecated, and +is supported only for Yacc like parsers. @xref{Pure Calling,, Calling +Conventions for Pure Parsers}. +@end deffn + +@deffn {Macro} YYRECOVERING +The expression @code{YYRECOVERING ()} yields 1 when the parser +is recovering from a syntax error, and 0 otherwise. +@xref{Action Features, ,Special Features for Use in Actions}. +@end deffn + +@deffn {Macro} YYSTACK_USE_ALLOCA +Macro used to control the use of @code{alloca} when the C +@acronym{LALR}(1) parser needs to extend its stacks. If defined to 0, +the parser will use @code{malloc} to extend its stacks. If defined to +1, the parser will use @code{alloca}. Values other than 0 and 1 are +reserved for future Bison extensions. If not defined, +@code{YYSTACK_USE_ALLOCA} defaults to 0. + +In the all-too-common case where your code may run on a host with a +limited stack and with unreliable stack-overflow checking, you should +set @code{YYMAXDEPTH} to a value that cannot possibly result in +unchecked stack overflow on any of your target hosts when +@code{alloca} is called. You can inspect the code that Bison +generates in order to determine the proper numeric values. This will +require some expertise in low-level implementation details. +@end deffn + +@deffn {Type} YYSTYPE +Data type of semantic values; @code{int} by default. +@xref{Value Type, ,Data Types of Semantic Values}. +@end deffn + +@node Glossary +@appendix Glossary +@cindex glossary + +@table @asis +@item Backus-Naur Form (@acronym{BNF}; also called ``Backus Normal Form'') +Formal method of specifying context-free grammars originally proposed +by John Backus, and slightly improved by Peter Naur in his 1960-01-02 +committee document contributing to what became the Algol 60 report. +@xref{Language and Grammar, ,Languages and Context-Free Grammars}. + +@item Context-free grammars +Grammars specified as rules that can be applied regardless of context. +Thus, if there is a rule which says that an integer can be used as an +expression, integers are allowed @emph{anywhere} an expression is +permitted. @xref{Language and Grammar, ,Languages and Context-Free +Grammars}. + +@item Dynamic allocation +Allocation of memory that occurs during execution, rather than at +compile time or on entry to a function. + +@item Empty string +Analogous to the empty set in set theory, the empty string is a +character string of length zero. + +@item Finite-state stack machine +A ``machine'' that has discrete states in which it is said to exist at +each instant in time. As input to the machine is processed, the +machine moves from state to state as specified by the logic of the +machine. In the case of the parser, the input is the language being +parsed, and the states correspond to various stages in the grammar +rules. @xref{Algorithm, ,The Bison Parser Algorithm}. + +@item Generalized @acronym{LR} (@acronym{GLR}) +A parsing algorithm that can handle all context-free grammars, including those +that are not @acronym{LALR}(1). It resolves situations that Bison's +usual @acronym{LALR}(1) +algorithm cannot by effectively splitting off multiple parsers, trying all +possible parsers, and discarding those that fail in the light of additional +right context. @xref{Generalized LR Parsing, ,Generalized +@acronym{LR} Parsing}. + +@item Grouping +A language construct that is (in general) grammatically divisible; +for example, `expression' or `declaration' in C@. +@xref{Language and Grammar, ,Languages and Context-Free Grammars}. + +@item Infix operator +An arithmetic operator that is placed between the operands on which it +performs some operation. + +@item Input stream +A continuous flow of data between devices or programs. + +@item Language construct +One of the typical usage schemas of the language. For example, one of +the constructs of the C language is the @code{if} statement. +@xref{Language and Grammar, ,Languages and Context-Free Grammars}. + +@item Left associativity +Operators having left associativity are analyzed from left to right: +@samp{a+b+c} first computes @samp{a+b} and then combines with +@samp{c}. @xref{Precedence, ,Operator Precedence}. + +@item Left recursion +A rule whose result symbol is also its first component symbol; for +example, @samp{expseq1 : expseq1 ',' exp;}. @xref{Recursion, ,Recursive +Rules}. + +@item Left-to-right parsing +Parsing a sentence of a language by analyzing it token by token from +left to right. @xref{Algorithm, ,The Bison Parser Algorithm}. + +@item Lexical analyzer (scanner) +A function that reads an input stream and returns tokens one by one. +@xref{Lexical, ,The Lexical Analyzer Function @code{yylex}}. + +@item Lexical tie-in +A flag, set by actions in the grammar rules, which alters the way +tokens are parsed. @xref{Lexical Tie-ins}. + +@item Literal string token +A token which consists of two or more fixed characters. @xref{Symbols}. + +@item Lookahead token +A token already read but not yet shifted. @xref{Lookahead, ,Lookahead +Tokens}. + +@item @acronym{LALR}(1) +The class of context-free grammars that Bison (like most other parser +generators) can handle; a subset of @acronym{LR}(1). @xref{Mystery +Conflicts, ,Mysterious Reduce/Reduce Conflicts}. + +@item @acronym{LR}(1) +The class of context-free grammars in which at most one token of +lookahead is needed to disambiguate the parsing of any piece of input. + +@item Nonterminal symbol +A grammar symbol standing for a grammatical construct that can +be expressed through rules in terms of smaller constructs; in other +words, a construct that is not a token. @xref{Symbols}. + +@item Parser +A function that recognizes valid sentences of a language by analyzing +the syntax structure of a set of tokens passed to it from a lexical +analyzer. + +@item Postfix operator +An arithmetic operator that is placed after the operands upon which it +performs some operation. + +@item Reduction +Replacing a string of nonterminals and/or terminals with a single +nonterminal, according to a grammar rule. @xref{Algorithm, ,The Bison +Parser Algorithm}. + +@item Reentrant +A reentrant subprogram is a subprogram which can be in invoked any +number of times in parallel, without interference between the various +invocations. @xref{Pure Decl, ,A Pure (Reentrant) Parser}. + +@item Reverse polish notation +A language in which all operators are postfix operators. + +@item Right recursion +A rule whose result symbol is also its last component symbol; for +example, @samp{expseq1: exp ',' expseq1;}. @xref{Recursion, ,Recursive +Rules}. + +@item Semantics +In computer languages, the semantics are specified by the actions +taken for each instance of the language, i.e., the meaning of +each statement. @xref{Semantics, ,Defining Language Semantics}. + +@item Shift +A parser is said to shift when it makes the choice of analyzing +further input from the stream rather than reducing immediately some +already-recognized rule. @xref{Algorithm, ,The Bison Parser Algorithm}. + +@item Single-character literal +A single character that is recognized and interpreted as is. +@xref{Grammar in Bison, ,From Formal Rules to Bison Input}. + +@item Start symbol +The nonterminal symbol that stands for a complete valid utterance in +the language being parsed. The start symbol is usually listed as the +first nonterminal symbol in a language specification. +@xref{Start Decl, ,The Start-Symbol}. + +@item Symbol table +A data structure where symbol names and associated data are stored +during parsing to allow for recognition and use of existing +information in repeated uses of a symbol. @xref{Multi-function Calc}. + +@item Syntax error +An error encountered during parsing of an input stream due to invalid +syntax. @xref{Error Recovery}. + +@item Token +A basic, grammatically indivisible unit of a language. The symbol +that describes a token in the grammar is a terminal symbol. +The input of the Bison parser is a stream of tokens which comes from +the lexical analyzer. @xref{Symbols}. + +@item Terminal symbol +A grammar symbol that has no rules in the grammar and therefore is +grammatically indivisible. The piece of text it represents is a token. +@xref{Language and Grammar, ,Languages and Context-Free Grammars}. +@end table + +@node Copying This Manual +@appendix Copying This Manual +@include fdl.texi + +@node Index +@unnumbered Index + +@printindex cp + +@bye + +@c LocalWords: texinfo setfilename settitle setchapternewpage finalout +@c LocalWords: ifinfo smallbook shorttitlepage titlepage GPL FIXME iftex +@c LocalWords: akim fn cp syncodeindex vr tp synindex dircategory direntry +@c LocalWords: ifset vskip pt filll insertcopying sp ISBN Etienne Suvasa +@c LocalWords: ifnottex yyparse detailmenu GLR RPN Calc var Decls Rpcalc +@c LocalWords: rpcalc Lexer Expr ltcalc mfcalc yylex +@c LocalWords: yyerror pxref LR yylval cindex dfn LALR samp gpl BNF xref +@c LocalWords: const int paren ifnotinfo AC noindent emph expr stmt findex +@c LocalWords: glr YYSTYPE TYPENAME prog dprec printf decl init stmtMerge +@c LocalWords: pre STDC GNUC endif yy YY alloca lf stddef stdlib YYDEBUG +@c LocalWords: NUM exp subsubsection kbd Ctrl ctype EOF getchar isdigit +@c LocalWords: ungetc stdin scanf sc calc ulator ls lm cc NEG prec yyerrok +@c LocalWords: longjmp fprintf stderr yylloc YYLTYPE cos ln +@c LocalWords: smallexample symrec val tptr FNCT fnctptr func struct sym +@c LocalWords: fnct putsym getsym fname arith fncts atan ptr malloc sizeof +@c LocalWords: strlen strcpy fctn strcmp isalpha symbuf realloc isalnum +@c LocalWords: ptypes itype YYPRINT trigraphs yytname expseq vindex dtype +@c LocalWords: Rhs YYRHSLOC LE nonassoc op deffn typeless yynerrs +@c LocalWords: yychar yydebug msg YYNTOKENS YYNNTS YYNRULES YYNSTATES +@c LocalWords: cparse clex deftypefun NE defmac YYACCEPT YYABORT param +@c LocalWords: strncmp intval tindex lvalp locp llocp typealt YYBACKUP +@c LocalWords: YYEMPTY YYEOF YYRECOVERING yyclearin GE def UMINUS maybeword +@c LocalWords: Johnstone Shamsa Sadaf Hussain Tomita TR uref YYMAXDEPTH +@c LocalWords: YYINITDEPTH stmnts ref stmnt initdcl maybeasm notype +@c LocalWords: hexflag STR exdent itemset asis DYYDEBUG YYFPRINTF args +@c LocalWords: infile ypp yxx outfile itemx tex leaderfill +@c LocalWords: hbox hss hfill tt ly yyin fopen fclose ofirst gcc ll +@c LocalWords: nbar yytext fst snd osplit ntwo strdup AST +@c LocalWords: YYSTACK DVI fdl printindex diff --git a/doc/bison.x b/doc/bison.x new file mode 100644 index 0000000..1eaa9fd --- /dev/null +++ b/doc/bison.x @@ -0,0 +1,55 @@ +[name] +bison \- GNU Project parser generator (yacc replacement) + +[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 = . diff --git a/doc/common.x b/doc/common.x new file mode 100644 index 0000000..60224c3 --- /dev/null +++ b/doc/common.x @@ -0,0 +1,4 @@ +[see also] +.BR lex (1), +.BR flex (1), +.BR yacc (1). diff --git a/doc/cross-options.texi b/doc/cross-options.texi new file mode 100644 index 0000000..52915db --- /dev/null +++ b/doc/cross-options.texi @@ -0,0 +1,21 @@ +@item @option{--debug} @tab @option{-t} +@item @option{--defines=[@var{file}]} @tab +@item @option{--file-prefix=@var{prefix}} @tab @option{-b} @var{prefix} +@item @option{--graph=[@var{file}]} @tab @option{-g} [@var{file}] +@item @option{--help} @tab @option{-h} +@item @option{--language=@var{language}} @tab @option{-L} @var{language} +@item @option{--locations} @tab +@item @option{--name-prefix=@var{prefix}} @tab @option{-p} @var{prefix} +@item @option{--no-lines} @tab @option{-l} +@item @option{--output=@var{file}} @tab @option{-o} @var{file} +@item @option{--print-datadir} @tab +@item @option{--print-localedir} @tab +@item @option{--report-file=@var{file}} @tab +@item @option{--report=@var{things}} @tab @option{-r} @var{things} +@item @option{--skeleton=@var{file}} @tab @option{-S} @var{file} +@item @option{--token-table} @tab @option{-k} +@item @option{--verbose} @tab @option{-v} +@item @option{--version} @tab @option{-V} +@item @option{--warnings} @tab @option{-W} +@item @option{--xml=[@var{file}]} @tab @option{-x} [@var{file}] +@item @option{--yacc} @tab @option{-y} diff --git a/doc/fdl.texi b/doc/fdl.texi new file mode 100644 index 0000000..7b93651 --- /dev/null +++ b/doc/fdl.texi @@ -0,0 +1,451 @@ +@c The GNU Free Documentation License. +@center Version 1.2, November 2002 + +@c This file is intended to be included within another document, +@c hence no sectioning command or @node. + +@display +Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document @dfn{free} in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The ``Document'', below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as ``you''. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +@sc{ascii} without markup, Texinfo input format, La@TeX{} input +format, @acronym{SGML} or @acronym{XML} using a publicly available +@acronym{DTD}, and standard-conforming simple @acronym{HTML}, +PostScript or @acronym{PDF} designed for human modification. Examples +of transparent image formats include @acronym{PNG}, @acronym{XCF} and +@acronym{JPG}. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, @acronym{SGML} or +@acronym{XML} for which the @acronym{DTD} and/or processing tools are +not generally available, and the machine-generated @acronym{HTML}, +PostScript or @acronym{PDF} produced by some word processors for +output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +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, +preceding the beginning of the body of the text. + +A section ``Entitled XYZ'' means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as ``Acknowledgements'', +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' +of such a section when you modify the Document means that it remains a +section ``Entitled XYZ'' according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + +@item +COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +@enumerate A +@item +Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +@item +List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +@item +State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +@item +Preserve all the copyright notices of the Document. + +@item +Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +@item +Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +@item +Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document's license notice. + +@item +Include an unaltered copy of this License. + +@item +Preserve the section Entitled ``History'', Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +@item +Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the ``History'' section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +@item +For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +@item +Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +@item +Delete any section Entitled ``Endorsements''. Such a section +may not be included in the Modified Version. + +@item +Do not retitle any existing section to be Entitled ``Endorsements'' or +to conflict in title with any Invariant Section. + +@item +Preserve any Warranty Disclaimers. +@end enumerate + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties---for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled ``History'' +in the various original documents, forming one section Entitled +``History''; likewise combine any sections Entitled ``Acknowledgements'', +and any sections Entitled ``Dedications''. You must delete all +sections Entitled ``Endorsements.'' + +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an ``aggregate'' if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled ``Acknowledgements'', +``Dedications'', or ``History'', the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +@uref{http://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +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 +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +@end enumerate + +@page +@heading ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + 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 + Free Documentation License''. +@end group +@end smallexample + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the ``with@dots{}Texts.'' line with this: + +@smallexample +@group + with the Invariant Sections being @var{list their titles}, with + the Front-Cover Texts being @var{list}, and with the Back-Cover Texts + being @var{list}. +@end group +@end smallexample + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +@c Local Variables: +@c ispell-local-pdict: "ispell-dict" +@c End: + diff --git a/doc/gpl-3.0.texi b/doc/gpl-3.0.texi new file mode 100644 index 0000000..1908d1f --- /dev/null +++ b/doc/gpl-3.0.texi @@ -0,0 +1,717 @@ +@c The GNU General Public License. +@center Version 3, 29 June 2007 + +@c This file is intended to be included within another document, +@c hence no sectioning command or @node. + +@display +Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/} + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. +@end display + +@heading Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom +to share and change all versions of a program---to make sure it remains +free software for all its users. We, the Free Software Foundation, +use the GNU General Public License for most of our software; it +applies also to any other work released this way by its authors. You +can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you +have certain responsibilities if you distribute copies of the +software, or if you modify it: responsibilities to respect the freedom +of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, +receive or can get the source code. And you must show them these +terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the +manufacturer can do so. This is fundamentally incompatible with the +aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for +individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the +practice for those products. If such problems arise substantially in +other domains, we stand ready to extend this provision to those +domains in future versions of the GPL, as needed to protect the +freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish +to avoid the special danger that patents applied to a free program +could make it effectively proprietary. To prevent this, the GPL +assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +@heading TERMS AND CONDITIONS + +@enumerate 0 +@item Definitions. + +``This License'' refers to version 3 of the GNU General Public License. + +``Copyright'' also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + +``The Program'' refers to any copyrightable work licensed under this +License. Each licensee is addressed as ``you''. ``Licensees'' and +``recipients'' may be individuals or organizations. + +To ``modify'' a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a ``modified version'' of +the earlier work or a work ``based on'' the earlier work. + +A ``covered work'' means either the unmodified Program or a work based +on the Program. + +To ``propagate'' a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To ``convey'' a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + +An interactive user interface displays ``Appropriate Legal Notices'' to +the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +@item Source Code. + +The ``source code'' for a work means the preferred form of the work for +making modifications to it. ``Object code'' means any non-source form +of a work. + +A ``Standard Interface'' means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The ``System Libraries'' of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +``Major Component'', in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The ``Corresponding Source'' for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same +work. + +@item Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, +without conditions so long as your license otherwise remains in force. +You may convey covered works to others for the sole purpose of having +them make modifications exclusively for you, or provide you with +facilities for running those works, provided that you comply with the +terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for +you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your +copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +@item Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such +circumvention is effected by exercising rights under this License with +respect to the covered work, and you disclaim any intention to limit +operation or modification of the work as a means of enforcing, against +the work's users, your or third parties' legal rights to forbid +circumvention of technological measures. + +@item Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +@item Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + +@enumerate a +@item +The work must carry prominent notices stating that you modified it, +and giving a relevant date. + +@item +The work must carry prominent notices stating that it is released +under this License and any conditions added under section 7. This +requirement modifies the requirement in section 4 to ``keep intact all +notices''. + +@item +You must license the entire work, as a whole, under this License to +anyone who comes into possession of a copy. This License will +therefore apply, along with any applicable section 7 additional terms, +to the whole of the work, and all its parts, regardless of how they +are packaged. This License gives no permission to license the work in +any other way, but it does not invalidate such permission if you have +separately received it. + +@item +If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your work +need not make them do so. +@end enumerate + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +``aggregate'' if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +@item Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of +sections 4 and 5, provided that you also convey the machine-readable +Corresponding Source under the terms of this License, in one of these +ways: + +@enumerate a +@item +Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium customarily +used for software interchange. + +@item +Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a written +offer, valid for at least three years and valid for as long as you +offer spare parts or customer support for that product model, to give +anyone who possesses the object code either (1) a copy of the +Corresponding Source for all the software in the product that is +covered by this License, on a durable physical medium customarily used +for software interchange, for a price no more than your reasonable +cost of physically performing this conveying of source, or (2) access +to copy the Corresponding Source from a network server at no charge. + +@item +Convey individual copies of the object code with a copy of the written +offer to provide the Corresponding Source. This alternative is +allowed only occasionally and noncommercially, and only if you +received the object code with such an offer, in accord with subsection +6b. + +@item +Convey the object code by offering access from a designated place +(gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to copy +the object code is a network server, the Corresponding Source may be +on a different server (operated by you or a third party) that supports +equivalent copying facilities, provided you maintain clear directions +next to the object code saying where to find the Corresponding Source. +Regardless of what server hosts the Corresponding Source, you remain +obligated to ensure that it is available for as long as needed to +satisfy these requirements. + +@item +Convey the object code using peer-to-peer transmission, provided you +inform other peers where the object code and Corresponding Source of +the work are being offered to the general public at no charge under +subsection 6d. + +@end enumerate + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A ``User Product'' is either (1) a ``consumer product'', which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is a +consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +``normally used'' refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product has substantial commercial, industrial or +non-consumer uses, unless such uses represent the only significant +mode of use of the product. + +``Installation Information'' for a User Product means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +@item Additional Terms. + +``Additional permissions'' are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + +@enumerate a +@item +Disclaiming warranty or limiting liability differently from the terms +of sections 15 and 16 of this License; or + +@item +Requiring preservation of specified reasonable legal notices or author +attributions in that material or in the Appropriate Legal Notices +displayed by works containing it; or + +@item +Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +@item +Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +@item +Declining to grant rights under trademark law for use of some trade +names, trademarks, or service marks; or + +@item +Requiring indemnification of licensors and authors of that material by +anyone who conveys the material (or modified versions of it) with +contractual assumptions of liability to the recipient, for any +liability that these contractual assumptions directly impose on those +licensors and authors. +@end enumerate + +All other non-permissive additional terms are considered ``further +restrictions'' within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + +@item Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +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, you do not qualify to receive new licenses for the same +material under section 10. + +@item Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run +a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +@item Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An ``entity transaction'' is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +@item Patents. + +A ``contributor'' is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's ``contributor version''. + +A contributor's ``essential patent claims'' are all patent claims owned +or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, ``control'' includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a ``patent license'' is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To ``grant'' such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. ``Knowingly relying'' means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is ``discriminatory'' if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on +the non-exercise of one or more of the rights that are specifically +granted under this License. You may not convey a covered work if you +are a party to an arrangement with a third party that is in the +business of distributing software, under which you make payment to the +third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties +who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by +you (or copies made from those copies), or (b) primarily for and in +connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent +license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +@item No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey +a covered work so as to satisfy simultaneously your obligations under +this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree +to terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +@item Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +@item Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU General Public +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that numbered version or +of any later version published by the Free Software Foundation. If +the Program does not specify a version number of the GNU General +Public License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions +of the GNU General Public License can be used, that proxy's public +statement of acceptance of a version permanently authorizes you to +choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +@item Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +@item Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR +CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT +NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR +LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM +TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +@item Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +@end enumerate + +@heading END OF TERMS AND CONDITIONS + +@heading How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the ``copyright'' line and a pointer to where the full notice is found. + +@smallexample +@var{one line to give the program's name and a brief idea of what it does.} +Copyright (C) @var{year} @var{name of author} + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +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 @url{http://www.gnu.org/licenses/}. +@end smallexample + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + +@smallexample +@var{program} Copyright (C) @var{year} @var{name of author} +This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}. +This is free software, and you are welcome to redistribute it +under certain conditions; type @samp{show c} for details. +@end smallexample + +The hypothetical commands @samp{show w} and @samp{show c} should show +the appropriate parts of the General Public License. Of course, your +program's commands might be different; for a GUI interface, you would +use an ``about box''. + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a ``copyright disclaimer'' for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +@url{http://www.gnu.org/licenses/}. + +The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use +the GNU Lesser General Public License instead of this License. But +first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}. diff --git a/doc/refcard.tex b/doc/refcard.tex new file mode 100644 index 0000000..85663cd --- /dev/null +++ b/doc/refcard.tex @@ -0,0 +1,510 @@ +% Bison Quick Reference + +%**start of header +\newcount\columnsperpage + +% This file can be printed with 1 or 2 columns per page (see below). +% Specify how many you want here. Nothing else needs to be changed +% unless you are maintaining the documentation. +% For printing reference cards to use in books, specify one column +% per page and reduce to 80%. +% Note that if columnsperpage is set to 2, there will be a few overfull +% boxes, but they are not serious. Just uncomment \finalout. + +\columnsperpage=1 + +% comment out this line if you want page numbers to appear. +\nopagenumbers + +\def\finalout{\overfullrule=0pt} +%\finalout + +% Copyright (c) 1998, 2001 Free Software Foundation, Inc. +% +% This file is part of 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 . +% +% This file is intended to be processed by plain TeX (TeX82). +% +% The final reference card has two columns: +% This file can be used to produce it in any of three ways: +% 1 column per page +% produces two separate pages, each of which needs to be reduced to 80%. +% This gives the best resolution. +% 2 columns per page +% produces a single page. +% You will still need to cut and paste. +% Which mode to use is controlled by setting \columnsperpage above. +% +% Authors: +% Brendan Kehoe +% UUCP: widener!brendan +% Internet: brendan@cs.widener.edu +% +% Gavin Nicol +% Internet: nick@nsis.cl.co.jp +% +% This refcard format was created by Steve Gildea. +% +% Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik +% for their many good ideas. + +% We only change the following to change the version numbers and +% such. + +\def\bisonversion{1.31} % the bison version + +\def\refcardversion{0.5} % reference card version +\def\month{November} % month +\def\year{2001} % year +\def\version{\month\ \year, Bison Refcard Version \refcardversion} + +% for copyright notices +\def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip} +\def\medium{\mediumfont\textfont2=\mediumsy\baselineskip=.8\baselineskip} + +\def\copyrightnotice{ +\vskip .15ex plus .25 fill +\begingroup\medium +\centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.} +\vskip .2\baselineskip +\centerline{\version} +\vskip .2\baselineskip +\centerline{designed by Brendan Kehoe and Gavin Nicol} +\vskip .2\baselineskip +\centerline{for Bison \bisonversion} + +Permission is granted to make and distribute copies of this card +provided the copyright notice and this permission notice +are preserved on all copies. +\vskip .2\baselineskip +For information, write to the: +\vskip .2\baselineskip +\centerline{Free Software Foundation, Inc.} +\vskip .2\baselineskip +\centerline{51 Franklin Street, Fifth Floor} +\vskip .2\baselineskip +\centerline{Boston, MA 02110-1301 USA} +\endgroup} + +%%%% smallcopyrightnotice for two column printing on one page. +\def\smallcopyrightnotice{ +\vskip .15ex plus .25 fill +\begingroup\small +\centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.} +\vskip .2\baselineskip +\centerline{\version} +\vskip .2\baselineskip +\centerline{designed by Brendan Kehoe and Gavin Nicol} +\vskip .2\baselineskip +\centerline{for Bison \bisonversion} + +Permission is granted to make and distribute copies of this card +provided the copyright notice and this permission notice +are preserved on all copies. +\vskip .2\baselineskip +For information, write to the: +\vskip .2\baselineskip +\centerline{Free Software Foundation, Inc.} +\vskip .2\baselineskip +\centerline{51 Franklin Street, Fifth Floor} +\vskip .2\baselineskip +\centerline{Boston, MA 02110-1301 USA} +\endgroup} + +% make \bye not \outer so that the \def\bye in the \else clause below +% can be scanned without complaint. +\def\bye{\par\vfill\supereject\end} + +\newdimen\intercolumnskip +\newbox\columna +\newbox\columnb + +\def\ncolumns{\the\columnsperpage} + +\message{[\ncolumns\space + column\if 1\ncolumns\else s\fi\space per page]} + +\def\scaledmag#1{ scaled \magstep #1} + +% This multi-way format was designed by Stephen Gildea +% October 1986. +\if 1\ncolumns + \hsize 4in + \vsize 10in +% We want output .3 inch *from top of paper edge*; i.e. -.7in from TeX default + \voffset -.7in % Comment out for xdvi viewing; include for printing. + \font\titlefont=\fontname\tenbf \scaledmag3 + \font\headingfont=\fontname\tenbf \scaledmag2 + \font\smallfont=cmr6 + \font\smallsy=cmsy6 + \font\mediumfont=cmr10 + \font\mediumsy=cmsy10 + + +% two lines below commented out in Yet Another Attempt to eliminate +% page numbers from the output. + \footline{\hss} +% \footline{\hss\folio} + \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}} +\else + \hsize 3.2in + \vsize 7.95in + \hoffset -.75in + \voffset -.745in + \font\titlefont=cmbx10 \scaledmag2 + \font\headingfont=cmbx10 \scaledmag1 + \font\smallfont=cmr6 + \font\smallsy=cmsy6 + \font\eightrm=cmr8 + \font\eightbf=cmbx8 + \font\eightit=cmti8 + \font\eighttt=cmtt8 + \font\eightsy=cmsy8 + \textfont0=\eightrm + \textfont2=\eightsy + \def\rm{\eightrm} + \def\bf{\eightbf} + \def\it{\eightit} + \def\tt{\eighttt} +%%%% Reduce skip from .8 to .75 to permit printing on two pages. + \normalbaselineskip=.75\normalbaselineskip + \normallineskip=.75\normallineskip + \normallineskiplimit=.75\normallineskiplimit + \normalbaselines\rm %make definitions take effect + + \if 2\ncolumns + \let\maxcolumn=b + \footline{\hss\rm\folio\hss} + \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}} + \font\mediumfont=cmr10 + \font\mediumsy=cmsy10 + +% Leave 3 column code here in case size increases. + \else \if 3\ncolumns + \let\maxcolumn=c + \nopagenumbers + \font\mediumfont=cmr10 + \font\mediumsy=cmsy10 + + \else + \errhelp{You must set \columnsperpage equal to 1, 2, or 3.} + \errmessage{Illegal number of columns per page} + \fi\fi + + \intercolumnskip=.46in + \def\abc{a} + \output={% + % This next line is useful when designing the layout. + %\immediate\write16{Column \folio\abc\space starts with \firstmark} + \if \maxcolumn\abc \multicolumnformat \global\def\abc{a} + \else\if a\abc + \global\setbox\columna\columnbox \global\def\abc{b} + %% in case we never use \columnb (two-column mode) + \global\setbox\columnb\hbox to -\intercolumnskip{} + \else + \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi} + \def\multicolumnformat{\shipout\vbox{\makeheadline + \hbox{\box\columna\hskip\intercolumnskip + \box\columnb\hskip\intercolumnskip\columnbox} + \makefootline}\advancepageno} + \def\columnbox{\leftline{\pagebody}} + + \def\bye{\par\vfill\supereject + \if a\abc \else\null\vfill\eject\fi + \if a\abc \else\null\vfill\eject\fi + \end} +\fi + +% we won't be using math mode much, so redefine some of the characters +% we might want to talk about +\catcode`\^=12 +\catcode`\_=12 + +\chardef\\=`\\ +\chardef\{=`\{ +\chardef\}=`\} + +\hyphenation{mini-buf-fer} + +\parindent 0pt +% \parskip 1ex plus .5ex minus .5ex +\parskip 0.5ex plus .25ex minus .25ex + +\outer\def\newcolumn{\vfill\eject} + +\outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex} + +\outer\def\section#1{\par\filbreak + \vskip 1.5ex plus 1ex minus 1ex {\headingfont #1}\mark{#1}% + \vskip 1ex plus .5ex minus 0.75ex} + +\newdimen\keyindent + +\def\beginindentedkeys{\keyindent=1em} +\def\endindentedkeys{\keyindent=0em} +\endindentedkeys + +\def\paralign{\vskip\parskip\halign} + +\def\<#1>{$\langle${\rm #1}$\rangle$} + +\def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows + +\def\beginexample{\par\leavevmode\begingroup + \obeylines\obeyspaces\parskip0pt\tt} +{\obeyspaces\global\let =\ } +\def\endexample{\endgroup} +\def\begincexample{% + \par\leavevmode\begingroup% + \obeylines\obeyspaces% + % bpk--added indentation + \advance\leftskip.25truein +% \parskip0pt% + \tt} +{\obeyspaces\global\let =\ } +\def\endcexample{\endgroup} + +%%%%% Prime definition of key; redefined below to prevent overful hboxes + +\def\key#1#2{\leavevmode\hbox to \hsize + {\vtop {\hsize=.67\hsize \rightskip=1em #1} + \kbd{#2}\hfil}} + +\newbox\metaxbox +\setbox\metaxbox\hbox{\kbd{M-x }} +\newdimen\metaxwidth +\metaxwidth=\wd\metaxbox + +\def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize + {\hskip\keyindent\relax#1\hfil}% + \hskip -\metaxwidth minus 1fil + \kbd{#2}\hfil}} + +\def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad + &\kbd{#3}\quad\cr} + +%**end of header + +% ************ +% ** BISON ** +% ************ + +\title{Bison Quick Reference} + +\section{Starting Bison} +%*********************** + +To use Bison, type: \kbd{bison {\it filename}} + +Options can be used as: \kbd{bison {\it options} {\it filename}} + +\section{Command Line Options} +%***************************** + +\key{Display usage information.} {-h} +\key{Display version information.} {-V} +\key{Generate token and {\tt YYSTYPE} definitions.} {-d} +\key{Prepend a prefix to external symbols.} {-p {\it prefix}} +\key{Don't put {\tt \#line} directives in the parser.} {-l} +\key{Specify the output file.} {-o {\it filename}} +\key{Debug or {\it trace} mode.} {-t} +\key{Verbose description of the parser.} {-v} +\key{Emulate {\tt yacc} (generate {\tt y.tab.*} files).} {-y} + +\vskip .10truein +{\bf Note:} The token and {\tt YYSTYPE} definitions are generated +to a file called {\tt y.tab.h} if the {\tt -y} option is used, +otherwise it will have the format {\tt {\it name}.tab.h}, where +{\it name} is the leading part of the parser definition filename. + +\section{Definitions} +%******************** + +\key{Declare a terminal symbol.}{\%token <{\it t\/}> + {\it n}} + +\key{Declare a terminal symbol, and define its association.} + {{\it association} <{\it t\/}> {\it n}} + +\vskip .2\baselineskip +\key{Generate a reentrant (pure) parser.} + {\%pure_parser} + +\key{Define the union of all data types used in the parser.} + {\%union\{{\it field list}\} } + +\vskip .2\baselineskip +\key{Tell {\tt bison} where to start parsing.} + {\%start {\it m}} + +\key{Tell {\tt bison} the data type of symbols.} + {\%type <{\it t\/}> {\it s1}\dots{\it sn}} + +\vskip .10truein + +In the above, {\it t} is a {\it type} defined in the {\tt \%union} +definition, {\it n} is a {\it terminal} symbol name, {\it m} is a +{\it non-terminal} symbol name, and {\it association} can be one of +{\tt \%left}, {\tt \%right}, or {\tt \%nonassoc}. + +\vskip .10truein + +The {\tt <{\it t\/}>} after {\tt \%token, \%left, \%right} and {\tt + \%nonassoc} is optional. Additionally, precedence may be overridden +in the rules with {\tt \%prec} commands. + +\section{Parser Definition Files} +%********************************* + +The general form for a parser definition is: + +\begincexample +\{\% + /* Initial C code. */ +\%\} + + {\it Token and type definitions} + +\%\% + + Rule definition 1 + \vdots + Rule definition {\it n} + +\%\% + + /* Other C code. */ +\endcexample + + +% Decrease standard baselineskip for the second page + \baselineskip = .9\baselineskip + +\section {Rule definitions} +%************************** + +Rules take the form: + +\vskip -\baselineskip +\beginexample + non-terminal : {\it statement} 1 + | {\it statement} 2 + \vdots + | {\it statement n} + ; +\endexample + +Where {\it statements} can be either empty, or contain +a mixture of C code (enclosed in {\tt \{...\}}), and the +symbols that make up the non-terminal. For example: + +\vskip -\baselineskip +\beginexample + expression : number '$+$' number \{ \$\$ $=$ \$1 $+$ \$3 \} + | number '$-$' number \{ \$\$ $=$ \$1 $-$ \$3 \} + | number '$/$' number \{ \$\$ $=$ \$1 $/$ \$3 \} + | number '$*$' number \{ \$\$ $=$ \$1 $*$ \$3 \} + ; +\endexample + +For altering the precedence of a symbol use: +\vskip -\baselineskip + +\beginexample + \%prec name +\endexample + +For example: +\vskip -\baselineskip +\beginexample + foo : gnu bar gnu \%prec bar + ; +\endexample + +\section{Grammar Variables and Symbols} +%************************************** + +\key{Recognize an error \& continue parsing.}{error} +\key{Access data associated with a symbol.} {\$\$, \$0\dots\${\it n}} +\key{Access a field of the data union.} {\$\$.{\it t}, + \$0.{\it t}\dots\${\it n}.{\it t}} +\key{Access symbol's location.} {@\$, @0\dots@{\it n}} +\key{Access data's line location.} {@{\it x}.{\it line\_spec}} +\key{Access data's column location.} {@{\it x}.{\it column\_spec}} + + +\vskip .10truein +% +Where {\it t} is a type defined in the {\tt \%union}, {\it n} is a +number, {\it x} is a number or \$, {\it line\_spec} one of {\tt + first_line} and {\tt last_line}, and {\it column\_spec} is specified +as either {\tt first_column} or {\tt last_column}. + +\section {Variables and Types} +%***************************** + +\key{Current lookahead token.} {yychar} +\key{Debug mode flag.} {yydebug} +\key{Data associated with the current token.} {yylval} +\key{Source position of current token.} {yylloc} +\key{Number of errors encountered.} {yynerrs} +\key{Position information type.} {YYLTYPE} +\key{Data type associated with symbols.} {YYSTYPE} + +\section {Functions} +%******************* + +% Redefine to prevent overfull hboxes +\def\key#1#2{\leavevmode\hbox to \hsize + {\vtop {\hsize=.625\hsize \rightskip=1em #1} + \kbd{#2}\hfil}} + +\key{User defined error handler.} {int yyerror(char *)} +\key{User defined lexical analyzer.} {int yylex()} +\key{The grammar parser.} {int yyparse()} + +% Return to previous size +\def\key#1#2{\leavevmode\hbox to \hsize + {\vtop {\hsize=.67\hsize \rightskip=1em #1} + \kbd{#2}\hfil}} + +\section{Macros} +%*************** + +\key{Quit parsing immediately. Return 1.} {YYABORT} +\key{Quit parsing immediately. Return 0.} {YYACCEPT} +\key{Pretend a syntax error occurred.} {YYERROR} +\key{Value in {\tt yychar} if no lookahead token.} {YYEMPTY} +\key{Clear previous lookahead token.} {yyclearin} +\key{Recover normally from an error.} {yyerrok} + +% ************** +% ** The end ** +% ************** + +\vskip \baselineskip +\if 1\ncolumns +\copyrightnotice +\else +\smallcopyrightnotice +\fi + +\bye + + +% Local variables: +% compile-command: "tex refcard" +% End: diff --git a/doc/stamp-vti b/doc/stamp-vti new file mode 100644 index 0000000..02e74ac --- /dev/null +++ b/doc/stamp-vti @@ -0,0 +1,4 @@ +@set UPDATED 19 November 2008 +@set UPDATED-MONTH November 2008 +@set EDITION 2.4.1 +@set VERSION 2.4.1 diff --git a/doc/version.texi b/doc/version.texi new file mode 100644 index 0000000..02e74ac --- /dev/null +++ b/doc/version.texi @@ -0,0 +1,4 @@ +@set UPDATED 19 November 2008 +@set UPDATED-MONTH November 2008 +@set EDITION 2.4.1 +@set VERSION 2.4.1 diff --git a/doc/yacc.1.in b/doc/yacc.1.in new file mode 100644 index 0000000..1d07483 --- /dev/null +++ b/doc/yacc.1.in @@ -0,0 +1,41 @@ +.TH YACC "1" "November 2007" "@PACKAGE_STRING@" "User Commands" +.SH NAME +yacc \- GNU Project parser generator +.SH SYNOPSIS +.B yacc +[\fIOPTION\fR]... \fIFILE\fR +.SH DESCRIPTION +.I Yacc +(Yet Another Compiler Compiler) is a parser generator. This +version is a simple wrapper around +.IR bison (1). +It passes option +\fB\-y\fR, \fB\-\-yacc\fR +to activate the upward compatibility mode. See +.IR bison (1) +for more information. +.SH AUTHOR +Written by Paul Eggert. +.SH "REPORTING BUGS" +Report bugs to <@PACKAGE_BUGREPORT@>. +.SH COPYRIGHT +Copyright \(co @PACKAGE_COPYRIGHT_YEAR@ 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 bison (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. diff --git a/etc/Makefile.am b/etc/Makefile.am new file mode 100644 index 0000000..8896606 --- /dev/null +++ b/etc/Makefile.am @@ -0,0 +1,16 @@ +## Copyright (C) 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 . + +nodist_noinst_SCRIPTS = bench.pl diff --git a/etc/Makefile.in b/etc/Makefile.in new file mode 100644 index 0000000..a83bd4c --- /dev/null +++ b/etc/Makefile.in @@ -0,0 +1,631 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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 . + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = etc +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/bench.pl.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = bench.pl +SCRIPTS = $(nodist_noinst_SCRIPTS) +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +nodist_noinst_SCRIPTS = bench.pl +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits etc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits etc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +bench.pl: $(top_builddir)/config.status $(srcdir)/bench.pl.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/etc/README b/etc/README new file mode 100644 index 0000000..d7fce47 --- /dev/null +++ b/etc/README @@ -0,0 +1,41 @@ +A directory of tools provided to people using CVS Bison. None of +these is distributed. + +* bench.pl +A primitive Perl script to run benches. Currently its only bench is +the usual calculator: it has a lightweight processing part (but not +null), so it is really emphasizing the cost of the whole parsing +(including scanning and I/O). + +Set the envvars BISON and CC to the programs and flags you want to +use. They default to bison and gcc. To run a non-installed bison +from a tarball built in _build, I suggest the following. + + BISON=_build/tests/bison CC='gcc -O2' ./bench.pl + +(The _build/tests/bison wrapper makes sure that _build/src/bison will +use the tarballs' skeletons, not those already installed as a +straightforward use of _build/src/bison would.) + +-- + +Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of Bison, the GNU Compiler Compiler. + +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 . + +Local Variables: +mode: outline +End: diff --git a/etc/bench.pl.in b/etc/bench.pl.in new file mode 100755 index 0000000..ca43349 --- /dev/null +++ b/etc/bench.pl.in @@ -0,0 +1,384 @@ +#! /usr/bin/perl -w + +# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# +# This file is part of Bison, the GNU Compiler Compiler. +# +# 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 . + +use IO::File; +use Benchmark qw (:all); + +my $bison = $ENV{'BISON'} || '@abs_top_builddir@/tests/bison'; +my $cc = $ENV{'CC'} || 'gcc'; + +################################################################## + +sub triangular_grammar ($$$) +{ + my ($base, $max, $directives) = @_; + + my $out = new IO::File ">$base.y" + or die; + print $out < +#include + +static int yylex (void); +static void yyerror (const char *msg); +%} +%union +{ + int val; +}; + +%token END "end" +%type exp input +EOF + + for my $size (1 .. $max) + { + print $out "%token t$size $size \"$size\"\n"; + }; + +print $out < $max) + return 0; + else if (inner > outer) + { + inner = 1; + ++outer; + return END; + } + return inner++; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\\n", msg); +} + +int +main (void) +{ + yydebug = !!getenv ("YYDEBUG"); + return yyparse (); +} +EOF +} + +################################################################## + +sub calc_input ($$) +{ + my ($base, $max) = @_; + my $out = new IO::File ">$base.input" + or die; + foreach (1 .. $max) + { + print $out "0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27+28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+47+48+49+50+51+52+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+72+73+74+75+76+77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+97+98+99\n"; + print $out "1+1*(2+2*(3+3*(4+4*(5+5*(6+6*(7+7*(8+8*(9+9*(10+10*(11+11*(12+12*(13+13*(14+14*(15+15*(16+16*(17+17*(18+18*(19+19*(20+20*(21+21*(22+22*(23+23*(24+24*(25+25*(26+26*(27+27*(28+28*(29+29*(30+30*(31+31*(32+32*(33+33*(34+34*(35+35*(36+36*(37+37*(38+38*(39+39*(40+40*(41+41*(42+42*(43+43*(44+44*(45+45*(46+46*(47+47*(48+48*(49+49*(50+50*(51+51*(52+52*(53+53*(54+54*(55+55*(56+56*(57+57*(58+58*(59+59*(60+60*(61+61*(62+62*(63+63*(64+64*(65+65*(66+66*(67+67*(68+68*(69+69*(70+70*(71+71*(72+72*(73+73*(74+74*(75+75*(76+76*(77+77*(78+78*(79+79*(80+80*(81+81*(82+82*(83+83*(84+84*(85+85*(86+86*(87+87*(88+88*(89+89*(90+90*(91+91*(92+92*(93+93*(94+94*(95+95*(96+96*(97+97*(98+98*(99+99*(100+100*(101+101*(102+102*(103+103*(104+104*(105+105*(106+106*(107+107*(108+108*(109+109*(110+110*(111+111*(112+112*(113+113*(114+114*(115+115*(116+116*(117+117*(118+118*(119+119*(120+120*(121+121*(122+122*(123+123*(124+124*(125+125*(126+126*(127+127*(128+128*(129+129*(130+130*(131+131*(132+132*(133+133*(134+134*(135+135*(136+136*(137+137*(138+138*(139+139*(140+140*(141+141*(142+142*(143+143*(144+144*(145+145*(146+146*(147+147*(148+148*(149+149*(150+150*(151+151*(152+152*(153+153*(154+154*(155+155*(156+156*(157+157*(158+158*(159+159*(160+160*(161+161*(162+162*(163+163*(164+164*(165+165*(166+166*(167+167*(168+168*(169+169*(170+170*(171+171*(172+172*(173+173*(174+174*(175+175*(176+176*(177+177*(178+178*(179+179*(180+180*(181+181*(182+182*(183+183*(184+184*(185+185*(186+186*(187+187*(188+188*(189+189*(190+190*(191+191*(192+192*(193+193*(194+194*(195+195*(196+196*(197+197*(198+198*(199+199*(200+200*(201+201*(202+202*(203+203*(204+204*(205+205*(206+206*(207+207*(208+208*(209+209*(210+210*(211+211*(212+212*(213+213*(214+214*(215+215*(216+216*(217+217*(218+218*(219+219*(220+220*(221+221*(222+222*(223+223*(224+224*(225+225*(226+226*(227+227*(228+228*(229+229*(230+230*(231+231*(232+232*(233+233*(234+234*(235+235*(236+236*(237+237*(238+238*(239+239*(240+240*(241+241*(242+242*(243+243*(244+244*(245+245*(246+246*(247+247*(248+248*(249+249*(250+250*(251+251*(252+252*(253+253*(254+254*(255+255*(256+256*(257+257*(258+258*(259+259*(260+260*(261+261*(262+262*(263+263*(264+264*(265+265*(266+266*(267+267*(268+268*(269+269*(270+270*(271+271*(272+272*(273+273*(274+274*(275+275*(276+276*(277+277*(278+278*(279+279*(280+280*(281+281*(282+282*(283+283*(284+284*(285+285*(286+286*(287+287*(288+288*(289+289*(290+290*(291+291*(292+292*(293+293*(294+294*(295+295*(296+296*(297+297*(298+298*(299+299*(300+300*(301+301*(302+302*(303+303*(304+304*(305+305*(306+306*(307+307*(308+308*(309+309*(310+310*(311+311*(312+312*(313+313*(314+314*(315+315*(316+316*(317+317*(318+318*(319+319*(320+320*(321+321*(322+322*(323+323*(324+324*(325+325*(326+326*(327+327*(328+328*(329+329*(330+330*(331+331*(332+332*(333+333*(334+334*(335+335*(336+336*(337+337*(338+338*(339+339*(340+340*(341+341*(342+342*(343+343*(344+344*(345+345*(346+346*(347+347*(348+348*(349+349*(350+350*(351+351*(352+352*(353+353*(354+354*(355+355*(356+356*(357+357*(358+358*(359+359*(360+360*(361+361*(362+362*(363+363*(364+364*(365+365*(366+366*(367+367*(368+368*(369+369*(370+370*(371+371*(372+372*(373+373*(374+374*(375+375*(376+376*(377+377*(378+378*(379+379*(380+380*(381+381*(382+382*(383+383*(384+384*(385+385*(386+386*(387+387*(388+388*(389+389*(390+390*(391+391*(392+392*(393+393*(394+394*(395+395*(396+396*(397+397*(398+398*(399+399*(400+400*(401+401*(402+402*(403+403*(404+404*(405+405*(406+406*(407+407*(408+408*(409+409*(410+410*(411+411*(412+412*(413+413*(414+414*(415+415*(416+416*(417+417*(418+418*(419+419*(420+420*(421+421*(422+422*(423+423*(424+424*(425+425*(426+426*(427+427*(428+428*(429+429*(430+430*(431+431*(432+432*(433+433*(434+434*(435+435*(436+436*(437+437*(438+438*(439+439*(440+440*(441+441*(442+442*(443+443*(444+444*(445+445*(446+446*(447+447*(448+448*(449+449*(450+450*(451+451*(452+452*(453+453*(454+454*(455+455*(456+456*(457+457*(458+458*(459+459*(460+460*(461+461*(462+462*(463+463*(464+464*(465+465*(466+466*(467+467*(468+468*(469+469*(470+470*(471+471*(472+472*(473+473*(474+474*(475+475*(476+476*(477+477*(478+478*(479+479*(480+480*(481+481*(482+482*(483+483*(484+484*(485+485*(486+486*(487+487*(488+488*(489+489*(490+490*(491+491*(492+492*(493+493*(494+494*(495+495*(496+496*(497+497*(498+498*(499+499*(500+500*(501+501*(502+502*(503+503*(504+504*(505+505*(506+506*(507+507*(508+508*(509+509*(510+510*(511+511*(512+512*(513+513*(514+514*(515+515*(516+516*(517+517*(518+518*(519+519*(520+520*(521+521*(522+522*(523+523*(524+524*(525+525*(526+526*(527+527*(528+528*(529+529*(530+530*(531+531*(532+532*(533+533*(534+534*(535+535*(536+536*(537+537*(538+538*(539+539*(540+540*(541+541*(542+542*(543+543*(544+544*(545+545*(546+546*(547+547*(548+548*(549+549*(550+550*(551+551*(552+552*(553+553*(554+554*(555+555*(556+556*(557+557*(558+558*(559+559*(560+560*(561+561*(562+562*(563+563*(564+564*(565+565*(566+566*(567+567*(568+568*(569+569*(570+570*(571+571*(572+572*(573+573*(574+574*(575+575*(576+576*(577+577*(578+578*(579+579*(580+580*(581+581*(582+582*(583+583*(584+584*(585+585*(586+586*(587+587*(588+588*(589+589*(590+590*(591+591*(592+592*(593+593*(594+594*(595+595*(596+596*(597+597*(598+598*(599+599*(600+600*(601+601*(602+602*(603+603*(604+604*(605+605*(606+606*(607+607*(608+608*(609+609*(610+610*(611+611*(612+612*(613+613*(614+614*(615+615*(616+616*(617+617*(618+618*(619+619*(620+620*(621+621*(622+622*(623+623*(624+624*(625+625*(626+626*(627+627*(628+628*(629+629*(630+630*(631+631*(632+632*(633+633*(634+634*(635+635*(636+636*(637+637*(638+638*(639+639*(640+640*(641+641*(642+642*(643+643*(644+644*(645+645*(646+646*(647+647*(648+648*(649+649*(650+650*(651+651*(652+652*(653+653*(654+654*(655+655*(656+656*(657+657*(658+658*(659+659*(660+660*(661+661*(662+662*(663+663*(664+664*(665+665*(666+666*(667+667*(668+668*(669+669*(670+670*(671+671*(672+672*(673+673*(674+674*(675+675*(676+676*(677+677*(678+678*(679+679*(680+680*(681+681*(682+682*(683+683*(684+684*(685+685*(686+686*(687+687*(688+688*(689+689*(690+690*(691+691*(692+692*(693+693*(694+694*(695+695*(696+696*(697+697*(698+698*(699+699*(700+700*(701+701*(702+702*(703+703*(704+704*(705+705*(706+706*(707+707*(708+708*(709+709*(710+710*(711+711*(712+712*(713+713*(714+714*(715+715*(716+716*(717+717*(718+718*(719+719*(720+720*(721+721*(722+722*(723+723*(724+724*(725+725*(726+726*(727+727*(728+728*(729+729*(730+730*(731+731*(732+732*(733+733*(734+734*(735+735*(736+736*(737+737*(738+738*(739+739*(740+740*(741+741*(742+742*(743+743*(744+744*(745+745*(746+746*(747+747*(748+748*(749+749*(750+750*(751+751*(752+752*(753+753*(754+754*(755+755*(756+756*(757+757*(758+758*(759+759*(760+760*(761+761*(762+762*(763+763*(764+764*(765+765*(766+766*(767+767*(768+768*(769+769*(770+770*(771+771*(772+772*(773+773*(774+774*(775+775*(776+776*(777+777*(778+778*(779+779*(780+780*(781+781*(782+782*(783+783*(784+784*(785+785*(786+786*(787+787*(788+788*(789+789*(790+790*(791+791*(792+792*(793+793*(794+794*(795+795*(796+796*(797+797*(798+798*(799+799*(800+800*(801+801*(802+802*(803+803*(804+804*(805+805*(806+806*(807+807*(808+808*(809+809*(810+810*(811+811*(812+812*(813+813*(814+814*(815+815*(816+816*(817+817*(818+818*(819+819*(820+820*(821+821*(822+822*(823+823*(824+824*(825+825*(826+826*(827+827*(828+828*(829+829*(830+830*(831+831*(832+832*(833+833*(834+834*(835+835*(836+836*(837+837*(838+838*(839+839*(840+840*(841+841*(842+842*(843+843*(844+844*(845+845*(846+846*(847+847*(848+848*(849+849*(850+850*(851+851*(852+852*(853+853*(854+854*(855+855*(856+856*(857+857*(858+858*(859+859*(860+860*(861+861*(862+862*(863+863*(864+864*(865+865*(866+866*(867+867*(868+868*(869+869*(870+870*(871+871*(872+872*(873+873*(874+874*(875+875*(876+876*(877+877*(878+878*(879+879*(880+880*(881+881*(882+882*(883+883*(884+884*(885+885*(886+886*(887+887*(888+888*(889+889*(890+890*(891+891*(892+892*(893+893*(894+894*(895+895*(896+896*(897+897*(898+898*(899+899*(900+900*(901+901*(902+902*(903+903*(904+904*(905+905*(906+906*(907+907*(908+908*(909+909*(910+910*(911+911*(912+912*(913+913*(914+914*(915+915*(916+916*(917+917*(918+918*(919+919*(920+920*(921+921*(922+922*(923+923*(924+924*(925+925*(926+926*(927+927*(928+928*(929+929*(930+930*(931+931*(932+932*(933+933*(934+934*(935+935*(936+936*(937+937*(938+938*(939+939*(940+940*(941+941*(942+942*(943+943*(944+944*(945+945*(946+946*(947+947*(948+948*(949+949*(950+950*(951+951*(952+952*(953+953*(954+954*(955+955*(956+956*(957+957*(958+958*(959+959*(960+960*(961+961*(962+962*(963+963*(964+964*(965+965*(966+966*(967+967*(968+968*(969+969*(970+970*(971+971*(972+972*(973+973*(974+974*(975+975*(976+976*(977+977*(978+978*(979+979*(980+980*(981+981*(982+982*(983+983*(984+984*(985+985*(986+986*(987+987*(988+988*(989+989*(990+990*(991+991*(992+992*(993+993*(994+994*(995+995*(996+996*(997+997*(998+998*(999+999*(1000+1000*(1001))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\n"; + } +} + +################################################################## + +sub calc_grammar ($$$) +{ + my ($base, $max, $directives) = @_; + + my $out = new IO::File ">$base.y" + or die; + print $out < + +#include +#include +#include +#define USE(Var) + +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; + +static semantic_value global_result = 0; +static int global_count = 0; +%} + +/* Exercise %union. */ +$directives +%error-verbose +%union +{ + semantic_value ival; +}; + +%{ +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror (const char *s); +#if YYPURE +static int yylex (YYSTYPE* yylvalp); +#else +static int yylex (void); +#endif +%} + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\\n' +| exp '\\n' { USE (\$1); } +; + +exp: + NUM { \$\$ = \$1; } +| exp '=' exp + { + if (\$1 != \$3) + fprintf (stderr, "calc: error: %d != %d\\n", \$1, \$3); + \$\$ = \$1; + } +| exp '+' exp { \$\$ = \$1 + \$3; } +| exp '-' exp { \$\$ = \$1 - \$3; } +| exp '*' exp { \$\$ = \$1 * \$3; } +| exp '/' exp { \$\$ = \$1 / \$3; } +| '-' exp %prec NEG { \$\$ = -\$2; } +| exp '^' exp { \$\$ = power (\$1, \$3); } +| '(' exp ')' { \$\$ = \$2; } +| '(' error ')' { \$\$ = 1111; } +| '!' { \$\$ = 0; YYERROR; } +| '-' error { \$\$ = 0; YYERROR; } +; +%% +/* The input. */ +static FILE *input; + +static void +yyerror (const char *s) +{ + fprintf (stderr, "%s\\n", s); +} + +static int +get_char (void) +{ + return getc (input); +} + + +static void +unget_char ( int c) +{ + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char (c); + + return sign * n; +} + +static int +#if YYPURE +# define yylval (*yylvalp) +yylex (YYSTYPE* yylvalp) +#else +yylex (void) +#endif +{ + int c; + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + continue; + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + yylval.ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + input = fopen ("calc.input", "r"); + if (!input) + { + perror ("calc.input"); + return 3; + } + + status = yyparse (); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + + return status; +} +EOF +} + +################################################################## + +sub compile ($) +{ + my ($base) = @_; + system ("$bison $base.y -o $base.c") == 0 + or die; + system ("$cc -o $base $base.c") == 0 + or die; +} + +sub bench_grammar ($) +{ + my ($gram) = @_; + my %test = + ( + "pull-impure" => '', + "pull-pure" => '%define api.pure', + "push-impure" => '%define api.push_pull "both"', + "push-pure" => '%define api.push_pull "both" %define api.pure', + ); + + my %bench; + while (my ($name, $directives) = each %test) + { + print STDERR "$name\n"; + my $generator = "$gram" . "_grammar"; + &$generator ($name, 200, $directives); + compile ($name); + $bench{$name} = "system ('./$name');"; + } + + print "$gram:\n"; + my $res = timethese (50, \%bench, 'nop'); + cmpthese ($res, 'nop'); +} + +print STDERR "Using $bison, $cc.\n"; +calc_input ('calc', 200); +bench_grammar ('calc'); + +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..4f2176f --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,21 @@ +## Process this file with automake to produce Makefile.in -*-Makefile-*- +## Copyright (C) 2005 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 . + +if BISON_CXX_WORKS +SUBDIRS = calc++ +endif + +dist_noinst_SCRIPTS = extexi diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..9da9b0f --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,788 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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 . + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = examples +DIST_COMMON = $(dist_noinst_SCRIPTS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = +SCRIPTS = $(dist_noinst_SCRIPTS) +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = calc++ +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@BISON_CXX_WORKS_TRUE@SUBDIRS = calc++ +dist_noinst_SCRIPTS = extexi +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits examples/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic ctags \ + ctags-recursive distclean distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/calc++/Makefile.am b/examples/calc++/Makefile.am new file mode 100644 index 0000000..6046738 --- /dev/null +++ b/examples/calc++/Makefile.am @@ -0,0 +1,86 @@ +## Process this file with automake to produce Makefile.in -*-Makefile-*- +## Copyright (C) 2005, 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 . + +## ------------------------------------- ## +## Running the bison from this tarball. ## +## ------------------------------------- ## + +BISON = $(top_builddir)/tests/bison +BISON_IN = $(top_srcdir)/tests/bison.in + +$(BISON): $(BISON_IN) + cd $(top_builddir)/tests && $(MAKE) $(AM_MAKEFLAGS) bison + +## ------------ ## +## Extracting. ## +## ------------ ## + +doc = $(top_srcdir)/doc/bison.texinfo +extexi = $(top_srcdir)/examples/extexi +# Extract in src. +$(calc_extracted): $(doc) $(extexi) + cd $(srcdir) && \ + $(AWK) -f ../extexi -v VERSION="$(VERSION)" \ + ../../doc/bison.texinfo -- calc++-parser.yy \ + calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc + + +## ------------------- ## +## Parser generation. ## +## ------------------- ## + +DEFAULT_INCLUDES = -I. -I$(srcdir) +BUILT_SOURCES = $(calc_extracted) $(calc_sources_generated) +CLEANFILES = $(srcdir)/*.output *.tmp +MAINTAINERCLEANFILES = $(srcdir)/*.stamp $(BUILT_SOURCES) + +# Compile the parser and save cycles. +# This code comes from "Handling Tools that Produce Many Outputs", +# from the Automake documentation. +EXTRA_DIST = $(srcdir)/calc++-parser.stamp $(srcdir)/calc++-parser.yy +# Don't depend on $(BISON) otherwise we would rebuild these files +# in srcdir, including during distcheck, which is forbidden. +$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN) + @rm -f calc++-parser.tmp + @touch calc++-parser.tmp + $(BISON) -d -ra -S lalr1.cc -o $(srcdir)/calc++-parser.cc \ + $(srcdir)/calc++-parser.yy + @mv -f calc++-parser.tmp $@ + +$(calc_sources_generated): $(srcdir)/calc++-parser.stamp + @if test -f $@; then :; else \ + rm -f $(srcdir)/calc++-parser.stamp && \ + $(MAKE) $(AM_MAKEFLAGS) $(srcdir)/calc++-parser.stamp; \ + fi + + +## --------------------------- ## +## Building & testing calc++. ## +## --------------------------- ## + +check_PROGRAMS = calc++ + +calc_sources_extracted = $(srcdir)/calc++-scanner.ll $(srcdir)/calc++.cc \ + $(srcdir)/calc++-driver.hh $(srcdir)/calc++-driver.cc +calc_extracted = $(calc_sources_extracted) $(srcdir)/calc++-parser.yy +calc_sources_generated = \ + $(srcdir)/stack.hh $(srcdir)/position.hh $(srcdir)/location.hh \ + $(srcdir)/calc++-parser.hh $(srcdir)/calc++-parser.cc + +calc___SOURCES = $(calc_sources_extracted) $(calc_sources_generated) + +TESTS = test +EXTRA_DIST += $(TESTS) diff --git a/examples/calc++/Makefile.in b/examples/calc++/Makefile.in new file mode 100644 index 0000000..43aeec7 --- /dev/null +++ b/examples/calc++/Makefile.in @@ -0,0 +1,905 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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 . +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = calc++$(EXEEXT) +subdir = examples/calc++ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + calc++-scanner.cc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = +am__objects_1 = calc++-scanner.$(OBJEXT) calc++.$(OBJEXT) \ + calc++-driver.$(OBJEXT) +am__objects_2 = calc++-parser.$(OBJEXT) +am_calc___OBJECTS = $(am__objects_1) $(am__objects_2) +calc___OBJECTS = $(am_calc___OBJECTS) +calc___LDADD = $(LDADD) +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) +YLWRAP = $(top_srcdir)/build-aux/ylwrap +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(calc___SOURCES) +DIST_SOURCES = $(calc___SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +BISON = $(top_builddir)/tests/bison +BISON_IN = $(top_srcdir)/tests/bison.in +doc = $(top_srcdir)/doc/bison.texinfo +extexi = $(top_srcdir)/examples/extexi +DEFAULT_INCLUDES = -I. -I$(srcdir) +BUILT_SOURCES = $(calc_extracted) $(calc_sources_generated) +CLEANFILES = $(srcdir)/*.output *.tmp +MAINTAINERCLEANFILES = $(srcdir)/*.stamp $(BUILT_SOURCES) + +# Compile the parser and save cycles. +# This code comes from "Handling Tools that Produce Many Outputs", +# from the Automake documentation. +EXTRA_DIST = $(srcdir)/calc++-parser.stamp $(srcdir)/calc++-parser.yy \ + $(TESTS) +calc_sources_extracted = $(srcdir)/calc++-scanner.ll $(srcdir)/calc++.cc \ + $(srcdir)/calc++-driver.hh $(srcdir)/calc++-driver.cc + +calc_extracted = $(calc_sources_extracted) $(srcdir)/calc++-parser.yy +calc_sources_generated = \ + $(srcdir)/stack.hh $(srcdir)/position.hh $(srcdir)/location.hh \ + $(srcdir)/calc++-parser.hh $(srcdir)/calc++-parser.cc + +calc___SOURCES = $(calc_sources_extracted) $(calc_sources_generated) +TESTS = test +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .cc .ll .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits examples/calc++/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits examples/calc++/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) +calc++$(EXEEXT): $(calc___OBJECTS) $(calc___DEPENDENCIES) + @rm -f calc++$(EXEEXT) + $(CXXLINK) $(calc___OBJECTS) $(calc___LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calc++-driver.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calc++-parser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calc++-scanner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calc++.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +calc++.o: $(srcdir)/calc++.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT calc++.o -MD -MP -MF $(DEPDIR)/calc++.Tpo -c -o calc++.o `test -f '$(srcdir)/calc++.cc' || echo '$(srcdir)/'`$(srcdir)/calc++.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/calc++.Tpo $(DEPDIR)/calc++.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(srcdir)/calc++.cc' object='calc++.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o calc++.o `test -f '$(srcdir)/calc++.cc' || echo '$(srcdir)/'`$(srcdir)/calc++.cc + +calc++.obj: $(srcdir)/calc++.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT calc++.obj -MD -MP -MF $(DEPDIR)/calc++.Tpo -c -o calc++.obj `if test -f '$(srcdir)/calc++.cc'; then $(CYGPATH_W) '$(srcdir)/calc++.cc'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/calc++.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/calc++.Tpo $(DEPDIR)/calc++.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(srcdir)/calc++.cc' object='calc++.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o calc++.obj `if test -f '$(srcdir)/calc++.cc'; then $(CYGPATH_W) '$(srcdir)/calc++.cc'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/calc++.cc'; fi` + +calc++-driver.o: $(srcdir)/calc++-driver.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT calc++-driver.o -MD -MP -MF $(DEPDIR)/calc++-driver.Tpo -c -o calc++-driver.o `test -f '$(srcdir)/calc++-driver.cc' || echo '$(srcdir)/'`$(srcdir)/calc++-driver.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/calc++-driver.Tpo $(DEPDIR)/calc++-driver.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(srcdir)/calc++-driver.cc' object='calc++-driver.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o calc++-driver.o `test -f '$(srcdir)/calc++-driver.cc' || echo '$(srcdir)/'`$(srcdir)/calc++-driver.cc + +calc++-driver.obj: $(srcdir)/calc++-driver.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT calc++-driver.obj -MD -MP -MF $(DEPDIR)/calc++-driver.Tpo -c -o calc++-driver.obj `if test -f '$(srcdir)/calc++-driver.cc'; then $(CYGPATH_W) '$(srcdir)/calc++-driver.cc'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/calc++-driver.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/calc++-driver.Tpo $(DEPDIR)/calc++-driver.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(srcdir)/calc++-driver.cc' object='calc++-driver.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o calc++-driver.obj `if test -f '$(srcdir)/calc++-driver.cc'; then $(CYGPATH_W) '$(srcdir)/calc++-driver.cc'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/calc++-driver.cc'; fi` + +calc++-parser.o: $(srcdir)/calc++-parser.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT calc++-parser.o -MD -MP -MF $(DEPDIR)/calc++-parser.Tpo -c -o calc++-parser.o `test -f '$(srcdir)/calc++-parser.cc' || echo '$(srcdir)/'`$(srcdir)/calc++-parser.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/calc++-parser.Tpo $(DEPDIR)/calc++-parser.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(srcdir)/calc++-parser.cc' object='calc++-parser.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o calc++-parser.o `test -f '$(srcdir)/calc++-parser.cc' || echo '$(srcdir)/'`$(srcdir)/calc++-parser.cc + +calc++-parser.obj: $(srcdir)/calc++-parser.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT calc++-parser.obj -MD -MP -MF $(DEPDIR)/calc++-parser.Tpo -c -o calc++-parser.obj `if test -f '$(srcdir)/calc++-parser.cc'; then $(CYGPATH_W) '$(srcdir)/calc++-parser.cc'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/calc++-parser.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/calc++-parser.Tpo $(DEPDIR)/calc++-parser.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(srcdir)/calc++-parser.cc' object='calc++-parser.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o calc++-parser.obj `if test -f '$(srcdir)/calc++-parser.cc'; then $(CYGPATH_W) '$(srcdir)/calc++-parser.cc'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/calc++-parser.cc'; fi` + +.ll.cc: + $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) + +calc++-scanner.cc: $(srcdir)/calc++-scanner.ll + $(am__skiplex) \ + $(SHELL) $(YLWRAP) `test -f '$(srcdir)/calc++-scanner.ll' || echo '$(srcdir)/'`$(srcdir)/calc++-scanner.ll $(LEX_OUTPUT_ROOT).c calc++-scanner.cc -- $(LEX) $(LFLAGS) $(AM_LFLAGS) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -rm -f calc++-scanner.cc + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +$(BISON): $(BISON_IN) + cd $(top_builddir)/tests && $(MAKE) $(AM_MAKEFLAGS) bison +# Extract in src. +$(calc_extracted): $(doc) $(extexi) + cd $(srcdir) && \ + $(AWK) -f ../extexi -v VERSION="$(VERSION)" \ + ../../doc/bison.texinfo -- calc++-parser.yy \ + calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc +# Don't depend on $(BISON) otherwise we would rebuild these files +# in srcdir, including during distcheck, which is forbidden. +$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN) + @rm -f calc++-parser.tmp + @touch calc++-parser.tmp + $(BISON) -d -ra -S lalr1.cc -o $(srcdir)/calc++-parser.cc \ + $(srcdir)/calc++-parser.yy + @mv -f calc++-parser.tmp $@ + +$(calc_sources_generated): $(srcdir)/calc++-parser.stamp + @if test -f $@; then :; else \ + rm -f $(srcdir)/calc++-parser.stamp && \ + $(MAKE) $(AM_MAKEFLAGS) $(srcdir)/calc++-parser.stamp; \ + fi +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/calc++/calc++-driver.cc b/examples/calc++/calc++-driver.cc new file mode 100644 index 0000000..8832c89 --- /dev/null +++ b/examples/calc++/calc++-driver.cc @@ -0,0 +1,38 @@ +#line 8370 "../../doc/bison.texinfo" +#include "calc++-driver.hh" +#include "calc++-parser.hh" + +calcxx_driver::calcxx_driver () + : trace_scanning (false), trace_parsing (false) +{ + variables["one"] = 1; + variables["two"] = 2; +} + +calcxx_driver::~calcxx_driver () +{ +} + +int +calcxx_driver::parse (const std::string &f) +{ + file = f; + scan_begin (); + yy::calcxx_parser parser (*this); + parser.set_debug_level (trace_parsing); + int res = parser.parse (); + scan_end (); + return res; +} + +void +calcxx_driver::error (const yy::location& l, const std::string& m) +{ + std::cerr << l << ": " << m << std::endl; +} + +void +calcxx_driver::error (const std::string& m) +{ + std::cerr << m << std::endl; +} diff --git a/examples/calc++/calc++-driver.hh b/examples/calc++/calc++-driver.hh new file mode 100644 index 0000000..a49c9b2 --- /dev/null +++ b/examples/calc++/calc++-driver.hh @@ -0,0 +1,42 @@ +#line 8281 "../../doc/bison.texinfo" +#ifndef CALCXX_DRIVER_HH +# define CALCXX_DRIVER_HH +# include +# include +# include "calc++-parser.hh" +#line 8297 "../../doc/bison.texinfo" +// Tell Flex the lexer's prototype ... +# define YY_DECL \ + yy::calcxx_parser::token_type \ + yylex (yy::calcxx_parser::semantic_type* yylval, \ + yy::calcxx_parser::location_type* yylloc, \ + calcxx_driver& driver) +// ... and declare it for the parser's sake. +YY_DECL; +#line 8313 "../../doc/bison.texinfo" +// Conducting the whole scanning and parsing of Calc++. +class calcxx_driver +{ +public: + calcxx_driver (); + virtual ~calcxx_driver (); + + std::map variables; + + int result; +#line 8331 "../../doc/bison.texinfo" + // Handling the scanner. + void scan_begin (); + void scan_end (); + bool trace_scanning; +#line 8342 "../../doc/bison.texinfo" + // Run the parser. Return 0 on success. + int parse (const std::string& f); + std::string file; + bool trace_parsing; +#line 8356 "../../doc/bison.texinfo" + // Error handling. + void error (const yy::location& l, const std::string& m); + void error (const std::string& m); +}; +#endif // ! CALCXX_DRIVER_HH diff --git a/examples/calc++/calc++-parser.cc b/examples/calc++/calc++-parser.cc new file mode 100644 index 0000000..61214dc --- /dev/null +++ b/examples/calc++/calc++-parser.cc @@ -0,0 +1,972 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison LALR(1) parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 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 . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* First part of user declarations. */ + + +/* Line 311 of lalr1.cc */ +#line 41 "./calc++-parser.cc" + + +#include "calc++-parser.hh" + +/* User implementation prologue. */ + + +/* Line 317 of lalr1.cc */ +#line 50 "./calc++-parser.cc" +/* Unqualified %code blocks. */ + +/* Line 318 of lalr1.cc */ +#line 8503 "../../doc/bison.texinfo" + +# include "calc++-driver.hh" + + + +/* Line 318 of lalr1.cc */ +#line 61 "./calc++-parser.cc" + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* FIXME: INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#define YYUSE(e) ((void) (e)) + +/* Enable debugging if requested. */ +#if YYDEBUG + +/* A pseudo ostream that takes yydebug_ into account. */ +# define YYCDEBUG if (yydebug_) (*yycdebug_) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug_) \ + { \ + *yycdebug_ << Title << ' '; \ + yy_symbol_print_ ((Type), (Value), (Location)); \ + *yycdebug_ << std::endl; \ + } \ +} while (false) + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug_) \ + yy_reduce_print_ (Rule); \ +} while (false) + +# define YY_STACK_PRINT() \ +do { \ + if (yydebug_) \ + yystack_print_ (); \ +} while (false) + +#else /* !YYDEBUG */ + +# define YYCDEBUG if (false) std::cerr +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_REDUCE_PRINT(Rule) +# define YY_STACK_PRINT() + +#endif /* !YYDEBUG */ + +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yychar = yyempty_) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) + + +/* Line 380 of lalr1.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +namespace yy { + +/* Line 380 of lalr1.cc */ +#line 130 "./calc++-parser.cc" +#if YYERROR_VERBOSE + + /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + std::string + calcxx_parser::yytnamerr_ (const char *yystr) + { + if (*yystr == '"') + { + std::string yyr = ""; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; + } + +#endif + + /// Build a parser object. + calcxx_parser::calcxx_parser (calcxx_driver& driver_yyarg) + : +#if YYDEBUG + yydebug_ (false), + yycdebug_ (&std::cerr), +#endif + driver (driver_yyarg) + { + } + + calcxx_parser::~calcxx_parser () + { + } + +#if YYDEBUG + /*--------------------------------. + | Print this symbol on YYOUTPUT. | + `--------------------------------*/ + + inline void + calcxx_parser::yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + YYUSE (yylocationp); + YYUSE (yyvaluep); + switch (yytype) + { + case 4: /* "\"identifier\"" */ + +/* Line 449 of lalr1.cc */ +#line 8532 "../../doc/bison.texinfo" + { debug_stream () << *(yyvaluep->sval); }; + +/* Line 449 of lalr1.cc */ +#line 207 "./calc++-parser.cc" + break; + case 5: /* "\"number\"" */ + +/* Line 449 of lalr1.cc */ +#line 8535 "../../doc/bison.texinfo" + { debug_stream () << (yyvaluep->ival); }; + +/* Line 449 of lalr1.cc */ +#line 216 "./calc++-parser.cc" + break; + case 14: /* "exp" */ + +/* Line 449 of lalr1.cc */ +#line 8535 "../../doc/bison.texinfo" + { debug_stream () << (yyvaluep->ival); }; + +/* Line 449 of lalr1.cc */ +#line 225 "./calc++-parser.cc" + break; + default: + break; + } + } + + + void + calcxx_parser::yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << *yylocationp << ": "; + yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); + *yycdebug_ << ')'; + } +#endif + + void + calcxx_parser::yydestruct_ (const char* yymsg, + int yytype, semantic_type* yyvaluep, location_type* yylocationp) + { + YYUSE (yylocationp); + YYUSE (yymsg); + YYUSE (yyvaluep); + + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + case 4: /* "\"identifier\"" */ + +/* Line 480 of lalr1.cc */ +#line 8533 "../../doc/bison.texinfo" + { delete (yyvaluep->sval); }; + +/* Line 480 of lalr1.cc */ +#line 264 "./calc++-parser.cc" + break; + + default: + break; + } + } + + void + calcxx_parser::yypop_ (unsigned int n) + { + yystate_stack_.pop (n); + yysemantic_stack_.pop (n); + yylocation_stack_.pop (n); + } + +#if YYDEBUG + std::ostream& + calcxx_parser::debug_stream () const + { + return *yycdebug_; + } + + void + calcxx_parser::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + calcxx_parser::debug_level_type + calcxx_parser::debug_level () const + { + return yydebug_; + } + + void + calcxx_parser::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } +#endif + + int + calcxx_parser::parse () + { + /// Lookahead and lookahead in internal form. + int yychar = yyempty_; + int yytoken = 0; + + /* State. */ + int yyn; + int yylen = 0; + int yystate = 0; + + /* Error handling. */ + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// Semantic value of the lookahead. + semantic_type yylval; + /// Location of the lookahead. + location_type yylloc; + /// The locations where the error started and ended. + location_type yyerror_range[2]; + + /// $$. + semantic_type yyval; + /// @$. + location_type yyloc; + + int yyresult; + + YYCDEBUG << "Starting parse" << std::endl; + + + /* User initialization code. */ + +/* Line 559 of lalr1.cc */ +#line 8466 "../../doc/bison.texinfo" +{ + // Initialize the initial location. + yylloc.begin.filename = yylloc.end.filename = &driver.file; +} + +/* Line 559 of lalr1.cc */ +#line 350 "./calc++-parser.cc" + + /* Initialize the stacks. The initial state will be pushed in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystate_stack_ = state_stack_type (0); + yysemantic_stack_ = semantic_stack_type (0); + yylocation_stack_ = location_stack_type (0); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); + + /* New state. */ + yynewstate: + yystate_stack_.push (yystate); + YYCDEBUG << "Entering state " << yystate << std::endl; + + /* Accept? */ + if (yystate == yyfinal_) + goto yyacceptlab; + + goto yybackup; + + /* Backup. */ + yybackup: + + /* Try to take a decision without lookahead. */ + yyn = yypact_[yystate]; + if (yyn == yypact_ninf_) + goto yydefault; + + /* Read a lookahead token. */ + if (yychar == yyempty_) + { + YYCDEBUG << "Reading a token: "; + yychar = yylex (&yylval, &yylloc, driver); + } + + + /* Convert token to internal form. */ + if (yychar <= yyeof_) + { + yychar = yytoken = yyeof_; + YYCDEBUG << "Now at end of input." << std::endl; + } + else + { + yytoken = yytranslate_ (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) + goto yydefault; + + /* Reduce or error. */ + yyn = yytable_[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == yytable_ninf_) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the token being shifted. */ + yychar = yyempty_; + + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus_) + --yyerrstatus_; + + yystate = yyn; + goto yynewstate; + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + /*-----------------------------. + | yyreduce -- Do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. Otherwise, use the top of the stack. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. */ + if (yylen) + yyval = yysemantic_stack_[yylen - 1]; + else + yyval = yysemantic_stack_[0]; + + { + slice slice (yylocation_stack_, yylen); + YYLLOC_DEFAULT (yyloc, slice, yylen); + } + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + +/* Line 678 of lalr1.cc */ +#line 8545 "../../doc/bison.texinfo" + { driver.result = (yysemantic_stack_[(2) - (2)].ival); } + break; + + case 3: + +/* Line 678 of lalr1.cc */ +#line 8547 "../../doc/bison.texinfo" + {} + break; + + case 4: + +/* Line 678 of lalr1.cc */ +#line 8548 "../../doc/bison.texinfo" + {} + break; + + case 5: + +/* Line 678 of lalr1.cc */ +#line 8552 "../../doc/bison.texinfo" + { driver.variables[*(yysemantic_stack_[(3) - (1)].sval)] = (yysemantic_stack_[(3) - (3)].ival); delete (yysemantic_stack_[(3) - (1)].sval); } + break; + + case 6: + +/* Line 678 of lalr1.cc */ +#line 8556 "../../doc/bison.texinfo" + { (yyval.ival) = (yysemantic_stack_[(3) - (1)].ival) + (yysemantic_stack_[(3) - (3)].ival); } + break; + + case 7: + +/* Line 678 of lalr1.cc */ +#line 8557 "../../doc/bison.texinfo" + { (yyval.ival) = (yysemantic_stack_[(3) - (1)].ival) - (yysemantic_stack_[(3) - (3)].ival); } + break; + + case 8: + +/* Line 678 of lalr1.cc */ +#line 8558 "../../doc/bison.texinfo" + { (yyval.ival) = (yysemantic_stack_[(3) - (1)].ival) * (yysemantic_stack_[(3) - (3)].ival); } + break; + + case 9: + +/* Line 678 of lalr1.cc */ +#line 8559 "../../doc/bison.texinfo" + { (yyval.ival) = (yysemantic_stack_[(3) - (1)].ival) / (yysemantic_stack_[(3) - (3)].ival); } + break; + + case 10: + +/* Line 678 of lalr1.cc */ +#line 8560 "../../doc/bison.texinfo" + { (yyval.ival) = driver.variables[*(yysemantic_stack_[(1) - (1)].sval)]; delete (yysemantic_stack_[(1) - (1)].sval); } + break; + + case 11: + +/* Line 678 of lalr1.cc */ +#line 8561 "../../doc/bison.texinfo" + { (yyval.ival) = (yysemantic_stack_[(1) - (1)].ival); } + break; + + + +/* Line 678 of lalr1.cc */ +#line 539 "./calc++-parser.cc" + default: + break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); + + yypop_ (yylen); + yylen = 0; + YY_STACK_PRINT (); + + yysemantic_stack_.push (yyval); + yylocation_stack_.push (yyloc); + + /* Shift the result of the reduction. */ + yyn = yyr1_[yyn]; + yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0]; + if (0 <= yystate && yystate <= yylast_ + && yycheck_[yystate] == yystate_stack_[0]) + yystate = yytable_[yystate]; + else + yystate = yydefgoto_[yyn - yyntokens_]; + goto yynewstate; + + /*------------------------------------. + | yyerrlab -- here on detecting error | + `------------------------------------*/ + yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus_) + { + ++yynerrs_; + error (yylloc, yysyntax_error_ (yystate, yytoken)); + } + + yyerror_range[0] = yylloc; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= yyeof_) + { + /* Return failure if at end of input. */ + if (yychar == yyeof_) + YYABORT; + } + else + { + yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc); + yychar = yyempty_; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (false) + goto yyerrorlab; + + yyerror_range[0] = yylocation_stack_[yylen - 1]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + yypop_ (yylen); + yylen = 0; + yystate = yystate_stack_[0]; + goto yyerrlab1; + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact_[yystate]; + if (yyn != yypact_ninf_) + { + yyn += yyterror_; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yystate_stack_.height () == 1) + YYABORT; + + yyerror_range[0] = yylocation_stack_[0]; + yydestruct_ ("Error: popping", + yystos_[yystate], + &yysemantic_stack_[0], &yylocation_stack_[0]); + yypop_ (); + yystate = yystate_stack_[0]; + YY_STACK_PRINT (); + } + + yyerror_range[1] = yylloc; + // Using YYLLOC is tempting, but would change the location of + // the lookahead. YYLOC is available though. + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yyloc); + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos_[yyn], + &yysemantic_stack_[0], &yylocation_stack_[0]); + + yystate = yyn; + goto yynewstate; + + /* Accept. */ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + /* Abort. */ + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyreturn: + if (yychar != yyempty_) + yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); + + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + yypop_ (yylen); + while (yystate_stack_.height () != 1) + { + yydestruct_ ("Cleanup: popping", + yystos_[yystate_stack_[0]], + &yysemantic_stack_[0], + &yylocation_stack_[0]); + yypop_ (); + } + + return yyresult; + } + + // Generate an error message. + std::string + calcxx_parser::yysyntax_error_ (int yystate, int tok) + { + std::string res; + YYUSE (yystate); +#if YYERROR_VERBOSE + int yyn = yypact_[yystate]; + if (yypact_ninf_ < yyn && yyn <= yylast_) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + 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_; + int count = 0; + for (int x = yyxbegin; x < yyxend; ++x) + if (yycheck_[x + yyn] == x && x != yyterror_) + ++count; + + // FIXME: This method of building the message is not compatible + // with internationalization. It should work like yacc.c does it. + // That is, first build a string that looks like this: + // "syntax error, unexpected %s or %s or %s" + // Then, invoke YY_ on this string. + // Finally, use the string as a format to output + // yytname_[tok], etc. + // Until this gets fixed, this message appears in English only. + res = "syntax error, unexpected "; + res += yytnamerr_ (yytname_[tok]); + if (count < 5) + { + 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; + } + + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + const signed char calcxx_parser::yypact_ninf_ = -9; + const signed char + calcxx_parser::yypact_[] = + { + -9, 13, 5, -9, 14, -9, -9, -1, 7, 7, + 7, 7, 7, -9, -1, 6, 6, -9, -9 + }; + + /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ + const unsigned char + calcxx_parser::yydefact_[] = + { + 4, 0, 0, 1, 10, 11, 3, 2, 0, 0, + 0, 0, 0, 10, 5, 6, 7, 8, 9 + }; + + /* YYPGOTO[NTERM-NUM]. */ + const signed char + calcxx_parser::yypgoto_[] = + { + -9, -9, -9, -9, -8 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + const signed char + calcxx_parser::yydefgoto_[] = + { + -1, 1, 2, 6, 7 + }; + + /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. */ + const signed char calcxx_parser::yytable_ninf_ = -1; + const unsigned char + calcxx_parser::yytable_[] = + { + 14, 15, 16, 17, 18, 9, 10, 11, 12, 4, + 5, 13, 5, 3, 11, 12, 0, 8 + }; + + /* YYCHECK. */ + const signed char + calcxx_parser::yycheck_[] = + { + 8, 9, 10, 11, 12, 6, 7, 8, 9, 4, + 5, 4, 5, 0, 8, 9, -1, 3 + }; + + /* STOS_[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + const unsigned char + calcxx_parser::yystos_[] = + { + 0, 11, 12, 0, 4, 5, 13, 14, 3, 6, + 7, 8, 9, 4, 14, 14, 14, 14, 14 + }; + +#if YYDEBUG + /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding + to YYLEX-NUM. */ + const unsigned short int + calcxx_parser::yytoken_number_[] = + { + 0, 256, 257, 258, 259, 260, 43, 45, 42, 47 + }; +#endif + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + const unsigned char + calcxx_parser::yyr1_[] = + { + 0, 10, 11, 12, 12, 13, 14, 14, 14, 14, + 14, 14 + }; + + /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ + const unsigned char + calcxx_parser::yyr2_[] = + { + 0, 2, 2, 2, 0, 3, 3, 3, 3, 3, + 1, 1 + }; + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at \a yyntokens_, nonterminals. */ + const char* + const calcxx_parser::yytname_[] = + { + "\"end of file\"", "error", "$undefined", "\":=\"", "\"identifier\"", + "\"number\"", "'+'", "'-'", "'*'", "'/'", "$accept", "unit", + "assignments", "assignment", "exp", 0 + }; +#endif + +#if YYDEBUG + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ + const calcxx_parser::rhs_number_type + calcxx_parser::yyrhs_[] = + { + 11, 0, -1, 12, 14, -1, 12, 13, -1, -1, + 4, 3, 14, -1, 14, 6, 14, -1, 14, 7, + 14, -1, 14, 8, 14, -1, 14, 9, 14, -1, + 4, -1, 5, -1 + }; + + /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ + const unsigned char + calcxx_parser::yyprhs_[] = + { + 0, 0, 3, 6, 9, 10, 14, 18, 22, 26, + 30, 32 + }; + + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + const unsigned short int + calcxx_parser::yyrline_[] = + { + 0, 8545, 8545, 8547, 8548, 8551, 8556, 8557, 8558, 8559, + 8560, 8561 + }; + + // Print the state stack on the debug stream. + void + calcxx_parser::yystack_print_ () + { + *yycdebug_ << "Stack now"; + for (state_stack_type::const_iterator i = yystate_stack_.begin (); + i != yystate_stack_.end (); ++i) + *yycdebug_ << ' ' << *i; + *yycdebug_ << std::endl; + } + + // Report on the debug stream that the rule \a yyrule is going to be reduced. + void + calcxx_parser::yy_reduce_print_ (int yyrule) + { + unsigned int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + /* Print the symbols being reduced, and their result. */ + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 + << " (line " << yylno << "):" << std::endl; + /* The symbols being reduced. */ + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", + yyrhs_[yyprhs_[yyrule] + yyi], + &(yysemantic_stack_[(yynrhs) - (yyi + 1)]), + &(yylocation_stack_[(yynrhs) - (yyi + 1)])); + } +#endif // YYDEBUG + + /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ + calcxx_parser::token_number_type + calcxx_parser::yytranslate_ (int t) + { + static + const token_number_type + translate_table[] = + { + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 8, 6, 2, 7, 2, 9, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5 + }; + if ((unsigned int) t <= yyuser_token_number_max_) + return translate_table[t]; + else + return yyundef_token_; + } + + const int calcxx_parser::yyeof_ = 0; + const int calcxx_parser::yylast_ = 17; + const int calcxx_parser::yynnts_ = 5; + const int calcxx_parser::yyempty_ = -2; + const int calcxx_parser::yyfinal_ = 3; + const int calcxx_parser::yyterror_ = 1; + const int calcxx_parser::yyerrcode_ = 256; + const int calcxx_parser::yyntokens_ = 10; + + const unsigned int calcxx_parser::yyuser_token_number_max_ = 260; + const calcxx_parser::token_number_type calcxx_parser::yyundef_token_ = 2; + + +/* Line 1054 of lalr1.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +} // yy + +/* Line 1054 of lalr1.cc */ +#line 960 "./calc++-parser.cc" + + +/* Line 1056 of lalr1.cc */ +#line 8562 "../../doc/bison.texinfo" + +#line 8571 "../../doc/bison.texinfo" +void +yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l, + const std::string& m) +{ + driver.error (l, m); +} + diff --git a/examples/calc++/calc++-parser.hh b/examples/calc++/calc++-parser.hh new file mode 100644 index 0000000..f09aba1 --- /dev/null +++ b/examples/calc++/calc++-parser.hh @@ -0,0 +1,339 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison LALR(1) parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 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 . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C++ LALR(1) parser skeleton written by Akim Demaille. */ + +#ifndef PARSER_HEADER_H +# define PARSER_HEADER_H + +/* "%code requires" blocks. */ + +/* Line 300 of lalr1.cc */ +#line 8438 "../../doc/bison.texinfo" + +# include +class calcxx_driver; + + + +/* Line 300 of lalr1.cc */ +#line 52 "./calc++-parser.hh" + + +#include +#include +#include "stack.hh" + + +/* Line 300 of lalr1.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +namespace yy { + +/* Line 300 of lalr1.cc */ +#line 66 "./calc++-parser.hh" + class position; + class location; + +/* Line 300 of lalr1.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +} // yy + +/* Line 300 of lalr1.cc */ +#line 76 "./calc++-parser.hh" + +#include "location.hh" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#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 + + +/* Line 300 of lalr1.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +namespace yy { + +/* Line 300 of lalr1.cc */ +#line 124 "./calc++-parser.hh" + + /// A Bison parser. + class calcxx_parser + { + public: + /// Symbol semantic values. +#ifndef YYSTYPE + union semantic_type + { + +/* Line 300 of lalr1.cc */ +#line 8490 "../../doc/bison.texinfo" + + int ival; + std::string *sval; + + + +/* Line 300 of lalr1.cc */ +#line 144 "./calc++-parser.hh" + }; +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef location location_type; + /// Tokens. + struct token + { + /* Tokens. */ + enum yytokentype { + END = 0, + ASSIGN = 258, + IDENTIFIER = 259, + NUMBER = 260 + }; + + }; + /// Token type. + typedef token::yytokentype token_type; + + /// Build a parser object. + calcxx_parser (calcxx_driver& driver_yyarg); + virtual ~calcxx_parser (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if YYDEBUG + /// The current debugging stream. + std::ostream& debug_stream () const; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + private: + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Generate an error message. + /// \param state the state where the error occurred. + /// \param tok the lookahead token. + virtual std::string yysyntax_error_ (int yystate, int tok); + +#if YYDEBUG + /// \brief Report a symbol value on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); + /// \brief Report a symbol on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); +#endif + + + /// State numbers. + typedef int state_type; + /// State stack type. + typedef stack state_stack_type; + /// Semantic value stack type. + typedef stack semantic_stack_type; + /// location stack type. + typedef stack location_stack_type; + + /// The state stack. + state_stack_type yystate_stack_; + /// The semantic value stack. + semantic_stack_type yysemantic_stack_; + /// The location stack. + location_stack_type yylocation_stack_; + + /// Internal symbol numbers. + typedef unsigned char token_number_type; + /* Tables. */ + /// For a state, the index in \a yytable_ of its portion. + static const signed char yypact_[]; + static const signed char yypact_ninf_; + + /// For a state, default rule to reduce. + /// Unless\a yytable_ specifies something else to do. + /// Zero means the default is an error. + static const unsigned char yydefact_[]; + + static const signed char yypgoto_[]; + static const signed char yydefgoto_[]; + + /// What to do in a state. + /// \a yytable_[yypact_[s]]: what to do in state \a s. + /// - if positive, shift that token. + /// - if negative, reduce the rule which number is the opposite. + /// - if zero, do what YYDEFACT says. + static const unsigned char yytable_[]; + static const signed char yytable_ninf_; + + static const signed char yycheck_[]; + + /// For a state, its accessing symbol. + static const unsigned char yystos_[]; + + /// For a rule, its LHS. + static const unsigned char yyr1_[]; + /// For a rule, its RHS length. + static const unsigned char yyr2_[]; + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#endif + +#if YYERROR_VERBOSE + /// Convert the symbol name \a n to a form suitable for a diagnostic. + virtual std::string yytnamerr_ (const char *n); +#endif + +#if YYDEBUG + /// A type to store symbol numbers and -1. + typedef signed char rhs_number_type; + /// A `-1'-separated list of the rules' RHS. + static const rhs_number_type yyrhs_[]; + /// For each rule, the index of the first RHS symbol in \a yyrhs_. + static const unsigned char yyprhs_[]; + /// For each rule, its source line number. + static const unsigned short int yyrline_[]; + /// For each scanner token number, its symbol number. + static const unsigned short int yytoken_number_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); + + /* Debugging. */ + int yydebug_; + std::ostream* yycdebug_; +#endif + + /// Convert a scanner token number \a t to a symbol number. + token_number_type yytranslate_ (int t); + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// \param yytype The symbol type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + inline void yydestruct_ (const char* yymsg, + int yytype, + semantic_type* yyvaluep, + location_type* yylocationp); + + /// Pop \a n symbols the three stacks. + inline void yypop_ (unsigned int n = 1); + + /* Constants. */ + static const int yyeof_; + /* LAST_ -- Last index in TABLE_. */ + static const int yylast_; + static const int yynnts_; + static const int yyempty_; + static const int yyfinal_; + static const int yyterror_; + static const int yyerrcode_; + static const int yyntokens_; + static const unsigned int yyuser_token_number_max_; + static const token_number_type yyundef_token_; + + /* User arguments. */ + calcxx_driver& driver; + }; + +/* Line 300 of lalr1.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +} // yy + +/* Line 300 of lalr1.cc */ +#line 336 "./calc++-parser.hh" + + + +#endif /* ! defined PARSER_HEADER_H */ diff --git a/examples/calc++/calc++-parser.stamp b/examples/calc++/calc++-parser.stamp new file mode 100644 index 0000000..e69de29 diff --git a/examples/calc++/calc++-parser.yy b/examples/calc++/calc++-parser.yy new file mode 100644 index 0000000..cd15944 --- /dev/null +++ b/examples/calc++/calc++-parser.yy @@ -0,0 +1,74 @@ +#line 8420 "../../doc/bison.texinfo" +%skeleton "lalr1.cc" /* -*- C++ -*- */ +%require "2.4.1" +%defines +%define parser_class_name "calcxx_parser" +#line 8438 "../../doc/bison.texinfo" +%code requires { +# include +class calcxx_driver; +} +#line 8451 "../../doc/bison.texinfo" +// The parsing context. +%parse-param { calcxx_driver& driver } +%lex-param { calcxx_driver& driver } +#line 8464 "../../doc/bison.texinfo" +%locations +%initial-action +{ + // Initialize the initial location. + @$.begin.filename = @$.end.filename = &driver.file; +}; +#line 8478 "../../doc/bison.texinfo" +%debug +%error-verbose +#line 8488 "../../doc/bison.texinfo" +// Symbols. +%union +{ + int ival; + std::string *sval; +}; +#line 8503 "../../doc/bison.texinfo" +%code { +# include "calc++-driver.hh" +} +#line 8518 "../../doc/bison.texinfo" +%token END 0 "end of file" +%token ASSIGN ":=" +%token IDENTIFIER "identifier" +%token NUMBER "number" +%type exp +#line 8532 "../../doc/bison.texinfo" +%printer { debug_stream () << *$$; } "identifier" +%destructor { delete $$; } "identifier" + +%printer { debug_stream () << $$; } +#line 8543 "../../doc/bison.texinfo" +%% +%start unit; +unit: assignments exp { driver.result = $2; }; + +assignments: assignments assignment {} + | /* Nothing. */ {}; + +assignment: + "identifier" ":=" exp + { driver.variables[*$1] = $3; delete $1; }; + +%left '+' '-'; +%left '*' '/'; +exp: exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp { $$ = $1 / $3; } + | "identifier" { $$ = driver.variables[*$1]; delete $1; } + | "number" { $$ = $1; }; +%% +#line 8571 "../../doc/bison.texinfo" +void +yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l, + const std::string& m) +{ + driver.error (l, m); +} diff --git a/examples/calc++/calc++-scanner.cc b/examples/calc++/calc++-scanner.cc new file mode 100644 index 0000000..48a05ff --- /dev/null +++ b/examples/calc++/calc++-scanner.cc @@ -0,0 +1,2089 @@ + +#line 3 "calc++-scanner.cc" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +/* %not-for-header */ + +/* %if-c-only */ +/* %if-not-reentrant */ + +/* %endif */ +/* %endif */ +/* %ok-for-header */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ +#include +#include +#include +#include +/* %endif */ + +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* %not-for-header */ + +/* Returned upon end-of-file. */ +#define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +/* %if-not-reentrant */ +extern int yyleng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +extern FILE *yyin, *yyout; +/* %endif */ +/* %endif */ + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { +/* %if-c-only */ + FILE *yy_input_file; +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %if-not-reentrant */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; +/* %ok-for-header */ + +/* %endif */ + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +/* %endif */ + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* %endif */ + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ + (yy_c_buf_p) = yy_cp; + +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ +#define YY_NUM_RULES 8 +#define YY_END_OF_BUFFER 9 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[17] = + { 0, + 0, 0, 9, 7, 1, 2, 3, 5, 7, 6, + 1, 2, 5, 4, 6, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 1, 4, 1, 4, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 6, 1, 1, + 7, 1, 1, 1, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 1, 1, 1, 1, 9, 1, 8, 8, 8, 8, + + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[10] = + { 0, + 1, 1, 1, 1, 2, 1, 1, 2, 2 + } ; + +static yyconst flex_int16_t yy_base[18] = + { 0, + 0, 0, 18, 19, 15, 13, 19, 10, 7, 0, + 11, 9, 6, 19, 0, 19, 8 + } ; + +static yyconst flex_int16_t yy_def[18] = + { 0, + 16, 1, 16, 16, 16, 16, 16, 16, 16, 17, + 16, 16, 16, 16, 17, 0, 16 + } ; + +static yyconst flex_int16_t yy_nxt[29] = + { 0, + 4, 5, 6, 7, 8, 9, 4, 10, 4, 15, + 13, 12, 11, 14, 13, 12, 11, 16, 3, 16, + 16, 16, 16, 16, 16, 16, 16, 16 + } ; + +static yyconst flex_int16_t yy_chk[29] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, + 13, 12, 11, 9, 8, 6, 5, 3, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 1; + +static yyconst flex_int16_t yy_rule_linenum[8] = + { 0, + 35, 36, 42, 43, 44, 52, 53 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "calc++-scanner.ll" +#line 2 "calc++-scanner.ll" +# include +# include +# include +# include +# include "calc++-driver.hh" +# include "calc++-parser.hh" + +/* Work around an incompatibility in flex (at least versions + 2.5.31 through 2.5.33): it generates code that does + not conform to C89. See Debian bug 333231 + . */ +# undef yywrap +# define yywrap() 1 + +/* By default yylex returns int, we use token_type. + Unfortunately yyterminate by default returns 0, which is + not of token_type. */ +#define yyterminate() return token::END +#line 29 "calc++-scanner.ll" +# define YY_USER_ACTION yylloc->columns (yyleng); +#line 568 "calc++-scanner.cc" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +#include +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-c-only */ + +static int yy_init_globals (void ); + +/* %endif */ +/* %if-reentrant */ +/* %endif */ +/* %endif End reentrant structures and macros. */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* %if-bison-bridge */ +/* %endif */ + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif +/* %ok-for-header */ + +/* %endif */ +#endif + +/* %if-c-only */ + +/* %endif */ + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ +/* %if-c++-only C++ definition \ */\ +/* %endif */ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +/* %if-c-only */ +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %not-for-header */ + +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ + +extern int yylex (void); + +#define YY_DECL int yylex (void) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +/* %% [6.0] YY_RULE_SETUP definition goes here */ +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/* %not-for-header */ + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +/* %% [7.0] user's declarations go here */ +#line 31 "calc++-scanner.ll" + + + yylloc->step (); + +#line 813 "calc++-scanner.cc" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) +/* %if-c-only */ + yyin = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! yyout ) +/* %if-c-only */ + yyout = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 17 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 16 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: +/* %% [10.0] code to find the action number goes here */ + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +/* %% [11.0] code for yylineno update goes here */ + +do_action: /* This label is used only to access EOF actions. */ + +/* %% [12.0] debug code goes here */ + if ( yy_flex_debug ) + { + if ( yy_act == 0 ) + fprintf( stderr, "--scanner backing up\n" ); + else if ( yy_act < 8 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], yytext ); + else if ( yy_act == 8 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + yytext ); + else if ( yy_act == 9 ) + fprintf( stderr, "--(end of buffer or a NUL)\n" ); + else + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + } + + switch ( yy_act ) + { /* beginning of action switch */ +/* %% [13.0] actions go here */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 35 "calc++-scanner.ll" +yylloc->step (); + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 36 "calc++-scanner.ll" +yylloc->lines (yyleng); yylloc->step (); + YY_BREAK + + typedef yy::calcxx_parser::token token; + +/* Convert ints to the actual type of tokens. */ +case 3: +YY_RULE_SETUP +#line 42 "calc++-scanner.ll" +return yy::calcxx_parser::token_type (yytext[0]); + YY_BREAK +case 4: +YY_RULE_SETUP +#line 43 "calc++-scanner.ll" +return token::ASSIGN; + YY_BREAK +case 5: +YY_RULE_SETUP +#line 44 "calc++-scanner.ll" +{ + errno = 0; + long n = strtol (yytext, NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + driver.error (*yylloc, "integer is out of range"); + yylval->ival = n; + return token::NUMBER; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 52 "calc++-scanner.ll" +yylval->sval = new std::string (yytext); return token::IDENTIFIER; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 53 "calc++-scanner.ll" +driver.error (*yylloc, "invalid character"); + YY_BREAK +case 8: +YY_RULE_SETUP +#line 54 "calc++-scanner.ll" +ECHO; + YY_BREAK +#line 975 "calc++-scanner.cc" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ +/* %ok-for-header */ + +/* %if-c++-only */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +/* %if-c-only */ +static int yy_get_next_buffer (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +/* %if-c-only */ +/* %not-for-header */ + + static yy_state_type yy_get_previous_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register yy_state_type yy_current_state; + register char *yy_cp; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { +/* %% [16.0] code to find the next state goes here */ + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 17 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +/* %if-c-only */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register int yy_is_jam; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 17 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 16); + + return yy_is_jam ? 0 : yy_current_state; +} + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + +/* %% [19.0] update BOL and yylineno */ + + return c; +} +/* %if-c-only */ +#endif /* ifndef YY_NO_INPUT */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void yyrestart (FILE * input_file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +/* %if-c-only */ +static void yy_load_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ +/* %if-c-only */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +/* %if-c-only */ + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ +/* %if-c-only */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + +/* %if-c-only */ + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + +/* %endif */ +/* %if-c++-only */ +/* %endif */ + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +void yypop_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +static void yyensure_buffer_stack (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} +/* %endif */ + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +/* %if-c-only */ +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/* %if-reentrant */ +/* %endif */ + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif if-c-only */ + +/* %if-c-only */ +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} +/* %endif */ + +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + +/* %if-reentrant */ +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + +#line 54 "calc++-scanner.ll" + + + +void +calcxx_driver::scan_begin () +{ + yy_flex_debug = trace_scanning; + if (file == "-") + yyin = stdin; + else if (!(yyin = fopen (file.c_str (), "r"))) + { + error (std::string ("cannot open ") + file); + exit (1); + } +} + +void +calcxx_driver::scan_end () +{ + fclose (yyin); +} + diff --git a/examples/calc++/calc++-scanner.ll b/examples/calc++/calc++-scanner.ll new file mode 100644 index 0000000..bf0b799 --- /dev/null +++ b/examples/calc++/calc++-scanner.ll @@ -0,0 +1,73 @@ +%{ /* -*- C++ -*- */ +# include +# include +# include +# include +# include "calc++-driver.hh" +# include "calc++-parser.hh" + +/* Work around an incompatibility in flex (at least versions + 2.5.31 through 2.5.33): it generates code that does + not conform to C89. See Debian bug 333231 + . */ +# undef yywrap +# define yywrap() 1 + +/* By default yylex returns int, we use token_type. + Unfortunately yyterminate by default returns 0, which is + not of token_type. */ +#define yyterminate() return token::END +%} + +%option noyywrap nounput batch debug + +id [a-zA-Z][a-zA-Z_0-9]* +int [0-9]+ +blank [ \t] + +%{ +# define YY_USER_ACTION yylloc->columns (yyleng); +%} +%% +%{ + yylloc->step (); +%} +{blank}+ yylloc->step (); +[\n]+ yylloc->lines (yyleng); yylloc->step (); + +%{ + typedef yy::calcxx_parser::token token; +%} + /* Convert ints to the actual type of tokens. */ +[-+*/] return yy::calcxx_parser::token_type (yytext[0]); +":=" return token::ASSIGN; +{int} { + errno = 0; + long n = strtol (yytext, NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + driver.error (*yylloc, "integer is out of range"); + yylval->ival = n; + return token::NUMBER; +} +{id} yylval->sval = new std::string (yytext); return token::IDENTIFIER; +. driver.error (*yylloc, "invalid character"); +%% + +void +calcxx_driver::scan_begin () +{ + yy_flex_debug = trace_scanning; + if (file == "-") + yyin = stdin; + else if (!(yyin = fopen (file.c_str (), "r"))) + { + error (std::string ("cannot open ") + file); + exit (1); + } +} + +void +calcxx_driver::scan_end () +{ + fclose (yyin); +} diff --git a/examples/calc++/calc++.cc b/examples/calc++/calc++.cc new file mode 100644 index 0000000..1dcb37a --- /dev/null +++ b/examples/calc++/calc++.cc @@ -0,0 +1,16 @@ +#line 8712 "../../doc/bison.texinfo" +#include +#include "calc++-driver.hh" + +int +main (int argc, char *argv[]) +{ + calcxx_driver driver; + for (++argv; argv[0]; ++argv) + if (*argv == std::string ("-p")) + driver.trace_parsing = true; + else if (*argv == std::string ("-s")) + driver.trace_scanning = true; + else if (!driver.parse (*argv)) + std::cout << driver.result << std::endl; +} diff --git a/examples/calc++/location.hh b/examples/calc++/location.hh new file mode 100644 index 0000000..34086a6 --- /dev/null +++ b/examples/calc++/location.hh @@ -0,0 +1,171 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Locations for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 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 . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file location.hh + ** Define the yy::location class. + */ + +#ifndef BISON_LOCATION_HH +# define BISON_LOCATION_HH + +# include +# include +# include "position.hh" + + +/* Line 162 of location.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +namespace yy { + +/* Line 162 of location.cc */ +#line 54 "./location.hh" + + /// Abstract a location. + class location + { + public: + + /// Construct a location. + location () + : begin (), end () + { + } + + + /// Initialization. + inline void initialize (std::string* fn) + { + begin.initialize (fn); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + inline void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + inline void columns (unsigned int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + inline void lines (unsigned int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two location objects to create a location. + inline const location operator+ (const location& begin, const location& end) + { + location res = begin; + res.end = end.end; + return res; + } + + /// Add two location objects. + inline const location operator+ (const location& begin, unsigned int width) + { + location res = begin; + res.columns (width); + return res; + } + + /// Add and assign a location. + inline location& operator+= (location& res, unsigned int width) + { + res.columns (width); + return res; + } + + /// Compare two location objects. + inline bool + operator== (const location& loc1, const location& loc2) + { + return loc1.begin == loc2.begin && loc1.end == loc2.end; + } + + /// Compare two location objects. + inline bool + operator!= (const location& loc1, const location& loc2) + { + return !(loc1 == loc2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + inline std::ostream& operator<< (std::ostream& ostr, const location& loc) + { + position last = loc.end - 1; + ostr << loc.begin; + if (last.filename + && (!loc.begin.filename + || *loc.begin.filename != *last.filename)) + ostr << '-' << last; + else if (loc.begin.line != last.line) + ostr << '-' << last.line << '.' << last.column; + else if (loc.begin.column != last.column) + ostr << '-' << last.column; + return ostr; + } + + +/* Line 271 of location.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +} // yy + +/* Line 271 of location.cc */ +#line 170 "./location.hh" + +#endif // not BISON_LOCATION_HH diff --git a/examples/calc++/position.hh b/examples/calc++/position.hh new file mode 100644 index 0000000..3ce5e9b --- /dev/null +++ b/examples/calc++/position.hh @@ -0,0 +1,167 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Positions for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 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 . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file position.hh + ** Define the yy::position class. + */ + +#ifndef BISON_POSITION_HH +# define BISON_POSITION_HH + +# include +# include +# include + + +/* Line 38 of location.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +namespace yy { + +/* Line 38 of location.cc */ +#line 54 "./position.hh" + /// Abstract a position. + class position + { + public: + + /// Construct a position. + position () + : filename (0), line (1), column (1) + { + } + + + /// Initialization. + inline void initialize (std::string* fn) + { + filename = fn; + line = 1; + column = 1; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// (line related) Advance to the COUNT next lines. + inline void lines (int count = 1) + { + column = 1; + line += count; + } + + /// (column related) Advance to the COUNT next columns. + inline void columns (int count = 1) + { + column = std::max (1u, column + count); + } + /** \} */ + + public: + /// File name to which this position refers. + std::string* filename; + /// Current line number. + unsigned int line; + /// Current column number. + unsigned int column; + }; + + /// Add and assign a position. + inline const position& + operator+= (position& res, const int width) + { + res.columns (width); + return res; + } + + /// Add two position objects. + inline const position + operator+ (const position& begin, const int width) + { + position res = begin; + return res += width; + } + + /// Add and assign a position. + inline const position& + operator-= (position& res, const int width) + { + return res += -width; + } + + /// Add two position objects. + inline const position + operator- (const position& begin, const int width) + { + return begin + -width; + } + + /// Compare two position objects. + inline bool + operator== (const position& pos1, const position& pos2) + { + return + (pos1.filename == pos2.filename + || pos1.filename && pos2.filename && *pos1.filename == *pos2.filename) + && pos1.line == pos2.line && pos1.column == pos2.column; + } + + /// Compare two position objects. + inline bool + operator!= (const position& pos1, const position& pos2) + { + return !(pos1 == pos2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + inline std::ostream& + operator<< (std::ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + + +/* Line 144 of location.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +} // yy + +/* Line 144 of location.cc */ +#line 167 "./position.hh" +#endif // not BISON_POSITION_HH diff --git a/examples/calc++/stack.hh b/examples/calc++/stack.hh new file mode 100644 index 0000000..b3a3b4e --- /dev/null +++ b/examples/calc++/stack.hh @@ -0,0 +1,143 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Stack handling for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 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 . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef BISON_STACK_HH +# define BISON_STACK_HH + +#include + + +/* Line 1067 of lalr1.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +namespace yy { + +/* Line 1067 of lalr1.cc */ +#line 48 "./stack.hh" + template > + class stack + { + public: + + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + + stack () : seq_ () + { + } + + stack (unsigned int n) : seq_ (n) + { + } + + inline + T& + operator [] (unsigned int i) + { + return seq_[i]; + } + + inline + const T& + operator [] (unsigned int i) const + { + return seq_[i]; + } + + inline + void + push (const T& t) + { + seq_.push_front (t); + } + + inline + void + pop (unsigned int n = 1) + { + for (; n; --n) + seq_.pop_front (); + } + + inline + unsigned int + height () const + { + return seq_.size (); + } + + inline const_iterator begin () const { return seq_.rbegin (); } + inline const_iterator end () const { return seq_.rend (); } + + private: + + S seq_; + }; + + /// Present a slice of the top of a stack. + template > + class slice + { + public: + + slice (const S& stack, + unsigned int range) : stack_ (stack), + range_ (range) + { + } + + inline + const T& + operator [] (unsigned int i) const + { + return stack_[range_ - i]; + } + + private: + + const S& stack_; + unsigned int range_; + }; + +/* Line 1153 of lalr1.cc */ +#line 1 "[Bison:b4_percent_define_default]" + +} // yy + +/* Line 1153 of lalr1.cc */ +#line 141 "./stack.hh" + +#endif // not BISON_STACK_HH[]dnl + diff --git a/examples/calc++/test b/examples/calc++/test new file mode 100755 index 0000000..2f8a045 --- /dev/null +++ b/examples/calc++/test @@ -0,0 +1,31 @@ +#! /bin/sh + +test -z "$VERBOSE" && { + exec > /dev/null 2>&1 + set -x +} + +cat >input <input <input <. + +# This script is for use with any Awk that conforms to POSIX. +# It was derived from a similar script tests/generate.awk in GNU m4. +# +# Usage: extexi input-file.texi ... -- [FILES to extract] +BEGIN { + if (!output_dir) + output_dir = "."; + for (argc = 1; argc < ARGC; ++argc) + if (ARGV[argc] == "--") + break; + for (i = argc + 1; i < ARGC; ++i) + file_wanted[ARGV[i]] = 1; + ARGC = argc; +} + +/^@node / { + if (seq > 0) + print "AT_CLEANUP"; + + split ($0, tmp, ","); + node = substr(tmp[1], 7); + seq = 0; +} + +/^@comment file: / { + if (!file_wanted[$3]) + message("ignoring " $3); + else + { + message("extracting " $3); + file = $3; + } +} + +/^@example$/, /^@end example$/ { + if (!file) + next; + + if ($0 ~ /^@example$/) + { + input = files_output[file] ? "\n" : ""; + + # FNR is starting at 0 instead of 1, and + # #line report the line number of the *next* line. + # => + 2. + # Note that recent Bison support it, but not Flex. + if (file ~ /\.[chy]*$/) + input = "#line " (FNR + 1) " \"" FILENAME "\"\n"; + next; + } + + if ($0 ~ /^@end example$/) + { + if (input == "") + fatal("no contents: " file); + + input = normalize(input); + # No spurious end of line: use printf. + if (files_output[file]) + # The parens around the output file seem to be required + # by awk on Mac OS X Tiger (darwin 8.4.6). + printf ("%s", input) >> (output_dir "/" file); + else + printf ("%s", input) > (output_dir "/" file); + close (output_dir "/" file); + files_output[file] = 1; + + file = input = ""; + next; + } + + input = input $0 "\n"; +} + + +# We have to handle CONTENTS line per line, since anchors in AWK are +# referring to the whole string, not the lines. +function normalize(contents, i, lines, n, line, res) { + # Remove the Texinfo tags. + n = split (contents, lines, "\n"); + # We don't want the last field which empty: it's behind the last \n. + for (i = 1; i < n; ++i) + { + line = lines[i]; + + # Whole line commands. + if (line ~ /^@(c |comment|dots|end (ignore|group)|ignore|group)/) + # Gperf accepts empty lines as valid input!!! + if (file ~ /\.gperf$/) + continue; + else + line = ""; + + gsub (/"@value\{VERSION\}"/, "\"" VERSION "\"", line) + gsub (/^@result\{\}/, "", line); + gsub (/^@error\{\}/, "", line); + gsub ("@[{]", "{", line); + gsub ("@}", "}", line); + gsub ("@@", "@", line); + gsub ("@comment.*", "", line); + + res = res line "\n"; + } + return res; +} + + +function message(msg) { + if (! message_printed[msg]) + { + print "extexi: " msg > "/dev/stderr"; + message_printed[msg] = 1; + } +} + +function fatal(msg) { + message(msg); + exit 1 +} diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 0000000..03d4138 --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,46 @@ +# Make bison/lib. + +# Copyright (C) 2001, 2002, 2003, 2004, 2006, 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 . + +include gnulib.mk + +AM_CFLAGS = $(WARN_CFLAGS) + +# Implementation of bitsets. +bitsets_sources = \ + abitset.c abitset.h bbitset.h bitset.c bitset.h bitset_stats.c \ + bitset_stats.h bitsetv.c bitsetv.h ebitset.c ebitset.h lbitset.c \ + lbitset.h libiberty.h vbitset.c vbitset.h + +# Additional bitset operations. +additional_bitsets_sources = \ + bitsetv-print.h bitsetv-print.c + +# timevars, stolen from GCC. +timevars_sources = \ + timevar.h timevar.c timevar.def + +# Non-gnulib sources in Bison's internal library. +libbison_a_SOURCES += \ + get-errno.h get-errno.c \ + subpipe.h subpipe.c \ + $(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources) + +# The Yacc compatibility library. +lib_LIBRARIES = $(YACC_LIBRARY) +EXTRA_LIBRARIES = liby.a +liby_a_SOURCES = main.c yyerror.c diff --git a/lib/Makefile.in b/lib/Makefile.in new file mode 100644 index 0000000..49e203e --- /dev/null +++ b/lib/Makefile.in @@ -0,0 +1,1517 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Make bison/lib. + +# Copyright (C) 2001, 2002, 2003, 2004, 2006, 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 . + +# Copyright (C) 2002-2008 Free Software Foundation, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libbison --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl announce-gen argmatch c-strcase config-h configmake dirname error extensions fopen-safer getopt gettext git-version-gen gnumakefile hash inttypes javacomp-script javaexec-script malloc mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul strverscmp unistd unistd-safer unlocked-io unsetenv verify warnings xalloc xalloc-die xstrndup + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.hin $(srcdir)/gnulib.mk +subdir = lib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLIBRARIES_INSTALL = $(INSTALL_DATA) +LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libbison_a_AR = $(AR) $(ARFLAGS) +am__DEPENDENCIES_1 = +am__dirstamp = $(am__leading_dot)dirstamp +am__objects_1 = abitset.$(OBJEXT) bitset.$(OBJEXT) \ + bitset_stats.$(OBJEXT) bitsetv.$(OBJEXT) ebitset.$(OBJEXT) \ + lbitset.$(OBJEXT) vbitset.$(OBJEXT) +am__objects_2 = bitsetv-print.$(OBJEXT) +am__objects_3 = timevar.$(OBJEXT) +am_libbison_a_OBJECTS = c-ctype.$(OBJEXT) c-strcasecmp.$(OBJEXT) \ + c-strncasecmp.$(OBJEXT) localcharset.$(OBJEXT) \ + mbswidth.$(OBJEXT) uniwidth/width.$(OBJEXT) \ + xalloc-die.$(OBJEXT) xstrndup.$(OBJEXT) get-errno.$(OBJEXT) \ + subpipe.$(OBJEXT) $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) +libbison_a_OBJECTS = $(am_libbison_a_OBJECTS) +liby_a_AR = $(AR) $(ARFLAGS) +liby_a_LIBADD = +am_liby_a_OBJECTS = main.$(OBJEXT) yyerror.$(OBJEXT) +liby_a_OBJECTS = $(am_liby_a_OBJECTS) +LTLIBRARIES = $(noinst_LTLIBRARIES) +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libbison_a_SOURCES) $(EXTRA_libbison_a_SOURCES) \ + $(liby_a_SOURCES) +DIST_SOURCES = $(libbison_a_SOURCES) $(EXTRA_libbison_a_SOURCES) \ + $(liby_a_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects +SUBDIRS = +noinst_HEADERS = +noinst_LIBRARIES = libbison.a +noinst_LTLIBRARIES = + +# This is for those projects which use "gettextize --intl" to put a source-code +# copy of libintl into their package. In such projects, every Makefile.am needs +# -I$(top_builddir)/intl, so that can be found in this directory. +# For the Makefile.ams in other directories it is the maintainer's +# responsibility; for the one from gnulib we do it here. +# This option has no effect when the user disables NLS (because then the intl +# directory contains no libintl.h file) or when the project does not use +# "gettextize --intl". +#AM_CPPFLAGS += -I$(top_builddir)/intl +EXTRA_DIST = $(top_srcdir)/build-aux/announce-gen argmatch.c \ + argmatch.h basename.c dirname.c dirname.h stripslash.c \ + errno.in.h error.c error.h exitfail.c exitfail.h fopen-safer.c \ + stdio--.h stdio-safer.h getopt.c getopt.in.h getopt1.c \ + getopt_int.h $(top_srcdir)/build-aux/config.rpath \ + $(top_srcdir)/build-aux/git-version-gen \ + $(top_srcdir)/GNUmakefile hash.c hash.h \ + $(top_srcdir)/build-aux/config.rpath intprops.h inttypes.in.h \ + $(top_srcdir)/build-aux/javacomp.sh.in \ + $(top_srcdir)/build-aux/javaexec.sh.in \ + $(top_srcdir)/build-aux/link-warning.h config.charset \ + ref-add.sin ref-del.sin malloc.c malloc.c obstack.c obstack.h \ + quote.c quote.h quotearg.c quotearg.h stdbool.in.h stdint.in.h \ + stdlib.in.h stpcpy.c streq.h strerror.c string.in.h strndup.c \ + strnlen.c strtol.c strtoul.c strverscmp.c unistd.in.h \ + dup-safer.c fd-safer.c pipe-safer.c unistd--.h unistd-safer.h \ + unitypes.h localcharset.h uniwidth.h uniwidth/cjk.h \ + unlocked-io.h unsetenv.c wchar.in.h wctype.in.h wcwidth.c \ + xalloc.h xmalloc.c +BUILT_SOURCES = configmake.h $(ERRNO_H) $(GETOPT_H) $(INTTYPES_H) \ + $(STDBOOL_H) $(STDINT_H) stdlib.h string.h unistd.h $(WCHAR_H) \ + $(WCTYPE_H) +SUFFIXES = .sed .sin +MOSTLYCLEANFILES = core *.stackdump errno.h errno.h-t getopt.h \ + getopt.h-t inttypes.h inttypes.h-t stdbool.h stdbool.h-t \ + stdint.h stdint.h-t stdlib.h stdlib.h-t string.h string.h-t \ + unistd.h unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t +MOSTLYCLEANDIRS = +CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \ + ref-del.sed +DISTCLEANFILES = +MAINTAINERCLEANFILES = +AM_CPPFLAGS = + +# Non-gnulib sources in Bison's internal library. +libbison_a_SOURCES = c-ctype.h c-ctype.c c-strcase.h c-strcasecmp.c \ + c-strncasecmp.c gettext.h localcharset.h localcharset.c \ + mbswidth.h mbswidth.c uniwidth/width.c verify.h xalloc-die.c \ + xstrndup.h xstrndup.c get-errno.h get-errno.c subpipe.h \ + subpipe.c $(bitsets_sources) $(additional_bitsets_sources) \ + $(timevars_sources) +libbison_a_LIBADD = $(gl_LIBOBJS) +libbison_a_DEPENDENCIES = $(gl_LIBOBJS) +EXTRA_libbison_a_SOURCES = argmatch.c basename.c dirname.c \ + stripslash.c error.c exitfail.c fopen-safer.c getopt.c \ + getopt1.c hash.c malloc.c malloc.c obstack.c quote.c \ + quotearg.c stpcpy.c strerror.c strndup.c strnlen.c strtol.c \ + strtoul.c strverscmp.c dup-safer.c fd-safer.c pipe-safer.c \ + unsetenv.c wcwidth.c xmalloc.c +LINK_WARNING_H = $(top_srcdir)/build-aux/link-warning.h +charset_alias = $(DESTDIR)$(libdir)/charset.alias +charset_tmp = $(DESTDIR)$(libdir)/charset.tmp +AM_CFLAGS = $(WARN_CFLAGS) + +# Implementation of bitsets. +bitsets_sources = \ + abitset.c abitset.h bbitset.h bitset.c bitset.h bitset_stats.c \ + bitset_stats.h bitsetv.c bitsetv.h ebitset.c ebitset.h lbitset.c \ + lbitset.h libiberty.h vbitset.c vbitset.h + + +# Additional bitset operations. +additional_bitsets_sources = \ + bitsetv-print.h bitsetv-print.c + + +# timevars, stolen from GCC. +timevars_sources = \ + timevar.h timevar.c timevar.def + + +# The Yacc compatibility library. +lib_LIBRARIES = $(YACC_LIBRARY) +EXTRA_LIBRARIES = liby.a +liby_a_SOURCES = main.c yyerror.c +all: $(BUILT_SOURCES) config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .sed .sin .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/gnulib.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.hin $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status lib/config.h +$(srcdir)/config.hin: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + p=$(am__strip_dir) \ + echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ + $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +uniwidth/$(am__dirstamp): + @$(MKDIR_P) uniwidth + @: > uniwidth/$(am__dirstamp) +uniwidth/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) uniwidth/$(DEPDIR) + @: > uniwidth/$(DEPDIR)/$(am__dirstamp) +uniwidth/width.$(OBJEXT): uniwidth/$(am__dirstamp) \ + uniwidth/$(DEPDIR)/$(am__dirstamp) +libbison.a: $(libbison_a_OBJECTS) $(libbison_a_DEPENDENCIES) + -rm -f libbison.a + $(libbison_a_AR) libbison.a $(libbison_a_OBJECTS) $(libbison_a_LIBADD) + $(RANLIB) libbison.a +liby.a: $(liby_a_OBJECTS) $(liby_a_DEPENDENCIES) + -rm -f liby.a + $(liby_a_AR) liby.a $(liby_a_OBJECTS) $(liby_a_LIBADD) + $(RANLIB) liby.a + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f uniwidth/width.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abitset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argmatch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitset_stats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitsetv-print.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitsetv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-ctype.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strcasecmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strncasecmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebitset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-errno.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lbitset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbswidth.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obstack.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipe-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quotearg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoul.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strverscmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subpipe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timevar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unsetenv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbitset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcwidth.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrndup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yyerror.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@uniwidth/$(DEPDIR)/width.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ mv -f $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ mv -f $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) config.h \ + all-local +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f uniwidth/$(DEPDIR)/$(am__dirstamp) + -rm -f uniwidth/$(am__dirstamp) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) uniwidth/$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-local distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: install-exec-local install-libLIBRARIES + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) uniwidth/$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-local + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-libLIBRARIES uninstall-local + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am all-local check check-am clean clean-generic \ + clean-libLIBRARIES clean-noinstLIBRARIES \ + clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-local distclean-tags distdir dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-exec-local install-html install-html-am install-info \ + install-info-am install-libLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-local pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-libLIBRARIES uninstall-local + + +# Retrieve values of the variables through 'configure' followed by +# 'make', not directly through 'configure', so that a user who +# sets some of these variables consistently on the 'make' command +# line gets correct results. +# +# One advantage of this approach, compared to the classical +# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS, +# is that it protects against the use of undefined variables. +# If, say, $(libdir) is not set in the Makefile, LIBDIR is not +# defined by this module, and code using LIBDIR gives a +# compilation error. +# +# Another advantage is that 'make' output is shorter. +# +# Listed in the same order as the GNU makefile conventions. +# The Automake-defined pkg* macros are appended, in the order +# listed in the Automake 1.10a+ documentation. +configmake.h: Makefile + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo '#define PREFIX "$(prefix)"'; \ + echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ + echo '#define BINDIR "$(bindir)"'; \ + echo '#define SBINDIR "$(sbindir)"'; \ + echo '#define LIBEXECDIR "$(libexecdir)"'; \ + echo '#define DATAROOTDIR "$(datarootdir)"'; \ + echo '#define DATADIR "$(datadir)"'; \ + echo '#define SYSCONFDIR "$(sysconfdir)"'; \ + echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \ + echo '#define LOCALSTATEDIR "$(localstatedir)"'; \ + echo '#define INCLUDEDIR "$(includedir)"'; \ + echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \ + echo '#define DOCDIR "$(docdir)"'; \ + echo '#define INFODIR "$(infodir)"'; \ + echo '#define HTMLDIR "$(htmldir)"'; \ + echo '#define DVIDIR "$(dvidir)"'; \ + echo '#define PDFDIR "$(pdfdir)"'; \ + echo '#define PSDIR "$(psdir)"'; \ + echo '#define LIBDIR "$(libdir)"'; \ + echo '#define LISPDIR "$(lispdir)"'; \ + echo '#define LOCALEDIR "$(localedir)"'; \ + echo '#define MANDIR "$(mandir)"'; \ + echo '#define MANEXT "$(manext)"'; \ + echo '#define PKGDATADIR "$(pkgdatadir)"'; \ + echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ + echo '#define PKGLIBDIR "$(pkglibdir)"'; \ + echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ + } | sed '/""/d' > $@-t + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that is POSIX compliant. +errno.h: errno.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ + -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ + -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ + -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ + -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ + -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ + -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ + < $(srcdir)/errno.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +getopt.h: getopt.in.h + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/getopt.in.h; \ + } > $@-t + mv -f $@-t $@ + +distclean-local: clean-GNUmakefile +clean-GNUmakefile: + test x'$(VPATH)' != x && rm -f $(top_builddir)/GNUmakefile || : + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +inttypes.h: inttypes.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ + -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ + -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \ + -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \ + -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \ + -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \ + -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ + -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ + -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ + -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ + -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ + -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \ + -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \ + -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/inttypes.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to install a simple file in $(libdir) +# which is shared with other installed packages. We use a list of referencing +# packages so that "make uninstall" will remove the file if and only if it +# is not used by another installed package. +# On systems with glibc-2.1 or newer, the file is redundant, therefore we +# avoid installing it. + +all-local: charset.alias ref-add.sed ref-del.sed +install-exec-local: all-local + test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir) + if test -f $(charset_alias); then \ + sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \ + $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ + rm -f $(charset_tmp) ; \ + else \ + if test $(GLIBC21) = no; then \ + sed -f ref-add.sed charset.alias > $(charset_tmp) ; \ + $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ + rm -f $(charset_tmp) ; \ + fi ; \ + fi + +uninstall-local: all-local + if test -f $(charset_alias); then \ + sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \ + if grep '^# Packages using this file: $$' $(charset_tmp) \ + > /dev/null; then \ + rm -f $(charset_alias); \ + else \ + $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \ + fi; \ + rm -f $(charset_tmp); \ + fi + +charset.alias: config.charset + rm -f t-$@ $@ + $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ + mv t-$@ $@ +.sin.sed: + rm -f t-$@ $@ + sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ + mv t-$@ $@ + +# We need the following in order to create when the system +# doesn't have one that works. +stdbool.h: stdbool.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdint.h: stdint.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ + -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ + -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + < $(srcdir)/stdint.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdlib.h: stdlib.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ + -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ + -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ + -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ + -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ + -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ + -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ + -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ + -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ + -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ + -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ + -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ + -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ + -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ + -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ + -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ + -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ + -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ + -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \ + -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ + -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \ + -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ + -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ + -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ + -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ + -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ + -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ + -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ + -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ + -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ + -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ + -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ + -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/stdlib.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +string.h: string.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ + -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ + -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ + -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ + -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ + -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ + -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ + -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ + -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ + -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ + -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ + -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ + -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ + -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ + -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ + -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ + -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ + -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ + -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ + -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ + -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ + -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ + -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ + -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ + -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ + -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ + -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ + -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ + -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ + -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ + -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ + -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ + -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ + -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ + -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ + -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ + -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ + -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ + -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ + -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ + -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ + -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ + -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ + -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ + -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ + -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ + -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/string.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create an empty placeholder for +# when the system doesn't have one. +unistd.h: unistd.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ + -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ + -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ + -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ + -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ + -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ + -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ + -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ + -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ + -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ + -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ + -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ + -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ + -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ + -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ + -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ + -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ + -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ + -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ + -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ + -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ + -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ + -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ + -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ + -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ + -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ + -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ + -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ + -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ + -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ + -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ + -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ + -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ + -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ + -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ + -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ + -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ + -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ + -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ + -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ + -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/unistd.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create when the system +# version does not work standalone. +wchar.h: wchar.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ + -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ + -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ + -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/wchar.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +wctype.h: wctype.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ + -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ + -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ + < $(srcdir)/wctype.in.h; \ + } > $@-t + mv $@-t $@ + +mostlyclean-local: mostlyclean-generic + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done; \ + : +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/abitset.c b/lib/abitset.c new file mode 100644 index 0000000..b03ff12 --- /dev/null +++ b/lib/abitset.c @@ -0,0 +1,825 @@ +/* Array bitsets. + Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#include + +#include "abitset.h" +#include +#include +#include + +/* This file implements fixed size bitsets stored as an array + of words. Any unused bits in the last word must be zero. */ + +#define ABITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS) +#define ABITSET_WORDS(X) ((X)->a.words) + + +static bitset_bindex +abitset_resize (bitset src, bitset_bindex size) +{ + /* These bitsets have a fixed size. */ + if (BITSET_SIZE_ (src) != size) + abort (); + + return size; +} + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT and store in array LIST. Return with actual number of bits + found and with *NEXT indicating where search stopped. */ +static bitset_bindex +abitset_small_list (bitset src, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + bitset_bindex bitno; + bitset_bindex count; + bitset_windex size; + bitset_word word; + + word = ABITSET_WORDS (src)[0]; + + /* Short circuit common case. */ + if (!word) + return 0; + + size = BITSET_SIZE_ (src); + bitno = *next; + if (bitno >= size) + return 0; + + word >>= bitno; + + /* If num is 1, we could speed things up with a binary search + of the word of interest. */ + + if (num >= BITSET_WORD_BITS) + { + for (count = 0; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + else + { + for (count = 0; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + bitno++; + break; + } + } + word >>= 1; + } + } + + *next = bitno; + return count; +} + + +/* Set bit BITNO in bitset DST. */ +static void +abitset_set (bitset dst ATTRIBUTE_UNUSED, bitset_bindex bitno ATTRIBUTE_UNUSED) +{ + /* This should never occur for abitsets since we should always hit + the cache. It is likely someone is trying to access outside the + bounds of the bitset. */ + abort (); +} + + +/* Reset bit BITNO in bitset DST. */ +static void +abitset_reset (bitset dst ATTRIBUTE_UNUSED, + bitset_bindex bitno ATTRIBUTE_UNUSED) +{ + /* This should never occur for abitsets since we should always hit + the cache. It is likely someone is trying to access outside the + bounds of the bitset. Since the bit is zero anyway, let it pass. */ +} + + +/* Test bit BITNO in bitset SRC. */ +static bool +abitset_test (bitset src ATTRIBUTE_UNUSED, + bitset_bindex bitno ATTRIBUTE_UNUSED) +{ + /* This should never occur for abitsets since we should always + hit the cache. */ + return false; +} + + +/* Find list of up to NUM bits set in BSET in reverse order, starting + from and including NEXT and store in array LIST. Return with + actual number of bits found and with *NEXT indicating where search + stopped. */ +static bitset_bindex +abitset_list_reverse (bitset src, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + bitset_bindex bitno; + bitset_bindex rbitno; + bitset_bindex count; + bitset_windex windex; + unsigned int bitcnt; + bitset_bindex bitoff; + bitset_word *srcp = ABITSET_WORDS (src); + bitset_bindex n_bits = BITSET_SIZE_ (src); + + rbitno = *next; + + /* If num is 1, we could speed things up with a binary search + of the word of interest. */ + + if (rbitno >= n_bits) + return 0; + + count = 0; + + bitno = n_bits - (rbitno + 1); + + windex = bitno / BITSET_WORD_BITS; + bitcnt = bitno % BITSET_WORD_BITS; + bitoff = windex * BITSET_WORD_BITS; + + do + { + bitset_word word; + + word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt); + for (; word; bitcnt--) + { + if (word & BITSET_MSB) + { + list[count++] = bitoff + bitcnt; + if (count >= num) + { + *next = n_bits - (bitoff + bitcnt); + return count; + } + } + word <<= 1; + } + bitoff -= BITSET_WORD_BITS; + bitcnt = BITSET_WORD_BITS - 1; + } + while (windex--); + + *next = n_bits - (bitoff + 1); + return count; +} + + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT and store in array LIST. Return with actual number of bits + found and with *NEXT indicating where search stopped. */ +static bitset_bindex +abitset_list (bitset src, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + bitset_bindex bitno; + bitset_bindex count; + bitset_windex windex; + bitset_bindex bitoff; + bitset_windex size = src->b.csize; + bitset_word *srcp = ABITSET_WORDS (src); + bitset_word word; + + bitno = *next; + + count = 0; + if (!bitno) + { + /* Many bitsets are zero, so make this common case fast. */ + for (windex = 0; windex < size && !srcp[windex]; windex++) + continue; + if (windex >= size) + return 0; + + /* If num is 1, we could speed things up with a binary search + of the current word. */ + + bitoff = windex * BITSET_WORD_BITS; + } + else + { + if (bitno >= BITSET_SIZE_ (src)) + return 0; + + windex = bitno / BITSET_WORD_BITS; + bitno = bitno % BITSET_WORD_BITS; + + if (bitno) + { + /* Handle the case where we start within a word. + Most often, this is executed with large bitsets + with many set bits where we filled the array + on the previous call to this function. */ + + bitoff = windex * BITSET_WORD_BITS; + word = srcp[windex] >> bitno; + for (bitno = bitoff + bitno; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + *next = bitno + 1; + return count; + } + } + word >>= 1; + } + windex++; + } + bitoff = windex * BITSET_WORD_BITS; + } + + for (; windex < size; windex++, bitoff += BITSET_WORD_BITS) + { + if (!(word = srcp[windex])) + continue; + + if ((count + BITSET_WORD_BITS) < num) + { + for (bitno = bitoff; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + else + { + for (bitno = bitoff; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + *next = bitno + 1; + return count; + } + } + word >>= 1; + } + } + } + + *next = bitoff; + return count; +} + + +/* Ensure that any unused bits within the last word are clear. */ +static inline void +abitset_unused_clear (bitset dst) +{ + unsigned int last_bit; + + last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS; + if (last_bit) + ABITSET_WORDS (dst)[dst->b.csize - 1] &= + ((bitset_word) 1 << last_bit) - 1; +} + + +static void +abitset_ones (bitset dst) +{ + bitset_word *dstp = ABITSET_WORDS (dst); + size_t bytes; + + bytes = sizeof (bitset_word) * dst->b.csize; + + memset (dstp, -1, bytes); + abitset_unused_clear (dst); +} + + +static void +abitset_zero (bitset dst) +{ + bitset_word *dstp = ABITSET_WORDS (dst); + size_t bytes; + + bytes = sizeof (bitset_word) * dst->b.csize; + + memset (dstp, 0, bytes); +} + + +static bool +abitset_empty_p (bitset dst) +{ + bitset_windex i; + bitset_word *dstp = ABITSET_WORDS (dst); + + for (i = 0; i < dst->b.csize; i++) + if (dstp[i]) + return false; + + return true; +} + + +static void +abitset_copy1 (bitset dst, bitset src) +{ + bitset_word *srcp = ABITSET_WORDS (src); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + if (srcp == dstp) + return; + memcpy (dstp, srcp, sizeof (bitset_word) * size); +} + + +static void +abitset_not (bitset dst, bitset src) +{ + bitset_windex i; + bitset_word *srcp = ABITSET_WORDS (src); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + *dstp++ = ~(*srcp++); + abitset_unused_clear (dst); +} + + +static bool +abitset_equal_p (bitset dst, bitset src) +{ + bitset_windex i; + bitset_word *srcp = ABITSET_WORDS (src); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + if (*srcp++ != *dstp++) + return false; + return true; +} + + +static bool +abitset_subset_p (bitset dst, bitset src) +{ + bitset_windex i; + bitset_word *srcp = ABITSET_WORDS (src); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++, dstp++, srcp++) + if (*dstp != (*srcp | *dstp)) + return false; + return true; +} + + +static bool +abitset_disjoint_p (bitset dst, bitset src) +{ + bitset_windex i; + bitset_word *srcp = ABITSET_WORDS (src); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + if (*srcp++ & *dstp++) + return false; + + return true; +} + + +static void +abitset_and (bitset dst, bitset src1, bitset src2) +{ + bitset_windex i; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + *dstp++ = *src1p++ & *src2p++; +} + + +static bool +abitset_and_cmp (bitset dst, bitset src1, bitset src2) +{ + bitset_windex i; + bool changed = false; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = *src1p++ & *src2p++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + return changed; +} + + +static void +abitset_andn (bitset dst, bitset src1, bitset src2) +{ + bitset_windex i; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + *dstp++ = *src1p++ & ~(*src2p++); +} + + +static bool +abitset_andn_cmp (bitset dst, bitset src1, bitset src2) +{ + bitset_windex i; + bool changed = false; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = *src1p++ & ~(*src2p++); + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + return changed; +} + + +static void +abitset_or (bitset dst, bitset src1, bitset src2) +{ + bitset_windex i; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + *dstp++ = *src1p++ | *src2p++; +} + + +static bool +abitset_or_cmp (bitset dst, bitset src1, bitset src2) +{ + bitset_windex i; + bool changed = false; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = *src1p++ | *src2p++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + return changed; +} + + +static void +abitset_xor (bitset dst, bitset src1, bitset src2) +{ + bitset_windex i; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + *dstp++ = *src1p++ ^ *src2p++; +} + + +static bool +abitset_xor_cmp (bitset dst, bitset src1, bitset src2) +{ + bitset_windex i; + bool changed = false; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = *src1p++ ^ *src2p++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + return changed; +} + + +static void +abitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_windex i; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *src3p = ABITSET_WORDS (src3); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + *dstp++ = (*src1p++ & *src2p++) | *src3p++; +} + + +static bool +abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_windex i; + bool changed = false; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *src3p = ABITSET_WORDS (src3); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = (*src1p++ & *src2p++) | *src3p++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + return changed; +} + + +static void +abitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_windex i; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *src3p = ABITSET_WORDS (src3); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + *dstp++ = (*src1p++ & ~(*src2p++)) | *src3p++; +} + + +static bool +abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_windex i; + bool changed = false; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *src3p = ABITSET_WORDS (src3); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + return changed; +} + + +static void +abitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_windex i; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *src3p = ABITSET_WORDS (src3); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++) + *dstp++ = (*src1p++ | *src2p++) & *src3p++; +} + + +static bool +abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_windex i; + bool changed = false; + bitset_word *src1p = ABITSET_WORDS (src1); + bitset_word *src2p = ABITSET_WORDS (src2); + bitset_word *src3p = ABITSET_WORDS (src3); + bitset_word *dstp = ABITSET_WORDS (dst); + bitset_windex size = dst->b.csize; + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = (*src1p++ | *src2p++) & *src3p++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + return changed; +} + + +static void +abitset_copy (bitset dst, bitset src) +{ + if (BITSET_COMPATIBLE_ (dst, src)) + abitset_copy1 (dst, src); + else + bitset_copy_ (dst, src); +} + + +/* Vector of operations for single word bitsets. */ +struct bitset_vtable abitset_small_vtable = { + abitset_set, + abitset_reset, + bitset_toggle_, + abitset_test, + abitset_resize, + bitset_size_, + bitset_count_, + abitset_empty_p, + abitset_ones, + abitset_zero, + abitset_copy, + abitset_disjoint_p, + abitset_equal_p, + abitset_not, + abitset_subset_p, + abitset_and, + abitset_and_cmp, + abitset_andn, + abitset_andn_cmp, + abitset_or, + abitset_or_cmp, + abitset_xor, + abitset_xor_cmp, + abitset_and_or, + abitset_and_or_cmp, + abitset_andn_or, + abitset_andn_or_cmp, + abitset_or_and, + abitset_or_and_cmp, + abitset_small_list, + abitset_list_reverse, + NULL, + BITSET_ARRAY +}; + + +/* Vector of operations for multiple word bitsets. */ +struct bitset_vtable abitset_vtable = { + abitset_set, + abitset_reset, + bitset_toggle_, + abitset_test, + abitset_resize, + bitset_size_, + bitset_count_, + abitset_empty_p, + abitset_ones, + abitset_zero, + abitset_copy, + abitset_disjoint_p, + abitset_equal_p, + abitset_not, + abitset_subset_p, + abitset_and, + abitset_and_cmp, + abitset_andn, + abitset_andn_cmp, + abitset_or, + abitset_or_cmp, + abitset_xor, + abitset_xor_cmp, + abitset_and_or, + abitset_and_or_cmp, + abitset_andn_or, + abitset_andn_or_cmp, + abitset_or_and, + abitset_or_and_cmp, + abitset_list, + abitset_list_reverse, + NULL, + BITSET_ARRAY +}; + + +size_t +abitset_bytes (bitset_bindex n_bits) +{ + bitset_windex size; + size_t bytes; + size_t header_size = offsetof (union bitset_union, a.words); + struct bitset_align_struct { char a; union bitset_union b; }; + size_t bitset_alignment = offsetof (struct bitset_align_struct, b); + + size = ABITSET_N_WORDS (n_bits); + bytes = header_size + size * sizeof (bitset_word); + + /* Align the size properly for a vector of abitset objects. */ + if (header_size % bitset_alignment != 0 + || sizeof (bitset_word) % bitset_alignment != 0) + { + bytes += bitset_alignment - 1; + bytes -= bytes % bitset_alignment; + } + + return bytes; +} + + +bitset +abitset_init (bitset bset, bitset_bindex n_bits) +{ + bitset_windex size; + + size = ABITSET_N_WORDS (n_bits); + BITSET_NBITS_ (bset) = n_bits; + + /* Use optimized routines if bitset fits within a single word. + There is probably little merit if using caching since + the small bitset will always fit in the cache. */ + if (size == 1) + bset->b.vtable = &abitset_small_vtable; + else + bset->b.vtable = &abitset_vtable; + + bset->b.cindex = 0; + bset->b.csize = size; + bset->b.cdata = ABITSET_WORDS (bset); + return bset; +} diff --git a/lib/abitset.h b/lib/abitset.h new file mode 100644 index 0000000..06fd1bd --- /dev/null +++ b/lib/abitset.h @@ -0,0 +1,27 @@ +/* Functions to support abitsets. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#ifndef _ABITSET_H +#define _ABITSET_H + +#include "bitset.h" + +extern size_t abitset_bytes (bitset_bindex); + +extern bitset abitset_init (bitset, bitset_bindex); + +#endif diff --git a/lib/argmatch.c b/lib/argmatch.c new file mode 100644 index 0000000..925449b --- /dev/null +++ b/lib/argmatch.c @@ -0,0 +1,277 @@ +/* argmatch.c -- find a match for a string in an array + + Copyright (C) 1990, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + 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 . */ + +/* Written by David MacKenzie + Modified by Akim Demaille */ + +#include + +/* Specification. */ +#include "argmatch.h" + +#include +#include +#include +#include + +#include "gettext.h" +#define _(msgid) gettext (msgid) + +#include "error.h" +#include "quotearg.h" +#include "quote.h" + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif + +/* When reporting an invalid argument, show nonprinting characters + by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use + literal_quoting_style. */ +#ifndef ARGMATCH_QUOTING_STYLE +# define ARGMATCH_QUOTING_STYLE locale_quoting_style +#endif + +/* Non failing version of argmatch call this function after failing. */ +#ifndef ARGMATCH_DIE +# include "exitfail.h" +# define ARGMATCH_DIE exit (exit_failure) +#endif + +#ifdef ARGMATCH_DIE_DECL +ARGMATCH_DIE_DECL; +#endif + +static void +__argmatch_die (void) +{ + ARGMATCH_DIE; +} + +/* Used by XARGMATCH and XARGCASEMATCH. See description in argmatch.h. + Default to __argmatch_die, but allow caller to change this at run-time. */ +argmatch_exit_fn argmatch_die = __argmatch_die; + + +/* If ARG is an unambiguous match for an element of the + NULL-terminated array ARGLIST, return the index in ARGLIST + of the matched element, else -1 if it does not match any element + or -2 if it is ambiguous (is a prefix of more than one element). + + If VALLIST is none null, use it to resolve ambiguities limited to + synonyms, i.e., for + "yes", "yop" -> 0 + "no", "nope" -> 1 + "y" is a valid argument, for `0', and "n" for `1'. */ + +ptrdiff_t +argmatch (const char *arg, const char *const *arglist, + const char *vallist, size_t valsize) +{ + size_t i; /* Temporary index in ARGLIST. */ + size_t arglen; /* Length of ARG. */ + ptrdiff_t matchind = -1; /* Index of first nonexact match. */ + bool ambiguous = false; /* If true, multiple nonexact match(es). */ + + arglen = strlen (arg); + + /* Test all elements for either exact match or abbreviated matches. */ + for (i = 0; arglist[i]; i++) + { + if (!strncmp (arglist[i], arg, arglen)) + { + if (strlen (arglist[i]) == arglen) + /* Exact match found. */ + return i; + else if (matchind == -1) + /* First nonexact match found. */ + matchind = i; + else + { + /* Second nonexact match found. */ + if (vallist == NULL + || memcmp (vallist + valsize * matchind, + vallist + valsize * i, valsize)) + { + /* There is a real ambiguity, or we could not + disambiguate. */ + ambiguous = true; + } + } + } + } + if (ambiguous) + return -2; + else + return matchind; +} + +/* Error reporting for argmatch. + CONTEXT is a description of the type of entity that was being matched. + VALUE is the invalid value that was given. + PROBLEM is the return value from argmatch. */ + +void +argmatch_invalid (const char *context, const char *value, ptrdiff_t problem) +{ + char const *format = (problem == -1 + ? _("invalid argument %s for %s") + : _("ambiguous argument %s for %s")); + + error (0, 0, format, quotearg_n_style (0, ARGMATCH_QUOTING_STYLE, value), + quote_n (1, context)); +} + +/* List the valid arguments for argmatch. + ARGLIST is the same as in argmatch. + VALLIST is a pointer to an array of values. + VALSIZE is the size of the elements of VALLIST */ +void +argmatch_valid (const char *const *arglist, + const char *vallist, size_t valsize) +{ + size_t i; + const char *last_val = NULL; + + /* We try to put synonyms on the same line. The assumption is that + synonyms follow each other */ + fprintf (stderr, _("Valid arguments are:")); + for (i = 0; arglist[i]; i++) + if ((i == 0) + || memcmp (last_val, vallist + valsize * i, valsize)) + { + fprintf (stderr, "\n - `%s'", arglist[i]); + last_val = vallist + valsize * i; + } + else + { + fprintf (stderr, ", `%s'", arglist[i]); + } + putc ('\n', stderr); +} + +/* Never failing versions of the previous functions. + + CONTEXT is the context for which argmatch is called (e.g., + "--version-control", or "$VERSION_CONTROL" etc.). Upon failure, + calls the (supposed never to return) function EXIT_FN. */ + +ptrdiff_t +__xargmatch_internal (const char *context, + const char *arg, const char *const *arglist, + const char *vallist, size_t valsize, + argmatch_exit_fn exit_fn) +{ + ptrdiff_t res = argmatch (arg, arglist, vallist, valsize); + if (res >= 0) + /* Success. */ + return res; + + /* We failed. Explain why. */ + argmatch_invalid (context, arg, res); + argmatch_valid (arglist, vallist, valsize); + (*exit_fn) (); + + return -1; /* To please the compilers. */ +} + +/* Look for VALUE in VALLIST, an array of objects of size VALSIZE and + return the first corresponding argument in ARGLIST */ +const char * +argmatch_to_argument (const char *value, + const char *const *arglist, + const char *vallist, size_t valsize) +{ + size_t i; + + for (i = 0; arglist[i]; i++) + if (!memcmp (value, vallist + valsize * i, valsize)) + return arglist[i]; + return NULL; +} + +#ifdef TEST +/* + * Based on "getversion.c" by David MacKenzie + */ +char *program_name; + +/* When to make backup files. */ +enum backup_type +{ + /* Never make backups. */ + no_backups, + + /* Make simple backups of every file. */ + simple_backups, + + /* Make numbered backups of files that already have numbered backups, + and simple backups of the others. */ + numbered_existing_backups, + + /* Make numbered backups of every file. */ + numbered_backups +}; + +/* Two tables describing arguments (keys) and their corresponding + values */ +static const char *const backup_args[] = +{ + "no", "none", "off", + "simple", "never", + "existing", "nil", + "numbered", "t", + 0 +}; + +static const enum backup_type backup_vals[] = +{ + no_backups, no_backups, no_backups, + simple_backups, simple_backups, + numbered_existing_backups, numbered_existing_backups, + numbered_backups, numbered_backups +}; + +int +main (int argc, const char *const *argv) +{ + const char *cp; + enum backup_type backup_type = no_backups; + + program_name = (char *) argv[0]; + + if (argc > 2) + { + fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", program_name); + exit (1); + } + + if ((cp = getenv ("VERSION_CONTROL"))) + backup_type = XARGMATCH ("$VERSION_CONTROL", cp, + backup_args, backup_vals); + + if (argc == 2) + backup_type = XARGMATCH (program_name, argv[1], + backup_args, backup_vals); + + printf ("The version control is `%s'\n", + ARGMATCH_TO_ARGUMENT (backup_type, backup_args, backup_vals)); + + return 0; +} +#endif diff --git a/lib/argmatch.h b/lib/argmatch.h new file mode 100644 index 0000000..cc40314 --- /dev/null +++ b/lib/argmatch.h @@ -0,0 +1,102 @@ +/* argmatch.h -- definitions and prototypes for argmatch.c + + Copyright (C) 1990, 1998, 1999, 2001, 2002, 2004, 2005 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 . */ + +/* Written by David MacKenzie + Modified by Akim Demaille */ + +#ifndef ARGMATCH_H_ +# define ARGMATCH_H_ 1 + +# include + +# include "verify.h" + +# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) + +/* Assert there are as many real arguments as there are values + (argument list ends with a NULL guard). */ + +# define ARGMATCH_VERIFY(Arglist, Vallist) \ + verify (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1) + +/* Return the index of the element of ARGLIST (NULL terminated) that + matches with ARG. If VALLIST is not NULL, then use it to resolve + false ambiguities (i.e., different matches of ARG but corresponding + to the same values in VALLIST). */ + +ptrdiff_t argmatch (char const *arg, char const *const *arglist, + char const *vallist, size_t valsize); + +# define ARGMATCH(Arg, Arglist, Vallist) \ + argmatch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist)) + +/* xargmatch calls this function when it fails. This function should not + return. By default, this is a function that calls ARGMATCH_DIE which + in turn defaults to `exit (exit_failure)'. */ +typedef void (*argmatch_exit_fn) (void); +extern argmatch_exit_fn argmatch_die; + +/* Report on stderr why argmatch failed. Report correct values. */ + +void argmatch_invalid (char const *context, char const *value, + ptrdiff_t problem); + +/* Left for compatibility with the old name invalid_arg */ + +# define invalid_arg(Context, Value, Problem) \ + argmatch_invalid (Context, Value, Problem) + + + +/* Report on stderr the list of possible arguments. */ + +void argmatch_valid (char const *const *arglist, + char const *vallist, size_t valsize); + +# define ARGMATCH_VALID(Arglist, Vallist) \ + argmatch_valid (Arglist, (char const *) (Vallist), sizeof *(Vallist)) + + + +/* Same as argmatch, but upon failure, reports a explanation on the + failure, and exits using the function EXIT_FN. */ + +ptrdiff_t __xargmatch_internal (char const *context, + char const *arg, char const *const *arglist, + char const *vallist, size_t valsize, + argmatch_exit_fn exit_fn); + +/* Programmer friendly interface to __xargmatch_internal. */ + +# define XARGMATCH(Context, Arg, Arglist, Vallist) \ + ((Vallist) [__xargmatch_internal (Context, Arg, Arglist, \ + (char const *) (Vallist), \ + sizeof *(Vallist), \ + argmatch_die)]) + +/* Convert a value into a corresponding argument. */ + +char const *argmatch_to_argument (char const *value, + char const *const *arglist, + char const *vallist, size_t valsize); + +# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \ + argmatch_to_argument (Value, Arglist, \ + (char const *) (Vallist), sizeof *(Vallist)) + +#endif /* ARGMATCH_H_ */ diff --git a/lib/basename.c b/lib/basename.c new file mode 100644 index 0000000..426ed40 --- /dev/null +++ b/lib/basename.c @@ -0,0 +1,128 @@ +/* basename.c -- return the last element in a file name + + Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 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 . */ + +#include + +#include "dirname.h" + +#include +#include "xalloc.h" +#include "xstrndup.h" + +/* Return the address of the last file name component of NAME. If + NAME has no relative file name components because it is a file + system root, return the empty string. */ + +char * +last_component (char const *name) +{ + char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); + char const *p; + bool saw_slash = false; + + while (ISSLASH (*base)) + base++; + + for (p = base; *p; p++) + { + if (ISSLASH (*p)) + saw_slash = true; + else if (saw_slash) + { + base = p; + saw_slash = false; + } + } + + return (char *) base; +} + + +/* In general, we can't use the builtin `basename' function if available, + since it has different meanings in different environments. + In some environments the builtin `basename' modifies its argument. + + Return the last file name component of NAME, allocated with + xmalloc. On systems with drive letters, a leading "./" + distinguishes relative names that would otherwise look like a drive + letter. Unlike POSIX basename(), NAME cannot be NULL, + base_name("") returns "", and the first trailing slash is not + stripped. + + If lstat (NAME) would succeed, then { chdir (dir_name (NAME)); + lstat (base_name (NAME)); } will access the same file. Likewise, + if the sequence { chdir (dir_name (NAME)); + rename (base_name (NAME), "foo"); } succeeds, you have renamed NAME + to "foo" in the same directory NAME was in. */ + +char * +base_name (char const *name) +{ + char const *base = last_component (name); + size_t length; + + /* If there is no last component, then name is a file system root or the + empty string. */ + if (! *base) + return xstrndup (name, base_len (name)); + + /* Collapse a sequence of trailing slashes into one. */ + length = base_len (base); + if (ISSLASH (base[length])) + length++; + + /* On systems with drive letters, `a/b:c' must return `./b:c' rather + than `b:c' to avoid confusion with a drive letter. On systems + with pure POSIX semantics, this is not an issue. */ + if (FILE_SYSTEM_PREFIX_LEN (base)) + { + char *p = xmalloc (length + 3); + p[0] = '.'; + p[1] = '/'; + memcpy (p + 2, base, length); + p[length + 2] = '\0'; + return p; + } + + /* Finally, copy the basename. */ + return xstrndup (base, length); +} + +/* Return the length of the basename NAME. Typically NAME is the + value returned by base_name or last_component. Act like strlen + (NAME), except omit all trailing slashes. */ + +size_t +base_len (char const *name) +{ + size_t len; + size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); + + for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) + continue; + + if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 + && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) + return 2; + + if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len + && len == prefix_len && ISSLASH (name[prefix_len])) + return prefix_len + 1; + + return len; +} diff --git a/lib/bbitset.h b/lib/bbitset.h new file mode 100644 index 0000000..35ff0e1 --- /dev/null +++ b/lib/bbitset.h @@ -0,0 +1,301 @@ +/* Base bitset stuff. + Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#ifndef _BBITSET_H +#define _BBITSET_H + +#include "libiberty.h" + +#include +#include +#include + +/* Currently we support five flavours of bitsets: + BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets). + Memory for bit array and bitset structure allocated + contiguously. + BITSET_LIST: Linked list of arrays of bits (variable size, least storage + for large very sparse sets). + BITSET_TABLE: Expandable table of pointers to arrays of bits + (variable size, less storage for large sparse sets). + Faster than BITSET_LIST for random access. + BITSET_VARRAY: Variable array of bits (variable size, fast for + dense bitsets). + BITSET_STATS: Wrapper bitset for internal use only. Used for gathering + statistics and/or better run-time checking. +*/ +enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_VARRAY, + BITSET_TYPE_NUM, BITSET_STATS}; +#define BITSET_TYPE_NAMES {"abitset", "lbitset", "ebitset", "vbitset"} + +extern const char * const bitset_type_names[]; + +enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC}; + +/* Data type used to store a word of bits. */ +typedef unsigned long int bitset_word; +#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word))) + +/* 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 + size_t, and that is good enough. If this type is changed to be + wider than size_t, the code needs to be modified to check for + overflow when converting bit counts to byte or word counts. + The bit and word index types must be unsigned. */ +typedef size_t bitset_bindex; + +/* Word index. */ +typedef size_t bitset_windex; + +/* Maximum values for commonly-used unsigned types. BITSET_SIZE_MAX + always equals SIZE_MAX, but some older systems lack SIZE_MAX. */ +#define BITSET_BINDEX_MAX ((bitset_bindex) -1) + +/* Limit max word index to the maximum value of a signed integer + to simplify cache disabling. */ +#define BITSET_WINDEX_MAX (((bitset_windex) -1) >> 1) +#define BITSET_SIZE_MAX ((size_t) -1) + +#define BITSET_MSB ((bitset_word) 1 << (BITSET_WORD_BITS - 1)) + +#define BITSET_LIST_SIZE 1024 + +enum bitset_ops {BITSET_OP_ZERO, BITSET_OP_ONES, + BITSET_OP_COPY, BITSET_OP_NOT, + BITSET_OP_EMPTY_P, BITSET_OP_EQUAL_P, + BITSET_OP_SUBSET_P, BITSET_OP_DISJOINT_P, + BITSET_OP_AND, BITSET_OP_OR, BITSET_OP_XOR, BITSET_OP_ANDN, + BITSET_OP_OR_AND, BITSET_OP_AND_OR, BITSET_OP_ANDN_OR}; + +struct bbitset_struct +{ + const struct bitset_vtable *vtable; + bitset_windex cindex; /* Cache word index. */ + bitset_windex csize; /* Cache size in words. */ + bitset_word *cdata; /* Cache data pointer. */ + bitset_bindex n_bits; /* Number of bits. */ + /* Perhaps we could sacrifice another word to indicate + that the bitset is known to be zero, that a bit has been set + in the cache, and that a bit has been cleared in the cache. + This would speed up some of the searches but slightly slow down + bit set/reset operations of cached bits. */ +}; + + +typedef union bitset_union *bitset; + + +/* Private accessor macros to bitset structure. */ +#define BITSET_VTABLE_(SRC) (SRC)->b.vtable +#define BITSET_CINDEX_(SRC) (SRC)->b.cindex +#define BITSET_CDATA_(SRC) (SRC)->b.cdata +#define BITSET_CSIZE_(SRC) (SRC)->b.csize +#define BITSET_NBITS_(SRC) (SRC)->b.n_bits + + +/* The contents of this structure should be considered private. */ +struct bitset_vtable +{ + void (*set) (bitset, bitset_bindex); + void (*reset) (bitset, bitset_bindex); + bool (*toggle) (bitset, bitset_bindex); + bool (*test) (bitset, bitset_bindex); + bitset_bindex (*resize) (bitset, bitset_bindex); + bitset_bindex (*size) (bitset); + bitset_bindex (*count) (bitset); + + bool (*empty_p) (bitset); + void (*ones) (bitset); + void (*zero) (bitset); + + void (*copy) (bitset, bitset); + bool (*disjoint_p) (bitset, bitset); + bool (*equal_p) (bitset, bitset); + void (*not_) (bitset, bitset); + bool (*subset_p) (bitset, bitset); + + void (*and_) (bitset, bitset, bitset); + bool (*and_cmp) (bitset, bitset, bitset); + void (*andn) (bitset, bitset, bitset); + bool (*andn_cmp) (bitset, bitset, bitset); + void (*or_) (bitset, bitset, bitset); + bool (*or_cmp) (bitset, bitset, bitset); + void (*xor_) (bitset, bitset, bitset); + bool (*xor_cmp) (bitset, bitset, bitset); + + void (*and_or) (bitset, bitset, bitset, bitset); + bool (*and_or_cmp) (bitset, bitset, bitset, bitset); + void (*andn_or) (bitset, bitset, bitset, bitset); + bool (*andn_or_cmp) (bitset, bitset, bitset, bitset); + void (*or_and) (bitset, bitset, bitset, bitset); + bool (*or_and_cmp) (bitset, bitset, bitset, bitset); + + bitset_bindex (*list) (bitset, bitset_bindex *, bitset_bindex, + bitset_bindex *); + bitset_bindex (*list_reverse) (bitset, bitset_bindex *, bitset_bindex, + bitset_bindex *); + void (*free) (bitset); + enum bitset_type type; +}; + +#define BITSET_COMPATIBLE_(BSET1, BSET2) \ +((BSET1)->b.vtable == (BSET2)->b.vtable) + +#define BITSET_CHECK2_(DST, SRC) \ +if (!BITSET_COMPATIBLE_ (DST, SRC)) abort (); + +#define BITSET_CHECK3_(DST, SRC1, SRC2) \ +if (!BITSET_COMPATIBLE_ (DST, SRC1) \ + || !BITSET_COMPATIBLE_ (DST, SRC2)) abort (); + +#define BITSET_CHECK4_(DST, SRC1, SRC2, SRC3) \ +if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \ + || !BITSET_COMPATIBLE_ (DST, SRC3)) abort (); + + +/* Redefine number of bits in bitset DST. */ +#define BITSET_RESIZE_(DST, SIZE) (DST)->b.vtable->resize (DST, SIZE) + +/* Return size in bits of bitset SRC. */ +#define BITSET_SIZE_(SRC) (SRC)->b.vtable->size (SRC) + +/* Return number of bits set in bitset SRC. */ +#define BITSET_COUNT_(SRC) (SRC)->b.vtable->count (SRC) + +/* Return type of bitset SRC. */ +#define BITSET_TYPE_(DST) (DST)->b.vtable->type + +/* Set bit BITNO in bitset DST. */ +#define BITSET_SET_(DST, BITNO) (DST)->b.vtable->set (DST, BITNO) + +/* Reset bit BITNO in bitset DST. */ +#define BITSET_RESET_(DST, BITNO) (DST)->b.vtable->reset (DST, BITNO) + +/* Toggle bit BITNO in bitset DST. */ +#define BITSET_TOGGLE_(DST, BITNO) (DST)->b.vtable->toggle (DST, BITNO) + +/* Return non-zero if bit BITNO in bitset SRC is set. */ +#define BITSET_TEST_(SRC, BITNO) (SRC)->b.vtable->test (SRC, BITNO) + +/* Free bitset SRC. */ +#define BITSET_FREE_(SRC)\ + ((SRC)->b.vtable->free ? (SRC)->b.vtable->free (SRC) :(void)0) + + +/* Return SRC == 0. */ +#define BITSET_EMPTY_P_(SRC) (SRC)->b.vtable->empty_p (SRC) + +/* DST = ~0. */ +#define BITSET_ONES_(DST) (DST)->b.vtable->ones (DST) + +/* DST = 0. */ +#define BITSET_ZERO_(DST) (DST)->b.vtable->zero (DST) + + + +/* DST = SRC. */ +#define BITSET_COPY_(DST, SRC) (SRC)->b.vtable->copy (DST, SRC) + +/* Return DST & SRC == 0. */ +#define BITSET_DISJOINT_P_(DST, SRC) (SRC)->b.vtable->disjoint_p (DST, SRC) + +/* Return DST == SRC. */ +#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC) + +/* DST = ~SRC. */ +#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC) + +/* Return DST == DST | SRC. */ +#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC) + + +/* 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) + +/* DST = SRC1 & ~SRC2. */ +#define BITSET_ANDN_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn (DST, SRC1, SRC2) +#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2) + +/* 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) + +/* 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) + + + +/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if + DST != (SRC1 & SRC2) | SRC3. */ +#define BITSET_AND_OR_(DST, SRC1, SRC2, SRC3) \ + (SRC1)->b.vtable->and_or (DST, SRC1, SRC2, SRC3) +#define BITSET_AND_OR_CMP_(DST, SRC1, SRC2, SRC3) \ + (SRC1)->b.vtable->and_or_cmp (DST, SRC1, SRC2, SRC3) + +/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if + DST != (SRC1 & ~SRC2) | SRC3. */ +#define BITSET_ANDN_OR_(DST, SRC1, SRC2, SRC3) \ + (SRC1)->b.vtable->andn_or (DST, SRC1, SRC2, SRC3) +#define BITSET_ANDN_OR_CMP_(DST, SRC1, SRC2, SRC3) \ + (SRC1)->b.vtable->andn_or_cmp (DST, SRC1, SRC2, SRC3) + +/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if + DST != (SRC1 | SRC2) & SRC3. */ +#define BITSET_OR_AND_(DST, SRC1, SRC2, SRC3) \ + (SRC1)->b.vtable->or_and (DST, SRC1, SRC2, SRC3) +#define BITSET_OR_AND_CMP_(DST, SRC1, SRC2, SRC3) \ + (SRC1)->b.vtable->or_and_cmp (DST, SRC1, SRC2, SRC3) + + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT. Return with actual number of bits found and with *NEXT + indicating where search stopped. */ +#define BITSET_LIST_(BSET, LIST, NUM, NEXT) \ + (BSET)->b.vtable->list (BSET, LIST, NUM, NEXT) + +/* Find reverse list of up to NUM bits set in BSET starting from and + including NEXT. Return with actual number of bits found and with + *NEXT indicating where search stopped. */ +#define BITSET_LIST_REVERSE_(BSET, LIST, NUM, NEXT) \ + (BSET)->b.vtable->list_reverse (BSET, LIST, NUM, NEXT) + + +/* Private functions for bitset implementations. */ + +extern bool bitset_toggle_ (bitset, bitset_bindex); + +extern bitset_bindex bitset_count_ (bitset); + +extern bitset_bindex bitset_size_ (bitset); + +extern bool bitset_copy_ (bitset, bitset); + +extern void bitset_and_or_ (bitset, bitset, bitset, bitset); + +extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset); + +extern void bitset_andn_or_ (bitset, bitset, bitset, bitset); + +extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset); + +extern void bitset_or_and_ (bitset, bitset, bitset, bitset); + +extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset); + +#endif /* _BBITSET_H */ diff --git a/lib/bitset.c b/lib/bitset.c new file mode 100644 index 0000000..ef4c6b2 --- /dev/null +++ b/lib/bitset.c @@ -0,0 +1,503 @@ +/* General bitsets. + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#include + +#include "bitset.h" + +#include +#include +#include "abitset.h" +#include "lbitset.h" +#include "ebitset.h" +#include "vbitset.h" +#include "bitset_stats.h" +#include "obstack.h" + +const char * const bitset_type_names[] = BITSET_TYPE_NAMES; + + +/* Return number of bytes required to create a N_BIT bitset + of TYPE. The bitset may grow to require more bytes than this. */ +size_t +bitset_bytes (enum bitset_type type, bitset_bindex n_bits) +{ + size_t bytes; + + if (bitset_stats_enabled) + return bitset_stats_bytes (); + + switch (type) + { + default: + abort (); + + case BITSET_ARRAY: + bytes = abitset_bytes (n_bits); + break; + + case BITSET_LIST: + bytes = lbitset_bytes (n_bits); + break; + + case BITSET_TABLE: + bytes = ebitset_bytes (n_bits); + break; + + case BITSET_VARRAY: + bytes = vbitset_bytes (n_bits); + break; + } + + return bytes; +} + + +/* Initialise bitset BSET of TYPE for N_BITS. */ +bitset +bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type) +{ + if (bitset_stats_enabled) + return bitset_stats_init (bset, n_bits, type); + + switch (type) + { + default: + abort (); + + case BITSET_ARRAY: + return abitset_init (bset, n_bits); + + case BITSET_LIST: + return lbitset_init (bset, n_bits); + + case BITSET_TABLE: + return ebitset_init (bset, n_bits); + + case BITSET_VARRAY: + return vbitset_init (bset, n_bits); + } +} + + +/* Select a bitset type for a set of N_BITS and with attribute hints + specified by ATTR. For variable size bitsets, N_BITS is only a + hint and may be zero. */ +enum bitset_type +bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr) +{ + /* Check attributes. */ + if (attr & BITSET_FIXED && attr & BITSET_VARIABLE) + abort (); + if (attr & BITSET_SPARSE && attr & BITSET_DENSE) + abort (); + + /* Choose the type of bitset. Note that sometimes we will be asked + for a zero length fixed size bitset. */ + + + /* If no attributes selected, choose a good compromise. */ + if (!attr) + return BITSET_VARRAY; + + if (attr & BITSET_SPARSE) + return BITSET_LIST; + + if (attr & BITSET_FIXED) + return BITSET_ARRAY; + + if (attr & BITSET_GREEDY) + return BITSET_TABLE; + + return BITSET_VARRAY; +} + + +/* Create a bitset of N_BITS of type TYPE. */ +bitset +bitset_alloc (bitset_bindex n_bits, enum bitset_type type) +{ + size_t bytes; + bitset bset; + + bytes = bitset_bytes (type, n_bits); + + bset = xcalloc (1, bytes); + + /* The cache is disabled until some elements are allocated. If we + have variable length arrays, then we may need to allocate a dummy + element. */ + + return bitset_init (bset, n_bits, type); +} + + +/* Create a bitset of N_BITS of type TYPE. */ +bitset +bitset_obstack_alloc (struct obstack *bobstack, + bitset_bindex n_bits, enum bitset_type type) +{ + size_t bytes; + bitset bset; + + bytes = bitset_bytes (type, n_bits); + + bset = obstack_alloc (bobstack, bytes); + memset (bset, 0, bytes); + + return bitset_init (bset, n_bits, type); +} + + +/* Create a bitset of N_BITS and with attribute hints specified by + ATTR. */ +bitset +bitset_create (bitset_bindex n_bits, unsigned int attr) +{ + enum bitset_type type; + + type = bitset_type_choose (n_bits, attr); + + return bitset_alloc (n_bits, type); +} + + +/* Free bitset BSET. */ +void +bitset_free (bitset bset) +{ + BITSET_FREE_ (bset); + free (bset); +} + + +/* Free bitset BSET allocated on obstack. */ +void +bitset_obstack_free (bitset bset) +{ + BITSET_FREE_ (bset); +} + + +/* Return bitset type. */ +enum bitset_type +bitset_type_get (bitset bset) +{ + enum bitset_type type; + + type = BITSET_TYPE_ (bset); + if (type != BITSET_STATS) + return type; + + return bitset_stats_type_get (bset); +} + + +/* Return name of bitset type. */ +const char * +bitset_type_name_get (bitset bset) +{ + enum bitset_type type; + + type = bitset_type_get (bset); + + return bitset_type_names[type]; +} + + +/* Find next bit set in SRC starting from and including BITNO. + Return BITSET_BINDEX_MAX if SRC empty. */ +bitset_bindex +bitset_next (bitset src, bitset_bindex bitno) +{ + bitset_bindex val; + bitset_bindex next = bitno; + + if (!bitset_list (src, &val, 1, &next)) + return BITSET_BINDEX_MAX; + return val; +} + + +/* Return true if both bitsets are of the same type and size. */ +extern bool +bitset_compatible_p (bitset bset1, bitset bset2) +{ + return BITSET_COMPATIBLE_ (bset1, bset2); +} + + +/* Find previous bit set in SRC starting from and including BITNO. + Return BITSET_BINDEX_MAX if SRC empty. */ +bitset_bindex +bitset_prev (bitset src, bitset_bindex bitno) +{ + bitset_bindex val; + bitset_bindex next = bitno; + + if (!bitset_list_reverse (src, &val, 1, &next)) + return BITSET_BINDEX_MAX; + return val; +} + + +/* Find first set bit. */ +bitset_bindex +bitset_first (bitset src) +{ + return bitset_next (src, 0); +} + + +/* Find last set bit. */ +bitset_bindex +bitset_last (bitset src) +{ + return bitset_prev (src, 0); +} + + +/* Is BITNO in SRC the only set bit? */ +bool +bitset_only_set_p (bitset src, bitset_bindex bitno) +{ + bitset_bindex val[2]; + bitset_bindex next = 0; + + if (bitset_list (src, val, 2, &next) != 1) + return false; + return val[0] == bitno; +} + + +/* Print contents of bitset BSET to FILE. */ +static void +bitset_print (FILE *file, bitset bset, bool verbose) +{ + unsigned int pos; + bitset_bindex i; + bitset_iterator iter; + + if (verbose) + fprintf (file, "n_bits = %lu, set = {", + (unsigned long int) bitset_size (bset)); + + pos = 30; + BITSET_FOR_EACH (iter, bset, i, 0) + { + if (pos > 70) + { + fprintf (file, "\n"); + pos = 0; + } + + fprintf (file, "%lu ", (unsigned long int) i); + pos += 1 + (i >= 10) + (i >= 100); + }; + + if (verbose) + fprintf (file, "}\n"); +} + + +/* Dump bitset BSET to FILE. */ +void +bitset_dump (FILE *file, bitset bset) +{ + bitset_print (file, bset, false); +} + + +/* Release memory associated with bitsets. */ +void +bitset_release_memory (void) +{ + lbitset_release_memory (); + ebitset_release_memory (); +} + + +/* Toggle bit BITNO in bitset BSET and the new value of the bit. */ +bool +bitset_toggle_ (bitset bset, bitset_bindex bitno) +{ + /* This routine is for completeness. It could be optimized if + required. */ + if (bitset_test (bset, bitno)) + { + bitset_reset (bset, bitno); + return false; + } + else + { + bitset_set (bset, bitno); + return true; + } +} + + +/* Return number of bits in bitset SRC. */ +bitset_bindex +bitset_size_ (bitset src) +{ + return BITSET_NBITS_ (src); +} + + +/* Return number of bits set in bitset SRC. */ +bitset_bindex +bitset_count_ (bitset src) +{ + bitset_bindex list[BITSET_LIST_SIZE]; + bitset_bindex next; + bitset_bindex num; + bitset_bindex count; + + /* This could be greatly sped up by adding a count method for each + bitset implementation that uses a direct technique (based on + masks) for counting the number of bits set in a word. */ + + next = 0; + for (count = 0; (num = bitset_list (src, list, BITSET_LIST_SIZE, &next)); + count += num) + continue; + + return count; +} + + +/* DST = SRC. Return true if DST != SRC. + This is a fallback for the case where SRC and DST are different + bitset types. */ +bool +bitset_copy_ (bitset dst, bitset src) +{ + bitset_bindex i; + bitset_iterator iter; + + /* Convert bitset types. We assume that the DST bitset + is large enough to hold the SRC bitset. */ + bitset_zero (dst); + BITSET_FOR_EACH (iter, src, i, 0) + { + bitset_set (dst, i); + }; + + return true; +} + + +/* This is a fallback for implementations that do not support + four operand operations. */ +static inline bool +bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3, + enum bitset_ops op) +{ + bool changed = false; + bool stats_enabled_save; + bitset tmp; + + /* Create temporary bitset. */ + stats_enabled_save = bitset_stats_enabled; + bitset_stats_enabled = false; + tmp = bitset_alloc (0, bitset_type_get (dst)); + bitset_stats_enabled = stats_enabled_save; + + switch (op) + { + default: + abort (); + + case BITSET_OP_OR_AND: + bitset_or (tmp, src1, src2); + changed = bitset_and_cmp (dst, src3, tmp); + break; + + case BITSET_OP_AND_OR: + bitset_and (tmp, src1, src2); + changed = bitset_or_cmp (dst, src3, tmp); + break; + + case BITSET_OP_ANDN_OR: + bitset_andn (tmp, src1, src2); + changed = bitset_or_cmp (dst, src3, tmp); + break; + } + + bitset_free (tmp); + return changed; +} + + +/* DST = (SRC1 & SRC2) | SRC3. */ +void +bitset_and_or_ (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_and_or_cmp_ (dst, src1, src2, src3); +} + + +/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if + DST != (SRC1 & SRC2) | SRC3. */ +bool +bitset_and_or_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3) +{ + return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_AND_OR); +} + + +/* DST = (SRC1 & ~SRC2) | SRC3. */ +void +bitset_andn_or_ (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_andn_or_cmp_ (dst, src1, src2, src3); +} + + +/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if + DST != (SRC1 & ~SRC2) | SRC3. */ +bool +bitset_andn_or_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3) +{ + return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_ANDN_OR); +} + + +/* DST = (SRC1 | SRC2) & SRC3. */ +void +bitset_or_and_ (bitset dst, bitset src1, bitset src2, bitset src3) +{ + bitset_or_and_cmp_ (dst, src1, src2, src3); +} + + +/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if + DST != (SRC1 | SRC2) & SRC3. */ +bool +bitset_or_and_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3) +{ + return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_OR_AND); +} + + +/* Function to be called from debugger to print bitset. */ +void +debug_bitset (bitset bset) +{ + if (bset) + bitset_print (stderr, bset, true); +} diff --git a/lib/bitset.h b/lib/bitset.h new file mode 100644 index 0000000..3e52940 --- /dev/null +++ b/lib/bitset.h @@ -0,0 +1,391 @@ +/* Generic bitsets. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#ifndef _BITSET_H +#define _BITSET_H + +/* This file is the public interface to the bitset abstract data type. + Only use the functions and macros defined in this file. */ + +#include "bbitset.h" +#include "obstack.h" +#include + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif + +/* Attributes used to select a bitset implementation. */ +enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */ + BITSET_VARIABLE = 2, /* Bitset size variable. */ + BITSET_DENSE = 4, /* Bitset dense. */ + BITSET_SPARSE = 8, /* Bitset sparse. */ + BITSET_FRUGAL = 16, /* Prefer most compact. */ + BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */ + +typedef unsigned int bitset_attrs; + +/* The contents of the union should be considered to be private. + While I would like to make this union opaque, it needs to be + visible for the inline bit set/test functions, and for delegation + to the proper implementation. */ +union bitset_union +{ + /* This must be the first member of every other structure that is a + member of this union. */ + struct bbitset_struct b; /* Base bitset data. */ + + struct abitset_struct + { + struct bbitset_struct b; + bitset_word words[1]; /* The array of bits. */ + } a; + + struct ebitset_struct + { + struct bbitset_struct b; + bitset_windex size; /* Number of elements. */ + struct ebitset_elt_struct **elts; /* Expanding array of ptrs to elts. */ + } e; + + struct lbitset_struct + { + struct bbitset_struct b; + struct lbitset_elt_struct *head; /* First element in linked list. */ + struct lbitset_elt_struct *tail; /* Last element in linked list. */ + } l; + + struct bitset_stats_struct + { + struct bbitset_struct b; + bitset bset; + } s; + + struct vbitset_struct + { + struct bbitset_struct b; + bitset_windex size; /* Allocated size of array. */ + } v; + +}; + + +/* The contents of this structure should be considered private. + It is used for iterating over set bits. */ +typedef struct +{ + bitset_bindex list[BITSET_LIST_SIZE]; + bitset_bindex next; + bitset_bindex num; + bitset_bindex i; +} bitset_iterator; + + +/* Return bytes required for bitset of desired type and size. */ +extern size_t bitset_bytes (enum bitset_type, bitset_bindex); + +/* Initialise a bitset with desired type and size. */ +extern bitset bitset_init (bitset, bitset_bindex, enum bitset_type); + +/* Select an implementation type based on the desired bitset size + and attributes. */ +extern enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs); + +/* Create a bitset of desired type and size. The bitset is zeroed. */ +extern bitset bitset_alloc (bitset_bindex, enum bitset_type); + +/* Free bitset. */ +extern void bitset_free (bitset); + +/* Create a bitset of desired type and size using an obstack. The + bitset is zeroed. */ +extern bitset bitset_obstack_alloc (struct obstack *bobstack, + bitset_bindex, enum bitset_type); + +/* Free bitset allocated on obstack. */ +extern void bitset_obstack_free (bitset); + +/* Create a bitset of desired size and attributes. The bitset is zeroed. */ +extern bitset bitset_create (bitset_bindex, bitset_attrs); + +/* Return bitset type. */ +extern enum bitset_type bitset_type_get (bitset); + +/* Return bitset type name. */ +extern const char *bitset_type_name_get (bitset); + + +/* Set bit BITNO in bitset BSET. */ +static inline void +bitset_set (bitset bset, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + bitset_windex offset = windex - bset->b.cindex; + + if (offset < bset->b.csize) + bset->b.cdata[offset] |= ((bitset_word) 1 << (bitno % BITSET_WORD_BITS)); + else + BITSET_SET_ (bset, bitno); +} + + +/* Reset bit BITNO in bitset BSET. */ +static inline void +bitset_reset (bitset bset, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + bitset_windex offset = windex - bset->b.cindex; + + if (offset < bset->b.csize) + bset->b.cdata[offset] &= ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS)); + else + BITSET_RESET_ (bset, bitno); +} + + +/* Test bit BITNO in bitset BSET. */ +static inline bool +bitset_test (bitset bset, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + bitset_windex offset = windex - bset->b.cindex; + + if (offset < bset->b.csize) + return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1; + else + return BITSET_TEST_ (bset, bitno); +} + + +/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */ +#define bitset_toggle(bset, bitno) BITSET_TOGGLE_ (bset, bitno) + +/* Return size in bits of bitset SRC. */ +#define bitset_size(SRC) BITSET_SIZE_ (SRC) + +/* Change size of bitset. */ +extern void bitset_resize (bitset, bitset_bindex); + +/* Return number of bits set in bitset SRC. */ +#define bitset_count(SRC) BITSET_COUNT_ (SRC) + + +/* Return SRC == 0. */ +#define bitset_empty_p(SRC) BITSET_EMPTY_P_ (SRC) + +/* DST = ~0. */ +#define bitset_ones(DST) BITSET_ONES_ (DST) + +/* DST = 0. */ +#define bitset_zero(DST) BITSET_ZERO_ (DST) + + + +/* DST = SRC. */ +#define bitset_copy(DST, SRC) BITSET_COPY_ (DST, SRC) + +/* Return DST & SRC == 0. */ +#define bitset_disjoint_p(DST, SRC) BITSET_DISJOINT_P_ (DST, SRC) + +/* Return DST == SRC. */ +#define bitset_equal_p(DST, SRC) BITSET_EQUAL_P_ (DST, SRC) + +/* DST = ~SRC. */ +#define bitset_not(DST, SRC) BITSET_NOT_ (DST, SRC) + +/* Return DST == DST | SRC. */ +#define bitset_subset_p(DST, SRC) BITSET_SUBSET_P_ (DST, SRC) + + + +/* DST = SRC1 & SRC2. */ +#define bitset_and(DST, SRC1, SRC2) BITSET_AND_ (DST, SRC1, SRC2) + +/* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */ +#define bitset_and_cmp(DST, SRC1, SRC2) BITSET_AND_CMP_ (DST, SRC1, SRC2) + +/* DST = SRC1 & ~SRC2. */ +#define bitset_andn(DST, SRC1, SRC2) BITSET_ANDN_ (DST, SRC1, SRC2) + +/* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */ +#define bitset_andn_cmp(DST, SRC1, SRC2) BITSET_ANDN_CMP_ (DST, SRC1, SRC2) + +/* DST = SRC1 | SRC2. */ +#define bitset_or(DST, SRC1, SRC2) BITSET_OR_ (DST, SRC1, SRC2) + +/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */ +#define bitset_or_cmp(DST, SRC1, SRC2) BITSET_OR_CMP_ (DST, SRC1, SRC2) + +/* DST = SRC1 ^ SRC2. */ +#define bitset_xor(DST, SRC1, SRC2) BITSET_XOR_ (DST, SRC1, SRC2) + +/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */ +#define bitset_xor_cmp(DST, SRC1, SRC2) BITSET_XOR_CMP_ (DST, SRC1, SRC2) + + + +/* DST = (SRC1 & SRC2) | SRC3. */ +#define bitset_and_or(DST, SRC1, SRC2, SRC3) \ + BITSET_AND_OR_ (DST, SRC1, SRC2, SRC3) + +/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if + DST != (SRC1 & SRC2) | SRC3. */ +#define bitset_and_or_cmp(DST, SRC1, SRC2, SRC3) \ + BITSET_AND_OR_CMP_ (DST, SRC1, SRC2, SRC3) + +/* DST = (SRC1 & ~SRC2) | SRC3. */ +#define bitset_andn_or(DST, SRC1, SRC2, SRC3) \ + BITSET_ANDN_OR_ (DST, SRC1, SRC2, SRC3) + +/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if + DST != (SRC1 & ~SRC2) | SRC3. */ +#define bitset_andn_or_cmp(DST, SRC1, SRC2, SRC3) \ + BITSET_ANDN_OR_CMP_ (DST, SRC1, SRC2, SRC3) + +/* DST = (SRC1 | SRC2) & SRC3. */ +#define bitset_or_and(DST, SRC1, SRC2, SRC3)\ + BITSET_OR_AND_ (DST, SRC1, SRC2, SRC3) + +/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if + DST != (SRC1 | SRC2) & SRC3. */ +#define bitset_or_and_cmp(DST, SRC1, SRC2, SRC3)\ + BITSET_OR_AND_CMP_ (DST, SRC1, SRC2, SRC3) + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT. Return with actual number of bits found and with *NEXT + indicating where search stopped. */ +#define bitset_list(BSET, LIST, NUM, NEXT) \ + BITSET_LIST_ (BSET, LIST, NUM, NEXT) + +/* Find reverse list of up to NUM bits set in BSET starting from and + including NEXT. Return with actual number of bits found and with + *NEXT indicating where search stopped. */ +#define 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. */ +extern bool bitset_compatible_p (bitset bset1, bitset bset2); + +/* Find next set bit from the given bit index. */ +extern bitset_bindex bitset_next (bitset, bitset_bindex); + +/* Find previous set bit from the given bit index. */ +extern bitset_bindex bitset_prev (bitset, bitset_bindex); + +/* Find first set bit. */ +extern bitset_bindex bitset_first (bitset); + +/* Find last set bit. */ +extern bitset_bindex bitset_last (bitset); + +/* Return nonzero if this is the only set bit. */ +extern bool bitset_only_set_p (bitset, bitset_bindex); + +/* Dump bitset. */ +extern void bitset_dump (FILE *, bitset); + +/* Loop over all elements of BSET, starting with MIN, setting INDEX + to the index of each set bit. For example, the following will print + the bits set in a bitset: + + bitset_bindex i; + bitset_iterator iter; + + BITSET_FOR_EACH (iter, src, i, 0) + { + printf ("%lu ", (unsigned long int) i); + }; +*/ +#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \ + for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \ + (ITER.num == BITSET_LIST_SIZE) \ + && (ITER.num = bitset_list (BSET, ITER.list, \ + BITSET_LIST_SIZE, &ITER.next));) \ + for (ITER.i = 0; \ + ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \ + ITER.i++) + + +/* Loop over all elements of BSET, in reverse order starting with + 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: + + bitset_bindex i; + bitset_iterator iter; + + BITSET_FOR_EACH_REVERSE (iter, src, i, 0) + { + printf ("%lu ", (unsigned long int) i); + }; +*/ +#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \ + for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \ + (ITER.num == BITSET_LIST_SIZE) \ + && (ITER.num = bitset_list_reverse (BSET, ITER.list, \ + BITSET_LIST_SIZE, &ITER.next));) \ + for (ITER.i = 0; \ + ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \ + ITER.i++) + + +/* Define set operations in terms of logical operations. */ + +#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2) +#define bitset_diff_cmp(DST, SRC1, SRC2) bitset_andn_cmp (DST, SRC1, SRC2) + +#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2) +#define bitset_intersection_cmp(DST, SRC1, SRC2) bitset_and_cmp (DST, SRC1, SRC2) + +#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2) +#define bitset_union_cmp(DST, SRC1, SRC2) bitset_or_cmp (DST, SRC1, SRC2) + +/* Symmetrical difference. */ +#define bitset_symdiff(DST, SRC1, SRC2) bitset_xor (DST, SRC1, SRC2) +#define bitset_symdiff_cmp(DST, SRC1, SRC2) bitset_xor_cmp (DST, SRC1, SRC2) + +/* Union of difference. */ +#define bitset_diff_union(DST, SRC1, SRC2, SRC3) \ + bitset_andn_or (DST, SRC1, SRC2, SRC3) +#define bitset_diff_union_cmp(DST, SRC1, SRC2, SRC3) \ + bitset_andn_or_cmp (DST, SRC1, SRC2, SRC3) + + +/* Release any memory tied up with bitsets. */ +extern void bitset_release_memory (void); + +/* Enable bitset stats gathering. */ +extern void bitset_stats_enable (void); + +/* Disable bitset stats gathering. */ +extern void bitset_stats_disable (void); + +/* Read bitset stats file of accummulated stats. */ +void bitset_stats_read (const char *file_name); + +/* Write bitset stats file of accummulated stats. */ +void bitset_stats_write (const char *file_name); + +/* Dump bitset stats. */ +extern void bitset_stats_dump (FILE *); + +/* Function to debug bitset from debugger. */ +extern void debug_bitset (bitset); + +/* Function to debug bitset stats from debugger. */ +extern void debug_bitset_stats (void); + +#endif /* _BITSET_H */ diff --git a/lib/bitset_stats.c b/lib/bitset_stats.c new file mode 100644 index 0000000..a7f53fb --- /dev/null +++ b/lib/bitset_stats.c @@ -0,0 +1,728 @@ +/* Bitset statistics. + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +/* This file is a wrapper bitset implementation for the other bitset + implementations. It provides bitset compatibility checking and + statistics gathering without having to instrument the bitset + implementations. When statistics gathering is enabled, the bitset + operations get vectored through here and we then call the appropriate + routines. */ + +#include + +#include "bitset_stats.h" + +#include "bbitset.h" +#include "abitset.h" +#include "ebitset.h" +#include "lbitset.h" +#include "vbitset.h" +#include +#include +#include + +#include "gettext.h" +#define _(Msgid) gettext (Msgid) + +/* Configuration macros. */ +#define BITSET_STATS_FILE "bitset.dat" +#define BITSET_LOG_COUNT_BINS 10 +#define BITSET_LOG_SIZE_BINS 16 +#define BITSET_DENSITY_BINS 20 + + +/* Accessor macros. */ +#define BITSET_STATS_ALLOCS_INC(TYPE) \ + bitset_stats_info->types[(TYPE)].allocs++ +#define BITSET_STATS_FREES_INC(BSET) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++ +#define BITSET_STATS_SETS_INC(BSET) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++ +#define BITSET_STATS_CACHE_SETS_INC(BSET) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++ +#define BITSET_STATS_RESETS_INC(BSET) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++ +#define BITSET_STATS_CACHE_RESETS_INC(BSET) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++ +#define BITSET_STATS_TESTS_INC(BSET) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++ +#define BITSET_STATS_CACHE_TESTS_INC(BSET) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++ +#define BITSET_STATS_LISTS_INC(BSET) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++ +#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++ +#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++ +#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \ + bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(I)]++ + + +struct bitset_type_info_struct +{ + unsigned int allocs; + unsigned int frees; + unsigned int lists; + unsigned int sets; + unsigned int cache_sets; + unsigned int resets; + unsigned int cache_resets; + unsigned int tests; + unsigned int cache_tests; + unsigned int list_counts[BITSET_LOG_COUNT_BINS]; + unsigned int list_sizes[BITSET_LOG_SIZE_BINS]; + unsigned int list_density[BITSET_DENSITY_BINS]; +}; + +struct bitset_stats_info_struct +{ + unsigned int runs; + struct bitset_type_info_struct types[BITSET_TYPE_NUM]; +}; + + +struct bitset_stats_info_struct bitset_stats_info_data; +struct bitset_stats_info_struct *bitset_stats_info; +bool bitset_stats_enabled = false; + + +/* Print a percentage histogram with message MSG to FILE. */ +static void +bitset_percent_histogram_print (FILE *file, const char *name, const char *msg, + unsigned int n_bins, unsigned int *bins) +{ + unsigned int i; + unsigned int total; + + total = 0; + for (i = 0; i < n_bins; i++) + total += bins[i]; + + if (!total) + return; + + fprintf (file, "%s %s", name, msg); + for (i = 0; i < n_bins; i++) + fprintf (file, "%.0f-%.0f%%\t%8u (%5.1f%%)\n", + i * 100.0 / n_bins, + (i + 1) * 100.0 / n_bins, bins[i], + (100.0 * bins[i]) / total); +} + + +/* Print a log histogram with message MSG to FILE. */ +static void +bitset_log_histogram_print (FILE *file, const char *name, const char *msg, + unsigned int n_bins, unsigned int *bins) +{ + unsigned int i; + unsigned int total; + unsigned int max_width; + + total = 0; + for (i = 0; i < n_bins; i++) + total += bins[i]; + + if (!total) + return; + + /* Determine number of useful bins. */ + for (i = n_bins; i > 3 && ! bins[i - 1]; i--) + continue; + n_bins = i; + + /* 2 * ceil (log10 (2) * (N - 1)) + 1. */ + max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1; + + fprintf (file, "%s %s", name, msg); + for (i = 0; i < 2; i++) + fprintf (file, "%*d\t%8u (%5.1f%%)\n", + max_width, i, bins[i], 100.0 * bins[i] / total); + + for (; i < n_bins; i++) + fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n", + max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1), + 1UL << (i - 1), + (1UL << i) - 1, + bins[i], + (100.0 * bins[i]) / total); +} + + +/* Print bitset statistics to FILE. */ +static void +bitset_stats_print_1 (FILE *file, const char *name, + struct bitset_type_info_struct *stats) +{ + if (!stats) + return; + + fprintf (file, "%s:\n", name); + fprintf (file, _("%u bitset_allocs, %u freed (%.2f%%).\n"), + stats->allocs, stats->frees, + stats->allocs ? 100.0 * stats->frees / stats->allocs : 0); + fprintf (file, _("%u bitset_sets, %u cached (%.2f%%)\n"), + stats->sets, stats->cache_sets, + stats->sets ? 100.0 * stats->cache_sets / stats->sets : 0); + fprintf (file, _("%u bitset_resets, %u cached (%.2f%%)\n"), + stats->resets, stats->cache_resets, + stats->resets ? 100.0 * stats->cache_resets / stats->resets : 0); + fprintf (file, _("%u bitset_tests, %u cached (%.2f%%)\n"), + stats->tests, stats->cache_tests, + stats->tests ? 100.0 * stats->cache_tests / stats->tests : 0); + + fprintf (file, _("%u bitset_lists\n"), stats->lists); + + bitset_log_histogram_print (file, name, _("count log histogram\n"), + BITSET_LOG_COUNT_BINS, stats->list_counts); + + bitset_log_histogram_print (file, name, _("size log histogram\n"), + BITSET_LOG_SIZE_BINS, stats->list_sizes); + + bitset_percent_histogram_print (file, name, _("density histogram\n"), + BITSET_DENSITY_BINS, stats->list_density); +} + + +/* Print all bitset statistics to FILE. */ +static void +bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED) +{ + int i; + + if (!bitset_stats_info) + return; + + fprintf (file, _("Bitset statistics:\n\n")); + + if (bitset_stats_info->runs > 1) + fprintf (file, _("Accumulated runs = %u\n"), bitset_stats_info->runs); + + for (i = 0; i < BITSET_TYPE_NUM; i++) + bitset_stats_print_1 (file, bitset_type_names[i], + &bitset_stats_info->types[i]); +} + + +/* Initialise bitset statistics logging. */ +void +bitset_stats_enable (void) +{ + if (!bitset_stats_info) + bitset_stats_info = &bitset_stats_info_data; + bitset_stats_enabled = true; +} + + +void +bitset_stats_disable (void) +{ + bitset_stats_enabled = false; +} + + +/* Read bitset statistics file. */ +void +bitset_stats_read (const char *file_name) +{ + FILE *file; + + if (!bitset_stats_info) + return; + + if (!file_name) + file_name = BITSET_STATS_FILE; + + file = fopen (file_name, "r"); + if (file) + { + if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data), + 1, file) != 1) + { + if (ferror (file)) + perror (_("Could not read stats file.")); + else + fprintf (stderr, _("Bad stats file size.\n")); + } + if (fclose (file) != 0) + perror (_("Could not read stats file.")); + } + bitset_stats_info_data.runs++; +} + + +/* Write bitset statistics file. */ +void +bitset_stats_write (const char *file_name) +{ + FILE *file; + + if (!bitset_stats_info) + return; + + if (!file_name) + file_name = BITSET_STATS_FILE; + + file = fopen (file_name, "w"); + if (file) + { + if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data), + 1, file) != 1) + perror (_("Could not write stats file.")); + if (fclose (file) != 0) + perror (_("Could not write stats file.")); + } + else + perror (_("Could not open stats file for writing.")); +} + + +/* Dump bitset statistics to FILE. */ +void +bitset_stats_dump (FILE *file) +{ + bitset_stats_print (file, false); +} + + +/* Function to be called from debugger to print bitset stats. */ +void +debug_bitset_stats (void) +{ + bitset_stats_print (stderr, true); +} + + +static void +bitset_stats_set (bitset dst, bitset_bindex bitno) +{ + bitset bset = dst->s.bset; + bitset_windex wordno = bitno / BITSET_WORD_BITS; + bitset_windex offset = wordno - bset->b.cindex; + + BITSET_STATS_SETS_INC (bset); + + if (offset < bset->b.csize) + { + bset->b.cdata[offset] |= (bitset_word) 1 << (bitno % BITSET_WORD_BITS); + BITSET_STATS_CACHE_SETS_INC (bset); + } + else + BITSET_SET_ (bset, bitno); +} + + +static void +bitset_stats_reset (bitset dst, bitset_bindex bitno) +{ + bitset bset = dst->s.bset; + bitset_windex wordno = bitno / BITSET_WORD_BITS; + bitset_windex offset = wordno - bset->b.cindex; + + BITSET_STATS_RESETS_INC (bset); + + if (offset < bset->b.csize) + { + bset->b.cdata[offset] &= + ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS)); + BITSET_STATS_CACHE_RESETS_INC (bset); + } + else + BITSET_RESET_ (bset, bitno); +} + + +static bool +bitset_stats_toggle (bitset src, bitset_bindex bitno) +{ + return BITSET_TOGGLE_ (src->s.bset, bitno); +} + + +static bool +bitset_stats_test (bitset src, bitset_bindex bitno) +{ + bitset bset = src->s.bset; + bitset_windex wordno = bitno / BITSET_WORD_BITS; + bitset_windex offset = wordno - bset->b.cindex; + + BITSET_STATS_TESTS_INC (bset); + + if (offset < bset->b.csize) + { + BITSET_STATS_CACHE_TESTS_INC (bset); + return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1; + } + else + return BITSET_TEST_ (bset, bitno); +} + + +static bitset_bindex +bitset_stats_resize (bitset src, bitset_bindex size) +{ + return BITSET_RESIZE_ (src->s.bset, size); +} + + +static bitset_bindex +bitset_stats_size (bitset src) +{ + return BITSET_SIZE_ (src->s.bset); +} + + +static bitset_bindex +bitset_stats_count (bitset src) +{ + return BITSET_COUNT_ (src->s.bset); +} + + +static bool +bitset_stats_empty_p (bitset dst) +{ + return BITSET_EMPTY_P_ (dst->s.bset); +} + + +static void +bitset_stats_ones (bitset dst) +{ + BITSET_ONES_ (dst->s.bset); +} + + +static void +bitset_stats_zero (bitset dst) +{ + BITSET_ZERO_ (dst->s.bset); +} + + +static void +bitset_stats_copy (bitset dst, bitset src) +{ + BITSET_CHECK2_ (dst, src); + BITSET_COPY_ (dst->s.bset, src->s.bset); +} + + +static bool +bitset_stats_disjoint_p (bitset dst, bitset src) +{ + BITSET_CHECK2_ (dst, src); + return BITSET_DISJOINT_P_ (dst->s.bset, src->s.bset); +} + + +static bool +bitset_stats_equal_p (bitset dst, bitset src) +{ + BITSET_CHECK2_ (dst, src); + return BITSET_EQUAL_P_ (dst->s.bset, src->s.bset); +} + + +static void +bitset_stats_not (bitset dst, bitset src) +{ + BITSET_CHECK2_ (dst, src); + BITSET_NOT_ (dst->s.bset, src->s.bset); +} + + +static bool +bitset_stats_subset_p (bitset dst, bitset src) +{ + BITSET_CHECK2_ (dst, src); + return BITSET_SUBSET_P_ (dst->s.bset, src->s.bset); +} + + +static void +bitset_stats_and (bitset dst, bitset src1, bitset src2) +{ + BITSET_CHECK3_ (dst, src1, src2); + BITSET_AND_ (dst->s.bset, src1->s.bset, src2->s.bset); +} + + +static bool +bitset_stats_and_cmp (bitset dst, bitset src1, bitset src2) +{ + BITSET_CHECK3_ (dst, src1, src2); + return BITSET_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset); +} + + +static void +bitset_stats_andn (bitset dst, bitset src1, bitset src2) +{ + BITSET_CHECK3_ (dst, src1, src2); + BITSET_ANDN_ (dst->s.bset, src1->s.bset, src2->s.bset); +} + + +static bool +bitset_stats_andn_cmp (bitset dst, bitset src1, bitset src2) +{ + BITSET_CHECK3_ (dst, src1, src2); + return BITSET_ANDN_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset); +} + + +static void +bitset_stats_or (bitset dst, bitset src1, bitset src2) +{ + BITSET_CHECK3_ (dst, src1, src2); + BITSET_OR_ (dst->s.bset, src1->s.bset, src2->s.bset); +} + + +static bool +bitset_stats_or_cmp (bitset dst, bitset src1, bitset src2) +{ + BITSET_CHECK3_ (dst, src1, src2); + return BITSET_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset); +} + + +static void +bitset_stats_xor (bitset dst, bitset src1, bitset src2) +{ + BITSET_CHECK3_ (dst, src1, src2); + BITSET_XOR_ (dst->s.bset, src1->s.bset, src2->s.bset); +} + + +static bool +bitset_stats_xor_cmp (bitset dst, bitset src1, bitset src2) +{ + BITSET_CHECK3_ (dst, src1, src2); + return BITSET_XOR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset); +} + + +static void +bitset_stats_and_or (bitset dst, bitset src1, bitset src2, bitset src3) +{ + BITSET_CHECK4_ (dst, src1, src2, src3); + BITSET_AND_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); +} + + +static bool +bitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + BITSET_CHECK4_ (dst, src1, src2, src3); + return BITSET_AND_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); +} + + +static void +bitset_stats_andn_or (bitset dst, bitset src1, bitset src2, bitset src3) +{ + BITSET_CHECK4_ (dst, src1, src2, src3); + BITSET_ANDN_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); +} + + +static bool +bitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + BITSET_CHECK4_ (dst, src1, src2, src3); + return BITSET_ANDN_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); +} + + +static void +bitset_stats_or_and (bitset dst, bitset src1, bitset src2, bitset src3) +{ + BITSET_CHECK4_ (dst, src1, src2, src3); + BITSET_OR_AND_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); +} + + +static bool +bitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + BITSET_CHECK4_ (dst, src1, src2, src3); + return BITSET_OR_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); +} + + +static bitset_bindex +bitset_stats_list (bitset bset, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + bitset_bindex count; + bitset_bindex tmp; + bitset_bindex size; + bitset_bindex i; + enum bitset_type type; + + count = BITSET_LIST_ (bset->s.bset, list, num, next); + + type = BITSET_TYPE_ (bset->s.bset); + BITSET_STATS_LISTS_INC (bset->s.bset); + + /* Log histogram of number of set bits. */ + for (i = 0, tmp = count; tmp; tmp >>= 1, i++) + continue; + if (i >= BITSET_LOG_COUNT_BINS) + i = BITSET_LOG_COUNT_BINS - 1; + BITSET_STATS_LIST_COUNTS_INC (bset->s.bset, i); + + /* Log histogram of number of bits in set. */ + size = BITSET_SIZE_ (bset->s.bset); + for (i = 0, tmp = size; tmp; tmp >>= 1, i++) + continue; + if (i >= BITSET_LOG_SIZE_BINS) + i = BITSET_LOG_SIZE_BINS - 1; + BITSET_STATS_LIST_SIZES_INC (bset->s.bset, i); + + /* Histogram of fraction of bits set. */ + i = size ? (count * BITSET_DENSITY_BINS) / size : 0; + if (i >= BITSET_DENSITY_BINS) + i = BITSET_DENSITY_BINS - 1; + BITSET_STATS_LIST_DENSITY_INC (bset->s.bset, i); + return count; +} + + +static bitset_bindex +bitset_stats_list_reverse (bitset bset, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + return BITSET_LIST_REVERSE_ (bset->s.bset, list, num, next); +} + + +static void +bitset_stats_free (bitset bset) +{ + BITSET_STATS_FREES_INC (bset->s.bset); + BITSET_FREE_ (bset->s.bset); +} + + +struct bitset_vtable bitset_stats_vtable = { + bitset_stats_set, + bitset_stats_reset, + bitset_stats_toggle, + bitset_stats_test, + bitset_stats_resize, + bitset_stats_size, + bitset_stats_count, + bitset_stats_empty_p, + bitset_stats_ones, + bitset_stats_zero, + bitset_stats_copy, + bitset_stats_disjoint_p, + bitset_stats_equal_p, + bitset_stats_not, + bitset_stats_subset_p, + bitset_stats_and, + bitset_stats_and_cmp, + bitset_stats_andn, + bitset_stats_andn_cmp, + bitset_stats_or, + bitset_stats_or_cmp, + bitset_stats_xor, + bitset_stats_xor_cmp, + bitset_stats_and_or, + bitset_stats_and_or_cmp, + bitset_stats_andn_or, + bitset_stats_andn_or_cmp, + bitset_stats_or_and, + bitset_stats_or_and_cmp, + bitset_stats_list, + bitset_stats_list_reverse, + bitset_stats_free, + BITSET_STATS +}; + + +/* Return enclosed bitset type. */ +enum bitset_type +bitset_stats_type_get (bitset bset) +{ + return BITSET_TYPE_ (bset->s.bset); +} + + +size_t +bitset_stats_bytes (void) +{ + return sizeof (struct bitset_stats_struct); +} + + +bitset +bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type) +{ + size_t bytes; + bitset sbset; + + bset->b.vtable = &bitset_stats_vtable; + + /* Disable cache. */ + bset->b.cindex = 0; + bset->b.csize = 0; + bset->b.cdata = 0; + + BITSET_NBITS_ (bset) = n_bits; + + /* Set up the actual bitset implementation that + we are a wrapper over. */ + switch (type) + { + default: + abort (); + + case BITSET_ARRAY: + bytes = abitset_bytes (n_bits); + sbset = xcalloc (1, bytes); + abitset_init (sbset, n_bits); + break; + + case BITSET_LIST: + bytes = lbitset_bytes (n_bits); + sbset = xcalloc (1, bytes); + lbitset_init (sbset, n_bits); + break; + + case BITSET_TABLE: + bytes = ebitset_bytes (n_bits); + sbset = xcalloc (1, bytes); + ebitset_init (sbset, n_bits); + break; + + case BITSET_VARRAY: + bytes = vbitset_bytes (n_bits); + sbset = xcalloc (1, bytes); + vbitset_init (sbset, n_bits); + break; + } + + bset->s.bset = sbset; + + BITSET_STATS_ALLOCS_INC (type); + + return bset; +} diff --git a/lib/bitset_stats.h b/lib/bitset_stats.h new file mode 100644 index 0000000..81e202a --- /dev/null +++ b/lib/bitset_stats.h @@ -0,0 +1,31 @@ +/* Functions to support bitset statistics. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#ifndef _BITSET_STATS_H +#define _BITSET_STATS_H + +#include "bbitset.h" + +extern bool bitset_stats_enabled; + +extern enum bitset_type bitset_stats_type_get (bitset); + +extern size_t bitset_stats_bytes (void); + +extern bitset bitset_stats_init (bitset, bitset_bindex, enum bitset_type); + +#endif diff --git a/lib/bitsetv-print.c b/lib/bitsetv-print.c new file mode 100644 index 0000000..00c4ecd --- /dev/null +++ b/lib/bitsetv-print.c @@ -0,0 +1,69 @@ +/* Bitset vectors. + Copyright (C) 2001, 2002, 2004, 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 . */ + +#include + +#include "bitsetv-print.h" + +#include + +/*--------------------------------------------------------. +| Display the MATRIX array of SIZE bitsets of size SIZE. | +`--------------------------------------------------------*/ + +void +bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset) +{ + bitset_bindex i, j; + bitset_bindex hsize = bitset_size (bset[0]); + + /* Title. */ + fprintf (out, "%s BEGIN\n", title); + + /* Column numbers. */ + fputs (" ", out); + for (i = 0; i < hsize; ++i) + putc (i / 10 ? '0' + i / 10 : ' ', out); + putc ('\n', out); + fputs (" ", out); + for (i = 0; i < hsize; ++i) + fprintf (out, "%d", (int) (i % 10)); + putc ('\n', out); + + /* Bar. */ + fputs (" .", out); + for (i = 0; i < hsize; ++i) + putc ('-', out); + fputs (".\n", out); + + /* Contents. */ + for (i = 0; bset[i]; ++i) + { + fprintf (out, "%2lu|", (unsigned long int) i); + for (j = 0; j < hsize; ++j) + fputs (bitset_test (bset[i], j) ? "1" : " ", out); + fputs ("|\n", out); + } + + /* Bar. */ + fputs (" `", out); + for (i = 0; i < hsize; ++i) + putc ('-', out); + fputs ("'\n", out); + + /* End title. */ + fprintf (out, "%s END\n\n", title); +} diff --git a/lib/bitsetv-print.h b/lib/bitsetv-print.h new file mode 100644 index 0000000..0f49de9 --- /dev/null +++ b/lib/bitsetv-print.h @@ -0,0 +1,26 @@ +/* Bitset vectors. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Contributed by Akim Demaille (akim@freefriends.org). + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 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 . */ + +#ifndef _BITSETV_PRINT_H +#define _BITSETV_PRINT_H + +#include "bitsetv.h" + +/* Dump vector of bitsets as a matrix. */ +extern void bitsetv_matrix_dump (FILE *, const char *, bitsetv); + +#endif /* _BITSETV_H */ diff --git a/lib/bitsetv.c b/lib/bitsetv.c new file mode 100644 index 0000000..54724c9 --- /dev/null +++ b/lib/bitsetv.c @@ -0,0 +1,167 @@ +/* Bitset vectors. + Copyright (C) 2001, 2002, 2004, 2005, 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 . */ + +#include + +#include "bitsetv.h" + +#include + + +/* Create a vector of N_VECS bitsets, each of N_BITS, and of + type TYPE. */ +bitset * +bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits, + enum bitset_type type) +{ + size_t vector_bytes; + size_t bytes; + bitset *bsetv; + bitset_bindex i; + + /* Determine number of bytes for each set. */ + bytes = bitset_bytes (type, n_bits); + + /* If size calculation overflows, memory is exhausted. */ + if (BITSET_SIZE_MAX / (sizeof (bitset) + bytes) <= n_vecs) + xalloc_die (); + + /* Allocate vector table at head of bitset array. */ + vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1; + vector_bytes -= vector_bytes % bytes; + bsetv = xcalloc (1, vector_bytes + bytes * n_vecs); + + for (i = 0; i < n_vecs; i++) + { + bsetv[i] = (bitset) (void *) ((char *) bsetv + vector_bytes + i * bytes); + + bitset_init (bsetv[i], n_bits, type); + } + + /* Null terminate table. */ + bsetv[i] = 0; + return bsetv; +} + + +/* Create a vector of N_VECS bitsets, each of N_BITS, and with + attribute hints specified by ATTR. */ +bitset * +bitsetv_create (bitset_bindex n_vecs, bitset_bindex n_bits, unsigned int attr) +{ + enum bitset_type type; + + type = bitset_type_choose (n_bits, attr); + return bitsetv_alloc (n_vecs, n_bits, type); +} + + +/* Free bitset vector BSETV. */ +void +bitsetv_free (bitsetv bsetv) +{ + bitset_bindex i; + + for (i = 0; bsetv[i]; i++) + BITSET_FREE_ (bsetv[i]); + free (bsetv); +} + + +/* Zero a vector of bitsets. */ +void +bitsetv_zero (bitsetv bsetv) +{ + bitset_bindex i; + + for (i = 0; bsetv[i]; i++) + bitset_zero (bsetv[i]); +} + + +/* Set a vector of bitsets to ones. */ +void +bitsetv_ones (bitsetv bsetv) +{ + bitset_bindex i; + + for (i = 0; bsetv[i]; i++) + bitset_ones (bsetv[i]); +} + + +/* Given a vector BSETV of N bitsets of size N, modify its contents to + be the transitive closure of what was given. */ +void +bitsetv_transitive_closure (bitsetv bsetv) +{ + bitset_bindex i; + bitset_bindex j; + + for (i = 0; bsetv[i]; i++) + for (j = 0; bsetv[j]; j++) + if (bitset_test (bsetv[j], i)) + bitset_or (bsetv[j], bsetv[j], bsetv[i]); +} + + +/* 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 + the same as transitive closure but with all bits on the diagonal + of the bit matrix set. */ +void +bitsetv_reflexive_transitive_closure (bitsetv bsetv) +{ + bitset_bindex i; + + bitsetv_transitive_closure (bsetv); + for (i = 0; bsetv[i]; i++) + bitset_set (bsetv[i], i); +} + + +/* Dump the contents of a bitset vector BSETV with N_VECS elements to + FILE. */ +void +bitsetv_dump (FILE *file, char const *title, char const *subtitle, + bitsetv bsetv) +{ + bitset_windex i; + + fprintf (file, "%s\n", title); + for (i = 0; bsetv[i]; i++) + { + fprintf (file, "%s %lu\n", subtitle, (unsigned long int) i); + bitset_dump (file, bsetv[i]); + } + + fprintf (file, "\n"); +} + + +void +debug_bitsetv (bitsetv bsetv) +{ + bitset_windex i; + + for (i = 0; bsetv[i]; i++) + { + fprintf (stderr, "%lu: ", (unsigned long int) i); + debug_bitset (bsetv[i]); + } + + fprintf (stderr, "\n"); +} diff --git a/lib/bitsetv.h b/lib/bitsetv.h new file mode 100644 index 0000000..7de2c0f --- /dev/null +++ b/lib/bitsetv.h @@ -0,0 +1,58 @@ +/* Bitset vectors. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#ifndef _BITSETV_H +#define _BITSETV_H + +#include "bitset.h" + +typedef bitset * bitsetv; + +/* Create a vector of N_VECS bitsets, each of N_BITS, and of + type TYPE. */ +extern bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type); + +/* Create a vector of N_VECS bitsets, each of N_BITS, and with + attribute hints specified by ATTR. */ +extern bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned int); + +/* Free vector of bitsets. */ +extern void bitsetv_free (bitsetv); + +/* Zero vector of bitsets. */ +extern void bitsetv_zero (bitsetv); + +/* Set vector of bitsets. */ +extern void bitsetv_ones (bitsetv); + +/* Given a vector BSETV of N bitsets of size N, modify its contents to + be the transitive closure of what was given. */ +extern void bitsetv_transitive_closure (bitsetv); + +/* 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 + the same as transitive closure but with all bits on the diagonal + of the bit matrix set. */ +extern void bitsetv_reflexive_transitive_closure (bitsetv); + +/* Dump vector of bitsets. */ +extern void bitsetv_dump (FILE *, const char *, const char *, bitsetv); + +/* Function to debug vector of bitsets from debugger. */ +extern void debug_bitsetv (bitsetv); + +#endif /* _BITSETV_H */ diff --git a/lib/c-ctype.c b/lib/c-ctype.c new file mode 100644 index 0000000..a669d7a --- /dev/null +++ b/lib/c-ctype.c @@ -0,0 +1,398 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Character handling in C locale. + + Copyright 2000-2003, 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, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#define NO_C_CTYPE_MACROS +#include "c-ctype.h" + +/* The function isascii is not locale dependent. Its use in EBCDIC is + questionable. */ +bool +c_isascii (int c) +{ + return (c >= 0x00 && c <= 0x7f); +} + +bool +c_isalnum (int c) +{ +#if C_CTYPE_CONSECUTIVE_DIGITS \ + && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII + return ((c >= '0' && c <= '9') + || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')); +#else + return ((c >= '0' && c <= '9') + || (c >= 'A' && c <= 'Z') + || (c >= 'a' && c <= 'z')); +#endif +#else + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isalpha (int c) +{ +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII + return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'); +#else + return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); +#endif +#else + switch (c) + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isblank (int c) +{ + return (c == ' ' || c == '\t'); +} + +bool +c_iscntrl (int c) +{ +#if C_CTYPE_ASCII + return ((c & ~0x1f) == 0 || c == 0x7f); +#else + switch (c) + { + case ' ': case '!': case '"': case '#': case '$': case '%': + case '&': case '\'': case '(': case ')': case '*': case '+': + case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': case '?': + case '@': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case '[': case '\\': case ']': case '^': case '_': case '`': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '{': case '|': case '}': case '~': + return 0; + default: + return 1; + } +#endif +} + +bool +c_isdigit (int c) +{ +#if C_CTYPE_CONSECUTIVE_DIGITS + return (c >= '0' && c <= '9'); +#else + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + return 1; + default: + return 0; + } +#endif +} + +bool +c_islower (int c) +{ +#if C_CTYPE_CONSECUTIVE_LOWERCASE + return (c >= 'a' && c <= 'z'); +#else + switch (c) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isgraph (int c) +{ +#if C_CTYPE_ASCII + return (c >= '!' && c <= '~'); +#else + switch (c) + { + case '!': case '"': case '#': case '$': case '%': case '&': + case '\'': case '(': case ')': case '*': case '+': case ',': + case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': case '?': + case '@': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case '[': case '\\': case ']': case '^': case '_': case '`': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '{': case '|': case '}': case '~': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isprint (int c) +{ +#if C_CTYPE_ASCII + return (c >= ' ' && c <= '~'); +#else + switch (c) + { + case ' ': case '!': case '"': case '#': case '$': case '%': + case '&': case '\'': case '(': case ')': case '*': case '+': + case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': case '?': + case '@': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case '[': case '\\': case ']': case '^': case '_': case '`': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '{': case '|': case '}': case '~': + return 1; + default: + return 0; + } +#endif +} + +bool +c_ispunct (int c) +{ +#if C_CTYPE_ASCII + return ((c >= '!' && c <= '~') + && !((c >= '0' && c <= '9') + || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'))); +#else + switch (c) + { + case '!': case '"': case '#': case '$': case '%': case '&': + case '\'': case '(': case ')': case '*': case '+': case ',': + case '-': case '.': case '/': + case ':': case ';': case '<': case '=': case '>': case '?': + case '@': + case '[': case '\\': case ']': case '^': case '_': case '`': + case '{': case '|': case '}': case '~': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isspace (int c) +{ + return (c == ' ' || c == '\t' + || c == '\n' || c == '\v' || c == '\f' || c == '\r'); +} + +bool +c_isupper (int c) +{ +#if C_CTYPE_CONSECUTIVE_UPPERCASE + return (c >= 'A' && c <= 'Z'); +#else + switch (c) + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isxdigit (int c) +{ +#if C_CTYPE_CONSECUTIVE_DIGITS \ + && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII + return ((c >= '0' && c <= '9') + || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F')); +#else + return ((c >= '0' && c <= '9') + || (c >= 'A' && c <= 'F') + || (c >= 'a' && c <= 'f')); +#endif +#else + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + return 1; + default: + return 0; + } +#endif +} + +int +c_tolower (int c) +{ +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE + return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); +#else + switch (c) + { + case 'A': return 'a'; + case 'B': return 'b'; + case 'C': return 'c'; + case 'D': return 'd'; + case 'E': return 'e'; + case 'F': return 'f'; + case 'G': return 'g'; + case 'H': return 'h'; + case 'I': return 'i'; + case 'J': return 'j'; + case 'K': return 'k'; + case 'L': return 'l'; + case 'M': return 'm'; + case 'N': return 'n'; + case 'O': return 'o'; + case 'P': return 'p'; + case 'Q': return 'q'; + case 'R': return 'r'; + case 'S': return 's'; + case 'T': return 't'; + case 'U': return 'u'; + case 'V': return 'v'; + case 'W': return 'w'; + case 'X': return 'x'; + case 'Y': return 'y'; + case 'Z': return 'z'; + default: return c; + } +#endif +} + +int +c_toupper (int c) +{ +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE + return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); +#else + switch (c) + { + case 'a': return 'A'; + case 'b': return 'B'; + case 'c': return 'C'; + case 'd': return 'D'; + case 'e': return 'E'; + case 'f': return 'F'; + case 'g': return 'G'; + case 'h': return 'H'; + case 'i': return 'I'; + case 'j': return 'J'; + case 'k': return 'K'; + case 'l': return 'L'; + case 'm': return 'M'; + case 'n': return 'N'; + case 'o': return 'O'; + case 'p': return 'P'; + case 'q': return 'Q'; + case 'r': return 'R'; + case 's': return 'S'; + case 't': return 'T'; + case 'u': return 'U'; + case 'v': return 'V'; + case 'w': return 'W'; + case 'x': return 'X'; + case 'y': return 'Y'; + case 'z': return 'Z'; + default: return c; + } +#endif +} diff --git a/lib/c-ctype.h b/lib/c-ctype.h new file mode 100644 index 0000000..a0ab083 --- /dev/null +++ b/lib/c-ctype.h @@ -0,0 +1,297 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Character handling in C locale. + + These functions work like the corresponding functions in , + except that they have the C (POSIX) locale hardwired, whereas the + functions' behaviour depends on the current locale set via + setlocale. + + Copyright (C) 2000-2003, 2006, 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, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef C_CTYPE_H +#define C_CTYPE_H + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* The functions defined in this file assume the "C" locale and a character + set without diacritics (ASCII-US or EBCDIC-US or something like that). + Even if the "C" locale on a particular system is an extension of the ASCII + character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it + is ISO-8859-1), the functions in this file recognize only the ASCII + characters. */ + + +/* Check whether the ASCII optimizations apply. */ + +/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that + '0', '1', ..., '9' have consecutive integer values. */ +#define C_CTYPE_CONSECUTIVE_DIGITS 1 + +#if ('A' <= 'Z') \ + && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \ + && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \ + && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \ + && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \ + && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \ + && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \ + && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \ + && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \ + && ('Y' + 1 == 'Z') +#define C_CTYPE_CONSECUTIVE_UPPERCASE 1 +#endif + +#if ('a' <= 'z') \ + && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \ + && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \ + && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \ + && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \ + && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \ + && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \ + && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \ + && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \ + && ('y' + 1 == 'z') +#define C_CTYPE_CONSECUTIVE_LOWERCASE 1 +#endif + +#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) +/* The character set is ASCII or one of its variants or extensions, not EBCDIC. + Testing the value of '\n' and '\r' is not relevant. */ +#define C_CTYPE_ASCII 1 +#endif + + +/* Function declarations. */ + +/* Unlike the functions in , which require an argument in the range + of the 'unsigned char' type, the functions here operate on values that are + in the 'unsigned char' range or in the 'char' range. In other words, + when you have a 'char' value, you need to cast it before using it as + argument to a function: + + const char *s = ...; + if (isalpha ((unsigned char) *s)) ... + + but you don't need to cast it for the functions defined in this file: + + const char *s = ...; + if (c_isalpha (*s)) ... + */ + +extern bool c_isascii (int c); /* not locale dependent */ + +extern bool c_isalnum (int c); +extern bool c_isalpha (int c); +extern bool c_isblank (int c); +extern bool c_iscntrl (int c); +extern bool c_isdigit (int c); +extern bool c_islower (int c); +extern bool c_isgraph (int c); +extern bool c_isprint (int c); +extern bool c_ispunct (int c); +extern bool c_isspace (int c); +extern bool c_isupper (int c); +extern bool c_isxdigit (int c); + +extern int c_tolower (int c); +extern int c_toupper (int c); + + +#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS + +/* ASCII optimizations. */ + +#undef c_isascii +#define c_isascii(c) \ + ({ int __c = (c); \ + (__c >= 0x00 && __c <= 0x7f); \ + }) + +#if C_CTYPE_CONSECUTIVE_DIGITS \ + && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII +#undef c_isalnum +#define c_isalnum(c) \ + ({ int __c = (c); \ + ((__c >= '0' && __c <= '9') \ + || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \ + }) +#else +#undef c_isalnum +#define c_isalnum(c) \ + ({ int __c = (c); \ + ((__c >= '0' && __c <= '9') \ + || (__c >= 'A' && __c <= 'Z') \ + || (__c >= 'a' && __c <= 'z')); \ + }) +#endif +#endif + +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII +#undef c_isalpha +#define c_isalpha(c) \ + ({ int __c = (c); \ + ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \ + }) +#else +#undef c_isalpha +#define c_isalpha(c) \ + ({ int __c = (c); \ + ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \ + }) +#endif +#endif + +#undef c_isblank +#define c_isblank(c) \ + ({ int __c = (c); \ + (__c == ' ' || __c == '\t'); \ + }) + +#if C_CTYPE_ASCII +#undef c_iscntrl +#define c_iscntrl(c) \ + ({ int __c = (c); \ + ((__c & ~0x1f) == 0 || __c == 0x7f); \ + }) +#endif + +#if C_CTYPE_CONSECUTIVE_DIGITS +#undef c_isdigit +#define c_isdigit(c) \ + ({ int __c = (c); \ + (__c >= '0' && __c <= '9'); \ + }) +#endif + +#if C_CTYPE_CONSECUTIVE_LOWERCASE +#undef c_islower +#define c_islower(c) \ + ({ int __c = (c); \ + (__c >= 'a' && __c <= 'z'); \ + }) +#endif + +#if C_CTYPE_ASCII +#undef c_isgraph +#define c_isgraph(c) \ + ({ int __c = (c); \ + (__c >= '!' && __c <= '~'); \ + }) +#endif + +#if C_CTYPE_ASCII +#undef c_isprint +#define c_isprint(c) \ + ({ int __c = (c); \ + (__c >= ' ' && __c <= '~'); \ + }) +#endif + +#if C_CTYPE_ASCII +#undef c_ispunct +#define c_ispunct(c) \ + ({ int _c = (c); \ + (c_isgraph (_c) && ! c_isalnum (_c)); \ + }) +#endif + +#undef c_isspace +#define c_isspace(c) \ + ({ int __c = (c); \ + (__c == ' ' || __c == '\t' \ + || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \ + }) + +#if C_CTYPE_CONSECUTIVE_UPPERCASE +#undef c_isupper +#define c_isupper(c) \ + ({ int __c = (c); \ + (__c >= 'A' && __c <= 'Z'); \ + }) +#endif + +#if C_CTYPE_CONSECUTIVE_DIGITS \ + && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII +#undef c_isxdigit +#define c_isxdigit(c) \ + ({ int __c = (c); \ + ((__c >= '0' && __c <= '9') \ + || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \ + }) +#else +#undef c_isxdigit +#define c_isxdigit(c) \ + ({ int __c = (c); \ + ((__c >= '0' && __c <= '9') \ + || (__c >= 'A' && __c <= 'F') \ + || (__c >= 'a' && __c <= 'f')); \ + }) +#endif +#endif + +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#undef c_tolower +#define c_tolower(c) \ + ({ int __c = (c); \ + (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \ + }) +#undef c_toupper +#define c_toupper(c) \ + ({ int __c = (c); \ + (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \ + }) +#endif + +#endif /* optimizing for speed */ + + +#ifdef __cplusplus +} +#endif + +#endif /* C_CTYPE_H */ diff --git a/lib/c-strcase.h b/lib/c-strcase.h new file mode 100644 index 0000000..03ae92e --- /dev/null +++ b/lib/c-strcase.h @@ -0,0 +1,57 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Case-insensitive string comparison functions in C locale. + Copyright (C) 1995-1996, 2001, 2003, 2005 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef C_STRCASE_H +#define C_STRCASE_H + +#include + + +/* The functions defined in this file assume the "C" locale and a character + set without diacritics (ASCII-US or EBCDIC-US or something like that). + Even if the "C" locale on a particular system is an extension of the ASCII + character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it + is ISO-8859-1), the functions in this file recognize only the ASCII + characters. More precisely, one of the string arguments must be an ASCII + string; the other one can also contain non-ASCII characters (but then + the comparison result will be nonzero). */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Compare strings S1 and S2, ignoring case, returning less than, equal to or + greater than zero if S1 is lexicographically less than, equal to or greater + than S2. */ +extern int c_strcasecmp (const char *s1, const char *s2); + +/* Compare no more than N characters of strings S1 and S2, ignoring case, + returning less than, equal to or greater than zero if S1 is + lexicographically less than, equal to or greater than S2. */ +extern int c_strncasecmp (const char *s1, const char *s2, size_t n); + + +#ifdef __cplusplus +} +#endif + + +#endif /* C_STRCASE_H */ diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c new file mode 100644 index 0000000..0553b28 --- /dev/null +++ b/lib/c-strcasecmp.c @@ -0,0 +1,59 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* c-strcasecmp.c -- case insensitive string comparator in C locale + Copyright (C) 1998-1999, 2005-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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "c-strcase.h" + +#include + +#include "c-ctype.h" + +int +c_strcasecmp (const char *s1, const char *s2) +{ + register const unsigned char *p1 = (const unsigned char *) s1; + register const unsigned char *p2 = (const unsigned char *) s2; + unsigned char c1, c2; + + if (p1 == p2) + return 0; + + do + { + c1 = c_tolower (*p1); + c2 = c_tolower (*p2); + + if (c1 == '\0') + break; + + ++p1; + ++p2; + } + while (c1 == c2); + + if (UCHAR_MAX <= INT_MAX) + return c1 - c2; + else + /* On machines where 'char' and 'int' are types of the same size, the + difference of two 'unsigned char' values - including the sign bit - + doesn't fit in an 'int'. */ + return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); +} diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c new file mode 100644 index 0000000..05c35d4 --- /dev/null +++ b/lib/c-strncasecmp.c @@ -0,0 +1,59 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* c-strncasecmp.c -- case insensitive string comparator in C locale + Copyright (C) 1998-1999, 2005-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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "c-strcase.h" + +#include + +#include "c-ctype.h" + +int +c_strncasecmp (const char *s1, const char *s2, size_t n) +{ + register const unsigned char *p1 = (const unsigned char *) s1; + register const unsigned char *p2 = (const unsigned char *) s2; + unsigned char c1, c2; + + if (p1 == p2 || n == 0) + return 0; + + do + { + c1 = c_tolower (*p1); + c2 = c_tolower (*p2); + + if (--n == 0 || c1 == '\0') + break; + + ++p1; + ++p2; + } + while (c1 == c2); + + if (UCHAR_MAX <= INT_MAX) + return c1 - c2; + else + /* On machines where 'char' and 'int' are types of the same size, the + difference of two 'unsigned char' values - including the sign bit - + doesn't fit in an 'int'. */ + return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); +} diff --git a/lib/config.charset b/lib/config.charset new file mode 100644 index 0000000..36ba683 --- /dev/null +++ b/lib/config.charset @@ -0,0 +1,649 @@ +#! /bin/sh +# Output a system dependent table of character encoding aliases. +# +# Copyright (C) 2000-2004, 2006-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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# The table consists of lines of the form +# ALIAS CANONICAL +# +# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)". +# ALIAS is compared in a case sensitive way. +# +# CANONICAL is the GNU canonical name for this character encoding. +# It must be an encoding supported by libiconv. Support by GNU libc is +# also desirable. CANONICAL is case insensitive. Usually an upper case +# MIME charset name is preferred. +# The current list of GNU canonical charset names is as follows. +# +# name MIME? used by which systems +# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin +# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin +# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin +# ISO-8859-3 Y glibc solaris +# ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin +# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin +# ISO-8859-6 Y glibc aix hpux solaris +# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin +# ISO-8859-8 Y glibc aix hpux osf solaris +# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin +# ISO-8859-13 glibc netbsd openbsd darwin +# ISO-8859-14 glibc +# ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin +# KOI8-R Y glibc solaris freebsd netbsd openbsd darwin +# KOI8-U Y glibc freebsd netbsd openbsd darwin +# KOI8-T glibc +# CP437 dos +# CP775 dos +# CP850 aix osf dos +# CP852 dos +# CP855 dos +# CP856 aix +# CP857 dos +# CP861 dos +# CP862 dos +# CP864 dos +# CP865 dos +# CP866 freebsd netbsd openbsd darwin dos +# CP869 dos +# CP874 woe32 dos +# CP922 aix +# CP932 aix woe32 dos +# CP943 aix +# CP949 osf woe32 dos +# CP950 woe32 dos +# CP1046 aix +# CP1124 aix +# CP1125 dos +# CP1129 aix +# CP1250 woe32 +# CP1251 glibc solaris netbsd openbsd darwin woe32 +# CP1252 aix woe32 +# CP1253 woe32 +# CP1254 woe32 +# CP1255 glibc woe32 +# CP1256 woe32 +# CP1257 woe32 +# GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin +# EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin +# EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin +# EUC-TW glibc aix hpux irix osf solaris netbsd +# BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin +# BIG5-HKSCS glibc solaris +# GBK glibc aix osf solaris woe32 dos +# GB18030 glibc solaris netbsd +# SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin +# JOHAB glibc solaris woe32 +# TIS-620 glibc aix hpux osf solaris +# VISCII Y glibc +# TCVN5712-1 glibc +# GEORGIAN-PS glibc +# HP-ROMAN8 hpux +# HP-ARABIC8 hpux +# HP-GREEK8 hpux +# HP-HEBREW8 hpux +# HP-TURKISH8 hpux +# HP-KANA8 hpux +# DEC-KANJI osf +# DEC-HANYU osf +# UTF-8 Y glibc aix hpux osf solaris netbsd darwin +# +# Note: Names which are not marked as being a MIME name should not be used in +# Internet protocols for information interchange (mail, news, etc.). +# +# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications +# must understand both names and treat them as equivalent. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + +host="$1" +os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'` +echo "# This file contains a table of character encoding aliases," +echo "# suitable for operating system '${os}'." +echo "# It was automatically generated from config.charset." +# List of references, updated during installation: +echo "# Packages using this file: " +case "$os" in + linux-gnulibc1*) + # Linux libc5 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "C ASCII" + echo "POSIX ASCII" + for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \ + en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \ + en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \ + es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \ + et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \ + fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \ + it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \ + sv_FI sv_SE; do + echo "$l ISO-8859-1" + echo "$l.iso-8859-1 ISO-8859-1" + echo "$l.iso-8859-15 ISO-8859-15" + echo "$l.iso-8859-15@euro ISO-8859-15" + echo "$l@euro ISO-8859-15" + echo "$l.cp-437 CP437" + echo "$l.cp-850 CP850" + echo "$l.cp-1252 CP1252" + echo "$l.cp-1252@euro CP1252" + #echo "$l.atari-st ATARI-ST" # not a commonly used encoding + echo "$l.utf-8 UTF-8" + echo "$l.utf-8@euro UTF-8" + done + for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \ + sl_SI sr sr_CS sr_YU; do + echo "$l ISO-8859-2" + echo "$l.iso-8859-2 ISO-8859-2" + echo "$l.cp-852 CP852" + echo "$l.cp-1250 CP1250" + echo "$l.utf-8 UTF-8" + done + for l in mk mk_MK ru ru_RU; do + echo "$l ISO-8859-5" + echo "$l.iso-8859-5 ISO-8859-5" + echo "$l.koi8-r KOI8-R" + echo "$l.cp-866 CP866" + echo "$l.cp-1251 CP1251" + echo "$l.utf-8 UTF-8" + done + for l in ar ar_SA; do + echo "$l ISO-8859-6" + echo "$l.iso-8859-6 ISO-8859-6" + echo "$l.cp-864 CP864" + #echo "$l.cp-868 CP868" # not a commonly used encoding + echo "$l.cp-1256 CP1256" + echo "$l.utf-8 UTF-8" + done + for l in el el_GR gr gr_GR; do + echo "$l ISO-8859-7" + echo "$l.iso-8859-7 ISO-8859-7" + echo "$l.cp-869 CP869" + echo "$l.cp-1253 CP1253" + echo "$l.cp-1253@euro CP1253" + echo "$l.utf-8 UTF-8" + echo "$l.utf-8@euro UTF-8" + done + for l in he he_IL iw iw_IL; do + echo "$l ISO-8859-8" + echo "$l.iso-8859-8 ISO-8859-8" + echo "$l.cp-862 CP862" + echo "$l.cp-1255 CP1255" + echo "$l.utf-8 UTF-8" + done + for l in tr tr_TR; do + echo "$l ISO-8859-9" + echo "$l.iso-8859-9 ISO-8859-9" + echo "$l.cp-857 CP857" + echo "$l.cp-1254 CP1254" + echo "$l.utf-8 UTF-8" + done + for l in lt lt_LT lv lv_LV; do + #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name + echo "$l ISO-8859-13" + done + for l in ru_UA uk uk_UA; do + echo "$l KOI8-U" + done + for l in zh zh_CN; do + #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name + echo "$l GB2312" + done + for l in ja ja_JP ja_JP.EUC; do + echo "$l EUC-JP" + done + for l in ko ko_KR; do + echo "$l EUC-KR" + done + for l in th th_TH; do + echo "$l TIS-620" + done + for l in fa fa_IR; do + #echo "$l ISIRI-3342" # a broken encoding + echo "$l.utf-8 UTF-8" + done + ;; + linux* | *-gnu*) + # With glibc-2.1 or newer, we don't need any canonicalization, + # because glibc has iconv and both glibc and libiconv support all + # GNU canonical names directly. Therefore, the Makefile does not + # need to install the alias file at all. + # The following applies only to glibc-2.0.x and older libcs. + echo "ISO_646.IRV:1983 ASCII" + ;; + aix*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-6 ISO-8859-6" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "IBM-850 CP850" + echo "IBM-856 CP856" + echo "IBM-921 ISO-8859-13" + echo "IBM-922 CP922" + echo "IBM-932 CP932" + echo "IBM-943 CP943" + echo "IBM-1046 CP1046" + echo "IBM-1124 CP1124" + echo "IBM-1129 CP1129" + echo "IBM-1252 CP1252" + echo "IBM-eucCN GB2312" + echo "IBM-eucJP EUC-JP" + echo "IBM-eucKR EUC-KR" + echo "IBM-eucTW EUC-TW" + echo "big5 BIG5" + echo "GBK GBK" + echo "TIS-620 TIS-620" + echo "UTF-8 UTF-8" + ;; + hpux*) + echo "iso88591 ISO-8859-1" + echo "iso88592 ISO-8859-2" + echo "iso88595 ISO-8859-5" + echo "iso88596 ISO-8859-6" + echo "iso88597 ISO-8859-7" + echo "iso88598 ISO-8859-8" + echo "iso88599 ISO-8859-9" + echo "iso885915 ISO-8859-15" + echo "roman8 HP-ROMAN8" + echo "arabic8 HP-ARABIC8" + echo "greek8 HP-GREEK8" + echo "hebrew8 HP-HEBREW8" + echo "turkish8 HP-TURKISH8" + echo "kana8 HP-KANA8" + echo "tis620 TIS-620" + echo "big5 BIG5" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "hp15CN GB2312" + #echo "ccdc ?" # what is this? + echo "SJIS SHIFT_JIS" + echo "utf8 UTF-8" + ;; + irix*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-9 ISO-8859-9" + echo "eucCN GB2312" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + ;; + osf*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "cp850 CP850" + echo "big5 BIG5" + echo "dechanyu DEC-HANYU" + echo "dechanzi GB2312" + echo "deckanji DEC-KANJI" + echo "deckorean EUC-KR" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "GBK GBK" + echo "KSC5601 CP949" + echo "sdeckanji EUC-JP" + echo "SJIS SHIFT_JIS" + echo "TACTIS TIS-620" + echo "UTF-8 UTF-8" + ;; + solaris*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-3 ISO-8859-3" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-6 ISO-8859-6" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "koi8-r KOI8-R" + echo "ansi-1251 CP1251" + echo "BIG5 BIG5" + echo "Big5-HKSCS BIG5-HKSCS" + echo "gb2312 GB2312" + echo "GBK GBK" + echo "GB18030 GB18030" + echo "cns11643 EUC-TW" + echo "5601 EUC-KR" + echo "ko_KR.johap92 JOHAB" + echo "eucJP EUC-JP" + echo "PCK SHIFT_JIS" + echo "TIS620.2533 TIS-620" + #echo "sun_eu_greek ?" # what is this? + echo "UTF-8 UTF-8" + ;; + freebsd* | os2*) + # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just + # reuse FreeBSD's locale data for OS/2. + echo "C ASCII" + echo "US-ASCII ASCII" + for l in la_LN lt_LN; do + echo "$l.ASCII ASCII" + done + for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ + fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ + lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do + echo "$l.ISO_8859-1 ISO-8859-1" + echo "$l.DIS_8859-15 ISO-8859-15" + done + for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do + echo "$l.ISO_8859-2 ISO-8859-2" + done + for l in la_LN lt_LT; do + echo "$l.ISO_8859-4 ISO-8859-4" + done + for l in ru_RU ru_SU; do + echo "$l.KOI8-R KOI8-R" + echo "$l.ISO_8859-5 ISO-8859-5" + echo "$l.CP866 CP866" + done + echo "uk_UA.KOI8-U KOI8-U" + echo "zh_TW.BIG5 BIG5" + echo "zh_TW.Big5 BIG5" + echo "zh_CN.EUC GB2312" + echo "ja_JP.EUC EUC-JP" + echo "ja_JP.SJIS SHIFT_JIS" + echo "ja_JP.Shift_JIS SHIFT_JIS" + echo "ko_KR.EUC EUC-KR" + ;; + netbsd*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-13 ISO-8859-13" + echo "ISO8859-15 ISO-8859-15" + echo "eucCN GB2312" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "BIG5 BIG5" + echo "SJIS SHIFT_JIS" + ;; + openbsd*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-13 ISO-8859-13" + echo "ISO8859-15 ISO-8859-15" + ;; + darwin[56]*) + # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "C ASCII" + for l in en_AU en_CA en_GB en_US la_LN; do + echo "$l.US-ASCII ASCII" + done + for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ + fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \ + nl_NL no_NO pt_PT sv_SE; do + echo "$l ISO-8859-1" + echo "$l.ISO8859-1 ISO-8859-1" + echo "$l.ISO8859-15 ISO-8859-15" + done + for l in la_LN; do + echo "$l.ISO8859-1 ISO-8859-1" + echo "$l.ISO8859-15 ISO-8859-15" + done + for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do + echo "$l.ISO8859-2 ISO-8859-2" + done + for l in la_LN lt_LT; do + echo "$l.ISO8859-4 ISO-8859-4" + done + for l in ru_RU; do + echo "$l.KOI8-R KOI8-R" + echo "$l.ISO8859-5 ISO-8859-5" + echo "$l.CP866 CP866" + done + for l in bg_BG; do + echo "$l.CP1251 CP1251" + done + echo "uk_UA.KOI8-U KOI8-U" + echo "zh_TW.BIG5 BIG5" + echo "zh_TW.Big5 BIG5" + echo "zh_CN.EUC GB2312" + echo "ja_JP.EUC EUC-JP" + echo "ja_JP.SJIS SHIFT_JIS" + echo "ko_KR.EUC EUC-KR" + ;; + darwin*) + # Darwin 7.5 has nl_langinfo(CODESET), but it is useless: + # - It returns the empty string when LANG is set to a locale of the + # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 + # LC_CTYPE file. + # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by + # the system; nl_langinfo(CODESET) returns "US-ASCII" in this case. + # - The documentation says: + # "... all code that calls BSD system routines should ensure + # that the const *char parameters of these routines are in UTF-8 + # encoding. All BSD system functions expect their string + # parameters to be in UTF-8 encoding and nothing else." + # It also says + # "An additional caveat is that string parameters for files, + # paths, and other file-system entities must be in canonical + # UTF-8. In a canonical UTF-8 Unicode string, all decomposable + # characters are decomposed ..." + # but this is not true: You can pass non-decomposed UTF-8 strings + # to file system functions, and it is the OS which will convert + # them to decomposed UTF-8 before accessing the file system. + # - The Apple Terminal application displays UTF-8 by default. + # - However, other applications are free to use different encodings: + # - xterm uses ISO-8859-1 by default. + # - TextEdit uses MacRoman by default. + # We prefer UTF-8 over decomposed UTF-8-MAC because one should + # minimize the use of decomposed Unicode. Unfortunately, through the + # Darwin file system, decomposed UTF-8 strings are leaked into user + # space nevertheless. + echo "* UTF-8" + ;; + beos* | haiku*) + # BeOS and Haiku have a single locale, and it has UTF-8 encoding. + echo "* UTF-8" + ;; + msdosdjgpp*) + # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "#" + echo "# The encodings given here may not all be correct." + echo "# If you find that the encoding given for your language and" + echo "# country is not the one your DOS machine actually uses, just" + echo "# correct it in this file, and send a mail to" + echo "# Juan Manuel Guerrero " + echo "# and Bruno Haible ." + echo "#" + echo "C ASCII" + # ISO-8859-1 languages + echo "ca CP850" + echo "ca_ES CP850" + echo "da CP865" # not CP850 ?? + echo "da_DK CP865" # not CP850 ?? + echo "de CP850" + echo "de_AT CP850" + echo "de_CH CP850" + echo "de_DE CP850" + echo "en CP850" + echo "en_AU CP850" # not CP437 ?? + echo "en_CA CP850" + echo "en_GB CP850" + echo "en_NZ CP437" + echo "en_US CP437" + echo "en_ZA CP850" # not CP437 ?? + echo "es CP850" + echo "es_AR CP850" + echo "es_BO CP850" + echo "es_CL CP850" + echo "es_CO CP850" + echo "es_CR CP850" + echo "es_CU CP850" + echo "es_DO CP850" + echo "es_EC CP850" + echo "es_ES CP850" + echo "es_GT CP850" + echo "es_HN CP850" + echo "es_MX CP850" + echo "es_NI CP850" + echo "es_PA CP850" + echo "es_PY CP850" + echo "es_PE CP850" + echo "es_SV CP850" + echo "es_UY CP850" + echo "es_VE CP850" + echo "et CP850" + echo "et_EE CP850" + echo "eu CP850" + echo "eu_ES CP850" + echo "fi CP850" + echo "fi_FI CP850" + echo "fr CP850" + echo "fr_BE CP850" + echo "fr_CA CP850" + echo "fr_CH CP850" + echo "fr_FR CP850" + echo "ga CP850" + echo "ga_IE CP850" + echo "gd CP850" + echo "gd_GB CP850" + echo "gl CP850" + echo "gl_ES CP850" + echo "id CP850" # not CP437 ?? + echo "id_ID CP850" # not CP437 ?? + echo "is CP861" # not CP850 ?? + echo "is_IS CP861" # not CP850 ?? + echo "it CP850" + echo "it_CH CP850" + echo "it_IT CP850" + echo "lt CP775" + echo "lt_LT CP775" + echo "lv CP775" + echo "lv_LV CP775" + echo "nb CP865" # not CP850 ?? + echo "nb_NO CP865" # not CP850 ?? + echo "nl CP850" + echo "nl_BE CP850" + echo "nl_NL CP850" + echo "nn CP865" # not CP850 ?? + echo "nn_NO CP865" # not CP850 ?? + echo "no CP865" # not CP850 ?? + echo "no_NO CP865" # not CP850 ?? + echo "pt CP850" + echo "pt_BR CP850" + echo "pt_PT CP850" + echo "sv CP850" + echo "sv_SE CP850" + # ISO-8859-2 languages + echo "cs CP852" + echo "cs_CZ CP852" + echo "hr CP852" + echo "hr_HR CP852" + echo "hu CP852" + echo "hu_HU CP852" + echo "pl CP852" + echo "pl_PL CP852" + echo "ro CP852" + echo "ro_RO CP852" + echo "sk CP852" + echo "sk_SK CP852" + echo "sl CP852" + echo "sl_SI CP852" + echo "sq CP852" + echo "sq_AL CP852" + echo "sr CP852" # CP852 or CP866 or CP855 ?? + echo "sr_CS CP852" # CP852 or CP866 or CP855 ?? + echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? + # ISO-8859-3 languages + echo "mt CP850" + echo "mt_MT CP850" + # ISO-8859-5 languages + echo "be CP866" + echo "be_BE CP866" + echo "bg CP866" # not CP855 ?? + echo "bg_BG CP866" # not CP855 ?? + echo "mk CP866" # not CP855 ?? + echo "mk_MK CP866" # not CP855 ?? + echo "ru CP866" + echo "ru_RU CP866" + echo "uk CP1125" + echo "uk_UA CP1125" + # ISO-8859-6 languages + echo "ar CP864" + echo "ar_AE CP864" + echo "ar_DZ CP864" + echo "ar_EG CP864" + echo "ar_IQ CP864" + echo "ar_IR CP864" + echo "ar_JO CP864" + echo "ar_KW CP864" + echo "ar_MA CP864" + echo "ar_OM CP864" + echo "ar_QA CP864" + echo "ar_SA CP864" + echo "ar_SY CP864" + # ISO-8859-7 languages + echo "el CP869" + echo "el_GR CP869" + # ISO-8859-8 languages + echo "he CP862" + echo "he_IL CP862" + # ISO-8859-9 languages + echo "tr CP857" + echo "tr_TR CP857" + # Japanese + echo "ja CP932" + echo "ja_JP CP932" + # Chinese + echo "zh_CN GBK" + echo "zh_TW CP950" # not CP938 ?? + # Korean + echo "kr CP949" # not CP934 ?? + echo "kr_KR CP949" # not CP934 ?? + # Thai + echo "th CP874" + echo "th_TH CP874" + # Other + echo "eo CP850" + echo "eo_EO CP850" + ;; +esac diff --git a/lib/config.hin b/lib/config.hin new file mode 100644 index 0000000..2810baa --- /dev/null +++ b/lib/config.hin @@ -0,0 +1,553 @@ +/* lib/config.hin. Generated from configure.ac by autoheader. */ + +/* Define to the number of bits in type 'ptrdiff_t'. */ +#undef BITSIZEOF_PTRDIFF_T + +/* Define to the number of bits in type 'sig_atomic_t'. */ +#undef BITSIZEOF_SIG_ATOMIC_T + +/* Define to the number of bits in type 'size_t'. */ +#undef BITSIZEOF_SIZE_T + +/* Define to the number of bits in type 'wchar_t'. */ +#undef BITSIZEOF_WCHAR_T + +/* Define to the number of bits in type 'wint_t'. */ +#undef BITSIZEOF_WINT_T + +/* Define to 1 if // is a file system root distinct from /. */ +#undef DOUBLE_SLASH_IS_DISTINCT_ROOT + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Define on systems for which file names may have a so-called `drive letter' + prefix, define this to compute the length of that prefix, including the + colon. */ +#undef FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX + +/* Define if the backslash character may also serve as a file name component + separator. */ +#undef FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR + +/* Define if a drive letter prefix denotes a relative path if it is not + followed by a file name component separator. */ +#undef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE + +/* Define to make the limit macros in visible. */ +#undef GL_TRIGGER_STDC_LIMIT_MACROS + +/* Define to 1 when using the gnulib module fopen-safer. */ +#undef GNULIB_FOPEN_SAFER + +/* Define to indicate the 'malloc' module. */ +#undef GNULIB_MALLOC_GNU + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +#undef HAVE_CFLOCALECOPYCURRENT + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +#undef HAVE_CFPREFERENCESCOPYAPPVALUE + +/* Define to 1 if the system has the type `clock_t'. */ +#undef HAVE_CLOCK_T + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT + +/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_CLEARERR_UNLOCKED + +/* Define to 1 if you have the declaration of `clock', and to 0 if you don't. + */ +#undef HAVE_DECL_CLOCK + +/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_FEOF_UNLOCKED + +/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FERROR_UNLOCKED + +/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FFLUSH_UNLOCKED + +/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FGETS_UNLOCKED + +/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FPUTC_UNLOCKED + +/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FPUTS_UNLOCKED + +/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FREAD_UNLOCKED + +/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FWRITE_UNLOCKED + +/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_GETCHAR_UNLOCKED + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_GETC_UNLOCKED + +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#undef HAVE_DECL_GETENV + +/* Define to 1 if you have the declaration of `getrusage', and to 0 if you + don't. */ +#undef HAVE_DECL_GETRUSAGE + +/* Define to 1 if you have the declaration of `imaxabs', and to 0 if you + don't. */ +#undef HAVE_DECL_IMAXABS + +/* Define to 1 if you have the declaration of `imaxdiv', and to 0 if you + don't. */ +#undef HAVE_DECL_IMAXDIV + +/* Define to 1 if you have a declaration of mbswidth() in , and to 0 + otherwise. */ +#undef HAVE_DECL_MBSWIDTH_IN_WCHAR_H + +/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_PUTCHAR_UNLOCKED + +/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_PUTC_UNLOCKED + +/* Define to 1 if you have the declaration of `strerror', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_R + +/* Define to 1 if you have the declaration of `strndup', and to 0 if you + don't. */ +#undef HAVE_DECL_STRNDUP + +/* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +#undef HAVE_DECL_STRNLEN + +/* Define to 1 if you have the declaration of `strtoimax', and to 0 if you + don't. */ +#undef HAVE_DECL_STRTOIMAX + +/* Define to 1 if you have the declaration of `strtoumax', and to 0 if you + don't. */ +#undef HAVE_DECL_STRTOUMAX + +/* Define to 1 if you have the declaration of `sysconf', and to 0 if you + don't. */ +#undef HAVE_DECL_SYSCONF + +/* Define to 1 if you have the declaration of `times', and to 0 if you don't. + */ +#undef HAVE_DECL_TIMES + +/* Define to 1 if you have the declaration of `wcwidth', and to 0 if you + don't. */ +#undef HAVE_DECL_WCWIDTH + +/* Define to 1 if you have the `dup2' function. */ +#undef HAVE_DUP2 + +/* Define if you have the declaration of environ. */ +#undef HAVE_ENVIRON_DECL + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `getopt_long_only' function. */ +#undef HAVE_GETOPT_LONG_ONLY + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define if you have the iconv() function and it works. */ +#undef HAVE_ICONV + +/* Define to 1 if the compiler supports one of the keywords 'inline', + '__inline__', '__inline' and effectively inlines functions marked as such. + */ +#undef HAVE_INLINE + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isascii' function. */ +#undef HAVE_ISASCII + +/* Define to 1 if you have the `iswcntrl' function. */ +#undef HAVE_ISWCNTRL + +/* Define if you have and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if the system has the type `long long int'. */ +#undef HAVE_LONG_LONG_INT + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define if the 'malloc' function is POSIX compliant. */ +#undef HAVE_MALLOC_POSIX + +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ +#undef HAVE_MBRTOWC + +/* Define to 1 if you have the `mbsinit' function. */ +#undef HAVE_MBSINIT + +/* Define to 1 if declares mbstate_t. */ +#undef HAVE_MBSTATE_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if libc includes obstacks. */ +#undef HAVE_OBSTACK + +/* Define to 1 if you have the `pipe' function. */ +#undef HAVE_PIPE + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +#undef HAVE_SIGNED_SIG_ATOMIC_T + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +#undef HAVE_SIGNED_WCHAR_T + +/* Define to 1 if 'wint_t' is a signed integer type. */ +#undef HAVE_SIGNED_WINT_T + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `stpcpy' function. */ +#undef HAVE_STPCPY + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the strndup() function and it works. */ +#undef HAVE_STRNDUP + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if the system has the type `struct random_data'. */ +#undef HAVE_STRUCT_RANDOM_DATA + +/* Define to 1 if the system has the type `struct tms'. */ +#undef HAVE_STRUCT_TMS + +/* Define to 1 if you have the `strverscmp' function. */ +#undef HAVE_STRVERSCMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BITYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIMES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the `times' function. */ +#undef HAVE_TIMES + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `unsetenv' function. */ +#undef HAVE_UNSETENV + +/* Define to 1 if the system has the type `unsigned long long int'. */ +#undef HAVE_UNSIGNED_LONG_LONG_INT + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the `waitpid' function. */ +#undef HAVE_WAITPID + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define if you have the 'wchar_t' type. */ +#undef HAVE_WCHAR_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCTYPE_H + +/* Define to 1 if you have the `wcwidth' function. */ +#undef HAVE_WCWIDTH + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define if you have the 'wint_t' type. */ +#undef HAVE_WINT_T + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#else +# define ISSLASH(C) ((C) == '/') +#endif + +/* Define to the GNU M4 executable name. */ +#undef M4 + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* The copyright year for this package */ +#undef PACKAGE_COPYRIGHT_YEAR + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define if exists and defines unusable PRI* macros. */ +#undef PRI_MACROS_BROKEN + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +#undef PTRDIFF_T_SUFFIX + +/* Define this to 1 if strerror is broken. */ +#undef REPLACE_STRERROR + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +#undef SIG_ATOMIC_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +#undef SIZE_T_SUFFIX + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + +/* Define to 1 if you want getc etc. to use unlocked I/O if available. + Unlocked I/O can improve performance in unithreaded apps, but it is not + safe for multithreaded apps. */ +#undef USE_UNLOCKED_IO + +/* Version number of package */ +#undef VERSION + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +#undef WCHAR_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +#undef WINT_T_SUFFIX + +/* Define if using the dmalloc debugging malloc package */ +#undef WITH_DMALLOC + +/* Define to 1 to internationalize bison runtime messages. */ +#undef YYENABLE_NLS + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Define to rpl_ if the getopt replacement functions and variables should be + used. */ +#undef __GETOPT_PREFIX + +/* Ensure that defines the limit macros, since gnulib's + relies on them. */ +#if defined __cplusplus && !defined __STDC_LIMIT_MACROS && GL_TRIGGER_STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS 1 +#endif + + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports + the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of + earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. + __APPLE__ && __MACH__ test for MacOS X. + __APPLE_CC__ tests for the Apple compiler and its version. + __STDC_VERSION__ tests for the C99 mode. */ +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ +# define __GNUC_STDC_INLINE__ 1 +#endif + +/* Define to 1 if the compiler is checking for lint. */ +#undef lint + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to a type if does not define. */ +#undef mbstate_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif + +/* Define to rpl_strnlen if the replacement function should be used. */ +#undef strnlen + +/* Define as a marker that can be attached to function parameter declarations + for parameters that are not used. This helps to reduce warnings, such as + from GCC -Wunused-parameter. */ +#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _UNUSED_PARAMETER_ __attribute__ ((__unused__)) +#else +# define _UNUSED_PARAMETER_ +#endif + + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork diff --git a/lib/dirname.c b/lib/dirname.c new file mode 100644 index 0000000..c27e5b5 --- /dev/null +++ b/lib/dirname.c @@ -0,0 +1,84 @@ +/* dirname.c -- return all but the last element in a file name + + Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004, 2005, 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 . */ + +#include + +#include "dirname.h" + +#include +#include "xalloc.h" + +/* Return the length of the prefix of FILE that will be used by + dir_name. If FILE is in the working directory, this returns zero + even though `dir_name (FILE)' will return ".". Works properly even + if there are trailing slashes (by effectively ignoring them). */ + +size_t +dir_len (char const *file) +{ + size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); + size_t length; + + /* Advance prefix_length beyond important leading slashes. */ + prefix_length += (prefix_length != 0 + ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE + && ISSLASH (file[prefix_length])) + : (ISSLASH (file[0]) + ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT + && ISSLASH (file[1]) && ! ISSLASH (file[2]) + ? 2 : 1)) + : 0)); + + /* Strip the basename and any redundant slashes before it. */ + for (length = last_component (file) - file; + prefix_length < length; length--) + if (! ISSLASH (file[length - 1])) + break; + return length; +} + + +/* In general, we can't use the builtin `dirname' function if available, + since it has different meanings in different environments. + In some environments the builtin `dirname' modifies its argument. + + Return the leading directories part of FILE, allocated with xmalloc. + Works properly even if there are trailing slashes (by effectively + ignoring them). Unlike POSIX dirname(), FILE cannot be NULL. + + If lstat (FILE) would succeed, then { chdir (dir_name (FILE)); + lstat (base_name (FILE)); } will access the same file. Likewise, + if the sequence { chdir (dir_name (FILE)); + rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE + to "foo" in the same directory FILE was in. */ + +char * +dir_name (char const *file) +{ + size_t length = dir_len (file); + bool append_dot = (length == 0 + || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE + && length == FILE_SYSTEM_PREFIX_LEN (file) + && file[2] != '\0' && ! ISSLASH (file[2]))); + char *dir = xmalloc (length + append_dot + 1); + memcpy (dir, file, length); + if (append_dot) + dir[length++] = '.'; + dir[length] = '\0'; + return dir; +} diff --git a/lib/dirname.h b/lib/dirname.h new file mode 100644 index 0000000..f592350 --- /dev/null +++ b/lib/dirname.h @@ -0,0 +1,69 @@ +/* Take file names apart into directory and base names. + + Copyright (C) 1998, 2001, 2003-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 . */ + +#ifndef DIRNAME_H_ +# define DIRNAME_H_ 1 + +# include +# include + +# ifndef DIRECTORY_SEPARATOR +# define DIRECTORY_SEPARATOR '/' +# endif + +# ifndef ISSLASH +# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) +# endif + +# ifndef FILE_SYSTEM_PREFIX_LEN +# if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX + /* This internal macro assumes ASCII, but all hosts that support drive + letters use ASCII. */ +# define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' \ + <= 'z' - 'a') +# define FILE_SYSTEM_PREFIX_LEN(Filename) \ + (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) +# else +# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 +# endif +# endif + +# ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 +# endif + +# ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT +# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 +# endif + +# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) +# else +# define IS_ABSOLUTE_FILE_NAME(F) \ + (ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F)) +# endif +# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) + +char *base_name (char const *file); +char *dir_name (char const *file); +size_t base_len (char const *file); +size_t dir_len (char const *file); +char *last_component (char const *file); + +bool strip_trailing_slashes (char *file); + +#endif /* not DIRNAME_H_ */ diff --git a/lib/dup-safer.c b/lib/dup-safer.c new file mode 100644 index 0000000..a690851 --- /dev/null +++ b/lib/dup-safer.c @@ -0,0 +1,44 @@ +/* Invoke dup, but avoid some glitches. + + Copyright (C) 2001, 2004, 2005, 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 . */ + +/* Written by Paul Eggert. */ + +#include + +#include "unistd-safer.h" + +#include + +#include +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or + STDERR_FILENO. */ + +int +dup_safer (int fd) +{ +#if defined F_DUPFD && !defined FCHDIR_REPLACEMENT + return fcntl (fd, F_DUPFD, STDERR_FILENO + 1); +#else + /* fd_safer calls us back, but eventually the recursion unwinds and + does the right thing. */ + return fd_safer (dup (fd)); +#endif +} diff --git a/lib/ebitset.c b/lib/ebitset.c new file mode 100644 index 0000000..cdbbe2d --- /dev/null +++ b/lib/ebitset.c @@ -0,0 +1,1364 @@ +/* Functions to support expandable bitsets. + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#include + +#include "ebitset.h" + +#include "obstack.h" +#include +#include + +/* This file implements expandable bitsets. These bitsets can be of + arbitrary length and are more efficient than arrays of bits for + large sparse sets. + + Empty elements are represented by a NULL pointer in the table of + element pointers. An alternative is to point to a special zero + element. Similarly, we could represent an all 1's element with + another special ones element pointer. + + Bitsets are commonly empty so we need to ensure that this special + case is fast. A zero bitset is indicated when cdata is 0. This is + conservative since cdata may be non zero and the bitset may still + be zero. + + The bitset cache can be disabled either by setting cindex to + BITSET_WINDEX_MAX or by setting csize to 0. Here + we use the former approach since cindex needs to be updated whenever + cdata is changed. +*/ + + +/* Number of words to use for each element. */ +#define EBITSET_ELT_WORDS 2 + +/* Number of bits stored in each element. */ +#define EBITSET_ELT_BITS \ + ((unsigned int) (EBITSET_ELT_WORDS * BITSET_WORD_BITS)) + +/* Ebitset element. We use an array of bits. */ +typedef struct ebitset_elt_struct +{ + union + { + bitset_word words[EBITSET_ELT_WORDS]; /* Bits that are set. */ + struct ebitset_elt_struct *next; + } + u; +} +ebitset_elt; + + +typedef ebitset_elt *ebitset_elts; + + +/* Number of elements to initially allocate. */ + +#ifndef EBITSET_INITIAL_SIZE +#define EBITSET_INITIAL_SIZE 2 +#endif + + +enum ebitset_find_mode + { EBITSET_FIND, EBITSET_CREATE, EBITSET_SUBST }; + +static ebitset_elt ebitset_zero_elts[1]; /* Elements of all zero bits. */ + +/* Obstack to allocate bitset elements from. */ +static struct obstack ebitset_obstack; +static bool ebitset_obstack_init = false; +static ebitset_elt *ebitset_free_list; /* Free list of bitset elements. */ + +#define EBITSET_N_ELTS(N) (((N) + EBITSET_ELT_BITS - 1) / EBITSET_ELT_BITS) +#define EBITSET_ELTS(BSET) ((BSET)->e.elts) +#define EBITSET_SIZE(BSET) EBITSET_N_ELTS (BITSET_NBITS_ (BSET)) +#define EBITSET_ASIZE(BSET) ((BSET)->e.size) + +#define EBITSET_NEXT(ELT) ((ELT)->u.next) +#define EBITSET_WORDS(ELT) ((ELT)->u.words) + +/* Disable bitset cache and mark BSET as being zero. */ +#define EBITSET_ZERO_SET(BSET) ((BSET)->b.cindex = BITSET_WINDEX_MAX, \ + (BSET)->b.cdata = 0) + +#define EBITSET_CACHE_DISABLE(BSET) ((BSET)->b.cindex = BITSET_WINDEX_MAX) + +/* Disable bitset cache and mark BSET as being possibly non-zero. */ +#define EBITSET_NONZERO_SET(BSET) \ + (EBITSET_CACHE_DISABLE (BSET), (BSET)->b.cdata = (bitset_word *)~0) + +/* A conservative estimate of whether the bitset is zero. + This is non-zero only if we know for sure that the bitset is zero. */ +#define EBITSET_ZERO_P(BSET) ((BSET)->b.cdata == 0) + +/* Enable cache to point to element with table index EINDEX. + The element must exist. */ +#define EBITSET_CACHE_SET(BSET, EINDEX) \ + ((BSET)->b.cindex = (EINDEX) * EBITSET_ELT_WORDS, \ + (BSET)->b.cdata = EBITSET_WORDS (EBITSET_ELTS (BSET) [EINDEX])) + +#undef min +#undef max +#define min(a, b) ((a) > (b) ? (b) : (a)) +#define max(a, b) ((a) > (b) ? (a) : (b)) + +static bitset_bindex +ebitset_resize (bitset src, bitset_bindex n_bits) +{ + bitset_windex oldsize; + bitset_windex newsize; + + if (n_bits == BITSET_NBITS_ (src)) + return n_bits; + + oldsize = EBITSET_SIZE (src); + newsize = EBITSET_N_ELTS (n_bits); + + if (oldsize < newsize) + { + bitset_windex size; + + /* The bitset needs to grow. If we already have enough memory + allocated, then just zero what we need. */ + if (newsize > EBITSET_ASIZE (src)) + { + /* We need to allocate more memory. When oldsize is + non-zero this means that we are changing the size, so + grow the bitset 25% larger than requested to reduce + number of reallocations. */ + + if (oldsize == 0) + size = newsize; + else + size = newsize + newsize / 4; + + EBITSET_ELTS (src) + = realloc (EBITSET_ELTS (src), size * sizeof (ebitset_elt *)); + EBITSET_ASIZE (src) = size; + } + + memset (EBITSET_ELTS (src) + oldsize, 0, + (newsize - oldsize) * sizeof (ebitset_elt *)); + } + else + { + /* The bitset needs to shrink. There's no point deallocating + the memory unless it is shrinking by a reasonable amount. */ + if ((oldsize - newsize) >= oldsize / 2) + { + EBITSET_ELTS (src) + = realloc (EBITSET_ELTS (src), newsize * sizeof (ebitset_elt *)); + EBITSET_ASIZE (src) = newsize; + } + + /* Need to prune any excess bits. FIXME. */ + } + + BITSET_NBITS_ (src) = n_bits; + return n_bits; +} + + +/* Allocate a ebitset element. The bits are not cleared. */ +static inline ebitset_elt * +ebitset_elt_alloc (void) +{ + ebitset_elt *elt; + + if (ebitset_free_list != 0) + { + elt = ebitset_free_list; + ebitset_free_list = EBITSET_NEXT (elt); + } + else + { + if (!ebitset_obstack_init) + { + ebitset_obstack_init = true; + + /* Let particular systems override the size of a chunk. */ + +#ifndef OBSTACK_CHUNK_SIZE +#define OBSTACK_CHUNK_SIZE 0 +#endif + + /* Let them override the alloc and free routines too. */ + +#ifndef OBSTACK_CHUNK_ALLOC +#define OBSTACK_CHUNK_ALLOC xmalloc +#endif + +#ifndef OBSTACK_CHUNK_FREE +#define OBSTACK_CHUNK_FREE free +#endif + +#if ! defined __GNUC__ || __GNUC__ < 2 +#define __alignof__(type) 0 +#endif + + obstack_specify_allocation (&ebitset_obstack, OBSTACK_CHUNK_SIZE, + __alignof__ (ebitset_elt), + OBSTACK_CHUNK_ALLOC, + OBSTACK_CHUNK_FREE); + } + + /* Perhaps we should add a number of new elements to the free + list. */ + elt = (ebitset_elt *) obstack_alloc (&ebitset_obstack, + sizeof (ebitset_elt)); + } + + return elt; +} + + +/* Allocate a ebitset element. The bits are cleared. */ +static inline ebitset_elt * +ebitset_elt_calloc (void) +{ + ebitset_elt *elt; + + elt = ebitset_elt_alloc (); + memset (EBITSET_WORDS (elt), 0, sizeof (EBITSET_WORDS (elt))); + return elt; +} + + +static inline void +ebitset_elt_free (ebitset_elt *elt) +{ + EBITSET_NEXT (elt) = ebitset_free_list; + ebitset_free_list = elt; +} + + +/* Remove element with index EINDEX from bitset BSET. */ +static inline void +ebitset_elt_remove (bitset bset, bitset_windex eindex) +{ + ebitset_elts *elts; + ebitset_elt *elt; + + elts = EBITSET_ELTS (bset); + + elt = elts[eindex]; + + elts[eindex] = 0; + ebitset_elt_free (elt); +} + + +/* Add ELT into elts at index EINDEX of bitset BSET. */ +static inline void +ebitset_elt_add (bitset bset, ebitset_elt *elt, bitset_windex eindex) +{ + ebitset_elts *elts; + + elts = EBITSET_ELTS (bset); + /* Assume that the elts entry not allocated. */ + elts[eindex] = elt; +} + + +/* Are all bits in an element zero? */ +static inline bool +ebitset_elt_zero_p (ebitset_elt *elt) +{ + int i; + + for (i = 0; i < EBITSET_ELT_WORDS; i++) + if (EBITSET_WORDS (elt)[i]) + return false; + + return true; +} + + +static ebitset_elt * +ebitset_elt_find (bitset bset, bitset_bindex bindex, + enum ebitset_find_mode mode) +{ + ebitset_elt *elt; + bitset_windex size; + bitset_windex eindex; + ebitset_elts *elts; + + eindex = bindex / EBITSET_ELT_BITS; + + elts = EBITSET_ELTS (bset); + size = EBITSET_SIZE (bset); + + if (eindex < size) + { + if ((elt = elts[eindex])) + { + if (EBITSET_WORDS (elt) == bset->b.cdata) + return elt; + + EBITSET_CACHE_SET (bset, eindex); + return elt; + } + } + + /* The element could not be found. */ + + switch (mode) + { + default: + abort (); + + case EBITSET_FIND: + return 0; + + case EBITSET_CREATE: + if (eindex >= size) + ebitset_resize (bset, bindex); + + /* Create a new element. */ + elt = ebitset_elt_calloc (); + ebitset_elt_add (bset, elt, eindex); + EBITSET_CACHE_SET (bset, eindex); + return elt; + + case EBITSET_SUBST: + return &ebitset_zero_elts[0]; + } +} + + +/* Weed out the zero elements from the elts. */ +static inline bitset_windex +ebitset_weed (bitset bset) +{ + ebitset_elts *elts; + bitset_windex j; + bitset_windex count; + + if (EBITSET_ZERO_P (bset)) + return 0; + + elts = EBITSET_ELTS (bset); + count = 0; + for (j = 0; j < EBITSET_SIZE (bset); j++) + { + ebitset_elt *elt = elts[j]; + + if (elt) + { + if (ebitset_elt_zero_p (elt)) + { + ebitset_elt_remove (bset, j); + count++; + } + } + else + count++; + } + + count = j - count; + if (!count) + { + /* All the bits are zero. We could shrink the elts. + For now just mark BSET as known to be zero. */ + EBITSET_ZERO_SET (bset); + } + else + EBITSET_NONZERO_SET (bset); + + return count; +} + + +/* Set all bits in the bitset to zero. */ +static inline void +ebitset_zero (bitset bset) +{ + ebitset_elts *elts; + bitset_windex j; + + if (EBITSET_ZERO_P (bset)) + return; + + elts = EBITSET_ELTS (bset); + for (j = 0; j < EBITSET_SIZE (bset); j++) + { + ebitset_elt *elt = elts[j]; + + if (elt) + ebitset_elt_remove (bset, j); + } + + /* All the bits are zero. We could shrink the elts. + For now just mark BSET as known to be zero. */ + EBITSET_ZERO_SET (bset); +} + + +static inline bool +ebitset_equal_p (bitset dst, bitset src) +{ + ebitset_elts *selts; + ebitset_elts *delts; + bitset_windex j; + + if (src == dst) + return true; + + ebitset_weed (dst); + ebitset_weed (src); + + if (EBITSET_SIZE (src) != EBITSET_SIZE (dst)) + return false; + + selts = EBITSET_ELTS (src); + delts = EBITSET_ELTS (dst); + + for (j = 0; j < EBITSET_SIZE (src); j++) + { + unsigned int i; + ebitset_elt *selt = selts[j]; + ebitset_elt *delt = delts[j]; + + if (!selt && !delt) + continue; + if ((selt && !delt) || (!selt && delt)) + return false; + + for (i = 0; i < EBITSET_ELT_WORDS; i++) + if (EBITSET_WORDS (selt)[i] != EBITSET_WORDS (delt)[i]) + return false; + } + return true; +} + + +/* Copy bits from bitset SRC to bitset DST. */ +static inline void +ebitset_copy_ (bitset dst, bitset src) +{ + ebitset_elts *selts; + ebitset_elts *delts; + bitset_windex j; + + if (src == dst) + return; + + ebitset_zero (dst); + + if (BITSET_NBITS_ (dst) != BITSET_NBITS_ (src)) + ebitset_resize (dst, BITSET_NBITS_ (src)); + + selts = EBITSET_ELTS (src); + delts = EBITSET_ELTS (dst); + for (j = 0; j < EBITSET_SIZE (src); j++) + { + ebitset_elt *selt = selts[j]; + + if (selt) + { + ebitset_elt *tmp; + + tmp = ebitset_elt_alloc (); + delts[j] = tmp; + memcpy (EBITSET_WORDS (tmp), EBITSET_WORDS (selt), + sizeof (EBITSET_WORDS (selt))); + } + } + EBITSET_NONZERO_SET (dst); +} + + +/* Copy bits from bitset SRC to bitset DST. Return true if + bitsets different. */ +static inline bool +ebitset_copy_cmp (bitset dst, bitset src) +{ + if (src == dst) + return false; + + if (EBITSET_ZERO_P (dst)) + { + ebitset_copy_ (dst, src); + return !EBITSET_ZERO_P (src); + } + + if (ebitset_equal_p (dst, src)) + return false; + + ebitset_copy_ (dst, src); + return true; +} + + +/* Set bit BITNO in bitset DST. */ +static void +ebitset_set (bitset dst, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + + ebitset_elt_find (dst, bitno, EBITSET_CREATE); + + dst->b.cdata[windex - dst->b.cindex] |= + (bitset_word) 1 << (bitno % BITSET_WORD_BITS); +} + + +/* Reset bit BITNO in bitset DST. */ +static void +ebitset_reset (bitset dst, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + + if (!ebitset_elt_find (dst, bitno, EBITSET_FIND)) + return; + + dst->b.cdata[windex - dst->b.cindex] &= + ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS)); + + /* If all the data is zero, perhaps we should remove it now... + However, there is a good chance that the element will be needed + again soon. */ +} + + +/* Test bit BITNO in bitset SRC. */ +static bool +ebitset_test (bitset src, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + + return (ebitset_elt_find (src, bitno, EBITSET_FIND) + && ((src->b.cdata[windex - src->b.cindex] + >> (bitno % BITSET_WORD_BITS)) + & 1)); +} + + +static void +ebitset_free (bitset bset) +{ + ebitset_zero (bset); + free (EBITSET_ELTS (bset)); +} + + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT and store in array LIST. Return with actual number of bits + found and with *NEXT indicating where search stopped. */ +static bitset_bindex +ebitset_list_reverse (bitset bset, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + bitset_bindex n_bits; + bitset_bindex bitno; + bitset_bindex rbitno; + unsigned int bcount; + bitset_bindex boffset; + bitset_windex windex; + bitset_windex eindex; + bitset_windex woffset; + bitset_bindex count; + bitset_windex size; + ebitset_elts *elts; + + if (EBITSET_ZERO_P (bset)) + return 0; + + size = EBITSET_SIZE (bset); + n_bits = size * EBITSET_ELT_BITS; + rbitno = *next; + + if (rbitno >= n_bits) + return 0; + + elts = EBITSET_ELTS (bset); + + bitno = n_bits - (rbitno + 1); + + windex = bitno / BITSET_WORD_BITS; + eindex = bitno / EBITSET_ELT_BITS; + woffset = windex - eindex * EBITSET_ELT_WORDS; + + /* If num is 1, we could speed things up with a binary search + of the word of interest. */ + + count = 0; + bcount = bitno % BITSET_WORD_BITS; + boffset = windex * BITSET_WORD_BITS; + + do + { + ebitset_elt *elt; + bitset_word *srcp; + + elt = elts[eindex]; + if (elt) + { + srcp = EBITSET_WORDS (elt); + + do + { + bitset_word word; + + word = srcp[woffset] << (BITSET_WORD_BITS - 1 - bcount); + + for (; word; bcount--) + { + if (word & BITSET_MSB) + { + list[count++] = boffset + bcount; + if (count >= num) + { + *next = n_bits - (boffset + bcount); + return count; + } + } + word <<= 1; + } + boffset -= BITSET_WORD_BITS; + bcount = BITSET_WORD_BITS - 1; + } + while (woffset--); + } + + woffset = EBITSET_ELT_WORDS - 1; + boffset = eindex * EBITSET_ELT_BITS - BITSET_WORD_BITS; + } + while (eindex--); + + *next = n_bits - (boffset + 1); + return count; +} + + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT and store in array LIST. Return with actual number of bits + found and with *NEXT indicating where search stopped. */ +static bitset_bindex +ebitset_list (bitset bset, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + bitset_bindex bitno; + bitset_windex windex; + bitset_windex eindex; + bitset_bindex count; + bitset_windex size; + ebitset_elt *elt; + bitset_word word; + ebitset_elts *elts; + + if (EBITSET_ZERO_P (bset)) + return 0; + + bitno = *next; + count = 0; + + elts = EBITSET_ELTS (bset); + size = EBITSET_SIZE (bset); + eindex = bitno / EBITSET_ELT_BITS; + + if (bitno % EBITSET_ELT_BITS) + { + /* We need to start within an element. This is not very common. */ + + elt = elts[eindex]; + if (elt) + { + bitset_windex woffset; + bitset_word *srcp = EBITSET_WORDS (elt); + + windex = bitno / BITSET_WORD_BITS; + woffset = eindex * EBITSET_ELT_WORDS; + + for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++) + { + word = srcp[windex - woffset] >> (bitno % BITSET_WORD_BITS); + + for (; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + *next = bitno + 1; + return count; + } + } + word >>= 1; + } + bitno = (windex + 1) * BITSET_WORD_BITS; + } + } + + /* Skip to next element. */ + eindex++; + } + + /* If num is 1, we could speed things up with a binary search + of the word of interest. */ + + for (; eindex < size; eindex++) + { + int i; + bitset_word *srcp; + + elt = elts[eindex]; + if (!elt) + continue; + + srcp = EBITSET_WORDS (elt); + windex = eindex * EBITSET_ELT_WORDS; + + if ((count + EBITSET_ELT_BITS) < num) + { + /* The coast is clear, plant boot! */ + +#if EBITSET_ELT_WORDS == 2 + word = srcp[0]; + if (word) + { + if (!(word & 0xffff)) + { + word >>= 16; + bitno += 16; + } + if (!(word & 0xff)) + { + word >>= 8; + bitno += 8; + } + for (; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + windex++; + bitno = windex * BITSET_WORD_BITS; + + word = srcp[1]; + if (word) + { + if (!(word & 0xffff)) + { + word >>= 16; + bitno += 16; + } + for (; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + windex++; + bitno = windex * BITSET_WORD_BITS; +#else + for (i = 0; i < EBITSET_ELT_WORDS; i++, windex++) + { + bitno = windex * BITSET_WORD_BITS; + + word = srcp[i]; + if (word) + { + if (!(word & 0xffff)) + { + word >>= 16; + bitno += 16; + } + if (!(word & 0xff)) + { + word >>= 8; + bitno += 8; + } + for (; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + } +#endif + } + else + { + /* Tread more carefully since we need to check + if array overflows. */ + + for (i = 0; i < EBITSET_ELT_WORDS; i++, windex++) + { + bitno = windex * BITSET_WORD_BITS; + + for (word = srcp[i]; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + *next = bitno + 1; + return count; + } + } + word >>= 1; + } + } + } + } + + *next = bitno; + return count; +} + + +/* Ensure that any unused bits within the last element are clear. */ +static inline void +ebitset_unused_clear (bitset dst) +{ + unsigned int last_bit; + bitset_bindex n_bits; + + n_bits = BITSET_NBITS_ (dst); + last_bit = n_bits % EBITSET_ELT_BITS; + + if (last_bit) + { + bitset_windex eindex; + ebitset_elts *elts; + ebitset_elt *elt; + + elts = EBITSET_ELTS (dst); + + eindex = n_bits / EBITSET_ELT_BITS; + + elt = elts[eindex]; + if (elt) + { + bitset_windex windex; + bitset_windex woffset; + bitset_word *srcp = EBITSET_WORDS (elt); + + windex = n_bits / BITSET_WORD_BITS; + woffset = eindex * EBITSET_ELT_WORDS; + + srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1; + windex++; + for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++) + srcp[windex - woffset] = 0; + } + } +} + + +static void +ebitset_ones (bitset dst) +{ + bitset_windex j; + ebitset_elt *elt; + + for (j = 0; j < EBITSET_SIZE (dst); j++) + { + /* Create new elements if they cannot be found. Perhaps + we should just add pointers to a ones element? */ + elt = + ebitset_elt_find (dst, j * EBITSET_ELT_BITS, EBITSET_CREATE); + memset (EBITSET_WORDS (elt), -1, sizeof (EBITSET_WORDS (elt))); + } + EBITSET_NONZERO_SET (dst); + ebitset_unused_clear (dst); +} + + +static bool +ebitset_empty_p (bitset dst) +{ + ebitset_elts *elts; + bitset_windex j; + + if (EBITSET_ZERO_P (dst)) + return 1; + + elts = EBITSET_ELTS (dst); + for (j = 0; j < EBITSET_SIZE (dst); j++) + { + ebitset_elt *elt = elts[j]; + + if (elt) + { + if (!ebitset_elt_zero_p (elt)) + return 0; + /* Do some weeding as we go. */ + ebitset_elt_remove (dst, j); + } + } + + /* All the bits are zero. We could shrink the elts. + For now just mark DST as known to be zero. */ + EBITSET_ZERO_SET (dst); + return 1; +} + + +static void +ebitset_not (bitset dst, bitset src) +{ + unsigned int i; + ebitset_elt *selt; + ebitset_elt *delt; + bitset_windex j; + + ebitset_resize (dst, BITSET_NBITS_ (src)); + + for (j = 0; j < EBITSET_SIZE (src); j++) + { + /* Create new elements for dst if they cannot be found + or substitute zero elements if src elements not found. */ + selt = + ebitset_elt_find (dst, j * EBITSET_ELT_BITS, EBITSET_SUBST); + delt = + ebitset_elt_find (dst, j * EBITSET_ELT_BITS, EBITSET_CREATE); + + for (i = 0; i < EBITSET_ELT_WORDS; i++) + EBITSET_WORDS (delt)[i] = ~EBITSET_WORDS (selt)[i]; + } + EBITSET_NONZERO_SET (dst); + ebitset_unused_clear (dst); +} + + +/* Is DST == DST | SRC? */ +static bool +ebitset_subset_p (bitset dst, bitset src) +{ + bitset_windex j; + ebitset_elts *selts; + ebitset_elts *delts; + bitset_windex ssize; + bitset_windex dsize; + + selts = EBITSET_ELTS (src); + delts = EBITSET_ELTS (dst); + + ssize = EBITSET_SIZE (src); + dsize = EBITSET_SIZE (dst); + + for (j = 0; j < ssize; j++) + { + unsigned int i; + ebitset_elt *selt; + ebitset_elt *delt; + + selt = j < ssize ? selts[j] : 0; + delt = j < dsize ? delts[j] : 0; + + if (!selt && !delt) + continue; + + if (!selt) + selt = &ebitset_zero_elts[0]; + if (!delt) + delt = &ebitset_zero_elts[0]; + + for (i = 0; i < EBITSET_ELT_WORDS; i++) + if (EBITSET_WORDS (delt)[i] + != (EBITSET_WORDS (selt)[i] | EBITSET_WORDS (delt)[i])) + return false; + } + return true; +} + + +/* Is DST & SRC == 0? */ +static bool +ebitset_disjoint_p (bitset dst, bitset src) +{ + bitset_windex j; + ebitset_elts *selts; + ebitset_elts *delts; + bitset_windex ssize; + bitset_windex dsize; + + selts = EBITSET_ELTS (src); + delts = EBITSET_ELTS (dst); + + ssize = EBITSET_SIZE (src); + dsize = EBITSET_SIZE (dst); + + for (j = 0; j < ssize; j++) + { + unsigned int i; + ebitset_elt *selt; + ebitset_elt *delt; + + selt = j < ssize ? selts[j] : 0; + delt = j < dsize ? delts[j] : 0; + + if (!selt || !delt) + continue; + + for (i = 0; i < EBITSET_ELT_WORDS; i++) + if ((EBITSET_WORDS (selt)[i] & EBITSET_WORDS (delt)[i])) + return false; + } + return true; +} + + + +static bool +ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op) +{ + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + bitset_windex size; + ebitset_elts *selts1; + ebitset_elts *selts2; + ebitset_elts *delts; + bitset_word *srcp1; + bitset_word *srcp2; + bitset_word *dstp; + bool changed = false; + unsigned int i; + bitset_windex j; + + ebitset_resize (dst, max (BITSET_NBITS_ (src1), BITSET_NBITS_ (src2))); + + ssize1 = EBITSET_SIZE (src1); + ssize2 = EBITSET_SIZE (src2); + dsize = EBITSET_SIZE (dst); + size = ssize1; + if (size < ssize2) + size = ssize2; + + selts1 = EBITSET_ELTS (src1); + selts2 = EBITSET_ELTS (src2); + delts = EBITSET_ELTS (dst); + + for (j = 0; j < size; j++) + { + ebitset_elt *selt1; + ebitset_elt *selt2; + ebitset_elt *delt; + + selt1 = j < ssize1 ? selts1[j] : 0; + selt2 = j < ssize2 ? selts2[j] : 0; + delt = j < dsize ? delts[j] : 0; + + if (!selt1 && !selt2) + { + if (delt) + { + changed = true; + ebitset_elt_remove (dst, j); + } + continue; + } + + if (!selt1) + selt1 = &ebitset_zero_elts[0]; + if (!selt2) + selt2 = &ebitset_zero_elts[0]; + if (!delt) + delt = ebitset_elt_calloc (); + else + delts[j] = 0; + + srcp1 = EBITSET_WORDS (selt1); + srcp2 = EBITSET_WORDS (selt2); + dstp = EBITSET_WORDS (delt); + switch (op) + { + default: + abort (); + + case BITSET_OP_OR: + for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++) + { + bitset_word tmp = *srcp1++ | *srcp2++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + break; + + case BITSET_OP_AND: + for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++) + { + bitset_word tmp = *srcp1++ & *srcp2++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + break; + + case BITSET_OP_XOR: + for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++) + { + bitset_word tmp = *srcp1++ ^ *srcp2++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + break; + + case BITSET_OP_ANDN: + for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++) + { + bitset_word tmp = *srcp1++ & ~(*srcp2++); + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + break; + } + + if (!ebitset_elt_zero_p (delt)) + { + ebitset_elt_add (dst, delt, j); + } + else + { + ebitset_elt_free (delt); + } + } + + /* If we have elements of DST left over, free them all. */ + for (; j < dsize; j++) + { + ebitset_elt *delt; + + changed = true; + + delt = delts[j]; + + if (delt) + ebitset_elt_remove (dst, j); + } + + EBITSET_NONZERO_SET (dst); + return changed; +} + + +static bool +ebitset_and_cmp (bitset dst, bitset src1, bitset src2) +{ + bool changed; + + if (EBITSET_ZERO_P (src2)) + { + ebitset_weed (dst); + changed = EBITSET_ZERO_P (dst); + ebitset_zero (dst); + return changed; + } + else if (EBITSET_ZERO_P (src1)) + { + ebitset_weed (dst); + changed = EBITSET_ZERO_P (dst); + ebitset_zero (dst); + return changed; + } + return ebitset_op3_cmp (dst, src1, src2, BITSET_OP_AND); +} + + +static void +ebitset_and (bitset dst, bitset src1, bitset src2) +{ + ebitset_and_cmp (dst, src1, src2); +} + + +static bool +ebitset_andn_cmp (bitset dst, bitset src1, bitset src2) +{ + bool changed; + + if (EBITSET_ZERO_P (src2)) + { + return ebitset_copy_cmp (dst, src1); + } + else if (EBITSET_ZERO_P (src1)) + { + ebitset_weed (dst); + changed = EBITSET_ZERO_P (dst); + ebitset_zero (dst); + return changed; + } + return ebitset_op3_cmp (dst, src1, src2, BITSET_OP_ANDN); +} + + +static void +ebitset_andn (bitset dst, bitset src1, bitset src2) +{ + ebitset_andn_cmp (dst, src1, src2); +} + + +static bool +ebitset_or_cmp (bitset dst, bitset src1, bitset src2) +{ + if (EBITSET_ZERO_P (src2)) + { + return ebitset_copy_cmp (dst, src1); + } + else if (EBITSET_ZERO_P (src1)) + { + return ebitset_copy_cmp (dst, src2); + } + return ebitset_op3_cmp (dst, src1, src2, BITSET_OP_OR); +} + + +static void +ebitset_or (bitset dst, bitset src1, bitset src2) +{ + ebitset_or_cmp (dst, src1, src2); +} + + +static bool +ebitset_xor_cmp (bitset dst, bitset src1, bitset src2) +{ + if (EBITSET_ZERO_P (src2)) + { + return ebitset_copy_cmp (dst, src1); + } + else if (EBITSET_ZERO_P (src1)) + { + return ebitset_copy_cmp (dst, src2); + } + return ebitset_op3_cmp (dst, src1, src2, BITSET_OP_XOR); +} + + +static void +ebitset_xor (bitset dst, bitset src1, bitset src2) +{ + ebitset_xor_cmp (dst, src1, src2); +} + + +static void +ebitset_copy (bitset dst, bitset src) +{ + if (BITSET_COMPATIBLE_ (dst, src)) + ebitset_copy_ (dst, src); + else + bitset_copy_ (dst, src); +} + + +/* Vector of operations for linked-list bitsets. */ +struct bitset_vtable ebitset_vtable = { + ebitset_set, + ebitset_reset, + bitset_toggle_, + ebitset_test, + ebitset_resize, + bitset_size_, + bitset_count_, + ebitset_empty_p, + ebitset_ones, + ebitset_zero, + ebitset_copy, + ebitset_disjoint_p, + ebitset_equal_p, + ebitset_not, + ebitset_subset_p, + ebitset_and, + ebitset_and_cmp, + ebitset_andn, + ebitset_andn_cmp, + ebitset_or, + ebitset_or_cmp, + ebitset_xor, + ebitset_xor_cmp, + bitset_and_or_, + bitset_and_or_cmp_, + bitset_andn_or_, + bitset_andn_or_cmp_, + bitset_or_and_, + bitset_or_and_cmp_, + ebitset_list, + ebitset_list_reverse, + ebitset_free, + BITSET_TABLE +}; + + +/* Return size of initial structure. */ +size_t +ebitset_bytes (bitset_bindex n_bits ATTRIBUTE_UNUSED) +{ + return sizeof (struct ebitset_struct); +} + + +/* Initialize a bitset. */ + +bitset +ebitset_init (bitset bset, bitset_bindex n_bits) +{ + bitset_windex size; + + bset->b.vtable = &ebitset_vtable; + + bset->b.csize = EBITSET_ELT_WORDS; + + EBITSET_ZERO_SET (bset); + + size = n_bits ? (n_bits + EBITSET_ELT_BITS - 1) / EBITSET_ELT_BITS + : EBITSET_INITIAL_SIZE; + + EBITSET_ASIZE (bset) = 0; + EBITSET_ELTS (bset) = 0; + ebitset_resize (bset, n_bits); + + return bset; +} + + +void +ebitset_release_memory (void) +{ + ebitset_free_list = 0; + if (ebitset_obstack_init) + { + ebitset_obstack_init = false; + obstack_free (&ebitset_obstack, NULL); + } +} diff --git a/lib/ebitset.h b/lib/ebitset.h new file mode 100644 index 0000000..b335803 --- /dev/null +++ b/lib/ebitset.h @@ -0,0 +1,29 @@ +/* Functions to support ebitsets. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#ifndef _EBITSET_H +#define _EBITSET_H + +#include "bitset.h" + +extern size_t ebitset_bytes (bitset_bindex); + +extern bitset ebitset_init (bitset, bitset_bindex); + +extern void ebitset_release_memory (void); + +#endif diff --git a/lib/errno.in.h b/lib/errno.in.h new file mode 100644 index 0000000..f873039 --- /dev/null +++ b/lib/errno.in.h @@ -0,0 +1,157 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* A POSIX-like . + + Copyright (C) 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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_ERRNO_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_ERRNO_H@ + +#ifndef _GL_ERRNO_H +#define _GL_ERRNO_H + + +/* On native Windows platforms, many macros are not defined. */ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value. */ +# define EWOULDBLOCK EAGAIN + +/* Values >= 100 seem safe to use. */ +# define ETXTBSY 100 +# define GNULIB_defined_ETXTBSY 1 + +/* These are intentionally the same values as the WSA* error numbers, defined + in . */ +# define EINPROGRESS 10036 +# define EALREADY 10037 +# define ENOTSOCK 10038 +# define EDESTADDRREQ 10039 +# define EMSGSIZE 10040 +# define EPROTOTYPE 10041 +# define ENOPROTOOPT 10042 +# define EPROTONOSUPPORT 10043 +# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ +# define EOPNOTSUPP 10045 +# define EPFNOSUPPORT 10046 /* not required by POSIX */ +# define EAFNOSUPPORT 10047 +# define EADDRINUSE 10048 +# define EADDRNOTAVAIL 10049 +# define ENETDOWN 10050 +# define ENETUNREACH 10051 +# define ENETRESET 10052 +# define ECONNABORTED 10053 +# define ECONNRESET 10054 +# define ENOBUFS 10055 +# define EISCONN 10056 +# define ENOTCONN 10057 +# define ESHUTDOWN 10058 /* not required by POSIX */ +# define ETOOMANYREFS 10059 /* not required by POSIX */ +# define ETIMEDOUT 10060 +# define ECONNREFUSED 10061 +# define ELOOP 10062 +# define EHOSTDOWN 10064 /* not required by POSIX */ +# define EHOSTUNREACH 10065 +# define EPROCLIM 10067 /* not required by POSIX */ +# define EUSERS 10068 /* not required by POSIX */ +# define EDQUOT 10069 +# define ESTALE 10070 +# define EREMOTE 10071 /* not required by POSIX */ +# define GNULIB_defined_ESOCK 1 + +# endif + + +/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros + EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */ +# if @EMULTIHOP_HIDDEN@ +# define EMULTIHOP @EMULTIHOP_VALUE@ +# define GNULIB_defined_EMULTIHOP 1 +# endif +# if @ENOLINK_HIDDEN@ +# define ENOLINK @ENOLINK_VALUE@ +# define GNULIB_defined_ENOLINK 1 +# endif +# if @EOVERFLOW_HIDDEN@ +# define EOVERFLOW @EOVERFLOW_VALUE@ +# define GNULIB_defined_EOVERFLOW 1 +# endif + + +/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, + EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. + Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, + HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. + + Note: When one of these systems defines some of these macros some day, + binaries will have to be recompiled so that they recognizes the new + errno values from the system. */ + +# ifndef ENOMSG +# define ENOMSG 2000 +# define GNULIB_defined_ENOMSG 1 +# endif + +# ifndef EIDRM +# define EIDRM 2001 +# define GNULIB_defined_EIDRM 1 +# endif + +# ifndef ENOLINK +# define ENOLINK 2002 +# define GNULIB_defined_ENOLINK 1 +# endif + +# ifndef EPROTO +# define EPROTO 2003 +# define GNULIB_defined_EPROTO 1 +# endif + +# ifndef EMULTIHOP +# define EMULTIHOP 2004 +# define GNULIB_defined_EMULTIHOP 1 +# endif + +# ifndef EBADMSG +# define EBADMSG 2005 +# define GNULIB_defined_EBADMSG 1 +# endif + +# ifndef EOVERFLOW +# define EOVERFLOW 2006 +# define GNULIB_defined_EOVERFLOW 1 +# endif + +# ifndef ENOTSUP +# define ENOTSUP 2007 +# define GNULIB_defined_ENOTSUP 1 +# endif + +# ifndef ECANCELED +# define ECANCELED 2008 +# define GNULIB_defined_ECANCELED 1 +# endif + + +#endif /* _GL_ERRNO_H */ +#endif /* _GL_ERRNO_H */ diff --git a/lib/error.c b/lib/error.c new file mode 100644 index 0000000..3177bd5 --- /dev/null +++ b/lib/error.c @@ -0,0 +1,338 @@ +/* Error handler for noninteractive utilities + Copyright (C) 1990-1998, 2000-2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +/* Written by David MacKenzie . */ + +#if !_LIBC +# include +#endif + +#include "error.h" + +#include +#include +#include +#include + +#if !_LIBC && ENABLE_NLS +# include "gettext.h" +# define _(msgid) gettext (msgid) +#endif + +#ifdef _LIBC +# include +# include +# include +# include +# define mbsrtowcs __mbsrtowcs +#endif + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif + +#ifndef _ +# define _(String) String +#endif + +/* If NULL, error will flush stdout, then print on stderr the program + name, a colon and a space. Otherwise, error will call this + function without parameters instead. */ +void (*error_print_progname) (void); + +/* This variable is incremented each time `error' is called. */ +unsigned int error_message_count; + +#ifdef _LIBC +/* In the GNU C library, there is a predefined variable for this. */ + +# define program_name program_invocation_name +# include +# include +# include + +/* In GNU libc we want do not want to use the common name `error' directly. + Instead make it a weak alias. */ +extern void __error (int status, int errnum, const char *message, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +extern void __error_at_line (int status, int errnum, const char *file_name, + unsigned int line_number, const char *message, + ...) + __attribute__ ((__format__ (__printf__, 5, 6)));; +# define error __error +# define error_at_line __error_at_line + +# include +# define fflush(s) INTUSE(_IO_fflush) (s) +# undef putc +# define putc(c, fp) INTUSE(_IO_putc) (c, fp) + +# include + +#else /* not _LIBC */ + +# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P +# ifndef HAVE_DECL_STRERROR_R +"this configure-time declaration test was not run" +# endif +char *strerror_r (); +# endif + +/* The calling program should define program_name and set it to the + name of the executing program. */ +extern char *program_name; + +# if HAVE_STRERROR_R || defined strerror_r +# define __strerror_r strerror_r +# endif /* HAVE_STRERROR_R || defined strerror_r */ +#endif /* not _LIBC */ + +static void +print_errno_message (int errnum) +{ + char const *s; + +#if defined HAVE_STRERROR_R || _LIBC + char errbuf[1024]; +# if STRERROR_R_CHAR_P || _LIBC + s = __strerror_r (errnum, errbuf, sizeof errbuf); +# else + if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) + s = errbuf; + else + s = 0; +# endif +#else + s = strerror (errnum); +#endif + +#if !_LIBC + if (! s) + s = _("Unknown system error"); +#endif + +#if _LIBC + __fxprintf (NULL, ": %s", s); +#else + fprintf (stderr, ": %s", s); +#endif +} + +static void +error_tail (int status, int errnum, const char *message, va_list args) +{ +#if _LIBC + if (_IO_fwide (stderr, 0) > 0) + { +# define ALLOCA_LIMIT 2000 + size_t len = strlen (message) + 1; + wchar_t *wmessage = NULL; + mbstate_t st; + size_t res; + const char *tmp; + bool use_malloc = false; + + while (1) + { + if (__libc_use_alloca (len * sizeof (wchar_t))) + wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); + else + { + if (!use_malloc) + wmessage = NULL; + + wchar_t *p = (wchar_t *) realloc (wmessage, + len * sizeof (wchar_t)); + if (p == NULL) + { + free (wmessage); + fputws_unlocked (L"out of memory\n", stderr); + return; + } + wmessage = p; + use_malloc = true; + } + + memset (&st, '\0', sizeof (st)); + tmp = message; + + res = mbsrtowcs (wmessage, &tmp, len, &st); + if (res != len) + break; + + if (__builtin_expect (len >= SIZE_MAX / 2, 0)) + { + /* This really should not happen if everything is fine. */ + res = (size_t) -1; + break; + } + + len *= 2; + } + + if (res == (size_t) -1) + { + /* The string cannot be converted. */ + if (use_malloc) + { + free (wmessage); + use_malloc = false; + } + wmessage = (wchar_t *) L"???"; + } + + __vfwprintf (stderr, wmessage, args); + + if (use_malloc) + free (wmessage); + } + else +#endif + vfprintf (stderr, message, args); + va_end (args); + + ++error_message_count; + if (errnum) + print_errno_message (errnum); +#if _LIBC + __fxprintf (NULL, "\n"); +#else + putc ('\n', stderr); +#endif + fflush (stderr); + if (status) + exit (status); +} + + +/* Print the program name and error message MESSAGE, which is a printf-style + format string with optional args. + If ERRNUM is nonzero, print its corresponding system error message. + Exit with status STATUS if it is nonzero. */ +void +error (int status, int errnum, const char *message, ...) +{ + va_list args; + +#if defined _LIBC && defined __libc_ptf_call + /* We do not want this call to be cut short by a thread + cancellation. Therefore disable cancellation for now. */ + int state = PTHREAD_CANCEL_ENABLE; + __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), + 0); +#endif + + fflush (stdout); +#ifdef _LIBC + _IO_flockfile (stderr); +#endif + if (error_print_progname) + (*error_print_progname) (); + else + { +#if _LIBC + __fxprintf (NULL, "%s: ", program_name); +#else + fprintf (stderr, "%s: ", program_name); +#endif + } + + va_start (args, message); + error_tail (status, errnum, message, args); + +#ifdef _LIBC + _IO_funlockfile (stderr); +# ifdef __libc_ptf_call + __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); +# endif +#endif +} + +/* Sometimes we want to have at most one error per line. This + variable controls whether this mode is selected or not. */ +int error_one_per_line; + +void +error_at_line (int status, int errnum, const char *file_name, + unsigned int line_number, const char *message, ...) +{ + va_list args; + + if (error_one_per_line) + { + static const char *old_file_name; + static unsigned int old_line_number; + + if (old_line_number == line_number + && (file_name == old_file_name + || strcmp (old_file_name, file_name) == 0)) + /* Simply return and print nothing. */ + return; + + old_file_name = file_name; + old_line_number = line_number; + } + +#if defined _LIBC && defined __libc_ptf_call + /* We do not want this call to be cut short by a thread + cancellation. Therefore disable cancellation for now. */ + int state = PTHREAD_CANCEL_ENABLE; + __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), + 0); +#endif + + fflush (stdout); +#ifdef _LIBC + _IO_flockfile (stderr); +#endif + if (error_print_progname) + (*error_print_progname) (); + else + { +#if _LIBC + __fxprintf (NULL, "%s:", program_name); +#else + fprintf (stderr, "%s:", program_name); +#endif + } + +#if _LIBC + __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", + file_name, line_number); +#else + fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", + file_name, line_number); +#endif + + va_start (args, message); + error_tail (status, errnum, message, args); + +#ifdef _LIBC + _IO_funlockfile (stderr); +# ifdef __libc_ptf_call + __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); +# endif +#endif +} + +#ifdef _LIBC +/* Make the weak alias. */ +# undef error +# undef error_at_line +weak_alias (__error, error) +weak_alias (__error_at_line, error_at_line) +#endif diff --git a/lib/error.h b/lib/error.h new file mode 100644 index 0000000..6d49681 --- /dev/null +++ b/lib/error.h @@ -0,0 +1,65 @@ +/* Declaration for error-reporting function + Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +#ifndef _ERROR_H +#define _ERROR_H 1 + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# define __attribute__(Spec) /* empty */ +# endif +/* The __-protected variants of `format' and `printf' attributes + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +# define __format__ format +# define __printf__ printf +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Print a message with `fprintf (stderr, FORMAT, ...)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ + +extern void error (int __status, int __errnum, const char *__format, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); + +extern void error_at_line (int __status, int __errnum, const char *__fname, + unsigned int __lineno, const char *__format, ...) + __attribute__ ((__format__ (__printf__, 5, 6))); + +/* If NULL, error will flush stdout, then print on stderr the program + name, a colon and a space. Otherwise, error will call this + function without parameters instead. */ +extern void (*error_print_progname) (void); + +/* This variable is incremented each time `error' is called. */ +extern unsigned int error_message_count; + +/* Sometimes we want to have at most one error per line. This + variable controls whether this mode is selected or not. */ +extern int error_one_per_line; + +#ifdef __cplusplus +} +#endif + +#endif /* error.h */ diff --git a/lib/exitfail.c b/lib/exitfail.c new file mode 100644 index 0000000..6d1fe4a --- /dev/null +++ b/lib/exitfail.c @@ -0,0 +1,24 @@ +/* Failure exit status + + Copyright (C) 2002, 2003, 2005, 2006, 2007 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 . */ + +#include + +#include "exitfail.h" + +#include + +int volatile exit_failure = EXIT_FAILURE; diff --git a/lib/exitfail.h b/lib/exitfail.h new file mode 100644 index 0000000..713f259 --- /dev/null +++ b/lib/exitfail.h @@ -0,0 +1,18 @@ +/* Failure exit status + + Copyright (C) 2002 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 . */ + +extern int volatile exit_failure; diff --git a/lib/fd-safer.c b/lib/fd-safer.c new file mode 100644 index 0000000..df38c8f --- /dev/null +++ b/lib/fd-safer.c @@ -0,0 +1,56 @@ +/* Return a safer copy of a file descriptor. + + Copyright (C) 2005, 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 . */ + +/* Written by Paul Eggert. */ + +#include + +#include "unistd-safer.h" + +#include + +#include +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Return FD, unless FD would be a copy of standard input, output, or + error; in that case, return a duplicate of FD, closing FD. On + failure to duplicate, close FD, set errno, and return -1. Preserve + errno if FD is negative, so that the caller can always inspect + errno when the returned value is negative. + + This function is usefully wrapped around functions that return file + descriptors, e.g., fd_safer (open ("file", O_RDONLY)). */ + +int +fd_safer (int fd) +{ + if (STDIN_FILENO <= fd && fd <= STDERR_FILENO) + { + int f = dup_safer (fd); + int e = errno; + close (fd); + errno = e; + fd = f; + } + + return fd; +} diff --git a/lib/fopen-safer.c b/lib/fopen-safer.c new file mode 100644 index 0000000..55991a2 --- /dev/null +++ b/lib/fopen-safer.c @@ -0,0 +1,67 @@ +/* Invoke fopen, but avoid some glitches. + + Copyright (C) 2001, 2004, 2005, 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 . */ + +/* Written by Paul Eggert. */ + +#include + +#include "stdio-safer.h" + +#include +#include +#include "unistd-safer.h" + +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Like fopen, but do not return stdin, stdout, or stderr. */ + +FILE * +fopen_safer (char const *file, char const *mode) +{ + FILE *fp = fopen (file, mode); + + if (fp) + { + int fd = fileno (fp); + + if (0 <= fd && fd <= STDERR_FILENO) + { + int f = dup_safer (fd); + + if (f < 0) + { + int e = errno; + fclose (fp); + errno = e; + return NULL; + } + + if (fclose (fp) != 0 + || ! (fp = fdopen (f, mode))) + { + int e = errno; + close (f); + errno = e; + return NULL; + } + } + } + + return fp; +} diff --git a/lib/get-errno.c b/lib/get-errno.c new file mode 100644 index 0000000..078b6e6 --- /dev/null +++ b/lib/get-errno.c @@ -0,0 +1,42 @@ +/* get-errno.c - get and set errno. + + Copyright (C) 2002, 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 . */ + +/* Written by Paul Eggert. */ + +#include + +#include "get-errno.h" + +#include + +/* Get and set errno. A source file that needs to set or get errno, + but doesn't need to test for specific errno values, can use these + functions to avoid namespace pollution. For example, a file that + defines EQUAL should not include , since might + define EQUAL; such a file can include instead. */ + +int +get_errno (void) +{ + return errno; +} + +void +set_errno (int e) +{ + errno = e; +} diff --git a/lib/get-errno.h b/lib/get-errno.h new file mode 100644 index 0000000..4dceca7 --- /dev/null +++ b/lib/get-errno.h @@ -0,0 +1,19 @@ +/* get-errno.h - get and set errno. + + Copyright (C) 2002 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 . */ + +extern int get_errno (void); +extern void set_errno (int); diff --git a/lib/getopt.c b/lib/getopt.c new file mode 100644 index 0000000..f1e6d1f --- /dev/null +++ b/lib/getopt.c @@ -0,0 +1,1186 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to drepper@gnu.org + before changing it! + Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006,2008 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +#ifndef _LIBC +# include +#endif + +#include "getopt.h" + +#include +#include +#include +#include + +#ifdef _LIBC +# include +#else +# include "gettext.h" +# define _(msgid) gettext (msgid) +#endif + +#if defined _LIBC && defined USE_IN_LIBIO +# include +#endif + +#ifndef attribute_hidden +# define attribute_hidden +#endif + +/* Unlike standard Unix `getopt', functions like `getopt_long' + let the user intersperse the options with the other arguments. + + As `getopt_long' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Using `getopt' or setting the environment variable POSIXLY_CORRECT + disables permutation. + Then the application's behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt_int.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Keep a global copy of all internal members of getopt_data. */ + +static struct _getopt_data getopt_data; + + +#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV +extern char *getenv (); +#endif + +#ifdef _LIBC +/* Stored original parameters. + XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ +extern int __libc_argc; +extern char **__libc_argv; + +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +# ifdef USE_NONOPTION_FLAGS +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; +# endif + +# ifdef USE_NONOPTION_FLAGS +# define SWAP_FLAGS(ch1, ch2) \ + if (d->__nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +# else +# define SWAP_FLAGS(ch1, ch2) +# endif +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +static void +exchange (char **argv, struct _getopt_data *d) +{ + int bottom = d->__first_nonopt; + int middle = d->__last_nonopt; + int top = d->optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#if defined _LIBC && defined USE_NONOPTION_FLAGS + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; + else + { + memset (__mempcpy (new_str, __getopt_nonoption_flags, + d->__nonoption_flags_max_len), + '\0', top + 1 - d->__nonoption_flags_max_len); + d->__nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + d->__first_nonopt += (d->optind - d->__last_nonopt); + d->__last_nonopt = d->optind; +} + +/* Initialize the internal data when the first call is made. */ + +static const char * +_getopt_initialize (int argc, char **argv, const char *optstring, + int posixly_correct, struct _getopt_data *d) +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + d->__first_nonopt = d->__last_nonopt = d->optind; + + d->__nextchar = NULL; + + d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + d->__ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + d->__ordering = REQUIRE_ORDER; + ++optstring; + } + else if (d->__posixly_correct) + d->__ordering = REQUIRE_ORDER; + else + d->__ordering = PERMUTE; + +#if defined _LIBC && defined USE_NONOPTION_FLAGS + if (!d->__posixly_correct + && argc == __libc_argc && argv == __libc_argv) + { + if (d->__nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + d->__nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = d->__nonoption_flags_max_len = strlen (orig_str); + if (d->__nonoption_flags_max_len < argc) + d->__nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (d->__nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + d->__nonoption_flags_max_len = -1; + else + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + '\0', d->__nonoption_flags_max_len - len); + } + } + d->__nonoption_flags_len = d->__nonoption_flags_max_len; + } + else + d->__nonoption_flags_len = 0; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns -1. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. + + If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT + environment variable were set. */ + +int +_getopt_internal_r (int argc, char **argv, const char *optstring, + const struct option *longopts, int *longind, + int long_only, int posixly_correct, struct _getopt_data *d) +{ + int print_errors = d->opterr; + if (optstring[0] == ':') + print_errors = 0; + + if (argc < 1) + return -1; + + d->optarg = NULL; + + if (d->optind == 0 || !d->__initialized) + { + if (d->optind == 0) + d->optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring, + posixly_correct, d); + d->__initialized = 1; + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#if defined _LIBC && defined USE_NONOPTION_FLAGS +# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ + || (d->optind < d->__nonoption_flags_len \ + && __getopt_nonoption_flags[d->optind] == '1')) +#else +# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') +#endif + + if (d->__nextchar == NULL || *d->__nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (d->__last_nonopt > d->optind) + d->__last_nonopt = d->optind; + if (d->__first_nonopt > d->optind) + d->__first_nonopt = d->optind; + + if (d->__ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (d->__first_nonopt != d->__last_nonopt + && d->__last_nonopt != d->optind) + exchange ((char **) argv, d); + else if (d->__last_nonopt != d->optind) + d->__first_nonopt = d->optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (d->optind < argc && NONOPTION_P) + d->optind++; + d->__last_nonopt = d->optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (d->optind != argc && !strcmp (argv[d->optind], "--")) + { + d->optind++; + + if (d->__first_nonopt != d->__last_nonopt + && d->__last_nonopt != d->optind) + exchange ((char **) argv, d); + else if (d->__first_nonopt == d->__last_nonopt) + d->__first_nonopt = d->optind; + d->__last_nonopt = argc; + + d->optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (d->optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (d->__first_nonopt != d->__last_nonopt) + d->optind = d->__first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (d->__ordering == REQUIRE_ORDER) + return -1; + d->optarg = argv[d->optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + d->__nextchar = (argv[d->optind] + 1 + + (longopts != NULL && argv[d->optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[d->optind][1] == '-' + || (long_only && (argv[d->optind][2] + || !strchr (optstring, argv[d->optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) + { + if ((unsigned int) (nameend - d->__nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else if (long_only + || pfound->has_arg != p->has_arg + || pfound->flag != p->flag + || pfound->val != p->val) + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (print_errors) + { +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + + if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[d->optind]) >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#else + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[d->optind]); +#endif + } + d->__nextchar += strlen (d->__nextchar); + d->optind++; + d->optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + d->optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + d->optarg = nameend + 1; + else + { + if (print_errors) + { +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + int n; +#endif + + if (argv[d->optind - 1][1] == '-') + { + /* --option */ +#if defined _LIBC && defined USE_IN_LIBIO + n = __asprintf (&buf, _("\ +%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); +#else + fprintf (stderr, _("\ +%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); +#endif + } + else + { + /* +option or -option */ +#if defined _LIBC && defined USE_IN_LIBIO + n = __asprintf (&buf, _("\ +%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[d->optind - 1][0], + pfound->name); +#else + fprintf (stderr, _("\ +%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[d->optind - 1][0], + pfound->name); +#endif + } + +#if defined _LIBC && defined USE_IN_LIBIO + if (n >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#endif + } + + d->__nextchar += strlen (d->__nextchar); + + d->optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (d->optind < argc) + d->optarg = argv[d->optind++]; + else + { + if (print_errors) + { +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + + if (__asprintf (&buf, _("\ +%s: option `%s' requires an argument\n"), + argv[0], argv[d->optind - 1]) >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#else + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[d->optind - 1]); +#endif + } + d->__nextchar += strlen (d->__nextchar); + d->optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + d->__nextchar += strlen (d->__nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[d->optind][1] == '-' + || strchr (optstring, *d->__nextchar) == NULL) + { + if (print_errors) + { +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + int n; +#endif + + if (argv[d->optind][1] == '-') + { + /* --option */ +#if defined _LIBC && defined USE_IN_LIBIO + n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), + argv[0], d->__nextchar); +#else + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], d->__nextchar); +#endif + } + else + { + /* +option or -option */ +#if defined _LIBC && defined USE_IN_LIBIO + n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[d->optind][0], d->__nextchar); +#else + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[d->optind][0], d->__nextchar); +#endif + } + +#if defined _LIBC && defined USE_IN_LIBIO + if (n >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#endif + } + d->__nextchar = (char *) ""; + d->optind++; + d->optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *d->__nextchar++; + char *temp = strchr (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*d->__nextchar == '\0') + ++d->optind; + + if (temp == NULL || c == ':') + { + if (print_errors) + { +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + int n; +#endif + + if (d->__posixly_correct) + { + /* 1003.2 specifies the format of this message. */ +#if defined _LIBC && defined USE_IN_LIBIO + n = __asprintf (&buf, _("%s: illegal option -- %c\n"), + argv[0], c); +#else + fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); +#endif + } + else + { +#if defined _LIBC && defined USE_IN_LIBIO + n = __asprintf (&buf, _("%s: invalid option -- %c\n"), + argv[0], c); +#else + fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); +#endif + } + +#if defined _LIBC && defined USE_IN_LIBIO + if (n >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#endif + } + d->optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*d->__nextchar != '\0') + { + d->optarg = d->__nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + d->optind++; + } + else if (d->optind == argc) + { + if (print_errors) + { + /* 1003.2 specifies the format of this message. */ +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + + if (__asprintf (&buf, + _("%s: option requires an argument -- %c\n"), + argv[0], c) >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#else + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); +#endif + } + d->optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `d->optind' once; + increment it again when taking next ARGV-elt as argument. */ + d->optarg = argv[d->optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; + nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) + { + if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (print_errors) + { +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + + if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[d->optind]) >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#else + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[d->optind]); +#endif + } + d->__nextchar += strlen (d->__nextchar); + d->optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + d->optarg = nameend + 1; + else + { + if (print_errors) + { +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + + if (__asprintf (&buf, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name) >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#else + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); +#endif + } + + d->__nextchar += strlen (d->__nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (d->optind < argc) + d->optarg = argv[d->optind++]; + else + { + if (print_errors) + { +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + + if (__asprintf (&buf, _("\ +%s: option `%s' requires an argument\n"), + argv[0], argv[d->optind - 1]) >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#else + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[d->optind - 1]); +#endif + } + d->__nextchar += strlen (d->__nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + d->__nextchar += strlen (d->__nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + d->__nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*d->__nextchar != '\0') + { + d->optarg = d->__nextchar; + d->optind++; + } + else + d->optarg = NULL; + d->__nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*d->__nextchar != '\0') + { + d->optarg = d->__nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + d->optind++; + } + else if (d->optind == argc) + { + if (print_errors) + { + /* 1003.2 specifies the format of this message. */ +#if defined _LIBC && defined USE_IN_LIBIO + char *buf; + + if (__asprintf (&buf, _("\ +%s: option requires an argument -- %c\n"), + argv[0], c) >= 0) + { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } +#else + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); +#endif + } + d->optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + d->optarg = argv[d->optind++]; + d->__nextchar = NULL; + } + } + return c; + } +} + +int +_getopt_internal (int argc, char **argv, const char *optstring, + const struct option *longopts, int *longind, + int long_only, int posixly_correct) +{ + int result; + + getopt_data.optind = optind; + getopt_data.opterr = opterr; + + result = _getopt_internal_r (argc, argv, optstring, longopts, longind, + long_only, posixly_correct, &getopt_data); + + optind = getopt_data.optind; + optarg = getopt_data.optarg; + optopt = getopt_data.optopt; + + return result; +} + +/* glibc gets a LSB-compliant getopt. + Standalone applications get a POSIX-compliant getopt. */ +#if _LIBC +enum { POSIXLY_CORRECT = 0 }; +#else +enum { POSIXLY_CORRECT = 1 }; +#endif + +int +getopt (int argc, char *const *argv, const char *optstring) +{ + return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, + POSIXLY_CORRECT); +} + + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (int argc, char **argv) +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/lib/getopt.in.h b/lib/getopt.in.h new file mode 100644 index 0000000..d2d3e6e --- /dev/null +++ b/lib/getopt.in.h @@ -0,0 +1,225 @@ +/* Declarations for getopt. + Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +#ifndef _GETOPT_H + +#ifndef __need_getopt +# define _GETOPT_H 1 +#endif + +/* Standalone applications should #define __GETOPT_PREFIX to an + identifier that prefixes the external functions and variables + defined in this header. When this happens, include the + headers that might declare getopt so that they will not cause + confusion if included after this file. Then systematically rename + identifiers so that they do not collide with the system functions + and variables. Renaming avoids problems with some compilers and + linkers. */ +#if defined __GETOPT_PREFIX && !defined __need_getopt +# include +# include +# include +# undef __need_getopt +# undef getopt +# undef getopt_long +# undef getopt_long_only +# undef optarg +# undef opterr +# undef optind +# undef optopt +# define __GETOPT_CONCAT(x, y) x ## y +# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) +# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) +# define getopt __GETOPT_ID (getopt) +# define getopt_long __GETOPT_ID (getopt_long) +# define getopt_long_only __GETOPT_ID (getopt_long_only) +# define optarg __GETOPT_ID (optarg) +# define opterr __GETOPT_ID (opterr) +# define optind __GETOPT_ID (optind) +# define optopt __GETOPT_ID (optopt) +#endif + +/* Standalone applications get correct prototypes for getopt_long and + getopt_long_only; they declare "char **argv". libc uses prototypes + with "char *const *argv" that are incorrect because getopt_long and + getopt_long_only can permute argv; this is required for backward + compatibility (e.g., for LSB 2.0.1). + + This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', + but it caused redefinition warnings if both unistd.h and getopt.h were + included, since unistd.h includes getopt.h having previously defined + __need_getopt. + + The only place where __getopt_argv_const is used is in definitions + of getopt_long and getopt_long_only below, but these are visible + only if __need_getopt is not defined, so it is quite safe to rewrite + the conditional as follows: +*/ +#if !defined __need_getopt +# if defined __GETOPT_PREFIX +# define __getopt_argv_const /* empty */ +# else +# define __getopt_argv_const const +# endif +#endif + +/* If __GNU_LIBRARY__ is not already defined, either we are being used + standalone, or this is the first header included in the source file. + If we are being used with glibc, we need to include , but + that does not exist if we are standalone. So: if __GNU_LIBRARY__ is + not defined, include , which will pull in for us + if it's from glibc. (Why ctype.h? It's guaranteed to exist and it + doesn't flood the namespace with stuff the way some other headers do.) */ +#if !defined __GNU_LIBRARY__ +# include +#endif + +#ifndef __THROW +# ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) (0) +# endif +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +#ifndef __need_getopt +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ + const char *name; + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +# define no_argument 0 +# define required_argument 1 +# define optional_argument 2 +#endif /* need getopt */ + + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, `optopt' is set to the option letter, and '?' is + returned. + + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in `optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU `getopt'. + + The argument `--' causes premature termination of argument + scanning, explicitly telling `getopt' that there are no more + options. + + If OPTS begins with `-', then non-option arguments are treated as + arguments to the option '\1'. This behavior is specific to the GNU + `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in + the environment, then do not permute arguments. */ + +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __THROW; + +#ifndef __need_getopt +extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW; +extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW; + +#endif + +#ifdef __cplusplus +} +#endif + +/* Make sure we later can get all the definitions and declarations. */ +#undef __need_getopt + +#endif /* getopt.h */ diff --git a/lib/getopt1.c b/lib/getopt1.c new file mode 100644 index 0000000..d6a3ecf --- /dev/null +++ b/lib/getopt1.c @@ -0,0 +1,170 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +#ifdef _LIBC +# include +#else +# include +# include "getopt.h" +#endif +#include "getopt_int.h" + +#include + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, + const struct option *long_options, int *opt_index) +{ + return _getopt_internal (argc, (char **) argv, options, long_options, + opt_index, 0, 0); +} + +int +_getopt_long_r (int argc, char **argv, const char *options, + const struct option *long_options, int *opt_index, + struct _getopt_data *d) +{ + return _getopt_internal_r (argc, argv, options, long_options, opt_index, + 0, 0, d); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (int argc, char *__getopt_argv_const *argv, + const char *options, + const struct option *long_options, int *opt_index) +{ + return _getopt_internal (argc, (char **) argv, options, long_options, + opt_index, 1, 0); +} + +int +_getopt_long_only_r (int argc, char **argv, const char *options, + const struct option *long_options, int *opt_index, + struct _getopt_data *d) +{ + return _getopt_internal_r (argc, argv, options, long_options, opt_index, + 1, 0, d); +} + + +#ifdef TEST + +#include + +int +main (int argc, char **argv) +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/lib/getopt_int.h b/lib/getopt_int.h new file mode 100644 index 0000000..3c6628b --- /dev/null +++ b/lib/getopt_int.h @@ -0,0 +1,130 @@ +/* Internal declarations for getopt. + Copyright (C) 1989-1994,1996-1999,2001,2003,2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +#ifndef _GETOPT_INT_H +#define _GETOPT_INT_H 1 + +extern int _getopt_internal (int ___argc, char **___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only, int __posixly_correct); + + +/* Reentrant versions which can handle parsing multiple argument + vectors at the same time. */ + +/* Data type for reentrant functions. */ +struct _getopt_data +{ + /* These have exactly the same meaning as the corresponding global + variables, except that they are used for the reentrant + versions of getopt. */ + int optind; + int opterr; + int optopt; + char *optarg; + + /* Internal members. */ + + /* True if the internal members have been initialized. */ + int __initialized; + + /* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + char *__nextchar; + + /* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters, or by calling getopt. + + PERMUTE is the default. We permute the contents of ARGV as we + scan, so that eventually all the non-options are at the end. + This allows options to be given in any order, even with programs + that were not written to expect this. + + RETURN_IN_ORDER is an option available to programs that were + written to expect options and other ARGV-elements in any order + and that care about the ordering of the two. We describe each + non-option ARGV-element as if it were the argument of an option + with character code 1. Using `-' as the first character of the + list of option characters selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + + enum + { + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER + } __ordering; + + /* If the POSIXLY_CORRECT environment variable is set + or getopt was called. */ + int __posixly_correct; + + + /* Handle permutation of arguments. */ + + /* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first + of them; `last_nonopt' is the index after the last of them. */ + + int __first_nonopt; + int __last_nonopt; + +#if defined _LIBC && defined USE_NONOPTION_FLAGS + int __nonoption_flags_max_len; + int __nonoption_flags_len; +# endif +}; + +/* The initializer is necessary to set OPTIND and OPTERR to their + default values and to clear the initialization flag. */ +#define _GETOPT_DATA_INITIALIZER { 1, 1 } + +extern int _getopt_internal_r (int ___argc, char **___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only, int __posixly_correct, + struct _getopt_data *__data); + +extern int _getopt_long_r (int ___argc, char **___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + struct _getopt_data *__data); + +extern int _getopt_long_only_r (int ___argc, char **___argv, + const char *__shortopts, + const struct option *__longopts, + int *__longind, + struct _getopt_data *__data); + +#endif /* getopt_int.h */ diff --git a/lib/gettext.h b/lib/gettext.h new file mode 100644 index 0000000..89b4feb --- /dev/null +++ b/lib/gettext.h @@ -0,0 +1,272 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002, 2004-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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include + +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by + the gettext() and ngettext() macros. This is an alternative to calling + textdomain(), and is useful for libraries. */ +# ifdef DEFAULT_TEXT_DOMAIN +# undef gettext +# define gettext(Msgid) \ + dgettext (DEFAULT_TEXT_DOMAIN, Msgid) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) +# endif + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ +#if defined(__sun) +# include +#endif + +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include + , which chokes if dcgettext is defined as a macro. So include + it now, to make later inclusions of a NOP. */ +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) +# include +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H +# include +# endif +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) +# define dcgettext(Domainname, Msgid, Category) \ + ((void) (Category), dgettext (Domainname, Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 \ + ? ((void) (Msgid2), (const char *) (Msgid1)) \ + : ((void) (Msgid1), (const char *) (Msgid2))) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) \ + ((void) (Domainname), (const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) \ + ((void) (Domainname), (const char *) (Codeset)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +/* The separator between msgctxt and msgid in a .mo file. */ +#define GETTEXT_CONTEXT_GLUE "\004" + +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a + MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be + short and rarely need to change. + The letter 'p' stands for 'particular' or 'special'. */ +#ifdef DEFAULT_TEXT_DOMAIN +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#else +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#endif +#define dpgettext(Domainname, Msgctxt, Msgid) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) +#ifdef DEFAULT_TEXT_DOMAIN +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#else +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#endif +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +pgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + int category) +{ + const char *translation = dcgettext (domain, msg_ctxt_id, category); + if (translation == msg_ctxt_id) + return msgid; + else + return translation; +} + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +npgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + const char *translation = + dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + if (translation == msg_ctxt_id || translation == msgid_plural) + return (n == 1 ? msgid : msgid_plural); + else + return translation; +} + +/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID + can be arbitrary expressions. But for string literals these macros are + less efficient than those above. */ + +#include + +#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ + (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ + /* || __STDC_VERSION__ >= 199901L */ ) + +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS +#include +#endif + +#define pgettext_expr(Msgctxt, Msgid) \ + dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ + dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcgettext (domain, msg_ctxt_id, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (translation != msg_ctxt_id) + return translation; + } + return msgid; +} + +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcnpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (!(translation == msg_ctxt_id || translation == msgid_plural)) + return translation; + } + return (n == 1 ? msgid : msgid_plural); +} + +#endif /* _LIBGETTEXT_H */ diff --git a/lib/gnulib.mk b/lib/gnulib.mk new file mode 100644 index 0000000..b71f8aa --- /dev/null +++ b/lib/gnulib.mk @@ -0,0 +1,911 @@ +## DO NOT EDIT! GENERATED AUTOMATICALLY! +## Process this file with automake to produce Makefile.in. +# Copyright (C) 2002-2008 Free Software Foundation, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libbison --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl announce-gen argmatch c-strcase config-h configmake dirname error extensions fopen-safer getopt gettext git-version-gen gnumakefile hash inttypes javacomp-script javaexec-script malloc mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul strverscmp unistd unistd-safer unlocked-io unsetenv verify warnings xalloc xalloc-die xstrndup + +AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects + +SUBDIRS = +noinst_HEADERS = +noinst_LIBRARIES = +noinst_LTLIBRARIES = +EXTRA_DIST = +BUILT_SOURCES = +SUFFIXES = +MOSTLYCLEANFILES = core *.stackdump +MOSTLYCLEANDIRS = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = + +AM_CPPFLAGS = + +noinst_LIBRARIES += libbison.a + +libbison_a_SOURCES = +libbison_a_LIBADD = $(gl_LIBOBJS) +libbison_a_DEPENDENCIES = $(gl_LIBOBJS) +EXTRA_libbison_a_SOURCES = + +## begin gnulib module announce-gen + + +EXTRA_DIST += $(top_srcdir)/build-aux/announce-gen + +## end gnulib module announce-gen + +## begin gnulib module argmatch + + +EXTRA_DIST += argmatch.c argmatch.h + +EXTRA_libbison_a_SOURCES += argmatch.c + +## end gnulib module argmatch + +## begin gnulib module c-ctype + +libbison_a_SOURCES += c-ctype.h c-ctype.c + +## end gnulib module c-ctype + +## begin gnulib module c-strcase + +libbison_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c + +## end gnulib module c-strcase + +## begin gnulib module configmake + +# Retrieve values of the variables through 'configure' followed by +# 'make', not directly through 'configure', so that a user who +# sets some of these variables consistently on the 'make' command +# line gets correct results. +# +# One advantage of this approach, compared to the classical +# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS, +# is that it protects against the use of undefined variables. +# If, say, $(libdir) is not set in the Makefile, LIBDIR is not +# defined by this module, and code using LIBDIR gives a +# compilation error. +# +# Another advantage is that 'make' output is shorter. +# +# Listed in the same order as the GNU makefile conventions. +# The Automake-defined pkg* macros are appended, in the order +# listed in the Automake 1.10a+ documentation. +configmake.h: Makefile + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo '#define PREFIX "$(prefix)"'; \ + echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ + echo '#define BINDIR "$(bindir)"'; \ + echo '#define SBINDIR "$(sbindir)"'; \ + echo '#define LIBEXECDIR "$(libexecdir)"'; \ + echo '#define DATAROOTDIR "$(datarootdir)"'; \ + echo '#define DATADIR "$(datadir)"'; \ + echo '#define SYSCONFDIR "$(sysconfdir)"'; \ + echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \ + echo '#define LOCALSTATEDIR "$(localstatedir)"'; \ + echo '#define INCLUDEDIR "$(includedir)"'; \ + echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \ + echo '#define DOCDIR "$(docdir)"'; \ + echo '#define INFODIR "$(infodir)"'; \ + echo '#define HTMLDIR "$(htmldir)"'; \ + echo '#define DVIDIR "$(dvidir)"'; \ + echo '#define PDFDIR "$(pdfdir)"'; \ + echo '#define PSDIR "$(psdir)"'; \ + echo '#define LIBDIR "$(libdir)"'; \ + echo '#define LISPDIR "$(lispdir)"'; \ + echo '#define LOCALEDIR "$(localedir)"'; \ + echo '#define MANDIR "$(mandir)"'; \ + echo '#define MANEXT "$(manext)"'; \ + echo '#define PKGDATADIR "$(pkgdatadir)"'; \ + echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ + echo '#define PKGLIBDIR "$(pkglibdir)"'; \ + echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ + } | sed '/""/d' > $@-t + mv $@-t $@ +BUILT_SOURCES += configmake.h +CLEANFILES += configmake.h configmake.h-t + +## end gnulib module configmake + +## begin gnulib module dirname + + +EXTRA_DIST += basename.c dirname.c dirname.h stripslash.c + +EXTRA_libbison_a_SOURCES += basename.c dirname.c stripslash.c + +## end gnulib module dirname + +## begin gnulib module errno + +BUILT_SOURCES += $(ERRNO_H) + +# We need the following in order to create when the system +# doesn't have one that is POSIX compliant. +errno.h: errno.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ + -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ + -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ + -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ + -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ + -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ + -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ + < $(srcdir)/errno.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += errno.h errno.h-t + +EXTRA_DIST += errno.in.h + +## end gnulib module errno + +## begin gnulib module error + + +EXTRA_DIST += error.c error.h + +EXTRA_libbison_a_SOURCES += error.c + +## end gnulib module error + +## begin gnulib module exitfail + + +EXTRA_DIST += exitfail.c exitfail.h + +EXTRA_libbison_a_SOURCES += exitfail.c + +## end gnulib module exitfail + +## begin gnulib module fopen-safer + + +EXTRA_DIST += fopen-safer.c stdio--.h stdio-safer.h + +EXTRA_libbison_a_SOURCES += fopen-safer.c + +## end gnulib module fopen-safer + +## begin gnulib module getopt + +BUILT_SOURCES += $(GETOPT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +getopt.h: getopt.in.h + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/getopt.in.h; \ + } > $@-t + mv -f $@-t $@ +MOSTLYCLEANFILES += getopt.h getopt.h-t + +EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h + +EXTRA_libbison_a_SOURCES += getopt.c getopt1.c + +## end gnulib module getopt + +## begin gnulib module gettext + +# This is for those projects which use "gettextize --intl" to put a source-code +# copy of libintl into their package. In such projects, every Makefile.am needs +# -I$(top_builddir)/intl, so that can be found in this directory. +# For the Makefile.ams in other directories it is the maintainer's +# responsibility; for the one from gnulib we do it here. +# This option has no effect when the user disables NLS (because then the intl +# directory contains no libintl.h file) or when the project does not use +# "gettextize --intl". +#AM_CPPFLAGS += -I$(top_builddir)/intl + +EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath + +## end gnulib module gettext + +## begin gnulib module gettext-h + +libbison_a_SOURCES += gettext.h + +## end gnulib module gettext-h + +## begin gnulib module git-version-gen + + +EXTRA_DIST += $(top_srcdir)/build-aux/git-version-gen + +## end gnulib module git-version-gen + +## begin gnulib module gnumakefile + +distclean-local: clean-GNUmakefile +clean-GNUmakefile: + test x'$(VPATH)' != x && rm -f $(top_builddir)/GNUmakefile || : + +EXTRA_DIST += $(top_srcdir)/GNUmakefile + +## end gnulib module gnumakefile + +## begin gnulib module hash + + +EXTRA_DIST += hash.c hash.h + +EXTRA_libbison_a_SOURCES += hash.c + +## end gnulib module hash + +## begin gnulib module havelib + + +EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath + +## end gnulib module havelib + +## begin gnulib module intprops + + +EXTRA_DIST += intprops.h + +## end gnulib module intprops + +## begin gnulib module inttypes + +BUILT_SOURCES += $(INTTYPES_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +inttypes.h: inttypes.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ + -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ + -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \ + -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \ + -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \ + -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \ + -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ + -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ + -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ + -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ + -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ + -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \ + -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \ + -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/inttypes.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += inttypes.h inttypes.h-t + +EXTRA_DIST += inttypes.in.h + +## end gnulib module inttypes + +## begin gnulib module javacomp-script + + +EXTRA_DIST += $(top_srcdir)/build-aux/javacomp.sh.in + +## end gnulib module javacomp-script + +## begin gnulib module javaexec-script + + +EXTRA_DIST += $(top_srcdir)/build-aux/javaexec.sh.in + +## end gnulib module javaexec-script + +## begin gnulib module link-warning + +LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h + +EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h + +## end gnulib module link-warning + +## begin gnulib module localcharset + +libbison_a_SOURCES += localcharset.h localcharset.c + +# We need the following in order to install a simple file in $(libdir) +# which is shared with other installed packages. We use a list of referencing +# packages so that "make uninstall" will remove the file if and only if it +# is not used by another installed package. +# On systems with glibc-2.1 or newer, the file is redundant, therefore we +# avoid installing it. + +all-local: charset.alias ref-add.sed ref-del.sed + +charset_alias = $(DESTDIR)$(libdir)/charset.alias +charset_tmp = $(DESTDIR)$(libdir)/charset.tmp +install-exec-local: all-local + test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir) + if test -f $(charset_alias); then \ + sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \ + $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ + rm -f $(charset_tmp) ; \ + else \ + if test $(GLIBC21) = no; then \ + sed -f ref-add.sed charset.alias > $(charset_tmp) ; \ + $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ + rm -f $(charset_tmp) ; \ + fi ; \ + fi + +uninstall-local: all-local + if test -f $(charset_alias); then \ + sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \ + if grep '^# Packages using this file: $$' $(charset_tmp) \ + > /dev/null; then \ + rm -f $(charset_alias); \ + else \ + $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \ + fi; \ + rm -f $(charset_tmp); \ + fi + +charset.alias: config.charset + rm -f t-$@ $@ + $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ + mv t-$@ $@ + +SUFFIXES += .sed .sin +.sin.sed: + rm -f t-$@ $@ + sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ + mv t-$@ $@ + +CLEANFILES += charset.alias ref-add.sed ref-del.sed + +EXTRA_DIST += config.charset ref-add.sin ref-del.sin + +## end gnulib module localcharset + +## begin gnulib module malloc + + +EXTRA_DIST += malloc.c + +EXTRA_libbison_a_SOURCES += malloc.c + +## end gnulib module malloc + +## begin gnulib module malloc-posix + + +EXTRA_DIST += malloc.c + +EXTRA_libbison_a_SOURCES += malloc.c + +## end gnulib module malloc-posix + +## begin gnulib module mbswidth + +libbison_a_SOURCES += mbswidth.h mbswidth.c + +## end gnulib module mbswidth + +## begin gnulib module obstack + + +EXTRA_DIST += obstack.c obstack.h + +EXTRA_libbison_a_SOURCES += obstack.c + +## end gnulib module obstack + +## begin gnulib module quote + + +EXTRA_DIST += quote.c quote.h + +EXTRA_libbison_a_SOURCES += quote.c + +## end gnulib module quote + +## begin gnulib module quotearg + + +EXTRA_DIST += quotearg.c quotearg.h + +EXTRA_libbison_a_SOURCES += quotearg.c + +## end gnulib module quotearg + +## begin gnulib module stdbool + +BUILT_SOURCES += $(STDBOOL_H) + +# We need the following in order to create when the system +# doesn't have one that works. +stdbool.h: stdbool.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += stdbool.h stdbool.h-t + +EXTRA_DIST += stdbool.in.h + +## end gnulib module stdbool + +## begin gnulib module stdint + +BUILT_SOURCES += $(STDINT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdint.h: stdint.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ + -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ + -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + < $(srcdir)/stdint.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += stdint.h stdint.h-t + +EXTRA_DIST += stdint.in.h + +## end gnulib module stdint + +## begin gnulib module stdlib + +BUILT_SOURCES += stdlib.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdlib.h: stdlib.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ + -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ + -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ + -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ + -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ + -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ + -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ + -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ + -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ + -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ + -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ + -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ + -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ + -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ + -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ + -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ + -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ + -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ + -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \ + -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ + -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \ + -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ + -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ + -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ + -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ + -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ + -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ + -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ + -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ + -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ + -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ + -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ + -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/stdlib.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += stdlib.h stdlib.h-t + +EXTRA_DIST += stdlib.in.h + +## end gnulib module stdlib + +## begin gnulib module stpcpy + + +EXTRA_DIST += stpcpy.c + +EXTRA_libbison_a_SOURCES += stpcpy.c + +## end gnulib module stpcpy + +## begin gnulib module streq + + +EXTRA_DIST += streq.h + +## end gnulib module streq + +## begin gnulib module strerror + + +EXTRA_DIST += strerror.c + +EXTRA_libbison_a_SOURCES += strerror.c + +## end gnulib module strerror + +## begin gnulib module string + +BUILT_SOURCES += string.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +string.h: string.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ + -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ + -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ + -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ + -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ + -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ + -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ + -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ + -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ + -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ + -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ + -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ + -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ + -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ + -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ + -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ + -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ + -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ + -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ + -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ + -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ + -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ + -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ + -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ + -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ + -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ + -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ + -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ + -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ + -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ + -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ + -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ + -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ + -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ + -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ + -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ + -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ + -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ + -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ + -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ + -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ + -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ + -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ + -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ + -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ + -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ + -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/string.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += string.h string.h-t + +EXTRA_DIST += string.in.h + +## end gnulib module string + +## begin gnulib module strndup + + +EXTRA_DIST += strndup.c + +EXTRA_libbison_a_SOURCES += strndup.c + +## end gnulib module strndup + +## begin gnulib module strnlen + + +EXTRA_DIST += strnlen.c + +EXTRA_libbison_a_SOURCES += strnlen.c + +## end gnulib module strnlen + +## begin gnulib module strtol + + +EXTRA_DIST += strtol.c + +EXTRA_libbison_a_SOURCES += strtol.c + +## end gnulib module strtol + +## begin gnulib module strtoul + + +EXTRA_DIST += strtoul.c + +EXTRA_libbison_a_SOURCES += strtoul.c + +## end gnulib module strtoul + +## begin gnulib module strverscmp + + +EXTRA_DIST += strverscmp.c + +EXTRA_libbison_a_SOURCES += strverscmp.c + +## end gnulib module strverscmp + +## begin gnulib module unistd + +BUILT_SOURCES += unistd.h + +# We need the following in order to create an empty placeholder for +# when the system doesn't have one. +unistd.h: unistd.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ + -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ + -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ + -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ + -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ + -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ + -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ + -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ + -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ + -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ + -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ + -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ + -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ + -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ + -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ + -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ + -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ + -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ + -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ + -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ + -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ + -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ + -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ + -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ + -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ + -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ + -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ + -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ + -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ + -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ + -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ + -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ + -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ + -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ + -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ + -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ + -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ + -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ + -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ + -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ + -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/unistd.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += unistd.h unistd.h-t + +EXTRA_DIST += unistd.in.h + +## end gnulib module unistd + +## begin gnulib module unistd-safer + + +EXTRA_DIST += dup-safer.c fd-safer.c pipe-safer.c unistd--.h unistd-safer.h + +EXTRA_libbison_a_SOURCES += dup-safer.c fd-safer.c pipe-safer.c + +## end gnulib module unistd-safer + +## begin gnulib module unitypes + + +EXTRA_DIST += unitypes.h + +## end gnulib module unitypes + +## begin gnulib module uniwidth/base + + +EXTRA_DIST += localcharset.h uniwidth.h + +## end gnulib module uniwidth/base + +## begin gnulib module uniwidth/width + +libbison_a_SOURCES += uniwidth/width.c + +EXTRA_DIST += uniwidth/cjk.h + +## end gnulib module uniwidth/width + +## begin gnulib module unlocked-io + + +EXTRA_DIST += unlocked-io.h + +## end gnulib module unlocked-io + +## begin gnulib module unsetenv + + +EXTRA_DIST += unsetenv.c + +EXTRA_libbison_a_SOURCES += unsetenv.c + +## end gnulib module unsetenv + +## begin gnulib module verify + +libbison_a_SOURCES += verify.h + +## end gnulib module verify + +## begin gnulib module wchar + +BUILT_SOURCES += $(WCHAR_H) + +# We need the following in order to create when the system +# version does not work standalone. +wchar.h: wchar.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ + -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ + -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ + -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/wchar.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += wchar.h wchar.h-t + +EXTRA_DIST += wchar.in.h + +## end gnulib module wchar + +## begin gnulib module wctype + +BUILT_SOURCES += $(WCTYPE_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +wctype.h: wctype.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ + -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ + -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ + < $(srcdir)/wctype.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += wctype.h wctype.h-t + +EXTRA_DIST += wctype.in.h + +## end gnulib module wctype + +## begin gnulib module wcwidth + + +EXTRA_DIST += wcwidth.c + +EXTRA_libbison_a_SOURCES += wcwidth.c + +## end gnulib module wcwidth + +## begin gnulib module xalloc + + +EXTRA_DIST += xalloc.h xmalloc.c + +EXTRA_libbison_a_SOURCES += xmalloc.c + +## end gnulib module xalloc + +## begin gnulib module xalloc-die + +libbison_a_SOURCES += xalloc-die.c + +## end gnulib module xalloc-die + +## begin gnulib module xstrndup + +libbison_a_SOURCES += xstrndup.h xstrndup.c + +## end gnulib module xstrndup + + +mostlyclean-local: mostlyclean-generic + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done; \ + : diff --git a/lib/hash.c b/lib/hash.c new file mode 100644 index 0000000..7d76d45 --- /dev/null +++ b/lib/hash.c @@ -0,0 +1,1049 @@ +/* hash - hashing table processing. + + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007 Free + Software Foundation, Inc. + + Written by Jim Meyering, 1992. + + 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 . */ + +/* A generic hash table package. */ + +/* Define USE_OBSTACK to 1 if you want the allocator to use obstacks instead + of malloc. If you change USE_OBSTACK, you have to recompile! */ + +#include + +#include "hash.h" +#include "xalloc.h" + +#include +#include +#include + +#if USE_OBSTACK +# include "obstack.h" +# ifndef obstack_chunk_alloc +# define obstack_chunk_alloc malloc +# endif +# ifndef obstack_chunk_free +# define obstack_chunk_free free +# endif +#endif + +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + +struct hash_table + { + /* The array of buckets starts at BUCKET and extends to BUCKET_LIMIT-1, + for a possibility of N_BUCKETS. Among those, N_BUCKETS_USED buckets + are not empty, there are N_ENTRIES active entries in the table. */ + struct hash_entry *bucket; + struct hash_entry const *bucket_limit; + size_t n_buckets; + size_t n_buckets_used; + size_t n_entries; + + /* Tuning arguments, kept in a physicaly separate structure. */ + const Hash_tuning *tuning; + + /* Three functions are given to `hash_initialize', see the documentation + block for this function. In a word, HASHER randomizes a user entry + into a number up from 0 up to some maximum minus 1; COMPARATOR returns + true if two user entries compare equally; and DATA_FREER is the cleanup + function for a user entry. */ + Hash_hasher hasher; + Hash_comparator comparator; + Hash_data_freer data_freer; + + /* A linked list of freed struct hash_entry structs. */ + struct hash_entry *free_entry_list; + +#if USE_OBSTACK + /* Whenever obstacks are used, it is possible to allocate all overflowed + entries into a single stack, so they all can be freed in a single + operation. It is not clear if the speedup is worth the trouble. */ + struct obstack entry_stack; +#endif + }; + +/* A hash table contains many internal entries, each holding a pointer to + some user provided data (also called a user entry). An entry indistinctly + refers to both the internal entry and its associated user entry. A user + entry contents may be hashed by a randomization function (the hashing + function, or just `hasher' for short) into a number (or `slot') between 0 + and the current table size. At each slot position in the hash table, + starts a linked chain of entries for which the user data all hash to this + slot. A bucket is the collection of all entries hashing to the same slot. + + A good `hasher' function will distribute entries rather evenly in buckets. + In the ideal case, the length of each bucket is roughly the number of + entries divided by the table size. Finding the slot for a data is usually + done in constant time by the `hasher', and the later finding of a precise + entry is linear in time with the size of the bucket. Consequently, a + larger hash table size (that is, a larger number of buckets) is prone to + yielding shorter chains, *given* the `hasher' function behaves properly. + + Long buckets slow down the lookup algorithm. One might use big hash table + sizes in hope to reduce the average length of buckets, but this might + become inordinate, as unused slots in the hash table take some space. The + best bet is to make sure you are using a good `hasher' function (beware + that those are not that easy to write! :-), and to use a table size + larger than the actual number of entries. */ + +/* If an insertion makes the ratio of nonempty buckets to table size larger + than the growth threshold (a number between 0.0 and 1.0), then increase + the table size by multiplying by the growth factor (a number greater than + 1.0). The growth threshold defaults to 0.8, and the growth factor + defaults to 1.414, meaning that the table will have doubled its size + every second time 80% of the buckets get used. */ +#define DEFAULT_GROWTH_THRESHOLD 0.8 +#define DEFAULT_GROWTH_FACTOR 1.414 + +/* If a deletion empties a bucket and causes the ratio of used buckets to + table size to become smaller than the shrink threshold (a number between + 0.0 and 1.0), then shrink the table by multiplying by the shrink factor (a + number greater than the shrink threshold but smaller than 1.0). The shrink + threshold and factor default to 0.0 and 1.0, meaning that the table never + shrinks. */ +#define DEFAULT_SHRINK_THRESHOLD 0.0 +#define DEFAULT_SHRINK_FACTOR 1.0 + +/* Use this to initialize or reset a TUNING structure to + some sensible values. */ +static const Hash_tuning default_tuning = + { + DEFAULT_SHRINK_THRESHOLD, + DEFAULT_SHRINK_FACTOR, + DEFAULT_GROWTH_THRESHOLD, + DEFAULT_GROWTH_FACTOR, + false + }; + +/* Information and lookup. */ + +/* The following few functions provide information about the overall hash + table organization: the number of entries, number of buckets and maximum + length of buckets. */ + +/* Return the number of buckets in the hash table. The table size, the total + number of buckets (used plus unused), or the maximum number of slots, are + the same quantity. */ + +size_t +hash_get_n_buckets (const Hash_table *table) +{ + return table->n_buckets; +} + +/* Return the number of slots in use (non-empty buckets). */ + +size_t +hash_get_n_buckets_used (const Hash_table *table) +{ + return table->n_buckets_used; +} + +/* Return the number of active entries. */ + +size_t +hash_get_n_entries (const Hash_table *table) +{ + return table->n_entries; +} + +/* Return the length of the longest chain (bucket). */ + +size_t +hash_get_max_bucket_length (const Hash_table *table) +{ + struct hash_entry const *bucket; + size_t max_bucket_length = 0; + + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + { + if (bucket->data) + { + struct hash_entry const *cursor = bucket; + size_t bucket_length = 1; + + while (cursor = cursor->next, cursor) + bucket_length++; + + if (bucket_length > max_bucket_length) + max_bucket_length = bucket_length; + } + } + + return max_bucket_length; +} + +/* Do a mild validation of a hash table, by traversing it and checking two + statistics. */ + +bool +hash_table_ok (const Hash_table *table) +{ + struct hash_entry const *bucket; + size_t n_buckets_used = 0; + size_t n_entries = 0; + + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + { + if (bucket->data) + { + struct hash_entry const *cursor = bucket; + + /* Count bucket head. */ + n_buckets_used++; + n_entries++; + + /* Count bucket overflow. */ + while (cursor = cursor->next, cursor) + n_entries++; + } + } + + if (n_buckets_used == table->n_buckets_used && n_entries == table->n_entries) + return true; + + return false; +} + +void +hash_print_statistics (const Hash_table *table, FILE *stream) +{ + size_t n_entries = hash_get_n_entries (table); + size_t n_buckets = hash_get_n_buckets (table); + size_t n_buckets_used = hash_get_n_buckets_used (table); + size_t max_bucket_length = hash_get_max_bucket_length (table); + + fprintf (stream, "# entries: %lu\n", (unsigned long int) n_entries); + fprintf (stream, "# buckets: %lu\n", (unsigned long int) n_buckets); + fprintf (stream, "# buckets used: %lu (%.2f%%)\n", + (unsigned long int) n_buckets_used, + (100.0 * n_buckets_used) / n_buckets); + fprintf (stream, "max bucket length: %lu\n", + (unsigned long int) max_bucket_length); +} + +/* If ENTRY matches an entry already in the hash table, return the + entry from the table. Otherwise, return NULL. */ + +void * +hash_lookup (const Hash_table *table, const void *entry) +{ + struct hash_entry const *bucket + = table->bucket + table->hasher (entry, table->n_buckets); + struct hash_entry const *cursor; + + if (! (bucket < table->bucket_limit)) + abort (); + + if (bucket->data == NULL) + return NULL; + + for (cursor = bucket; cursor; cursor = cursor->next) + if (table->comparator (entry, cursor->data)) + return cursor->data; + + return NULL; +} + +/* Walking. */ + +/* The functions in this page traverse the hash table and process the + contained entries. For the traversal to work properly, the hash table + should not be resized nor modified while any particular entry is being + processed. In particular, entries should not be added or removed. */ + +/* Return the first data in the table, or NULL if the table is empty. */ + +void * +hash_get_first (const Hash_table *table) +{ + struct hash_entry const *bucket; + + if (table->n_entries == 0) + return NULL; + + for (bucket = table->bucket; ; bucket++) + if (! (bucket < table->bucket_limit)) + abort (); + else if (bucket->data) + return bucket->data; +} + +/* Return the user data for the entry following ENTRY, where ENTRY has been + returned by a previous call to either `hash_get_first' or `hash_get_next'. + Return NULL if there are no more entries. */ + +void * +hash_get_next (const Hash_table *table, const void *entry) +{ + struct hash_entry const *bucket + = table->bucket + table->hasher (entry, table->n_buckets); + struct hash_entry const *cursor; + + if (! (bucket < table->bucket_limit)) + abort (); + + /* Find next entry in the same bucket. */ + for (cursor = bucket; cursor; cursor = cursor->next) + if (cursor->data == entry && cursor->next) + return cursor->next->data; + + /* Find first entry in any subsequent bucket. */ + while (++bucket < table->bucket_limit) + if (bucket->data) + return bucket->data; + + /* None found. */ + return NULL; +} + +/* Fill BUFFER with pointers to active user entries in the hash table, then + return the number of pointers copied. Do not copy more than BUFFER_SIZE + pointers. */ + +size_t +hash_get_entries (const Hash_table *table, void **buffer, + size_t buffer_size) +{ + size_t counter = 0; + struct hash_entry const *bucket; + struct hash_entry const *cursor; + + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + { + if (bucket->data) + { + for (cursor = bucket; cursor; cursor = cursor->next) + { + if (counter >= buffer_size) + return counter; + buffer[counter++] = cursor->data; + } + } + } + + return counter; +} + +/* Call a PROCESSOR function for each entry of a hash table, and return the + number of entries for which the processor function returned success. A + pointer to some PROCESSOR_DATA which will be made available to each call to + the processor function. The PROCESSOR accepts two arguments: the first is + the user entry being walked into, the second is the value of PROCESSOR_DATA + as received. The walking continue for as long as the PROCESSOR function + returns nonzero. When it returns zero, the walking is interrupted. */ + +size_t +hash_do_for_each (const Hash_table *table, Hash_processor processor, + void *processor_data) +{ + size_t counter = 0; + struct hash_entry const *bucket; + struct hash_entry const *cursor; + + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + { + if (bucket->data) + { + for (cursor = bucket; cursor; cursor = cursor->next) + { + if (!(*processor) (cursor->data, processor_data)) + return counter; + counter++; + } + } + } + + return counter; +} + +/* Allocation and clean-up. */ + +/* Return a hash index for a NUL-terminated STRING between 0 and N_BUCKETS-1. + This is a convenience routine for constructing other hashing functions. */ + +#if USE_DIFF_HASH + +/* About hashings, Paul Eggert writes to me (FP), on 1994-01-01: "Please see + B. J. McKenzie, R. Harries & T. Bell, Selecting a hashing algorithm, + Software--practice & experience 20, 2 (Feb 1990), 209-224. Good hash + algorithms tend to be domain-specific, so what's good for [diffutils'] io.c + may not be good for your application." */ + +size_t +hash_string (const char *string, size_t n_buckets) +{ +# define ROTATE_LEFT(Value, Shift) \ + ((Value) << (Shift) | (Value) >> ((sizeof (size_t) * CHAR_BIT) - (Shift))) +# define HASH_ONE_CHAR(Value, Byte) \ + ((Byte) + ROTATE_LEFT (Value, 7)) + + size_t value = 0; + unsigned char ch; + + for (; (ch = *string); string++) + value = HASH_ONE_CHAR (value, ch); + return value % n_buckets; + +# undef ROTATE_LEFT +# undef HASH_ONE_CHAR +} + +#else /* not USE_DIFF_HASH */ + +/* This one comes from `recode', and performs a bit better than the above as + per a few experiments. It is inspired from a hashing routine found in the + very old Cyber `snoop', itself written in typical Greg Mansfield style. + (By the way, what happened to this excellent man? Is he still alive?) */ + +size_t +hash_string (const char *string, size_t n_buckets) +{ + size_t value = 0; + unsigned char ch; + + for (; (ch = *string); string++) + value = (value * 31 + ch) % n_buckets; + return value; +} + +#endif /* not USE_DIFF_HASH */ + +/* Return true if CANDIDATE is a prime number. CANDIDATE should be an odd + number at least equal to 11. */ + +static bool +is_prime (size_t candidate) +{ + size_t divisor = 3; + size_t square = divisor * divisor; + + while (square < candidate && (candidate % divisor)) + { + divisor++; + square += 4 * divisor; + divisor++; + } + + return (candidate % divisor ? true : false); +} + +/* Round a given CANDIDATE number up to the nearest prime, and return that + prime. Primes lower than 10 are merely skipped. */ + +static size_t +next_prime (size_t candidate) +{ + /* Skip small primes. */ + if (candidate < 10) + candidate = 10; + + /* Make it definitely odd. */ + candidate |= 1; + + while (!is_prime (candidate)) + candidate += 2; + + return candidate; +} + +void +hash_reset_tuning (Hash_tuning *tuning) +{ + *tuning = default_tuning; +} + +/* For the given hash TABLE, check the user supplied tuning structure for + reasonable values, and return true if there is no gross error with it. + Otherwise, definitively reset the TUNING field to some acceptable default + in the hash table (that is, the user loses the right of further modifying + tuning arguments), and return false. */ + +static bool +check_tuning (Hash_table *table) +{ + const Hash_tuning *tuning = table->tuning; + + /* Be a bit stricter than mathematics would require, so that + rounding errors in size calculations do not cause allocations to + fail to grow or shrink as they should. The smallest allocation + is 11 (due to next_prime's algorithm), so an epsilon of 0.1 + should be good enough. */ + float epsilon = 0.1f; + + if (epsilon < tuning->growth_threshold + && tuning->growth_threshold < 1 - epsilon + && 1 + epsilon < tuning->growth_factor + && 0 <= tuning->shrink_threshold + && tuning->shrink_threshold + epsilon < tuning->shrink_factor + && tuning->shrink_factor <= 1 + && tuning->shrink_threshold + epsilon < tuning->growth_threshold) + return true; + + table->tuning = &default_tuning; + return false; +} + +/* Allocate and return a new hash table, or NULL upon failure. The initial + number of buckets is automatically selected so as to _guarantee_ that you + may insert at least CANDIDATE different user entries before any growth of + the hash table size occurs. So, if have a reasonably tight a-priori upper + bound on the number of entries you intend to insert in the hash table, you + may save some table memory and insertion time, by specifying it here. If + the IS_N_BUCKETS field of the TUNING structure is true, the CANDIDATE + argument has its meaning changed to the wanted number of buckets. + + TUNING points to a structure of user-supplied values, in case some fine + tuning is wanted over the default behavior of the hasher. If TUNING is + NULL, the default tuning parameters are used instead. + + The user-supplied HASHER function should be provided. It accepts two + arguments ENTRY and TABLE_SIZE. It computes, by hashing ENTRY contents, a + slot number for that entry which should be in the range 0..TABLE_SIZE-1. + This slot number is then returned. + + The user-supplied COMPARATOR function should be provided. It accepts two + arguments pointing to user data, it then returns true for a pair of entries + that compare equal, or false otherwise. This function is internally called + on entries which are already known to hash to the same bucket index. + + The user-supplied DATA_FREER function, when not NULL, may be later called + with the user data as an argument, just before the entry containing the + data gets freed. This happens from within `hash_free' or `hash_clear'. + You should specify this function only if you want these functions to free + all of your `data' data. This is typically the case when your data is + simply an auxiliary struct that you have malloc'd to aggregate several + values. */ + +Hash_table * +hash_initialize (size_t candidate, const Hash_tuning *tuning, + Hash_hasher hasher, Hash_comparator comparator, + Hash_data_freer data_freer) +{ + Hash_table *table; + + if (hasher == NULL || comparator == NULL) + return NULL; + + table = malloc (sizeof *table); + if (table == NULL) + return NULL; + + if (!tuning) + tuning = &default_tuning; + table->tuning = tuning; + if (!check_tuning (table)) + { + /* Fail if the tuning options are invalid. This is the only occasion + when the user gets some feedback about it. Once the table is created, + if the user provides invalid tuning options, we silently revert to + using the defaults, and ignore further request to change the tuning + options. */ + goto fail; + } + + if (!tuning->is_n_buckets) + { + float new_candidate = candidate / tuning->growth_threshold; + if (SIZE_MAX <= new_candidate) + goto fail; + candidate = new_candidate; + } + + if (xalloc_oversized (candidate, sizeof *table->bucket)) + goto fail; + table->n_buckets = next_prime (candidate); + if (xalloc_oversized (table->n_buckets, sizeof *table->bucket)) + goto fail; + + table->bucket = calloc (table->n_buckets, sizeof *table->bucket); + if (table->bucket == NULL) + goto fail; + table->bucket_limit = table->bucket + table->n_buckets; + table->n_buckets_used = 0; + table->n_entries = 0; + + table->hasher = hasher; + table->comparator = comparator; + table->data_freer = data_freer; + + table->free_entry_list = NULL; +#if USE_OBSTACK + obstack_init (&table->entry_stack); +#endif + return table; + + fail: + free (table); + return NULL; +} + +/* Make all buckets empty, placing any chained entries on the free list. + Apply the user-specified function data_freer (if any) to the datas of any + affected entries. */ + +void +hash_clear (Hash_table *table) +{ + struct hash_entry *bucket; + + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + { + if (bucket->data) + { + struct hash_entry *cursor; + struct hash_entry *next; + + /* Free the bucket overflow. */ + for (cursor = bucket->next; cursor; cursor = next) + { + if (table->data_freer) + (*table->data_freer) (cursor->data); + cursor->data = NULL; + + next = cursor->next; + /* Relinking is done one entry at a time, as it is to be expected + that overflows are either rare or short. */ + cursor->next = table->free_entry_list; + table->free_entry_list = cursor; + } + + /* Free the bucket head. */ + if (table->data_freer) + (*table->data_freer) (bucket->data); + bucket->data = NULL; + bucket->next = NULL; + } + } + + table->n_buckets_used = 0; + table->n_entries = 0; +} + +/* Reclaim all storage associated with a hash table. If a data_freer + function has been supplied by the user when the hash table was created, + this function applies it to the data of each entry before freeing that + entry. */ + +void +hash_free (Hash_table *table) +{ + struct hash_entry *bucket; + struct hash_entry *cursor; + struct hash_entry *next; + + /* Call the user data_freer function. */ + if (table->data_freer && table->n_entries) + { + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + { + if (bucket->data) + { + for (cursor = bucket; cursor; cursor = cursor->next) + { + (*table->data_freer) (cursor->data); + } + } + } + } + +#if USE_OBSTACK + + obstack_free (&table->entry_stack, NULL); + +#else + + /* Free all bucket overflowed entries. */ + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + { + for (cursor = bucket->next; cursor; cursor = next) + { + next = cursor->next; + free (cursor); + } + } + + /* Also reclaim the internal list of previously freed entries. */ + for (cursor = table->free_entry_list; cursor; cursor = next) + { + next = cursor->next; + free (cursor); + } + +#endif + + /* Free the remainder of the hash table structure. */ + free (table->bucket); + free (table); +} + +/* Insertion and deletion. */ + +/* Get a new hash entry for a bucket overflow, possibly by reclying a + previously freed one. If this is not possible, allocate a new one. */ + +static struct hash_entry * +allocate_entry (Hash_table *table) +{ + struct hash_entry *new; + + if (table->free_entry_list) + { + new = table->free_entry_list; + table->free_entry_list = new->next; + } + else + { +#if USE_OBSTACK + new = obstack_alloc (&table->entry_stack, sizeof *new); +#else + new = malloc (sizeof *new); +#endif + } + + return new; +} + +/* Free a hash entry which was part of some bucket overflow, + saving it for later recycling. */ + +static void +free_entry (Hash_table *table, struct hash_entry *entry) +{ + entry->data = NULL; + entry->next = table->free_entry_list; + table->free_entry_list = entry; +} + +/* This private function is used to help with insertion and deletion. When + ENTRY matches an entry in the table, return a pointer to the corresponding + user data and set *BUCKET_HEAD to the head of the selected bucket. + Otherwise, return NULL. When DELETE is true and ENTRY matches an entry in + the table, unlink the matching entry. */ + +static void * +hash_find_entry (Hash_table *table, const void *entry, + struct hash_entry **bucket_head, bool delete) +{ + struct hash_entry *bucket + = table->bucket + table->hasher (entry, table->n_buckets); + struct hash_entry *cursor; + + if (! (bucket < table->bucket_limit)) + abort (); + + *bucket_head = bucket; + + /* Test for empty bucket. */ + if (bucket->data == NULL) + return NULL; + + /* See if the entry is the first in the bucket. */ + if ((*table->comparator) (entry, bucket->data)) + { + void *data = bucket->data; + + if (delete) + { + if (bucket->next) + { + struct hash_entry *next = bucket->next; + + /* Bump the first overflow entry into the bucket head, then save + the previous first overflow entry for later recycling. */ + *bucket = *next; + free_entry (table, next); + } + else + { + bucket->data = NULL; + } + } + + return data; + } + + /* Scan the bucket overflow. */ + for (cursor = bucket; cursor->next; cursor = cursor->next) + { + if ((*table->comparator) (entry, cursor->next->data)) + { + void *data = cursor->next->data; + + if (delete) + { + struct hash_entry *next = cursor->next; + + /* Unlink the entry to delete, then save the freed entry for later + recycling. */ + cursor->next = next->next; + free_entry (table, next); + } + + return data; + } + } + + /* No entry found. */ + return NULL; +} + +/* For an already existing hash table, change the number of buckets through + specifying CANDIDATE. The contents of the hash table are preserved. The + new number of buckets is automatically selected so as to _guarantee_ that + the table may receive at least CANDIDATE different user entries, including + those already in the table, before any other growth of the hash table size + occurs. If TUNING->IS_N_BUCKETS is true, then CANDIDATE specifies the + exact number of buckets desired. */ + +bool +hash_rehash (Hash_table *table, size_t candidate) +{ + Hash_table *new_table; + struct hash_entry *bucket; + struct hash_entry *cursor; + struct hash_entry *next; + + new_table = hash_initialize (candidate, table->tuning, table->hasher, + table->comparator, table->data_freer); + if (new_table == NULL) + return false; + + /* Merely reuse the extra old space into the new table. */ +#if USE_OBSTACK + obstack_free (&new_table->entry_stack, NULL); + new_table->entry_stack = table->entry_stack; +#endif + new_table->free_entry_list = table->free_entry_list; + + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + if (bucket->data) + for (cursor = bucket; cursor; cursor = next) + { + void *data = cursor->data; + struct hash_entry *new_bucket + = (new_table->bucket + + new_table->hasher (data, new_table->n_buckets)); + + if (! (new_bucket < new_table->bucket_limit)) + abort (); + + next = cursor->next; + + if (new_bucket->data) + { + if (cursor == bucket) + { + /* Allocate or recycle an entry, when moving from a bucket + header into a bucket overflow. */ + struct hash_entry *new_entry = allocate_entry (new_table); + + if (new_entry == NULL) + return false; + + new_entry->data = data; + new_entry->next = new_bucket->next; + new_bucket->next = new_entry; + } + else + { + /* Merely relink an existing entry, when moving from a + bucket overflow into a bucket overflow. */ + cursor->next = new_bucket->next; + new_bucket->next = cursor; + } + } + else + { + /* Free an existing entry, when moving from a bucket + overflow into a bucket header. Also take care of the + simple case of moving from a bucket header into a bucket + header. */ + new_bucket->data = data; + new_table->n_buckets_used++; + if (cursor != bucket) + free_entry (new_table, cursor); + } + } + + free (table->bucket); + table->bucket = new_table->bucket; + table->bucket_limit = new_table->bucket_limit; + table->n_buckets = new_table->n_buckets; + table->n_buckets_used = new_table->n_buckets_used; + table->free_entry_list = new_table->free_entry_list; + /* table->n_entries already holds its value. */ +#if USE_OBSTACK + table->entry_stack = new_table->entry_stack; +#endif + free (new_table); + + return true; +} + +/* If ENTRY matches an entry already in the hash table, return the pointer + to the entry from the table. Otherwise, insert ENTRY and return ENTRY. + Return NULL if the storage required for insertion cannot be allocated. */ + +void * +hash_insert (Hash_table *table, const void *entry) +{ + void *data; + struct hash_entry *bucket; + + /* The caller cannot insert a NULL entry. */ + if (! entry) + abort (); + + /* If there's a matching entry already in the table, return that. */ + if ((data = hash_find_entry (table, entry, &bucket, false)) != NULL) + return data; + + /* ENTRY is not matched, it should be inserted. */ + + if (bucket->data) + { + struct hash_entry *new_entry = allocate_entry (table); + + if (new_entry == NULL) + return NULL; + + /* Add ENTRY in the overflow of the bucket. */ + + new_entry->data = (void *) entry; + new_entry->next = bucket->next; + bucket->next = new_entry; + table->n_entries++; + return (void *) entry; + } + + /* Add ENTRY right in the bucket head. */ + + bucket->data = (void *) entry; + table->n_entries++; + table->n_buckets_used++; + + /* If the growth threshold of the buckets in use has been reached, increase + the table size and rehash. There's no point in checking the number of + entries: if the hashing function is ill-conditioned, rehashing is not + likely to improve it. */ + + if (table->n_buckets_used + > table->tuning->growth_threshold * table->n_buckets) + { + /* Check more fully, before starting real work. If tuning arguments + became invalid, the second check will rely on proper defaults. */ + check_tuning (table); + if (table->n_buckets_used + > table->tuning->growth_threshold * table->n_buckets) + { + const Hash_tuning *tuning = table->tuning; + float candidate = + (tuning->is_n_buckets + ? (table->n_buckets * tuning->growth_factor) + : (table->n_buckets * tuning->growth_factor + * tuning->growth_threshold)); + + if (SIZE_MAX <= candidate) + return NULL; + + /* If the rehash fails, arrange to return NULL. */ + if (!hash_rehash (table, candidate)) + entry = NULL; + } + } + + return (void *) entry; +} + +/* If ENTRY is already in the table, remove it and return the just-deleted + data (the user may want to deallocate its storage). If ENTRY is not in the + table, don't modify the table and return NULL. */ + +void * +hash_delete (Hash_table *table, const void *entry) +{ + void *data; + struct hash_entry *bucket; + + data = hash_find_entry (table, entry, &bucket, true); + if (!data) + return NULL; + + table->n_entries--; + if (!bucket->data) + { + table->n_buckets_used--; + + /* If the shrink threshold of the buckets in use has been reached, + rehash into a smaller table. */ + + if (table->n_buckets_used + < table->tuning->shrink_threshold * table->n_buckets) + { + /* Check more fully, before starting real work. If tuning arguments + became invalid, the second check will rely on proper defaults. */ + check_tuning (table); + if (table->n_buckets_used + < table->tuning->shrink_threshold * table->n_buckets) + { + const Hash_tuning *tuning = table->tuning; + size_t candidate = + (tuning->is_n_buckets + ? table->n_buckets * tuning->shrink_factor + : (table->n_buckets * tuning->shrink_factor + * tuning->growth_threshold)); + + hash_rehash (table, candidate); + } + } + } + + return data; +} + +/* Testing. */ + +#if TESTING + +void +hash_print (const Hash_table *table) +{ + struct hash_entry const *bucket; + + for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) + { + struct hash_entry *cursor; + + if (bucket) + printf ("%lu:\n", (unsigned long int) (bucket - table->bucket)); + + for (cursor = bucket; cursor; cursor = cursor->next) + { + char const *s = cursor->data; + /* FIXME */ + if (s) + printf (" %s\n", s); + } + } +} + +#endif /* TESTING */ diff --git a/lib/hash.h b/lib/hash.h new file mode 100644 index 0000000..fc1af28 --- /dev/null +++ b/lib/hash.h @@ -0,0 +1,87 @@ +/* hash - hashing table processing. + Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc. + Written by Jim Meyering , 1998. + + 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 . */ + +/* A generic hash table package. */ + +/* Make sure USE_OBSTACK is defined to 1 if you want the allocator to use + obstacks instead of malloc, and recompile `hash.c' with same setting. */ + +#ifndef HASH_H_ +# define HASH_H_ + +# include +# include + +typedef size_t (*Hash_hasher) (const void *, size_t); +typedef bool (*Hash_comparator) (const void *, const void *); +typedef void (*Hash_data_freer) (void *); +typedef bool (*Hash_processor) (void *, void *); + +struct hash_entry + { + void *data; + struct hash_entry *next; + }; + +struct hash_tuning + { + /* This structure is mainly used for `hash_initialize', see the block + documentation of `hash_reset_tuning' for more complete comments. */ + + float shrink_threshold; /* ratio of used buckets to trigger a shrink */ + float shrink_factor; /* ratio of new smaller size to original size */ + float growth_threshold; /* ratio of used buckets to trigger a growth */ + float growth_factor; /* ratio of new bigger size to original size */ + bool is_n_buckets; /* if CANDIDATE really means table size */ + }; + +typedef struct hash_tuning Hash_tuning; + +struct hash_table; + +typedef struct hash_table Hash_table; + +/* Information and lookup. */ +size_t hash_get_n_buckets (const Hash_table *); +size_t hash_get_n_buckets_used (const Hash_table *); +size_t hash_get_n_entries (const Hash_table *); +size_t hash_get_max_bucket_length (const Hash_table *); +bool hash_table_ok (const Hash_table *); +void hash_print_statistics (const Hash_table *, FILE *); +void *hash_lookup (const Hash_table *, const void *); + +/* Walking. */ +void *hash_get_first (const Hash_table *); +void *hash_get_next (const Hash_table *, const void *); +size_t hash_get_entries (const Hash_table *, void **, size_t); +size_t hash_do_for_each (const Hash_table *, Hash_processor, void *); + +/* Allocation and clean-up. */ +size_t hash_string (const char *, size_t); +void hash_reset_tuning (Hash_tuning *); +Hash_table *hash_initialize (size_t, const Hash_tuning *, + Hash_hasher, Hash_comparator, + Hash_data_freer); +void hash_clear (Hash_table *); +void hash_free (Hash_table *); + +/* Insertion and deletion. */ +bool hash_rehash (Hash_table *, size_t); +void *hash_insert (Hash_table *, const void *); +void *hash_delete (Hash_table *, const void *); + +#endif diff --git a/lib/intprops.h b/lib/intprops.h new file mode 100644 index 0000000..002161e --- /dev/null +++ b/lib/intprops.h @@ -0,0 +1,77 @@ +/* intprops.h -- properties of integer types + + Copyright (C) 2001, 2002, 2003, 2004, 2005 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 . */ + +/* Written by Paul Eggert. */ + +#include + +/* The extra casts in the following macros work around compiler bugs, + e.g., in Cray C 5.0.3.0. */ + +/* True if the arithmetic type T is an integer type. bool counts as + an integer. */ +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) + +/* True if negative values of the signed integer type T use two's + complement, ones' complement, or signed magnitude representation, + respectively. Much GNU code assumes two's complement, but some + people like to be portable to all possible C hosts. */ +#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) + +/* True if the arithmetic type T is signed. */ +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* The maximum and minimum values for the integer type T. These + macros have undefined behavior if T is signed and has padding bits. + If this is a problem for you, please let us know how to fix it for + your host. */ +#define TYPE_MINIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ + : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + +/* Return zero if T can be determined to be an unsigned type. + Otherwise, return 1. + When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a + tighter bound. Otherwise, it overestimates the true bound by one byte + when applied to unsigned types of size 2, 4, 16, ... bytes. + The symbol signed_type_or_expr__ is private to this header file. */ +#if __GNUC__ >= 2 +# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define signed_type_or_expr__(t) 1 +#endif + +/* Bound on length of the string representing an integer type or expression T. + Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485; + add 1 for integer division truncation; add 1 more for a minus sign + if needed. */ +#define INT_STRLEN_BOUND(t) \ + ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \ + + signed_type_or_expr__ (t) + 1) + +/* Bound on buffer size needed to represent an integer type or expression T, + including the terminating null. */ +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h new file mode 100644 index 0000000..bd9d0d2 --- /dev/null +++ b/lib/inttypes.in.h @@ -0,0 +1,1098 @@ +/* Copyright (C) 2006-2008 Free Software Foundation, Inc. + Written by Paul Eggert, Bruno Haible, Derek Price. + This file is part of gnulib. + + 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 . */ + +/* + * ISO C 99 for platforms that lack it. + * + */ + +/* Include the original if it exists, and if this file + has not been included yet or if this file includes gnulib stdint.h + which in turn includes this file. + The include_next requires a split double-inclusion guard. */ +#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H +# if @HAVE_INTTYPES_H@ +# if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +# endif +# @INCLUDE_NEXT@ @NEXT_INTTYPES_H@ +# endif +#endif + +#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H +#define INTTYPES_H + +/* Include or the gnulib replacement. */ +#include +/* Get CHAR_BIT. */ +#include + +#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX) +# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to ." +#endif + +/* The definition of GL_LINK_WARNING is copied here. */ + +/* 7.8.1 Macros for format specifiers */ + +#if ! defined __cplusplus || defined __STDC_FORMAT_MACROS + +# if defined _TNS_R_TARGET + /* Tandem NonStop R series and compatible platforms released before + July 2005 support %Ld but not %lld. */ +# define _LONG_LONG_FORMAT_PREFIX "L" +# else +# define _LONG_LONG_FORMAT_PREFIX "ll" +# endif + +# if !defined PRId8 || @PRI_MACROS_BROKEN@ +# undef PRId8 +# ifdef INT8_MAX +# define PRId8 "d" +# endif +# endif +# if !defined PRIi8 || @PRI_MACROS_BROKEN@ +# undef PRIi8 +# ifdef INT8_MAX +# define PRIi8 "i" +# endif +# endif +# if !defined PRIo8 || @PRI_MACROS_BROKEN@ +# undef PRIo8 +# ifdef UINT8_MAX +# define PRIo8 "o" +# endif +# endif +# if !defined PRIu8 || @PRI_MACROS_BROKEN@ +# undef PRIu8 +# ifdef UINT8_MAX +# define PRIu8 "u" +# endif +# endif +# if !defined PRIx8 || @PRI_MACROS_BROKEN@ +# undef PRIx8 +# ifdef UINT8_MAX +# define PRIx8 "x" +# endif +# endif +# if !defined PRIX8 || @PRI_MACROS_BROKEN@ +# undef PRIX8 +# ifdef UINT8_MAX +# define PRIX8 "X" +# endif +# endif +# if !defined PRId16 || @PRI_MACROS_BROKEN@ +# undef PRId16 +# ifdef INT16_MAX +# define PRId16 "d" +# endif +# endif +# if !defined PRIi16 || @PRI_MACROS_BROKEN@ +# undef PRIi16 +# ifdef INT16_MAX +# define PRIi16 "i" +# endif +# endif +# if !defined PRIo16 || @PRI_MACROS_BROKEN@ +# undef PRIo16 +# ifdef UINT16_MAX +# define PRIo16 "o" +# endif +# endif +# if !defined PRIu16 || @PRI_MACROS_BROKEN@ +# undef PRIu16 +# ifdef UINT16_MAX +# define PRIu16 "u" +# endif +# endif +# if !defined PRIx16 || @PRI_MACROS_BROKEN@ +# undef PRIx16 +# ifdef UINT16_MAX +# define PRIx16 "x" +# endif +# endif +# if !defined PRIX16 || @PRI_MACROS_BROKEN@ +# undef PRIX16 +# ifdef UINT16_MAX +# define PRIX16 "X" +# endif +# endif +# if !defined PRId32 || @PRI_MACROS_BROKEN@ +# undef PRId32 +# ifdef INT32_MAX +# define PRId32 "d" +# endif +# endif +# if !defined PRIi32 || @PRI_MACROS_BROKEN@ +# undef PRIi32 +# ifdef INT32_MAX +# define PRIi32 "i" +# endif +# endif +# if !defined PRIo32 || @PRI_MACROS_BROKEN@ +# undef PRIo32 +# ifdef UINT32_MAX +# define PRIo32 "o" +# endif +# endif +# if !defined PRIu32 || @PRI_MACROS_BROKEN@ +# undef PRIu32 +# ifdef UINT32_MAX +# define PRIu32 "u" +# endif +# endif +# if !defined PRIx32 || @PRI_MACROS_BROKEN@ +# undef PRIx32 +# ifdef UINT32_MAX +# define PRIx32 "x" +# endif +# endif +# if !defined PRIX32 || @PRI_MACROS_BROKEN@ +# undef PRIX32 +# ifdef UINT32_MAX +# define PRIX32 "X" +# endif +# endif +# ifdef INT64_MAX +# if @INT64_MAX_EQ_LONG_MAX@ +# define _PRI64_PREFIX "l" +# elif defined _MSC_VER || defined __MINGW32__ +# define _PRI64_PREFIX "I64" +# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX +# endif +# if !defined PRId64 || @PRI_MACROS_BROKEN@ +# undef PRId64 +# define PRId64 _PRI64_PREFIX "d" +# endif +# if !defined PRIi64 || @PRI_MACROS_BROKEN@ +# undef PRIi64 +# define PRIi64 _PRI64_PREFIX "i" +# endif +# endif +# ifdef UINT64_MAX +# if @UINT64_MAX_EQ_ULONG_MAX@ +# define _PRIu64_PREFIX "l" +# elif defined _MSC_VER || defined __MINGW32__ +# define _PRIu64_PREFIX "I64" +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX +# endif +# if !defined PRIo64 || @PRI_MACROS_BROKEN@ +# undef PRIo64 +# define PRIo64 _PRIu64_PREFIX "o" +# endif +# if !defined PRIu64 || @PRI_MACROS_BROKEN@ +# undef PRIu64 +# define PRIu64 _PRIu64_PREFIX "u" +# endif +# if !defined PRIx64 || @PRI_MACROS_BROKEN@ +# undef PRIx64 +# define PRIx64 _PRIu64_PREFIX "x" +# endif +# if !defined PRIX64 || @PRI_MACROS_BROKEN@ +# undef PRIX64 +# define PRIX64 _PRIu64_PREFIX "X" +# endif +# endif + +# if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@ +# undef PRIdLEAST8 +# define PRIdLEAST8 "d" +# endif +# if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@ +# undef PRIiLEAST8 +# define PRIiLEAST8 "i" +# endif +# if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@ +# undef PRIoLEAST8 +# define PRIoLEAST8 "o" +# endif +# if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@ +# undef PRIuLEAST8 +# define PRIuLEAST8 "u" +# endif +# if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@ +# undef PRIxLEAST8 +# define PRIxLEAST8 "x" +# endif +# if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@ +# undef PRIXLEAST8 +# define PRIXLEAST8 "X" +# endif +# if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@ +# undef PRIdLEAST16 +# define PRIdLEAST16 "d" +# endif +# if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@ +# undef PRIiLEAST16 +# define PRIiLEAST16 "i" +# endif +# if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@ +# undef PRIoLEAST16 +# define PRIoLEAST16 "o" +# endif +# if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@ +# undef PRIuLEAST16 +# define PRIuLEAST16 "u" +# endif +# if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@ +# undef PRIxLEAST16 +# define PRIxLEAST16 "x" +# endif +# if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@ +# undef PRIXLEAST16 +# define PRIXLEAST16 "X" +# endif +# if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@ +# undef PRIdLEAST32 +# define PRIdLEAST32 "d" +# endif +# if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@ +# undef PRIiLEAST32 +# define PRIiLEAST32 "i" +# endif +# if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@ +# undef PRIoLEAST32 +# define PRIoLEAST32 "o" +# endif +# if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@ +# undef PRIuLEAST32 +# define PRIuLEAST32 "u" +# endif +# if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@ +# undef PRIxLEAST32 +# define PRIxLEAST32 "x" +# endif +# if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@ +# undef PRIXLEAST32 +# define PRIXLEAST32 "X" +# endif +# ifdef INT64_MAX +# if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@ +# undef PRIdLEAST64 +# define PRIdLEAST64 PRId64 +# endif +# if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@ +# undef PRIiLEAST64 +# define PRIiLEAST64 PRIi64 +# endif +# endif +# ifdef UINT64_MAX +# if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@ +# undef PRIoLEAST64 +# define PRIoLEAST64 PRIo64 +# endif +# if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@ +# undef PRIuLEAST64 +# define PRIuLEAST64 PRIu64 +# endif +# if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@ +# undef PRIxLEAST64 +# define PRIxLEAST64 PRIx64 +# endif +# if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@ +# undef PRIXLEAST64 +# define PRIXLEAST64 PRIX64 +# endif +# endif + +# if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@ +# undef PRIdFAST8 +# if INT_FAST8_MAX > INT32_MAX +# define PRIdFAST8 PRId64 +# else +# define PRIdFAST8 "d" +# endif +# endif +# if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@ +# undef PRIiFAST8 +# if INT_FAST8_MAX > INT32_MAX +# define PRIiFAST8 PRIi64 +# else +# define PRIiFAST8 "i" +# endif +# endif +# if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@ +# undef PRIoFAST8 +# if UINT_FAST8_MAX > UINT32_MAX +# define PRIoFAST8 PRIo64 +# else +# define PRIoFAST8 "o" +# endif +# endif +# if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@ +# undef PRIuFAST8 +# if UINT_FAST8_MAX > UINT32_MAX +# define PRIuFAST8 PRIu64 +# else +# define PRIuFAST8 "u" +# endif +# endif +# if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@ +# undef PRIxFAST8 +# if UINT_FAST8_MAX > UINT32_MAX +# define PRIxFAST8 PRIx64 +# else +# define PRIxFAST8 "x" +# endif +# endif +# if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@ +# undef PRIXFAST8 +# if UINT_FAST8_MAX > UINT32_MAX +# define PRIXFAST8 PRIX64 +# else +# define PRIXFAST8 "X" +# endif +# endif +# if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@ +# undef PRIdFAST16 +# if INT_FAST16_MAX > INT32_MAX +# define PRIdFAST16 PRId64 +# else +# define PRIdFAST16 "d" +# endif +# endif +# if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@ +# undef PRIiFAST16 +# if INT_FAST16_MAX > INT32_MAX +# define PRIiFAST16 PRIi64 +# else +# define PRIiFAST16 "i" +# endif +# endif +# if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@ +# undef PRIoFAST16 +# if UINT_FAST16_MAX > UINT32_MAX +# define PRIoFAST16 PRIo64 +# else +# define PRIoFAST16 "o" +# endif +# endif +# if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@ +# undef PRIuFAST16 +# if UINT_FAST16_MAX > UINT32_MAX +# define PRIuFAST16 PRIu64 +# else +# define PRIuFAST16 "u" +# endif +# endif +# if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@ +# undef PRIxFAST16 +# if UINT_FAST16_MAX > UINT32_MAX +# define PRIxFAST16 PRIx64 +# else +# define PRIxFAST16 "x" +# endif +# endif +# if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@ +# undef PRIXFAST16 +# if UINT_FAST16_MAX > UINT32_MAX +# define PRIXFAST16 PRIX64 +# else +# define PRIXFAST16 "X" +# endif +# endif +# if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@ +# undef PRIdFAST32 +# if INT_FAST32_MAX > INT32_MAX +# define PRIdFAST32 PRId64 +# else +# define PRIdFAST32 "d" +# endif +# endif +# if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@ +# undef PRIiFAST32 +# if INT_FAST32_MAX > INT32_MAX +# define PRIiFAST32 PRIi64 +# else +# define PRIiFAST32 "i" +# endif +# endif +# if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@ +# undef PRIoFAST32 +# if UINT_FAST32_MAX > UINT32_MAX +# define PRIoFAST32 PRIo64 +# else +# define PRIoFAST32 "o" +# endif +# endif +# if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@ +# undef PRIuFAST32 +# if UINT_FAST32_MAX > UINT32_MAX +# define PRIuFAST32 PRIu64 +# else +# define PRIuFAST32 "u" +# endif +# endif +# if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@ +# undef PRIxFAST32 +# if UINT_FAST32_MAX > UINT32_MAX +# define PRIxFAST32 PRIx64 +# else +# define PRIxFAST32 "x" +# endif +# endif +# if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@ +# undef PRIXFAST32 +# if UINT_FAST32_MAX > UINT32_MAX +# define PRIXFAST32 PRIX64 +# else +# define PRIXFAST32 "X" +# endif +# endif +# ifdef INT64_MAX +# if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@ +# undef PRIdFAST64 +# define PRIdFAST64 PRId64 +# endif +# if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@ +# undef PRIiFAST64 +# define PRIiFAST64 PRIi64 +# endif +# endif +# ifdef UINT64_MAX +# if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@ +# undef PRIoFAST64 +# define PRIoFAST64 PRIo64 +# endif +# if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@ +# undef PRIuFAST64 +# define PRIuFAST64 PRIu64 +# endif +# if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@ +# undef PRIxFAST64 +# define PRIxFAST64 PRIx64 +# endif +# if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@ +# undef PRIXFAST64 +# define PRIXFAST64 PRIX64 +# endif +# endif + +# if !defined PRIdMAX || @PRI_MACROS_BROKEN@ +# undef PRIdMAX +# if @INT32_MAX_LT_INTMAX_MAX@ +# define PRIdMAX PRId64 +# else +# define PRIdMAX "ld" +# endif +# endif +# if !defined PRIiMAX || @PRI_MACROS_BROKEN@ +# undef PRIiMAX +# if @INT32_MAX_LT_INTMAX_MAX@ +# define PRIiMAX PRIi64 +# else +# define PRIiMAX "li" +# endif +# endif +# if !defined PRIoMAX || @PRI_MACROS_BROKEN@ +# undef PRIoMAX +# if @UINT32_MAX_LT_UINTMAX_MAX@ +# define PRIoMAX PRIo64 +# else +# define PRIoMAX "lo" +# endif +# endif +# if !defined PRIuMAX || @PRI_MACROS_BROKEN@ +# undef PRIuMAX +# if @UINT32_MAX_LT_UINTMAX_MAX@ +# define PRIuMAX PRIu64 +# else +# define PRIuMAX "lu" +# endif +# endif +# if !defined PRIxMAX || @PRI_MACROS_BROKEN@ +# undef PRIxMAX +# if @UINT32_MAX_LT_UINTMAX_MAX@ +# define PRIxMAX PRIx64 +# else +# define PRIxMAX "lx" +# endif +# endif +# if !defined PRIXMAX || @PRI_MACROS_BROKEN@ +# undef PRIXMAX +# if @UINT32_MAX_LT_UINTMAX_MAX@ +# define PRIXMAX PRIX64 +# else +# define PRIXMAX "lX" +# endif +# endif + +# if !defined PRIdPTR || @PRI_MACROS_BROKEN@ +# undef PRIdPTR +# ifdef INTPTR_MAX +# define PRIdPTR @PRIPTR_PREFIX@ "d" +# endif +# endif +# if !defined PRIiPTR || @PRI_MACROS_BROKEN@ +# undef PRIiPTR +# ifdef INTPTR_MAX +# define PRIiPTR @PRIPTR_PREFIX@ "i" +# endif +# endif +# if !defined PRIoPTR || @PRI_MACROS_BROKEN@ +# undef PRIoPTR +# ifdef UINTPTR_MAX +# define PRIoPTR @PRIPTR_PREFIX@ "o" +# endif +# endif +# if !defined PRIuPTR || @PRI_MACROS_BROKEN@ +# undef PRIuPTR +# ifdef UINTPTR_MAX +# define PRIuPTR @PRIPTR_PREFIX@ "u" +# endif +# endif +# if !defined PRIxPTR || @PRI_MACROS_BROKEN@ +# undef PRIxPTR +# ifdef UINTPTR_MAX +# define PRIxPTR @PRIPTR_PREFIX@ "x" +# endif +# endif +# if !defined PRIXPTR || @PRI_MACROS_BROKEN@ +# undef PRIXPTR +# ifdef UINTPTR_MAX +# define PRIXPTR @PRIPTR_PREFIX@ "X" +# endif +# endif + +# if !defined SCNd8 || @PRI_MACROS_BROKEN@ +# undef SCNd8 +# ifdef INT8_MAX +# define SCNd8 "hhd" +# endif +# endif +# if !defined SCNi8 || @PRI_MACROS_BROKEN@ +# undef SCNi8 +# ifdef INT8_MAX +# define SCNi8 "hhi" +# endif +# endif +# if !defined SCNo8 || @PRI_MACROS_BROKEN@ +# undef SCNo8 +# ifdef UINT8_MAX +# define SCNo8 "hho" +# endif +# endif +# if !defined SCNu8 || @PRI_MACROS_BROKEN@ +# undef SCNu8 +# ifdef UINT8_MAX +# define SCNu8 "hhu" +# endif +# endif +# if !defined SCNx8 || @PRI_MACROS_BROKEN@ +# undef SCNx8 +# ifdef UINT8_MAX +# define SCNx8 "hhx" +# endif +# endif +# if !defined SCNd16 || @PRI_MACROS_BROKEN@ +# undef SCNd16 +# ifdef INT16_MAX +# define SCNd16 "hd" +# endif +# endif +# if !defined SCNi16 || @PRI_MACROS_BROKEN@ +# undef SCNi16 +# ifdef INT16_MAX +# define SCNi16 "hi" +# endif +# endif +# if !defined SCNo16 || @PRI_MACROS_BROKEN@ +# undef SCNo16 +# ifdef UINT16_MAX +# define SCNo16 "ho" +# endif +# endif +# if !defined SCNu16 || @PRI_MACROS_BROKEN@ +# undef SCNu16 +# ifdef UINT16_MAX +# define SCNu16 "hu" +# endif +# endif +# if !defined SCNx16 || @PRI_MACROS_BROKEN@ +# undef SCNx16 +# ifdef UINT16_MAX +# define SCNx16 "hx" +# endif +# endif +# if !defined SCNd32 || @PRI_MACROS_BROKEN@ +# undef SCNd32 +# ifdef INT32_MAX +# define SCNd32 "d" +# endif +# endif +# if !defined SCNi32 || @PRI_MACROS_BROKEN@ +# undef SCNi32 +# ifdef INT32_MAX +# define SCNi32 "i" +# endif +# endif +# if !defined SCNo32 || @PRI_MACROS_BROKEN@ +# undef SCNo32 +# ifdef UINT32_MAX +# define SCNo32 "o" +# endif +# endif +# if !defined SCNu32 || @PRI_MACROS_BROKEN@ +# undef SCNu32 +# ifdef UINT32_MAX +# define SCNu32 "u" +# endif +# endif +# if !defined SCNx32 || @PRI_MACROS_BROKEN@ +# undef SCNx32 +# ifdef UINT32_MAX +# define SCNx32 "x" +# endif +# endif +# ifdef INT64_MAX +# if @INT64_MAX_EQ_LONG_MAX@ +# define _SCN64_PREFIX "l" +# elif defined _MSC_VER || defined __MINGW32__ +# define _SCN64_PREFIX "I64" +# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX +# endif +# if !defined SCNd64 || @PRI_MACROS_BROKEN@ +# undef SCNd64 +# define SCNd64 _SCN64_PREFIX "d" +# endif +# if !defined SCNi64 || @PRI_MACROS_BROKEN@ +# undef SCNi64 +# define SCNi64 _SCN64_PREFIX "i" +# endif +# endif +# ifdef UINT64_MAX +# if @UINT64_MAX_EQ_ULONG_MAX@ +# define _SCNu64_PREFIX "l" +# elif defined _MSC_VER || defined __MINGW32__ +# define _SCNu64_PREFIX "I64" +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX +# endif +# if !defined SCNo64 || @PRI_MACROS_BROKEN@ +# undef SCNo64 +# define SCNo64 _SCNu64_PREFIX "o" +# endif +# if !defined SCNu64 || @PRI_MACROS_BROKEN@ +# undef SCNu64 +# define SCNu64 _SCNu64_PREFIX "u" +# endif +# if !defined SCNx64 || @PRI_MACROS_BROKEN@ +# undef SCNx64 +# define SCNx64 _SCNu64_PREFIX "x" +# endif +# endif + +# if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@ +# undef SCNdLEAST8 +# define SCNdLEAST8 "hhd" +# endif +# if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@ +# undef SCNiLEAST8 +# define SCNiLEAST8 "hhi" +# endif +# if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@ +# undef SCNoLEAST8 +# define SCNoLEAST8 "hho" +# endif +# if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@ +# undef SCNuLEAST8 +# define SCNuLEAST8 "hhu" +# endif +# if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@ +# undef SCNxLEAST8 +# define SCNxLEAST8 "hhx" +# endif +# if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@ +# undef SCNdLEAST16 +# define SCNdLEAST16 "hd" +# endif +# if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@ +# undef SCNiLEAST16 +# define SCNiLEAST16 "hi" +# endif +# if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@ +# undef SCNoLEAST16 +# define SCNoLEAST16 "ho" +# endif +# if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@ +# undef SCNuLEAST16 +# define SCNuLEAST16 "hu" +# endif +# if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@ +# undef SCNxLEAST16 +# define SCNxLEAST16 "hx" +# endif +# if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@ +# undef SCNdLEAST32 +# define SCNdLEAST32 "d" +# endif +# if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@ +# undef SCNiLEAST32 +# define SCNiLEAST32 "i" +# endif +# if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@ +# undef SCNoLEAST32 +# define SCNoLEAST32 "o" +# endif +# if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@ +# undef SCNuLEAST32 +# define SCNuLEAST32 "u" +# endif +# if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@ +# undef SCNxLEAST32 +# define SCNxLEAST32 "x" +# endif +# ifdef INT64_MAX +# if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@ +# undef SCNdLEAST64 +# define SCNdLEAST64 SCNd64 +# endif +# if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@ +# undef SCNiLEAST64 +# define SCNiLEAST64 SCNi64 +# endif +# endif +# ifdef UINT64_MAX +# if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@ +# undef SCNoLEAST64 +# define SCNoLEAST64 SCNo64 +# endif +# if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@ +# undef SCNuLEAST64 +# define SCNuLEAST64 SCNu64 +# endif +# if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@ +# undef SCNxLEAST64 +# define SCNxLEAST64 SCNx64 +# endif +# endif + +# if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@ +# undef SCNdFAST8 +# if INT_FAST8_MAX > INT32_MAX +# define SCNdFAST8 SCNd64 +# elif INT_FAST8_MAX == 0x7fff +# define SCNdFAST8 "hd" +# elif INT_FAST8_MAX == 0x7f +# define SCNdFAST8 "hhd" +# else +# define SCNdFAST8 "d" +# endif +# endif +# if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@ +# undef SCNiFAST8 +# if INT_FAST8_MAX > INT32_MAX +# define SCNiFAST8 SCNi64 +# elif INT_FAST8_MAX == 0x7fff +# define SCNiFAST8 "hi" +# elif INT_FAST8_MAX == 0x7f +# define SCNiFAST8 "hhi" +# else +# define SCNiFAST8 "i" +# endif +# endif +# if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@ +# undef SCNoFAST8 +# if UINT_FAST8_MAX > UINT32_MAX +# define SCNoFAST8 SCNo64 +# elif UINT_FAST8_MAX == 0xffff +# define SCNoFAST8 "ho" +# elif UINT_FAST8_MAX == 0xff +# define SCNoFAST8 "hho" +# else +# define SCNoFAST8 "o" +# endif +# endif +# if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@ +# undef SCNuFAST8 +# if UINT_FAST8_MAX > UINT32_MAX +# define SCNuFAST8 SCNu64 +# elif UINT_FAST8_MAX == 0xffff +# define SCNuFAST8 "hu" +# elif UINT_FAST8_MAX == 0xff +# define SCNuFAST8 "hhu" +# else +# define SCNuFAST8 "u" +# endif +# endif +# if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@ +# undef SCNxFAST8 +# if UINT_FAST8_MAX > UINT32_MAX +# define SCNxFAST8 SCNx64 +# elif UINT_FAST8_MAX == 0xffff +# define SCNxFAST8 "hx" +# elif UINT_FAST8_MAX == 0xff +# define SCNxFAST8 "hhx" +# else +# define SCNxFAST8 "x" +# endif +# endif +# if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@ +# undef SCNdFAST16 +# if INT_FAST16_MAX > INT32_MAX +# define SCNdFAST16 SCNd64 +# elif INT_FAST16_MAX == 0x7fff +# define SCNdFAST16 "hd" +# else +# define SCNdFAST16 "d" +# endif +# endif +# if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@ +# undef SCNiFAST16 +# if INT_FAST16_MAX > INT32_MAX +# define SCNiFAST16 SCNi64 +# elif INT_FAST16_MAX == 0x7fff +# define SCNiFAST16 "hi" +# else +# define SCNiFAST16 "i" +# endif +# endif +# if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@ +# undef SCNoFAST16 +# if UINT_FAST16_MAX > UINT32_MAX +# define SCNoFAST16 SCNo64 +# elif UINT_FAST16_MAX == 0xffff +# define SCNoFAST16 "ho" +# else +# define SCNoFAST16 "o" +# endif +# endif +# if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@ +# undef SCNuFAST16 +# if UINT_FAST16_MAX > UINT32_MAX +# define SCNuFAST16 SCNu64 +# elif UINT_FAST16_MAX == 0xffff +# define SCNuFAST16 "hu" +# else +# define SCNuFAST16 "u" +# endif +# endif +# if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@ +# undef SCNxFAST16 +# if UINT_FAST16_MAX > UINT32_MAX +# define SCNxFAST16 SCNx64 +# elif UINT_FAST16_MAX == 0xffff +# define SCNxFAST16 "hx" +# else +# define SCNxFAST16 "x" +# endif +# endif +# if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@ +# undef SCNdFAST32 +# if INT_FAST32_MAX > INT32_MAX +# define SCNdFAST32 SCNd64 +# else +# define SCNdFAST32 "d" +# endif +# endif +# if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@ +# undef SCNiFAST32 +# if INT_FAST32_MAX > INT32_MAX +# define SCNiFAST32 SCNi64 +# else +# define SCNiFAST32 "i" +# endif +# endif +# if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@ +# undef SCNoFAST32 +# if UINT_FAST32_MAX > UINT32_MAX +# define SCNoFAST32 SCNo64 +# else +# define SCNoFAST32 "o" +# endif +# endif +# if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@ +# undef SCNuFAST32 +# if UINT_FAST32_MAX > UINT32_MAX +# define SCNuFAST32 SCNu64 +# else +# define SCNuFAST32 "u" +# endif +# endif +# if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@ +# undef SCNxFAST32 +# if UINT_FAST32_MAX > UINT32_MAX +# define SCNxFAST32 SCNx64 +# else +# define SCNxFAST32 "x" +# endif +# endif +# ifdef INT64_MAX +# if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@ +# undef SCNdFAST64 +# define SCNdFAST64 SCNd64 +# endif +# if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@ +# undef SCNiFAST64 +# define SCNiFAST64 SCNi64 +# endif +# endif +# ifdef UINT64_MAX +# if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@ +# undef SCNoFAST64 +# define SCNoFAST64 SCNo64 +# endif +# if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@ +# undef SCNuFAST64 +# define SCNuFAST64 SCNu64 +# endif +# if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@ +# undef SCNxFAST64 +# define SCNxFAST64 SCNx64 +# endif +# endif + +# if !defined SCNdMAX || @PRI_MACROS_BROKEN@ +# undef SCNdMAX +# if @INT32_MAX_LT_INTMAX_MAX@ +# define SCNdMAX SCNd64 +# else +# define SCNdMAX "ld" +# endif +# endif +# if !defined SCNiMAX || @PRI_MACROS_BROKEN@ +# undef SCNiMAX +# if @INT32_MAX_LT_INTMAX_MAX@ +# define SCNiMAX SCNi64 +# else +# define SCNiMAX "li" +# endif +# endif +# if !defined SCNoMAX || @PRI_MACROS_BROKEN@ +# undef SCNoMAX +# if @UINT32_MAX_LT_UINTMAX_MAX@ +# define SCNoMAX SCNo64 +# else +# define SCNoMAX "lo" +# endif +# endif +# if !defined SCNuMAX || @PRI_MACROS_BROKEN@ +# undef SCNuMAX +# if @UINT32_MAX_LT_UINTMAX_MAX@ +# define SCNuMAX SCNu64 +# else +# define SCNuMAX "lu" +# endif +# endif +# if !defined SCNxMAX || @PRI_MACROS_BROKEN@ +# undef SCNxMAX +# if @UINT32_MAX_LT_UINTMAX_MAX@ +# define SCNxMAX SCNx64 +# else +# define SCNxMAX "lx" +# endif +# endif + +# if !defined SCNdPTR || @PRI_MACROS_BROKEN@ +# undef SCNdPTR +# ifdef INTPTR_MAX +# define SCNdPTR @PRIPTR_PREFIX@ "d" +# endif +# endif +# if !defined SCNiPTR || @PRI_MACROS_BROKEN@ +# undef SCNiPTR +# ifdef INTPTR_MAX +# define SCNiPTR @PRIPTR_PREFIX@ "i" +# endif +# endif +# if !defined SCNoPTR || @PRI_MACROS_BROKEN@ +# undef SCNoPTR +# ifdef UINTPTR_MAX +# define SCNoPTR @PRIPTR_PREFIX@ "o" +# endif +# endif +# if !defined SCNuPTR || @PRI_MACROS_BROKEN@ +# undef SCNuPTR +# ifdef UINTPTR_MAX +# define SCNuPTR @PRIPTR_PREFIX@ "u" +# endif +# endif +# if !defined SCNxPTR || @PRI_MACROS_BROKEN@ +# undef SCNxPTR +# ifdef UINTPTR_MAX +# define SCNxPTR @PRIPTR_PREFIX@ "x" +# endif +# endif + +#endif + +/* 7.8.2 Functions for greatest-width integer types */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if @GNULIB_IMAXABS@ +# if !@HAVE_DECL_IMAXABS@ +extern intmax_t imaxabs (intmax_t); +# endif +#elif defined GNULIB_POSIXCHECK +# undef imaxabs +# define imaxabs(a) \ + (GL_LINK_WARNING ("imaxabs is unportable - " \ + "use gnulib module imaxabs for portability"), \ + imaxabs (a)) +#endif + +#if @GNULIB_IMAXDIV@ +# if !@HAVE_DECL_IMAXDIV@ +typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; +extern imaxdiv_t imaxdiv (intmax_t, intmax_t); +# endif +#elif defined GNULIB_POSIXCHECK +# undef imaxdiv +# define imaxdiv(a,b) \ + (GL_LINK_WARNING ("imaxdiv is unportable - " \ + "use gnulib module imaxdiv for portability"), \ + imaxdiv (a, b)) +#endif + +#if @GNULIB_STRTOIMAX@ +# if !@HAVE_DECL_STRTOIMAX@ +extern intmax_t strtoimax (const char *, char **, int); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtoimax +# define strtoimax(p,e,b) \ + (GL_LINK_WARNING ("strtoimax is unportable - " \ + "use gnulib module strtoimax for portability"), \ + strtoimax (p, e, b)) +#endif + +#if @GNULIB_STRTOUMAX@ +# if !@HAVE_DECL_STRTOUMAX@ +extern uintmax_t strtoumax (const char *, char **, int); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtoumax +# define strtoumax(p,e,b) \ + (GL_LINK_WARNING ("strtoumax is unportable - " \ + "use gnulib module strtoumax for portability"), \ + strtoumax (p, e, b)) +#endif + +/* Don't bother defining or declaring wcstoimax and wcstoumax, since + wide-character functions like this are hardly ever useful. */ + +#ifdef __cplusplus +} +#endif + +#endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */ diff --git a/lib/lbitset.c b/lib/lbitset.c new file mode 100644 index 0000000..9a6fc0a --- /dev/null +++ b/lib/lbitset.c @@ -0,0 +1,1403 @@ +/* Functions to support link list bitsets. + Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#include + +#include "lbitset.h" + +#include "obstack.h" +#include +#include +#include +#include + +/* This file implements linked-list bitsets. These bitsets can be of + arbitrary length and are more efficient than arrays of bits for + large sparse sets. + + Usually if all the bits in an element are zero we remove the element + from the list. However, a side effect of the bit caching is that we + do not always notice when an element becomes zero. Hence the + lbitset_weed function which removes zero elements. */ + + +/* Number of words to use for each element. The larger the value the + greater the size of the cache and the shorter the time to find a given bit + but the more memory wasted for sparse bitsets and the longer the time + to search for set bits. + + The routines that dominate timing profiles are lbitset_elt_find + and lbitset_elt_link, especially when accessing the bits randomly. */ + +#define LBITSET_ELT_WORDS 2 + +typedef bitset_word lbitset_word; + +#define LBITSET_WORD_BITS BITSET_WORD_BITS + +/* Number of bits stored in each element. */ +#define LBITSET_ELT_BITS \ + ((unsigned int) (LBITSET_ELT_WORDS * LBITSET_WORD_BITS)) + +/* Lbitset element. We use an array of bits for each element. + These are linked together in a doubly-linked list. */ +typedef struct lbitset_elt_struct +{ + struct lbitset_elt_struct *next; /* Next element. */ + struct lbitset_elt_struct *prev; /* Previous element. */ + bitset_windex index; /* bitno / BITSET_WORD_BITS. */ + bitset_word words[LBITSET_ELT_WORDS]; /* Bits that are set. */ +} +lbitset_elt; + + +enum lbitset_find_mode + { LBITSET_FIND, LBITSET_CREATE, LBITSET_SUBST }; + +static lbitset_elt lbitset_zero_elts[3]; /* Elements of all zero bits. */ + +/* Obstack to allocate bitset elements from. */ +static struct obstack lbitset_obstack; +static bool lbitset_obstack_init = false; +static lbitset_elt *lbitset_free_list; /* Free list of bitset elements. */ + +extern void debug_lbitset (bitset); + +#define LBITSET_CURRENT1(X) \ + ((lbitset_elt *) (void *) ((char *) (X) - offsetof (lbitset_elt, words))) + +#define LBITSET_CURRENT(X) LBITSET_CURRENT1((X)->b.cdata) + +#define LBITSET_HEAD(X) ((X)->l.head) +#define LBITSET_TAIL(X) ((X)->l.tail) + +/* Allocate a lbitset element. The bits are not cleared. */ +static inline lbitset_elt * +lbitset_elt_alloc (void) +{ + lbitset_elt *elt; + + if (lbitset_free_list != 0) + { + elt = lbitset_free_list; + lbitset_free_list = elt->next; + } + else + { + if (!lbitset_obstack_init) + { + lbitset_obstack_init = true; + + /* Let particular systems override the size of a chunk. */ + +#ifndef OBSTACK_CHUNK_SIZE +#define OBSTACK_CHUNK_SIZE 0 +#endif + + /* Let them override the alloc and free routines too. */ + +#ifndef OBSTACK_CHUNK_ALLOC +#define OBSTACK_CHUNK_ALLOC xmalloc +#endif + +#ifndef OBSTACK_CHUNK_FREE +#define OBSTACK_CHUNK_FREE free +#endif + +#if ! defined __GNUC__ || __GNUC__ < 2 +#define __alignof__(type) 0 +#endif + + obstack_specify_allocation (&lbitset_obstack, OBSTACK_CHUNK_SIZE, + __alignof__ (lbitset_elt), + OBSTACK_CHUNK_ALLOC, + OBSTACK_CHUNK_FREE); + } + + /* Perhaps we should add a number of new elements to the free + list. */ + elt = (lbitset_elt *) obstack_alloc (&lbitset_obstack, + sizeof (lbitset_elt)); + } + + return elt; +} + + +/* Allocate a lbitset element. The bits are cleared. */ +static inline lbitset_elt * +lbitset_elt_calloc (void) +{ + lbitset_elt *elt; + + elt = lbitset_elt_alloc (); + memset (elt->words, 0, sizeof (elt->words)); + return elt; +} + + +static inline void +lbitset_elt_free (lbitset_elt *elt) +{ + elt->next = lbitset_free_list; + lbitset_free_list = elt; +} + + +/* Unlink element ELT from bitset BSET. */ +static inline void +lbitset_elt_unlink (bitset bset, lbitset_elt *elt) +{ + lbitset_elt *next = elt->next; + lbitset_elt *prev = elt->prev; + + if (prev) + prev->next = next; + + if (next) + next->prev = prev; + + if (LBITSET_HEAD (bset) == elt) + LBITSET_HEAD (bset) = next; + if (LBITSET_TAIL (bset) == elt) + LBITSET_TAIL (bset) = prev; + + /* Update cache pointer. Since the first thing we try is to insert + before current, make current the next entry in preference to the + previous. */ + if (LBITSET_CURRENT (bset) == elt) + { + if (next) + { + bset->b.cdata = next->words; + bset->b.cindex = next->index; + } + else if (prev) + { + bset->b.cdata = prev->words; + bset->b.cindex = prev->index; + } + else + { + bset->b.csize = 0; + bset->b.cdata = 0; + } + } + + lbitset_elt_free (elt); +} + + +/* Cut the chain of bitset BSET before element ELT and free the + elements. */ +static inline void +lbitset_prune (bitset bset, lbitset_elt *elt) +{ + lbitset_elt *next; + + if (!elt) + return; + + if (elt->prev) + { + LBITSET_TAIL (bset) = elt->prev; + bset->b.cdata = elt->prev->words; + bset->b.cindex = elt->prev->index; + elt->prev->next = 0; + } + else + { + LBITSET_HEAD (bset) = 0; + LBITSET_TAIL (bset) = 0; + bset->b.cdata = 0; + bset->b.csize = 0; + } + + for (; elt; elt = next) + { + next = elt->next; + lbitset_elt_free (elt); + } +} + + +/* Are all bits in an element zero? */ +static inline bool +lbitset_elt_zero_p (lbitset_elt *elt) +{ + int i; + + for (i = 0; i < LBITSET_ELT_WORDS; i++) + if (elt->words[i]) + return false; + + return true; +} + + +/* Link the bitset element into the current bitset linked list. */ +static inline void +lbitset_elt_link (bitset bset, lbitset_elt *elt) +{ + bitset_windex windex = elt->index; + lbitset_elt *ptr; + lbitset_elt *current; + + if (bset->b.csize) + current = LBITSET_CURRENT (bset); + else + current = LBITSET_HEAD (bset); + + /* If this is the first and only element, add it in. */ + if (LBITSET_HEAD (bset) == 0) + { + elt->next = elt->prev = 0; + LBITSET_HEAD (bset) = elt; + LBITSET_TAIL (bset) = elt; + } + + /* If this index is less than that of the current element, it goes + somewhere before the current element. */ + else if (windex < bset->b.cindex) + { + for (ptr = current; + ptr->prev && ptr->prev->index > windex; ptr = ptr->prev) + continue; + + if (ptr->prev) + ptr->prev->next = elt; + else + LBITSET_HEAD (bset) = elt; + + elt->prev = ptr->prev; + elt->next = ptr; + ptr->prev = elt; + } + + /* Otherwise, it must go somewhere after the current element. */ + else + { + for (ptr = current; + ptr->next && ptr->next->index < windex; ptr = ptr->next) + continue; + + if (ptr->next) + ptr->next->prev = elt; + else + LBITSET_TAIL (bset) = elt; + + elt->next = ptr->next; + elt->prev = ptr; + ptr->next = elt; + } + + /* Set up so this is the first element searched. */ + bset->b.cindex = windex; + bset->b.csize = LBITSET_ELT_WORDS; + bset->b.cdata = elt->words; +} + + +static lbitset_elt * +lbitset_elt_find (bitset bset, bitset_windex windex, + enum lbitset_find_mode mode) +{ + lbitset_elt *elt; + lbitset_elt *current; + + if (bset->b.csize) + { + current = LBITSET_CURRENT (bset); + /* Check if element is the cached element. */ + if ((windex - bset->b.cindex) < bset->b.csize) + return current; + } + else + { + current = LBITSET_HEAD (bset); + } + + if (current) + { + if (windex < bset->b.cindex) + { + for (elt = current; + elt->prev && elt->index > windex; elt = elt->prev) + continue; + } + else + { + for (elt = current; + elt->next && (elt->index + LBITSET_ELT_WORDS - 1) < windex; + elt = elt->next) + continue; + } + + /* ELT is the nearest to the one we want. If it's not the one + we want, the one we want does not exist. */ + if (elt && (windex - elt->index) < LBITSET_ELT_WORDS) + { + bset->b.cindex = elt->index; + bset->b.csize = LBITSET_ELT_WORDS; + bset->b.cdata = elt->words; + return elt; + } + } + + switch (mode) + { + default: + abort (); + + case LBITSET_FIND: + return 0; + + case LBITSET_CREATE: + windex -= windex % LBITSET_ELT_WORDS; + + elt = lbitset_elt_calloc (); + elt->index = windex; + lbitset_elt_link (bset, elt); + return elt; + + case LBITSET_SUBST: + return &lbitset_zero_elts[0]; + } +} + + +/* Weed out the zero elements from the list. */ +static inline void +lbitset_weed (bitset bset) +{ + lbitset_elt *elt; + lbitset_elt *next; + + for (elt = LBITSET_HEAD (bset); elt; elt = next) + { + next = elt->next; + if (lbitset_elt_zero_p (elt)) + lbitset_elt_unlink (bset, elt); + } +} + + +/* Set all bits in the bitset to zero. */ +static void +lbitset_zero (bitset bset) +{ + lbitset_elt *head; + + head = LBITSET_HEAD (bset); + if (!head) + return; + + /* Clear a bitset by freeing the linked list at the head element. */ + lbitset_prune (bset, head); +} + + +/* Is DST == SRC? */ +static inline bool +lbitset_equal_p (bitset dst, bitset src) +{ + lbitset_elt *selt; + lbitset_elt *delt; + int j; + + if (src == dst) + return true; + + lbitset_weed (src); + lbitset_weed (dst); + for (selt = LBITSET_HEAD (src), delt = LBITSET_HEAD (dst); + selt && delt; selt = selt->next, delt = delt->next) + { + if (selt->index != delt->index) + return false; + + for (j = 0; j < LBITSET_ELT_WORDS; j++) + if (delt->words[j] != selt->words[j]) + return false; + } + return !selt && !delt; +} + + +/* Copy bits from bitset SRC to bitset DST. */ +static inline void +lbitset_copy (bitset dst, bitset src) +{ + lbitset_elt *elt; + lbitset_elt *head; + lbitset_elt *prev; + lbitset_elt *tmp; + + if (src == dst) + return; + + lbitset_zero (dst); + + head = LBITSET_HEAD (src); + if (!head) + return; + + prev = 0; + for (elt = head; elt; elt = elt->next) + { + tmp = lbitset_elt_alloc (); + tmp->index = elt->index; + tmp->prev = prev; + tmp->next = 0; + if (prev) + prev->next = tmp; + else + LBITSET_HEAD (dst) = tmp; + prev = tmp; + + memcpy (tmp->words, elt->words, sizeof (elt->words)); + } + LBITSET_TAIL (dst) = tmp; + + dst->b.csize = LBITSET_ELT_WORDS; + dst->b.cdata = LBITSET_HEAD (dst)->words; + dst->b.cindex = LBITSET_HEAD (dst)->index; +} + + +/* Copy bits from bitset SRC to bitset DST. Return true if + bitsets different. */ +static inline bool +lbitset_copy_cmp (bitset dst, bitset src) +{ + if (src == dst) + return false; + + if (!LBITSET_HEAD (dst)) + { + lbitset_copy (dst, src); + return LBITSET_HEAD (src) != 0; + } + + if (lbitset_equal_p (dst, src)) + return false; + + lbitset_copy (dst, src); + return true; +} + + +static bitset_bindex +lbitset_resize (bitset src, bitset_bindex size) +{ + BITSET_NBITS_ (src) = size; + + /* Need to prune any excess bits. FIXME. */ + return size; +} + +/* Set bit BITNO in bitset DST. */ +static void +lbitset_set (bitset dst, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + + lbitset_elt_find (dst, windex, LBITSET_CREATE); + + dst->b.cdata[windex - dst->b.cindex] |= + (bitset_word) 1 << (bitno % BITSET_WORD_BITS); +} + + +/* Reset bit BITNO in bitset DST. */ +static void +lbitset_reset (bitset dst, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + + if (!lbitset_elt_find (dst, windex, LBITSET_FIND)) + return; + + dst->b.cdata[windex - dst->b.cindex] &= + ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS)); + + /* If all the data is zero, perhaps we should unlink it now... */ +} + + +/* Test bit BITNO in bitset SRC. */ +static bool +lbitset_test (bitset src, bitset_bindex bitno) +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + + return (lbitset_elt_find (src, windex, LBITSET_FIND) + && ((src->b.cdata[windex - src->b.cindex] + >> (bitno % BITSET_WORD_BITS)) + & 1)); +} + + +static void +lbitset_free (bitset bset) +{ + lbitset_zero (bset); +} + + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT and store in array LIST. Return with actual number of bits + found and with *NEXT indicating where search stopped. */ +static bitset_bindex +lbitset_list_reverse (bitset bset, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + bitset_bindex rbitno; + bitset_bindex bitno; + unsigned int bcount; + bitset_bindex boffset; + bitset_windex windex; + bitset_bindex count; + lbitset_elt *elt; + bitset_word word; + bitset_bindex n_bits; + + elt = LBITSET_TAIL (bset); + if (!elt) + return 0; + + n_bits = (elt->index + LBITSET_ELT_WORDS) * BITSET_WORD_BITS; + rbitno = *next; + + if (rbitno >= n_bits) + return 0; + + bitno = n_bits - (rbitno + 1); + + windex = bitno / BITSET_WORD_BITS; + + /* Skip back to starting element. */ + for (; elt && elt->index > windex; elt = elt->prev) + continue; + + if (!elt) + return 0; + + if (windex >= elt->index + LBITSET_ELT_WORDS) + { + /* We are trying to start in no-mans land so start + at end of current elt. */ + bcount = BITSET_WORD_BITS - 1; + windex = elt->index + LBITSET_ELT_WORDS - 1; + } + else + { + bcount = bitno % BITSET_WORD_BITS; + } + + count = 0; + boffset = windex * BITSET_WORD_BITS; + + /* If num is 1, we could speed things up with a binary search + of the word of interest. */ + + while (elt) + { + bitset_word *srcp = elt->words; + + for (; (windex - elt->index) < LBITSET_ELT_WORDS; + windex--, boffset -= BITSET_WORD_BITS, + bcount = BITSET_WORD_BITS - 1) + { + word = + srcp[windex - elt->index] << (BITSET_WORD_BITS - 1 - bcount); + + for (; word; bcount--) + { + if (word & BITSET_MSB) + { + list[count++] = boffset + bcount; + if (count >= num) + { + *next = n_bits - (boffset + bcount); + return count; + } + } + word <<= 1; + } + } + + elt = elt->prev; + if (elt) + { + windex = elt->index + LBITSET_ELT_WORDS - 1; + boffset = windex * BITSET_WORD_BITS; + } + } + + *next = n_bits - (boffset + 1); + return count; +} + + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT and store in array LIST. Return with actual number of bits + found and with *NEXT indicating where search stopped. */ +static bitset_bindex +lbitset_list (bitset bset, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) +{ + bitset_bindex bitno; + bitset_windex windex; + bitset_bindex count; + lbitset_elt *elt; + lbitset_elt *head; + bitset_word word; + + head = LBITSET_HEAD (bset); + if (!head) + return 0; + + bitno = *next; + count = 0; + + if (!bitno) + { + /* This is the most common case. */ + + /* Start with the first element. */ + elt = head; + windex = elt->index; + bitno = windex * BITSET_WORD_BITS; + } + else + { + windex = bitno / BITSET_WORD_BITS; + + /* Skip to starting element. */ + for (elt = head; + elt && (elt->index + LBITSET_ELT_WORDS - 1) < windex; + elt = elt->next) + continue; + + if (!elt) + return 0; + + if (windex < elt->index) + { + windex = elt->index; + bitno = windex * BITSET_WORD_BITS; + } + else + { + bitset_word *srcp = elt->words; + + /* We are starting within an element. */ + + for (; (windex - elt->index) < LBITSET_ELT_WORDS; windex++) + { + word = srcp[windex - elt->index] >> (bitno % BITSET_WORD_BITS); + + for (; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + *next = bitno + 1; + return count; + } + } + word >>= 1; + } + bitno = (windex + 1) * BITSET_WORD_BITS; + } + + elt = elt->next; + if (elt) + { + windex = elt->index; + bitno = windex * BITSET_WORD_BITS; + } + } + } + + + /* If num is 1, we could speed things up with a binary search + of the word of interest. */ + + while (elt) + { + int i; + bitset_word *srcp = elt->words; + + if ((count + LBITSET_ELT_BITS) < num) + { + /* The coast is clear, plant boot! */ + +#if LBITSET_ELT_WORDS == 2 + word = srcp[0]; + if (word) + { + if (!(word & 0xffff)) + { + word >>= 16; + bitno += 16; + } + if (!(word & 0xff)) + { + word >>= 8; + bitno += 8; + } + for (; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + windex++; + bitno = windex * BITSET_WORD_BITS; + + word = srcp[1]; + if (word) + { + if (!(word & 0xffff)) + { + word >>= 16; + bitno += 16; + } + for (; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + windex++; + bitno = windex * BITSET_WORD_BITS; +#else + for (i = 0; i < LBITSET_ELT_WORDS; i++) + { + word = srcp[i]; + if (word) + { + if (!(word & 0xffff)) + { + word >>= 16; + bitno += 16; + } + if (!(word & 0xff)) + { + word >>= 8; + bitno += 8; + } + for (; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + windex++; + bitno = windex * BITSET_WORD_BITS; + } +#endif + } + else + { + /* Tread more carefully since we need to check + if array overflows. */ + + for (i = 0; i < LBITSET_ELT_WORDS; i++) + { + for (word = srcp[i]; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + *next = bitno + 1; + return count; + } + } + word >>= 1; + } + windex++; + bitno = windex * BITSET_WORD_BITS; + } + } + + elt = elt->next; + if (elt) + { + windex = elt->index; + bitno = windex * BITSET_WORD_BITS; + } + } + + *next = bitno; + return count; +} + + +static bool +lbitset_empty_p (bitset dst) +{ + lbitset_elt *elt; + lbitset_elt *next; + + for (elt = LBITSET_HEAD (dst); elt; elt = next) + { + next = elt->next; + if (!lbitset_elt_zero_p (elt)) + return 0; + /* Weed as we go. */ + lbitset_elt_unlink (dst, elt); + } + + return 1; +} + + +/* Ensure that any unused bits within the last element are clear. */ +static inline void +lbitset_unused_clear (bitset dst) +{ + unsigned int last_bit; + bitset_bindex n_bits; + + n_bits = BITSET_SIZE_ (dst); + last_bit = n_bits % LBITSET_ELT_BITS; + + if (last_bit) + { + lbitset_elt *elt; + bitset_windex windex; + bitset_word *srcp; + + elt = LBITSET_TAIL (dst); + srcp = elt->words; + windex = n_bits / BITSET_WORD_BITS; + + srcp[windex - elt->index] &= ((bitset_word) 1 << last_bit) - 1; + windex++; + + for (; (windex - elt->index) < LBITSET_ELT_WORDS; windex++) + srcp[windex - elt->index] = 0; + } +} + + +static void +lbitset_ones (bitset dst) +{ + bitset_windex i; + bitset_windex windex; + lbitset_elt *elt; + + /* This is a decidedly unfriendly operation for a linked list + bitset! It makes a sparse bitset become dense. An alternative + is to have a flag that indicates that the bitset stores the + complement of what it indicates. */ + + windex = (BITSET_SIZE_ (dst) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS; + + for (i = 0; i < windex; i += LBITSET_ELT_WORDS) + { + /* Create new elements if they cannot be found. */ + elt = lbitset_elt_find (dst, i, LBITSET_CREATE); + memset (elt->words, -1, sizeof (elt->words)); + } + + lbitset_unused_clear (dst); +} + + +static void +lbitset_not (bitset dst, bitset src) +{ + lbitset_elt *elt; + lbitset_elt *selt; + lbitset_elt *delt; + bitset_windex i; + unsigned int j; + bitset_windex windex; + + /* This is another unfriendly operation for a linked list + bitset! */ + elt = LBITSET_TAIL (dst); + + windex = (BITSET_SIZE_ (dst) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS; + + for (i = 0; i < windex; i += LBITSET_ELT_WORDS) + { + /* Create new elements for dst if they cannot be found + or substitute zero elements if src elements not found. */ + selt = lbitset_elt_find (src, i, LBITSET_SUBST); + delt = lbitset_elt_find (dst, i, LBITSET_CREATE); + + for (j = 0; j < LBITSET_ELT_WORDS; j++) + delt->words[j] = ~selt->words[j]; + } + lbitset_unused_clear (dst); + lbitset_weed (dst); + return; +} + + +/* Is DST == DST | SRC? */ +static bool +lbitset_subset_p (bitset dst, bitset src) +{ + lbitset_elt *selt; + lbitset_elt *delt; + unsigned int j; + + for (selt = LBITSET_HEAD (src), delt = LBITSET_HEAD (dst); + selt || delt; selt = selt->next, delt = delt->next) + { + if (!selt) + selt = &lbitset_zero_elts[0]; + else if (!delt) + delt = &lbitset_zero_elts[0]; + else if (selt->index != delt->index) + { + if (selt->index < delt->index) + { + lbitset_zero_elts[2].next = delt; + delt = &lbitset_zero_elts[2]; + } + else + { + lbitset_zero_elts[1].next = selt; + selt = &lbitset_zero_elts[1]; + } + } + + for (j = 0; j < LBITSET_ELT_WORDS; j++) + if (delt->words[j] != (selt->words[j] | delt->words[j])) + return false; + } + return true; +} + + +/* Is DST & SRC == 0? */ +static bool +lbitset_disjoint_p (bitset dst, bitset src) +{ + lbitset_elt *selt; + lbitset_elt *delt; + unsigned int j; + + for (selt = LBITSET_HEAD (src), delt = LBITSET_HEAD (dst); + selt && delt; selt = selt->next, delt = delt->next) + { + if (selt->index != delt->index) + { + if (selt->index < delt->index) + { + lbitset_zero_elts[2].next = delt; + delt = &lbitset_zero_elts[2]; + } + else + { + lbitset_zero_elts[1].next = selt; + selt = &lbitset_zero_elts[1]; + } + /* Since the elements are different, there is no + intersection of these elements. */ + continue; + } + + for (j = 0; j < LBITSET_ELT_WORDS; j++) + if (selt->words[j] & delt->words[j]) + return false; + } + return true; +} + + +static bool +lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op) +{ + lbitset_elt *selt1 = LBITSET_HEAD (src1); + lbitset_elt *selt2 = LBITSET_HEAD (src2); + lbitset_elt *delt = LBITSET_HEAD (dst); + bitset_windex windex1; + bitset_windex windex2; + bitset_windex windex; + lbitset_elt *stmp1; + lbitset_elt *stmp2; + lbitset_elt *dtmp; + bitset_word *srcp1; + bitset_word *srcp2; + bitset_word *dstp; + bool changed = false; + unsigned int i; + + LBITSET_HEAD (dst) = 0; + dst->b.csize = 0; + + windex1 = (selt1) ? selt1->index : BITSET_WINDEX_MAX; + windex2 = (selt2) ? selt2->index : BITSET_WINDEX_MAX; + + while (selt1 || selt2) + { + /* Figure out whether we need to substitute zero elements for + missing links. */ + if (windex1 == windex2) + { + windex = windex1; + stmp1 = selt1; + stmp2 = selt2; + selt1 = selt1->next; + windex1 = (selt1) ? selt1->index : BITSET_WINDEX_MAX; + selt2 = selt2->next; + windex2 = (selt2) ? selt2->index : BITSET_WINDEX_MAX; + } + else if (windex1 < windex2) + { + windex = windex1; + stmp1 = selt1; + stmp2 = &lbitset_zero_elts[0]; + selt1 = selt1->next; + windex1 = (selt1) ? selt1->index : BITSET_WINDEX_MAX; + } + else + { + windex = windex2; + stmp1 = &lbitset_zero_elts[0]; + stmp2 = selt2; + selt2 = selt2->next; + windex2 = (selt2) ? selt2->index : BITSET_WINDEX_MAX; + } + + /* Find the appropriate element from DST. Begin by discarding + elements that we've skipped. */ + while (delt && delt->index < windex) + { + changed = true; + dtmp = delt; + delt = delt->next; + lbitset_elt_free (dtmp); + } + if (delt && delt->index == windex) + { + dtmp = delt; + delt = delt->next; + } + else + dtmp = lbitset_elt_calloc (); + + /* Do the operation, and if any bits are set, link it into the + linked list. */ + srcp1 = stmp1->words; + srcp2 = stmp2->words; + dstp = dtmp->words; + switch (op) + { + default: + abort (); + + case BITSET_OP_OR: + for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++) + { + bitset_word tmp = *srcp1++ | *srcp2++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + break; + + case BITSET_OP_AND: + for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++) + { + bitset_word tmp = *srcp1++ & *srcp2++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + break; + + case BITSET_OP_XOR: + for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++) + { + bitset_word tmp = *srcp1++ ^ *srcp2++; + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + break; + + case BITSET_OP_ANDN: + for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++) + { + bitset_word tmp = *srcp1++ & ~(*srcp2++); + + if (*dstp != tmp) + { + changed = true; + *dstp = tmp; + } + } + break; + } + + if (!lbitset_elt_zero_p (dtmp)) + { + dtmp->index = windex; + /* Perhaps this could be optimised... */ + lbitset_elt_link (dst, dtmp); + } + else + { + lbitset_elt_free (dtmp); + } + } + + /* If we have elements of DST left over, free them all. */ + if (delt) + { + changed = true; + lbitset_prune (dst, delt); + } + + return changed; +} + + +static bool +lbitset_and_cmp (bitset dst, bitset src1, bitset src2) +{ + lbitset_elt *selt1 = LBITSET_HEAD (src1); + lbitset_elt *selt2 = LBITSET_HEAD (src2); + bool changed; + + if (!selt2) + { + lbitset_weed (dst); + changed = !LBITSET_HEAD (dst); + lbitset_zero (dst); + return changed; + } + else if (!selt1) + { + lbitset_weed (dst); + changed = !LBITSET_HEAD (dst); + lbitset_zero (dst); + return changed; + } + return lbitset_op3_cmp (dst, src1, src2, BITSET_OP_AND); +} + + +static void +lbitset_and (bitset dst, bitset src1, bitset src2) +{ + lbitset_and_cmp (dst, src1, src2); +} + + +static bool +lbitset_andn_cmp (bitset dst, bitset src1, bitset src2) +{ + lbitset_elt *selt1 = LBITSET_HEAD (src1); + lbitset_elt *selt2 = LBITSET_HEAD (src2); + bool changed; + + if (!selt2) + { + return lbitset_copy_cmp (dst, src1); + } + else if (!selt1) + { + lbitset_weed (dst); + changed = !LBITSET_HEAD (dst); + lbitset_zero (dst); + return changed; + } + return lbitset_op3_cmp (dst, src1, src2, BITSET_OP_ANDN); +} + + +static void +lbitset_andn (bitset dst, bitset src1, bitset src2) +{ + lbitset_andn_cmp (dst, src1, src2); +} + + +static bool +lbitset_or_cmp (bitset dst, bitset src1, bitset src2) +{ + lbitset_elt *selt1 = LBITSET_HEAD (src1); + lbitset_elt *selt2 = LBITSET_HEAD (src2); + + if (!selt2) + { + return lbitset_copy_cmp (dst, src1); + } + else if (!selt1) + { + return lbitset_copy_cmp (dst, src2); + } + return lbitset_op3_cmp (dst, src1, src2, BITSET_OP_OR); +} + + +static void +lbitset_or (bitset dst, bitset src1, bitset src2) +{ + lbitset_or_cmp (dst, src1, src2); +} + + +static bool +lbitset_xor_cmp (bitset dst, bitset src1, bitset src2) +{ + lbitset_elt *selt1 = LBITSET_HEAD (src1); + lbitset_elt *selt2 = LBITSET_HEAD (src2); + + if (!selt2) + { + return lbitset_copy_cmp (dst, src1); + } + else if (!selt1) + { + return lbitset_copy_cmp (dst, src2); + } + return lbitset_op3_cmp (dst, src1, src2, BITSET_OP_XOR); +} + + +static void +lbitset_xor (bitset dst, bitset src1, bitset src2) +{ + lbitset_xor_cmp (dst, src1, src2); +} + + + +/* Vector of operations for linked-list bitsets. */ +struct bitset_vtable lbitset_vtable = { + lbitset_set, + lbitset_reset, + bitset_toggle_, + lbitset_test, + lbitset_resize, + bitset_size_, + bitset_count_, + lbitset_empty_p, + lbitset_ones, + lbitset_zero, + lbitset_copy, + lbitset_disjoint_p, + lbitset_equal_p, + lbitset_not, + lbitset_subset_p, + lbitset_and, + lbitset_and_cmp, + lbitset_andn, + lbitset_andn_cmp, + lbitset_or, + lbitset_or_cmp, + lbitset_xor, + lbitset_xor_cmp, + bitset_and_or_, + bitset_and_or_cmp_, + bitset_andn_or_, + bitset_andn_or_cmp_, + bitset_or_and_, + bitset_or_and_cmp_, + lbitset_list, + lbitset_list_reverse, + lbitset_free, + BITSET_LIST +}; + + +/* Return size of initial structure. */ +size_t +lbitset_bytes (bitset_bindex n_bits ATTRIBUTE_UNUSED) +{ + return sizeof (struct lbitset_struct); +} + + +/* Initialize a bitset. */ +bitset +lbitset_init (bitset bset, bitset_bindex n_bits ATTRIBUTE_UNUSED) +{ + BITSET_NBITS_ (bset) = n_bits; + bset->b.vtable = &lbitset_vtable; + return bset; +} + + +void +lbitset_release_memory (void) +{ + lbitset_free_list = 0; + if (lbitset_obstack_init) + { + lbitset_obstack_init = false; + obstack_free (&lbitset_obstack, NULL); + } +} + + +/* Function to be called from debugger to debug lbitset. */ +void +debug_lbitset (bitset bset) +{ + lbitset_elt *elt; + unsigned int i; + + if (!bset) + return; + + for (elt = LBITSET_HEAD (bset); elt; elt = elt->next) + { + fprintf (stderr, "Elt %lu\n", (unsigned long int) elt->index); + for (i = 0; i < LBITSET_ELT_WORDS; i++) + { + unsigned int j; + bitset_word word; + + word = elt->words[i]; + + fprintf (stderr, " Word %u:", i); + for (j = 0; j < LBITSET_WORD_BITS; j++) + if ((word & ((bitset_word) 1 << j))) + fprintf (stderr, " %u", j); + fprintf (stderr, "\n"); + } + } +} diff --git a/lib/lbitset.h b/lib/lbitset.h new file mode 100644 index 0000000..9301a3f --- /dev/null +++ b/lib/lbitset.h @@ -0,0 +1,29 @@ +/* Functions to support lbitsets. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#ifndef _LBITSET_H +#define _LBITSET_H + +#include "bitset.h" + +extern size_t lbitset_bytes (bitset_bindex); + +extern bitset lbitset_init (bitset, bitset_bindex); + +extern void lbitset_release_memory (void); + +#endif diff --git a/lib/libiberty.h b/lib/libiberty.h new file mode 100644 index 0000000..3071662 --- /dev/null +++ b/lib/libiberty.h @@ -0,0 +1,35 @@ +/* Fake libiberty.h for Bison. + Copyright (C) 2002, 2003, 2004 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 . */ + + +/* Bison depends on libiberty's implementation of bitsets, which + requires a `libiberty.h' file. This file provides the minimum + services. */ + +#ifndef BISON_LIBIBERTY_H_ +# define BISON_LIBIBERTY_H_ 1 + +# ifndef __attribute__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# define __attribute__(x) +# endif +# endif + +# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) + +# include "xalloc.h" + +#endif /* ! BISON_LIBIBERTY_H_ */ diff --git a/lib/localcharset.c b/lib/localcharset.c new file mode 100644 index 0000000..f49d75b --- /dev/null +++ b/lib/localcharset.c @@ -0,0 +1,464 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Determine a canonical name for the current locale's character encoding. + + Copyright (C) 2000-2006, 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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible . */ + +#include + +/* Specification. */ +#include "localcharset.h" + +#include +#include +#include +#include + +#if defined _WIN32 || defined __WIN32__ +# define WIN32_NATIVE +#endif + +#if defined __EMX__ +/* Assume EMX program runs on OS/2, even if compiled under DOS. */ +# ifndef OS2 +# define OS2 +# endif +#endif + +#if !defined WIN32_NATIVE +# if HAVE_LANGINFO_CODESET +# include +# else +# if 0 /* see comment below */ +# include +# endif +# endif +# ifdef __CYGWIN__ +# define WIN32_LEAN_AND_MEAN +# include +# endif +#elif defined WIN32_NATIVE +# define WIN32_LEAN_AND_MEAN +# include +#endif +#if defined OS2 +# define INCL_DOS +# include +#endif + +#if ENABLE_RELOCATABLE +# include "relocatable.h" +#else +# define relocate(pathname) (pathname) +#endif + +/* Get LIBDIR. */ +#ifndef LIBDIR +# include "configmake.h" +#endif + +#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + /* Win32, Cygwin, OS/2, DOS */ +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#endif + +#ifndef DIRECTORY_SEPARATOR +# define DIRECTORY_SEPARATOR '/' +#endif + +#ifndef ISSLASH +# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) +#endif + +#if HAVE_DECL_GETC_UNLOCKED +# undef getc +# define getc getc_unlocked +#endif + +/* The following static variable is declared 'volatile' to avoid a + possible multithread problem in the function get_charset_aliases. If we + are running in a threaded environment, and if two threads initialize + 'charset_aliases' simultaneously, both will produce the same value, + and everything will be ok if the two assignments to 'charset_aliases' + are atomic. But I don't know what will happen if the two assignments mix. */ +#if __STDC__ != 1 +# define volatile /* empty */ +#endif +/* Pointer to the contents of the charset.alias file, if it has already been + read, else NULL. Its format is: + ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */ +static const char * volatile charset_aliases; + +/* Return a pointer to the contents of the charset.alias file. */ +static const char * +get_charset_aliases (void) +{ + const char *cp; + + cp = charset_aliases; + if (cp == NULL) + { +#if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__) + FILE *fp; + const char *dir; + const char *base = "charset.alias"; + char *file_name; + + /* Make it possible to override the charset.alias location. This is + necessary for running the testsuite before "make install". */ + dir = getenv ("CHARSETALIASDIR"); + if (dir == NULL || dir[0] == '\0') + dir = relocate (LIBDIR); + + /* Concatenate dir and base into freshly allocated file_name. */ + { + size_t dir_len = strlen (dir); + size_t base_len = strlen (base); + int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1])); + file_name = (char *) malloc (dir_len + add_slash + base_len + 1); + if (file_name != NULL) + { + memcpy (file_name, dir, dir_len); + if (add_slash) + file_name[dir_len] = DIRECTORY_SEPARATOR; + memcpy (file_name + dir_len + add_slash, base, base_len + 1); + } + } + + if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL) + /* Out of memory or file not found, treat it as empty. */ + cp = ""; + else + { + /* Parse the file's contents. */ + char *res_ptr = NULL; + size_t res_size = 0; + + for (;;) + { + int c; + char buf1[50+1]; + char buf2[50+1]; + size_t l1, l2; + char *old_res_ptr; + + c = getc (fp); + if (c == EOF) + break; + if (c == '\n' || c == ' ' || c == '\t') + continue; + if (c == '#') + { + /* Skip comment, to end of line. */ + do + c = getc (fp); + while (!(c == EOF || c == '\n')); + if (c == EOF) + break; + continue; + } + ungetc (c, fp); + if (fscanf (fp, "%50s %50s", buf1, buf2) < 2) + break; + l1 = strlen (buf1); + l2 = strlen (buf2); + old_res_ptr = res_ptr; + if (res_size == 0) + { + res_size = l1 + 1 + l2 + 1; + res_ptr = (char *) malloc (res_size + 1); + } + else + { + res_size += l1 + 1 + l2 + 1; + res_ptr = (char *) realloc (res_ptr, res_size + 1); + } + if (res_ptr == NULL) + { + /* Out of memory. */ + res_size = 0; + if (old_res_ptr != NULL) + free (old_res_ptr); + break; + } + strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); + strcpy (res_ptr + res_size - (l2 + 1), buf2); + } + fclose (fp); + if (res_size == 0) + cp = ""; + else + { + *(res_ptr + res_size) = '\0'; + cp = res_ptr; + } + } + + if (file_name != NULL) + free (file_name); + +#else + +# if defined VMS + /* To avoid the troubles of an extra file charset.alias_vms in the + sources of many GNU packages, simply inline the aliases here. */ + /* The list of encodings is taken from the OpenVMS 7.3-1 documentation + "Compaq C Run-Time Library Reference Manual for OpenVMS systems" + section 10.7 "Handling Different Character Sets". */ + cp = "ISO8859-1" "\0" "ISO-8859-1" "\0" + "ISO8859-2" "\0" "ISO-8859-2" "\0" + "ISO8859-5" "\0" "ISO-8859-5" "\0" + "ISO8859-7" "\0" "ISO-8859-7" "\0" + "ISO8859-8" "\0" "ISO-8859-8" "\0" + "ISO8859-9" "\0" "ISO-8859-9" "\0" + /* Japanese */ + "eucJP" "\0" "EUC-JP" "\0" + "SJIS" "\0" "SHIFT_JIS" "\0" + "DECKANJI" "\0" "DEC-KANJI" "\0" + "SDECKANJI" "\0" "EUC-JP" "\0" + /* Chinese */ + "eucTW" "\0" "EUC-TW" "\0" + "DECHANYU" "\0" "DEC-HANYU" "\0" + "DECHANZI" "\0" "GB2312" "\0" + /* Korean */ + "DECKOREAN" "\0" "EUC-KR" "\0"; +# endif + +# if defined WIN32_NATIVE || defined __CYGWIN__ + /* To avoid the troubles of installing a separate file in the same + directory as the DLL and of retrieving the DLL's directory at + runtime, simply inline the aliases here. */ + + cp = "CP936" "\0" "GBK" "\0" + "CP1361" "\0" "JOHAB" "\0" + "CP20127" "\0" "ASCII" "\0" + "CP20866" "\0" "KOI8-R" "\0" + "CP20936" "\0" "GB2312" "\0" + "CP21866" "\0" "KOI8-RU" "\0" + "CP28591" "\0" "ISO-8859-1" "\0" + "CP28592" "\0" "ISO-8859-2" "\0" + "CP28593" "\0" "ISO-8859-3" "\0" + "CP28594" "\0" "ISO-8859-4" "\0" + "CP28595" "\0" "ISO-8859-5" "\0" + "CP28596" "\0" "ISO-8859-6" "\0" + "CP28597" "\0" "ISO-8859-7" "\0" + "CP28598" "\0" "ISO-8859-8" "\0" + "CP28599" "\0" "ISO-8859-9" "\0" + "CP28605" "\0" "ISO-8859-15" "\0" + "CP38598" "\0" "ISO-8859-8" "\0" + "CP51932" "\0" "EUC-JP" "\0" + "CP51936" "\0" "GB2312" "\0" + "CP51949" "\0" "EUC-KR" "\0" + "CP51950" "\0" "EUC-TW" "\0" + "CP54936" "\0" "GB18030" "\0" + "CP65001" "\0" "UTF-8" "\0"; +# endif +#endif + + charset_aliases = cp; + } + + return cp; +} + +/* Determine the current locale's character encoding, and canonicalize it + into one of the canonical names listed in config.charset. + The result must not be freed; it is statically allocated. + If the canonical name cannot be determined, the result is a non-canonical + name. */ + +#ifdef STATIC +STATIC +#endif +const char * +locale_charset (void) +{ + const char *codeset; + const char *aliases; + +#if !(defined WIN32_NATIVE || defined OS2) + +# if HAVE_LANGINFO_CODESET + + /* Most systems support nl_langinfo (CODESET) nowadays. */ + codeset = nl_langinfo (CODESET); + +# ifdef __CYGWIN__ + /* Cygwin 2006 does not have locales. nl_langinfo (CODESET) always + returns "US-ASCII". As long as this is not fixed, return the suffix + of the locale name from the environment variables (if present) or + the codepage as a number. */ + if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0) + { + const char *locale; + static char buf[2 + 10 + 1]; + + locale = getenv ("LC_ALL"); + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_CTYPE"); + if (locale == NULL || locale[0] == '\0') + locale = getenv ("LANG"); + } + if (locale != NULL && locale[0] != '\0') + { + /* If the locale name contains an encoding after the dot, return + it. */ + const char *dot = strchr (locale, '.'); + + if (dot != NULL) + { + const char *modifier; + + dot++; + /* Look for the possible @... trailer and remove it, if any. */ + modifier = strchr (dot, '@'); + if (modifier == NULL) + return dot; + if (modifier - dot < sizeof (buf)) + { + memcpy (buf, dot, modifier - dot); + buf [modifier - dot] = '\0'; + return buf; + } + } + } + + /* Woe32 has a function returning the locale's codepage as a number. */ + sprintf (buf, "CP%u", GetACP ()); + codeset = buf; + } +# endif + +# else + + /* On old systems which lack it, use setlocale or getenv. */ + const char *locale = NULL; + + /* But most old systems don't have a complete set of locales. Some + (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't + use setlocale here; it would return "C" when it doesn't support the + locale name the user has set. */ +# if 0 + locale = setlocale (LC_CTYPE, NULL); +# endif + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_ALL"); + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_CTYPE"); + if (locale == NULL || locale[0] == '\0') + locale = getenv ("LANG"); + } + } + + /* On some old systems, one used to set locale = "iso8859_1". On others, + you set it to "language_COUNTRY.charset". In any case, we resolve it + through the charset.alias file. */ + codeset = locale; + +# endif + +#elif defined WIN32_NATIVE + + static char buf[2 + 10 + 1]; + + /* Woe32 has a function returning the locale's codepage as a number. */ + sprintf (buf, "CP%u", GetACP ()); + codeset = buf; + +#elif defined OS2 + + const char *locale; + static char buf[2 + 10 + 1]; + ULONG cp[3]; + ULONG cplen; + + /* Allow user to override the codeset, as set in the operating system, + with standard language environment variables. */ + locale = getenv ("LC_ALL"); + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_CTYPE"); + if (locale == NULL || locale[0] == '\0') + locale = getenv ("LANG"); + } + if (locale != NULL && locale[0] != '\0') + { + /* If the locale name contains an encoding after the dot, return it. */ + const char *dot = strchr (locale, '.'); + + if (dot != NULL) + { + const char *modifier; + + dot++; + /* Look for the possible @... trailer and remove it, if any. */ + modifier = strchr (dot, '@'); + if (modifier == NULL) + return dot; + if (modifier - dot < sizeof (buf)) + { + memcpy (buf, dot, modifier - dot); + buf [modifier - dot] = '\0'; + return buf; + } + } + + /* Resolve through the charset.alias file. */ + codeset = locale; + } + else + { + /* OS/2 has a function returning the locale's codepage as a number. */ + if (DosQueryCp (sizeof (cp), cp, &cplen)) + codeset = ""; + else + { + sprintf (buf, "CP%u", cp[0]); + codeset = buf; + } + } + +#endif + + if (codeset == NULL) + /* The canonical name cannot be determined. */ + codeset = ""; + + /* Resolve alias. */ + for (aliases = get_charset_aliases (); + *aliases != '\0'; + aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1) + if (strcmp (codeset, aliases) == 0 + || (aliases[0] == '*' && aliases[1] == '\0')) + { + codeset = aliases + strlen (aliases) + 1; + break; + } + + /* Don't return an empty string. GNU libc and GNU libiconv interpret + the empty string as denoting "the locale's character encoding", + thus GNU libiconv would call this function a second time. */ + if (codeset[0] == '\0') + codeset = "ASCII"; + + return codeset; +} diff --git a/lib/localcharset.h b/lib/localcharset.h new file mode 100644 index 0000000..7f0b974 --- /dev/null +++ b/lib/localcharset.h @@ -0,0 +1,43 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Determine a canonical name for the current locale's character encoding. + Copyright (C) 2000-2003 Free Software Foundation, Inc. + This file is part of the GNU CHARSET Library. + + 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _LOCALCHARSET_H +#define _LOCALCHARSET_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Determine the current locale's character encoding, and canonicalize it + into one of the canonical names listed in config.charset. + The result must not be freed; it is statically allocated. + If the canonical name cannot be determined, the result is a non-canonical + name. */ +extern const char * locale_charset (void); + + +#ifdef __cplusplus +} +#endif + + +#endif /* _LOCALCHARSET_H */ diff --git a/lib/main.c b/lib/main.c new file mode 100644 index 0000000..4b165ce --- /dev/null +++ b/lib/main.c @@ -0,0 +1,36 @@ +/* Yacc library main function. + + Copyright (C) 2002 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include + +#if HAVE_LOCALE_H +# include +#endif +#if ! HAVE_SETLOCALE +# define setlocale(Category, Locale) +#endif + +int yyparse (void); + +int +main (void) +{ + setlocale (LC_ALL, ""); + return yyparse (); +} diff --git a/lib/malloc.c b/lib/malloc.c new file mode 100644 index 0000000..4738df2 --- /dev/null +++ b/lib/malloc.c @@ -0,0 +1,59 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* malloc() function that is glibc compatible. + + Copyright (C) 1997, 1998, 2006, 2007 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* written by Jim Meyering and Bruno Haible */ + +#include +/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ +#ifdef malloc +# define NEED_MALLOC_GNU +# undef malloc +#endif + +/* Specification. */ +#include + +#include + +/* Call the system's malloc below. */ +#undef malloc + +/* Allocate an N-byte block of memory from the heap. + If N is zero, allocate a 1-byte block. */ + +void * +rpl_malloc (size_t n) +{ + void *result; + +#ifdef NEED_MALLOC_GNU + if (n == 0) + n = 1; +#endif + + result = malloc (n); + +#if !HAVE_MALLOC_POSIX + if (result == NULL) + errno = ENOMEM; +#endif + + return result; +} diff --git a/lib/mbswidth.c b/lib/mbswidth.c new file mode 100644 index 0000000..3c54133 --- /dev/null +++ b/lib/mbswidth.c @@ -0,0 +1,175 @@ +/* Determine the number of screen columns needed for a string. + Copyright (C) 2000-2007 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 . */ + +/* Written by Bruno Haible . */ + +#include + +/* Specification. */ +#include "mbswidth.h" + +/* Get MB_CUR_MAX. */ +#include + +#include + +/* Get isprint(). */ +#include + +/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */ +#include + +/* Get iswcntrl(). */ +#include + +#ifndef mbsinit +# if !HAVE_MBSINIT +# define mbsinit(ps) 1 +# endif +#endif + +/* Returns the number of columns needed to represent the multibyte + character string pointed to by STRING. If a non-printable character + occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. + With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is + the multibyte analogue of the wcswidth function. + If STRING is not of length < INT_MAX / 2, integer overflow can occur. */ +int +mbswidth (const char *string, int flags) +{ + return mbsnwidth (string, strlen (string), flags); +} + +/* Returns the number of columns needed to represent the multibyte + character string pointed to by STRING of length NBYTES. If a + non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is + specified, -1 is returned. + If NBYTES is not < INT_MAX / 2, integer overflow can occur. */ +int +mbsnwidth (const char *string, size_t nbytes, int flags) +{ + const char *p = string; + const char *plimit = p + nbytes; + int width; + + width = 0; +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1) + { + while (p < plimit) + switch (*p) + { + case ' ': case '!': case '"': case '#': case '%': + case '&': case '\'': case '(': case ')': case '*': + case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': + case '?': + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': + case 'Z': + case '[': case '\\': case ']': case '^': case '_': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': + case 'z': case '{': case '|': case '}': case '~': + /* These characters are printable ASCII characters. */ + p++; + width++; + break; + default: + /* If we have a multibyte sequence, scan it up to its end. */ + { + mbstate_t mbstate; + memset (&mbstate, 0, sizeof mbstate); + do + { + wchar_t wc; + size_t bytes; + int w; + + bytes = mbrtowc (&wc, p, plimit - p, &mbstate); + + if (bytes == (size_t) -1) + /* An invalid multibyte sequence was encountered. */ + { + if (!(flags & MBSW_REJECT_INVALID)) + { + p++; + width++; + break; + } + else + return -1; + } + + if (bytes == (size_t) -2) + /* An incomplete multibyte character at the end. */ + { + if (!(flags & MBSW_REJECT_INVALID)) + { + p = plimit; + width++; + break; + } + else + return -1; + } + + if (bytes == 0) + /* A null wide character was encountered. */ + bytes = 1; + + w = wcwidth (wc); + if (w >= 0) + /* A printable multibyte character. */ + width += w; + else + /* An unprintable multibyte character. */ + if (!(flags & MBSW_REJECT_UNPRINTABLE)) + width += (iswcntrl (wc) ? 0 : 1); + else + return -1; + + p += bytes; + } + while (! mbsinit (&mbstate)); + } + break; + } + return width; + } +#endif + + while (p < plimit) + { + unsigned char c = (unsigned char) *p++; + + if (isprint (c)) + width++; + else if (!(flags & MBSW_REJECT_UNPRINTABLE)) + width += (iscntrl (c) ? 0 : 1); + else + return -1; + } + return width; +} diff --git a/lib/mbswidth.h b/lib/mbswidth.h new file mode 100644 index 0000000..15da406 --- /dev/null +++ b/lib/mbswidth.h @@ -0,0 +1,60 @@ +/* Determine the number of screen columns needed for a string. + Copyright (C) 2000-2004, 2007 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 . */ + +#include + +/* Avoid a clash of our mbswidth() with a function of the same name defined + in UnixWare 7.1.1 . We need this #include before the #define + below. + However, we don't want to #include on all platforms because + - Tru64 with Desktop Toolkit C has a bug: must be included before + . + - BSD/OS 4.1 has a bug: and must be included before + . */ +#if HAVE_DECL_MBSWIDTH_IN_WCHAR_H +# include +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Optional flags to influence mbswidth/mbsnwidth behavior. */ + +/* If this bit is set, return -1 upon finding an invalid or incomplete + character. Otherwise, assume invalid characters have width 1. */ +#define MBSW_REJECT_INVALID 1 + +/* If this bit is set, return -1 upon finding a non-printable character. + Otherwise, assume unprintable characters have width 0 if they are + control characters and 1 otherwise. */ +#define MBSW_REJECT_UNPRINTABLE 2 + + +/* Returns the number of screen columns needed for STRING. */ +#define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */ +extern int mbswidth (const char *string, int flags); + +/* Returns the number of screen columns needed for the NBYTES bytes + starting at BUF. */ +extern int mbsnwidth (const char *buf, size_t nbytes, int flags); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/obstack.c b/lib/obstack.c new file mode 100644 index 0000000..5b87466 --- /dev/null +++ b/lib/obstack.c @@ -0,0 +1,430 @@ +/* obstack.c - subroutines used implicitly by object stack macros + + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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 . */ + +#ifdef _LIBC +# include +# include +#else +# include +# include "obstack.h" +#endif + +/* NOTE BEFORE MODIFYING THIS FILE: This version number must be + incremented whenever callers compiled using an old obstack.h can no + longer properly call the functions in this obstack.c. */ +#define OBSTACK_INTERFACE_VERSION 1 + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself, and the installed library + supports the same library interface we do. This code is part of the GNU + C Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object + files, it is simpler to just do this in the source for each such file. */ + +#include /* Random thing to get __GNU_LIBRARY__. */ +#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 +# include +# if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION +# define ELIDE_CODE +# endif +#endif + +#include + +#ifndef ELIDE_CODE + +# include + +/* Determine default alignment. */ +union fooround +{ + uintmax_t i; + long double d; + void *p; +}; +struct fooalign +{ + char c; + union fooround u; +}; +/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. + But in fact it might be less smart and round addresses to as much as + DEFAULT_ROUNDING. So we prepare for it to do that. */ +enum + { + DEFAULT_ALIGNMENT = offsetof (struct fooalign, u), + DEFAULT_ROUNDING = sizeof (union fooround) + }; + +/* When we copy a long block of data, this is the unit to do it with. + On some machines, copying successive ints does not work; + in such a case, redefine COPYING_UNIT to `long' (if that works) + or `char' as a last resort. */ +# ifndef COPYING_UNIT +# define COPYING_UNIT int +# endif + + +/* The functions allocating more room by calling `obstack_chunk_alloc' + jump to the handler pointed to by `obstack_alloc_failed_handler'. + This can be set to a user defined function which should either + abort gracefully or use longjump - but shouldn't return. This + variable by default points to the internal function + `print_and_abort'. */ +static void print_and_abort (void); +void (*obstack_alloc_failed_handler) (void) = print_and_abort; + +/* Exit value used when `print_and_abort' is used. */ +# include +# ifdef _LIBC +int obstack_exit_failure = EXIT_FAILURE; +# else +# include "exitfail.h" +# define obstack_exit_failure exit_failure +# endif + +# ifdef _LIBC +# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) +/* A looong time ago (before 1994, anyway; we're not sure) this global variable + was used by non-GNU-C macros to avoid multiple evaluation. The GNU C + library still exports it because somebody might use it. */ +struct obstack *_obstack_compat; +compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); +# endif +# endif + +/* Define a macro that either calls functions with the traditional malloc/free + calling interface, or calls functions with the mmalloc/mfree interface + (that adds an extra first argument), based on the state of use_extra_arg. + For free, do not use ?:, since some compilers, like the MIPS compilers, + do not allow (expr) ? void : void. */ + +# define CALL_CHUNKFUN(h, size) \ + (((h) -> use_extra_arg) \ + ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ + : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) + +# define CALL_FREEFUN(h, old_chunk) \ + do { \ + if ((h) -> use_extra_arg) \ + (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ + else \ + (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ + } while (0) + + +/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). + Objects start on multiples of ALIGNMENT (0 means use default). + CHUNKFUN is the function to use to allocate chunks, + and FREEFUN the function to free them. + + Return nonzero if successful, calls obstack_alloc_failed_handler if + allocation fails. */ + +int +_obstack_begin (struct obstack *h, + int size, int alignment, + void *(*chunkfun) (long), + void (*freefun) (void *)) +{ + register struct _obstack_chunk *chunk; /* points to new chunk */ + + if (alignment == 0) + alignment = DEFAULT_ALIGNMENT; + if (size == 0) + /* Default size is what GNU malloc can fit in a 4096-byte block. */ + { + /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. + + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ + int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); + size = 4096 - extra; + } + + h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun; + h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; + h->chunk_size = size; + h->alignment_mask = alignment - 1; + h->use_extra_arg = 0; + + chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); + if (!chunk) + (*obstack_alloc_failed_handler) (); + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); + h->chunk_limit = chunk->limit + = (char *) chunk + h->chunk_size; + chunk->prev = 0; + /* The initial chunk now contains no empty object. */ + h->maybe_empty_object = 0; + h->alloc_failed = 0; + return 1; +} + +int +_obstack_begin_1 (struct obstack *h, int size, int alignment, + void *(*chunkfun) (void *, long), + void (*freefun) (void *, void *), + void *arg) +{ + register struct _obstack_chunk *chunk; /* points to new chunk */ + + if (alignment == 0) + alignment = DEFAULT_ALIGNMENT; + if (size == 0) + /* Default size is what GNU malloc can fit in a 4096-byte block. */ + { + /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. + + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ + int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); + size = 4096 - extra; + } + + h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun; + h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; + h->chunk_size = size; + h->alignment_mask = alignment - 1; + h->extra_arg = arg; + h->use_extra_arg = 1; + + chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); + if (!chunk) + (*obstack_alloc_failed_handler) (); + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); + h->chunk_limit = chunk->limit + = (char *) chunk + h->chunk_size; + chunk->prev = 0; + /* The initial chunk now contains no empty object. */ + h->maybe_empty_object = 0; + h->alloc_failed = 0; + return 1; +} + +/* Allocate a new current chunk for the obstack *H + on the assumption that LENGTH bytes need to be added + to the current object, or a new object of length LENGTH allocated. + Copies any partial object from the end of the old chunk + to the beginning of the new one. */ + +void +_obstack_newchunk (struct obstack *h, int length) +{ + register struct _obstack_chunk *old_chunk = h->chunk; + register struct _obstack_chunk *new_chunk; + register long new_size; + register long obj_size = h->next_free - h->object_base; + register long i; + long already; + char *object_base; + + /* Compute size for new chunk. */ + new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100; + if (new_size < h->chunk_size) + new_size = h->chunk_size; + + /* Allocate and initialize the new chunk. */ + new_chunk = CALL_CHUNKFUN (h, new_size); + if (!new_chunk) + (*obstack_alloc_failed_handler) (); + h->chunk = new_chunk; + new_chunk->prev = old_chunk; + new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; + + /* Compute an aligned object_base in the new chunk */ + object_base = + __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); + + /* Move the existing object to the new chunk. + Word at a time is fast and is safe if the object + is sufficiently aligned. */ + if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) + { + for (i = obj_size / sizeof (COPYING_UNIT) - 1; + i >= 0; i--) + ((COPYING_UNIT *)object_base)[i] + = ((COPYING_UNIT *)h->object_base)[i]; + /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, + but that can cross a page boundary on a machine + which does not do strict alignment for COPYING_UNITS. */ + already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); + } + else + already = 0; + /* Copy remaining bytes one by one. */ + for (i = already; i < obj_size; i++) + object_base[i] = h->object_base[i]; + + /* If the object just copied was the only data in OLD_CHUNK, + free that chunk and remove it from the chain. + But not if that chunk might contain an empty object. */ + if (! h->maybe_empty_object + && (h->object_base + == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, + h->alignment_mask))) + { + new_chunk->prev = old_chunk->prev; + CALL_FREEFUN (h, old_chunk); + } + + h->object_base = object_base; + h->next_free = h->object_base + obj_size; + /* The new chunk certainly contains no empty object yet. */ + h->maybe_empty_object = 0; +} +# ifdef _LIBC +libc_hidden_def (_obstack_newchunk) +# endif + +/* Return nonzero if object OBJ has been allocated from obstack H. + This is here for debugging. + If you use it in a program, you are probably losing. */ + +/* Suppress -Wmissing-prototypes warning. We don't want to declare this in + obstack.h because it is just for debugging. */ +int _obstack_allocated_p (struct obstack *h, void *obj); + +int +_obstack_allocated_p (struct obstack *h, void *obj) +{ + register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = (h)->chunk; + /* We use >= rather than > since the object cannot be exactly at + the beginning of the chunk but might be an empty object exactly + at the end of an adjacent chunk. */ + while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) + { + plp = lp->prev; + lp = plp; + } + return lp != 0; +} + +/* Free objects in obstack H, including OBJ and everything allocate + more recently than OBJ. If OBJ is zero, free everything in H. */ + +# undef obstack_free + +void +__obstack_free (struct obstack *h, void *obj) +{ + register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = h->chunk; + /* We use >= because there cannot be an object at the beginning of a chunk. + But there can be an empty object at that address + at the end of another chunk. */ + while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) + { + plp = lp->prev; + CALL_FREEFUN (h, lp); + lp = plp; + /* If we switch chunks, we can't tell whether the new current + chunk contains an empty object, so assume that it may. */ + h->maybe_empty_object = 1; + } + if (lp) + { + h->object_base = h->next_free = (char *) (obj); + h->chunk_limit = lp->limit; + h->chunk = lp; + } + else if (obj != 0) + /* obj is not in any of the chunks! */ + abort (); +} + +# ifdef _LIBC +/* Older versions of libc used a function _obstack_free intended to be + called by non-GCC compilers. */ +strong_alias (obstack_free, _obstack_free) +# endif + +int +_obstack_memory_used (struct obstack *h) +{ + register struct _obstack_chunk* lp; + register int nbytes = 0; + + for (lp = h->chunk; lp != 0; lp = lp->prev) + { + nbytes += lp->limit - (char *) lp; + } + return nbytes; +} + +/* Define the error handler. */ +# ifdef _LIBC +# include +# else +# include "gettext.h" +# endif +# ifndef _ +# define _(msgid) gettext (msgid) +# endif + +# ifdef _LIBC +# include +# endif + +# ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# define __attribute__(Spec) /* empty */ +# endif +# endif + +static void +__attribute__ ((noreturn)) +print_and_abort (void) +{ + /* Don't change any of these strings. Yes, it would be possible to add + the newline to the string and use fputs or so. But this must not + happen because the "memory exhausted" message appears in other places + like this and the translation should be reused instead of creating + a very similar string which requires a separate translation. */ +# ifdef _LIBC + (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); +# else + fprintf (stderr, "%s\n", _("memory exhausted")); +# endif + exit (obstack_exit_failure); +} + +#endif /* !ELIDE_CODE */ diff --git a/lib/obstack.h b/lib/obstack.h new file mode 100644 index 0000000..1bf4b2f --- /dev/null +++ b/lib/obstack.h @@ -0,0 +1,512 @@ +/* obstack.h - object stack macros + Copyright (C) 1988-1994,1996-1999,2003,2004,2005,2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +/* Summary: + +All the apparent functions defined here are macros. The idea +is that you would use these pre-tested macros to solve a +very specific set of problems, and they would run fast. +Caution: no side-effects in arguments please!! They may be +evaluated MANY times!! + +These macros operate a stack of objects. Each object starts life +small, and may grow to maturity. (Consider building a word syllable +by syllable.) An object can move while it is growing. Once it has +been "finished" it never changes address again. So the "top of the +stack" is typically an immature growing object, while the rest of the +stack is of mature, fixed size and fixed address objects. + +These routines grab large chunks of memory, using a function you +supply, called `obstack_chunk_alloc'. On occasion, they free chunks, +by calling `obstack_chunk_free'. You must define them and declare +them before using any obstack macros. + +Each independent stack is represented by a `struct obstack'. +Each of the obstack macros expects a pointer to such a structure +as the first argument. + +One motivation for this package is the problem of growing char strings +in symbol tables. Unless you are "fascist pig with a read-only mind" +--Gosper's immortal quote from HAKMEM item 154, out of context--you +would not like to put any arbitrary upper limit on the length of your +symbols. + +In practice this often means you will build many short symbols and a +few long symbols. At the time you are reading a symbol you don't know +how long it is. One traditional method is to read a symbol into a +buffer, realloc()ating the buffer every time you try to read a symbol +that is longer than the buffer. This is beaut, but you still will +want to copy the symbol from the buffer to a more permanent +symbol-table entry say about half the time. + +With obstacks, you can work differently. Use one obstack for all symbol +names. As you read a symbol, grow the name in the obstack gradually. +When the name is complete, finalize it. Then, if the symbol exists already, +free the newly read name. + +The way we do this is to take a large chunk, allocating memory from +low addresses. When you want to build a symbol in the chunk you just +add chars above the current "high water mark" in the chunk. When you +have finished adding chars, because you got to the end of the symbol, +you know how long the chars are, and you can create a new object. +Mostly the chars will not burst over the highest address of the chunk, +because you would typically expect a chunk to be (say) 100 times as +long as an average object. + +In case that isn't clear, when we have enough chars to make up +the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) +so we just point to it where it lies. No moving of chars is +needed and this is the second win: potentially long strings need +never be explicitly shuffled. Once an object is formed, it does not +change its address during its lifetime. + +When the chars burst over a chunk boundary, we allocate a larger +chunk, and then copy the partly formed object from the end of the old +chunk to the beginning of the new larger chunk. We then carry on +accreting characters to the end of the object as we normally would. + +A special macro is provided to add a single char at a time to a +growing object. This allows the use of register variables, which +break the ordinary 'growth' macro. + +Summary: + We allocate large chunks. + We carve out one object at a time from the current chunk. + Once carved, an object never moves. + We are free to append data of any size to the currently + growing object. + Exactly one object is growing in an obstack at any one time. + You can run one obstack per control block. + You may have as many control blocks as you dare. + Because of the way we do it, you can `unwind' an obstack + back to a previous state. (You may remove objects much + as you would with a stack.) +*/ + + +/* Don't do the contents of this file more than once. */ + +#ifndef _OBSTACK_H +#define _OBSTACK_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is + defined, as with GNU C, use that; that way we don't pollute the + namespace with 's symbols. Otherwise, include + and use ptrdiff_t. */ + +#ifdef __PTRDIFF_TYPE__ +# define PTR_INT_TYPE __PTRDIFF_TYPE__ +#else +# include +# define PTR_INT_TYPE ptrdiff_t +#endif + +/* If B is the base of an object addressed by P, return the result of + aligning P to the next multiple of A + 1. B and P must be of type + char *. A + 1 must be a power of 2. */ + +#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) + +/* Similiar to _BPTR_ALIGN (B, P, A), except optimize the common case + where pointers can be converted to integers, aligned as integers, + and converted back again. If PTR_INT_TYPE is narrower than a + pointer (e.g., the AS/400), play it safe and compute the alignment + relative to B. Otherwise, use the faster strategy of computing the + alignment relative to 0. */ + +#define __PTR_ALIGN(B, P, A) \ + __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \ + P, A) + +#include + +struct _obstack_chunk /* Lives at front of each chunk. */ +{ + char *limit; /* 1 past end of this chunk */ + struct _obstack_chunk *prev; /* address of prior chunk or NULL */ + char contents[4]; /* objects begin here */ +}; + +struct obstack /* control current object in current chunk */ +{ + long chunk_size; /* preferred size to allocate chunks in */ + struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ + char *object_base; /* address of object we are building */ + char *next_free; /* where to add next char to current object */ + char *chunk_limit; /* address of char after current chunk */ + union + { + PTR_INT_TYPE tempint; + void *tempptr; + } temp; /* Temporary for some macros. */ + int alignment_mask; /* Mask of alignment for each object. */ + /* These prototypes vary based on `use_extra_arg', and we use + casts to the prototypeless function type in all assignments, + but having prototypes here quiets -Wstrict-prototypes. */ + struct _obstack_chunk *(*chunkfun) (void *, long); + void (*freefun) (void *, struct _obstack_chunk *); + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ + unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ + unsigned maybe_empty_object:1;/* There is a possibility that the current + chunk contains a zero-length object. This + prevents freeing the chunk if we allocate + a bigger chunk to replace it. */ + unsigned alloc_failed:1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ +}; + +/* Declare the external functions we use; they are in obstack.c. */ + +extern void _obstack_newchunk (struct obstack *, int); +extern int _obstack_begin (struct obstack *, int, int, + void *(*) (long), void (*) (void *)); +extern int _obstack_begin_1 (struct obstack *, int, int, + void *(*) (void *, long), + void (*) (void *, void *), void *); +extern int _obstack_memory_used (struct obstack *); + +/* The default name of the function for freeing a chunk is 'obstack_free', + but gnulib users can override this by defining '__obstack_free'. */ +#ifndef __obstack_free +# define __obstack_free obstack_free +#endif +extern void __obstack_free (struct obstack *obstack, void *block); + + +/* Error handler called when `obstack_chunk_alloc' failed to allocate + more memory. This can be set to a user defined function which + should either abort gracefully or use longjump - but shouldn't + return. The default action is to print a message and abort. */ +extern void (*obstack_alloc_failed_handler) (void); + +/* Exit value used when `print_and_abort' is used. */ +extern int obstack_exit_failure; + +/* Pointer to beginning of object being allocated or to be allocated next. + Note that this might not be the final address of the object + because a new chunk might be needed to hold the final size. */ + +#define obstack_base(h) ((void *) (h)->object_base) + +/* Size for allocating ordinary chunks. */ + +#define obstack_chunk_size(h) ((h)->chunk_size) + +/* Pointer to next byte not yet allocated in current chunk. */ + +#define obstack_next_free(h) ((h)->next_free) + +/* Mask specifying low bits that should be clear in address of an object. */ + +#define obstack_alignment_mask(h) ((h)->alignment_mask) + +/* To prevent prototype warnings provide complete argument list. */ +#define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + (void *(*) (long)) obstack_chunk_alloc, \ + (void (*) (void *)) obstack_chunk_free) + +#define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + (void *(*) (long)) obstack_chunk_alloc, \ + (void (*) (void *)) obstack_chunk_free) + +#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + (void *(*) (long)) (chunkfun), \ + (void (*) (void *)) (freefun)) + +#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + (void *(*) (void *, long)) (chunkfun), \ + (void (*) (void *, void *)) (freefun), (arg)) + +#define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) + +#define obstack_freefun(h, newfreefun) \ + ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) + +#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) + +#define obstack_blank_fast(h,n) ((h)->next_free += (n)) + +#define obstack_memory_used(h) _obstack_memory_used (h) + +#if defined __GNUC__ && defined __STDC__ && __STDC__ +/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ +# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) +# define __extension__ +# endif + +/* For GNU C, if not -traditional, + we can define these macros to compute all args only once + without using a global variable. + Also, we can avoid using the `temp' slot, to make faster code. */ + +# define obstack_object_size(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (unsigned) (__o->next_free - __o->object_base); }) + +# define obstack_room(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (unsigned) (__o->chunk_limit - __o->next_free); }) + +# define obstack_make_room(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->chunk_limit - __o->next_free < __len) \ + _obstack_newchunk (__o, __len); \ + (void) 0; }) + +# define obstack_empty_p(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (__o->chunk->prev == 0 \ + && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ + __o->chunk->contents, \ + __o->alignment_mask)); }) + +# define obstack_grow(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->next_free + __len > __o->chunk_limit) \ + _obstack_newchunk (__o, __len); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_grow0(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->next_free + __len + 1 > __o->chunk_limit) \ + _obstack_newchunk (__o, __len + 1); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + *(__o->next_free)++ = 0; \ + (void) 0; }) + +# define obstack_1grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + 1 > __o->chunk_limit) \ + _obstack_newchunk (__o, 1); \ + obstack_1grow_fast (__o, datum); \ + (void) 0; }) + +/* These assume that the obstack alignment is good enough for pointers + or ints, and that the data added so far to the current object + shares that much alignment. */ + +# define obstack_ptr_grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ + _obstack_newchunk (__o, sizeof (void *)); \ + obstack_ptr_grow_fast (__o, datum); }) \ + +# define obstack_int_grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + sizeof (int) > __o->chunk_limit) \ + _obstack_newchunk (__o, sizeof (int)); \ + obstack_int_grow_fast (__o, datum); }) + +# define obstack_ptr_grow_fast(OBSTACK,aptr) \ +__extension__ \ +({ struct obstack *__o1 = (OBSTACK); \ + *(const void **) __o1->next_free = (aptr); \ + __o1->next_free += sizeof (const void *); \ + (void) 0; }) + +# define obstack_int_grow_fast(OBSTACK,aint) \ +__extension__ \ +({ struct obstack *__o1 = (OBSTACK); \ + *(int *) __o1->next_free = (aint); \ + __o1->next_free += sizeof (int); \ + (void) 0; }) + +# define obstack_blank(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->chunk_limit - __o->next_free < __len) \ + _obstack_newchunk (__o, __len); \ + obstack_blank_fast (__o, __len); \ + (void) 0; }) + +# define obstack_alloc(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_blank (__h, (length)); \ + obstack_finish (__h); }) + +# define obstack_copy(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_grow (__h, (where), (length)); \ + obstack_finish (__h); }) + +# define obstack_copy0(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_grow0 (__h, (where), (length)); \ + obstack_finish (__h); }) + +/* The local variable is named __o1 to avoid a name conflict + when obstack_blank is called. */ +# define obstack_finish(OBSTACK) \ +__extension__ \ +({ struct obstack *__o1 = (OBSTACK); \ + void *__value = (void *) __o1->object_base; \ + if (__o1->next_free == __value) \ + __o1->maybe_empty_object = 1; \ + __o1->next_free \ + = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ + __o1->alignment_mask); \ + if (__o1->next_free - (char *)__o1->chunk \ + > __o1->chunk_limit - (char *)__o1->chunk) \ + __o1->next_free = __o1->chunk_limit; \ + __o1->object_base = __o1->next_free; \ + __value; }) + +# define obstack_free(OBSTACK, OBJ) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + void *__obj = (OBJ); \ + if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ + __o->next_free = __o->object_base = (char *)__obj; \ + else (__obstack_free) (__o, __obj); }) + +#else /* not __GNUC__ or not __STDC__ */ + +# define obstack_object_size(h) \ + (unsigned) ((h)->next_free - (h)->object_base) + +# define obstack_room(h) \ + (unsigned) ((h)->chunk_limit - (h)->next_free) + +# define obstack_empty_p(h) \ + ((h)->chunk->prev == 0 \ + && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ + (h)->chunk->contents, \ + (h)->alignment_mask)) + +/* Note that the call to _obstack_newchunk is enclosed in (..., 0) + so that we can avoid having void expressions + in the arms of the conditional expression. + Casting the third operand to void was tried before, + but some compilers won't accept it. */ + +# define obstack_make_room(h,length) \ +( (h)->temp.tempint = (length), \ + (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0)) + +# define obstack_grow(h,where,length) \ +( (h)->temp.tempint = (length), \ + (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.tempint), \ + (h)->next_free += (h)->temp.tempint) + +# define obstack_grow0(h,where,length) \ +( (h)->temp.tempint = (length), \ + (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.tempint), \ + (h)->next_free += (h)->temp.tempint, \ + *((h)->next_free)++ = 0) + +# define obstack_1grow(h,datum) \ +( (((h)->next_free + 1 > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), 1), 0) : 0), \ + obstack_1grow_fast (h, datum)) + +# define obstack_ptr_grow(h,datum) \ +( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ + obstack_ptr_grow_fast (h, datum)) + +# define obstack_int_grow(h,datum) \ +( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ + obstack_int_grow_fast (h, datum)) + +# define obstack_ptr_grow_fast(h,aptr) \ + (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) + +# define obstack_int_grow_fast(h,aint) \ + (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint)) + +# define obstack_blank(h,length) \ +( (h)->temp.tempint = (length), \ + (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \ + ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ + obstack_blank_fast (h, (h)->temp.tempint)) + +# define obstack_alloc(h,length) \ + (obstack_blank ((h), (length)), obstack_finish ((h))) + +# define obstack_copy(h,where,length) \ + (obstack_grow ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_copy0(h,where,length) \ + (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_finish(h) \ +( ((h)->next_free == (h)->object_base \ + ? (((h)->maybe_empty_object = 1), 0) \ + : 0), \ + (h)->temp.tempptr = (h)->object_base, \ + (h)->next_free \ + = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ + (h)->alignment_mask), \ + (((h)->next_free - (char *) (h)->chunk \ + > (h)->chunk_limit - (char *) (h)->chunk) \ + ? ((h)->next_free = (h)->chunk_limit) : 0), \ + (h)->object_base = (h)->next_free, \ + (h)->temp.tempptr) + +# define obstack_free(h,obj) \ +( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \ + ((((h)->temp.tempint > 0 \ + && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \ + ? (int) ((h)->next_free = (h)->object_base \ + = (h)->temp.tempint + (char *) (h)->chunk) \ + : (((__obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0))) + +#endif /* not __GNUC__ or not __STDC__ */ + +#ifdef __cplusplus +} /* C++ */ +#endif + +#endif /* obstack.h */ diff --git a/lib/pipe-safer.c b/lib/pipe-safer.c new file mode 100644 index 0000000..0fc6850 --- /dev/null +++ b/lib/pipe-safer.c @@ -0,0 +1,56 @@ +/* Invoke pipe, but avoid some glitches. + Copyright (C) 2005, 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 . */ + +/* Written by Jim Meyering. */ + +#include + +#include "unistd-safer.h" + +#include +#include + +/* Like pipe, but ensure that neither of the file descriptors is + STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. Fail with ENOSYS on + platforms that lack pipe. */ + +int +pipe_safer (int fd[2]) +{ +#if HAVE_PIPE + if (pipe (fd) == 0) + { + int i; + for (i = 0; i < 2; i++) + { + fd[i] = fd_safer (fd[i]); + if (fd[i] < 0) + { + int e = errno; + close (fd[1 - i]); + errno = e; + return -1; + } + } + + return 0; + } +#else + errno = ENOSYS; +#endif + + return -1; +} diff --git a/lib/quote.c b/lib/quote.c new file mode 100644 index 0000000..5e8b764 --- /dev/null +++ b/lib/quote.c @@ -0,0 +1,40 @@ +/* quote.c - quote arguments for output + + Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005, 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 . */ + +/* Written by Paul Eggert */ + +#include + +#include "quotearg.h" +#include "quote.h" + +/* Return an unambiguous printable representation of NAME, + allocated in slot N, suitable for diagnostics. */ +char const * +quote_n (int n, char const *name) +{ + return quotearg_n_style (n, locale_quoting_style, name); +} + +/* Return an unambiguous printable representation of NAME, + suitable for diagnostics. */ +char const * +quote (char const *name) +{ + return quote_n (0, name); +} diff --git a/lib/quote.h b/lib/quote.h new file mode 100644 index 0000000..c3660b1 --- /dev/null +++ b/lib/quote.h @@ -0,0 +1,21 @@ +/* quote.h - prototypes for quote.c + + Copyright (C) 1998, 1999, 2000, 2001, 2003 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 . */ + + +char const *quote_n (int n, char const *name); +char const *quote (char const *name); diff --git a/lib/quotearg.c b/lib/quotearg.c new file mode 100644 index 0000000..75fbc72 --- /dev/null +++ b/lib/quotearg.c @@ -0,0 +1,816 @@ +/* quotearg.c - quote arguments for output + + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 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 . */ + +/* Written by Paul Eggert */ + +#include + +#include "quotearg.h" + +#include "xalloc.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + +#if !HAVE_MBRTOWC +/* Disable multibyte processing entirely. Since MB_CUR_MAX is 1, the + other macros are defined only for documentation and to satisfy C + syntax. */ +# undef MB_CUR_MAX +# define MB_CUR_MAX 1 +# undef mbstate_t +# define mbstate_t int +# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0) +# define iswprint(wc) isprint ((unsigned char) (wc)) +# undef HAVE_MBSINIT +#endif + +#if !defined mbsinit && !HAVE_MBSINIT +# define mbsinit(ps) 1 +#endif + +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + +#define INT_BITS (sizeof (int) * CHAR_BIT) + +struct quoting_options +{ + /* Basic quoting style. */ + enum quoting_style style; + + /* Additional flags. Bitwise combination of enum quoting_flags. */ + int flags; + + /* Quote the characters indicated by this bit vector even if the + quoting style would not normally require them to be quoted. */ + unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1]; +}; + +/* Names of quoting styles. */ +char const *const quoting_style_args[] = +{ + "literal", + "shell", + "shell-always", + "c", + "c-maybe", + "escape", + "locale", + "clocale", + 0 +}; + +/* Correspondences to quoting style names. */ +enum quoting_style const quoting_style_vals[] = +{ + literal_quoting_style, + shell_quoting_style, + shell_always_quoting_style, + c_quoting_style, + c_maybe_quoting_style, + escape_quoting_style, + locale_quoting_style, + clocale_quoting_style +}; + +/* The default quoting options. */ +static struct quoting_options default_quoting_options; + +/* Allocate a new set of quoting options, with contents initially identical + to O if O is not null, or to the default if O is null. + It is the caller's responsibility to free the result. */ +struct quoting_options * +clone_quoting_options (struct quoting_options *o) +{ + int e = errno; + struct quoting_options *p = xmemdup (o ? o : &default_quoting_options, + sizeof *o); + errno = e; + return p; +} + +/* Get the value of O's quoting style. If O is null, use the default. */ +enum quoting_style +get_quoting_style (struct quoting_options *o) +{ + return (o ? o : &default_quoting_options)->style; +} + +/* In O (or in the default if O is null), + set the value of the quoting style to S. */ +void +set_quoting_style (struct quoting_options *o, enum quoting_style s) +{ + (o ? o : &default_quoting_options)->style = s; +} + +/* In O (or in the default if O is null), + set the value of the quoting options for character C to I. + Return the old value. Currently, the only values defined for I are + 0 (the default) and 1 (which means to quote the character even if + it would not otherwise be quoted). */ +int +set_char_quoting (struct quoting_options *o, char c, int i) +{ + unsigned char uc = c; + unsigned int *p = + (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS; + int shift = uc % INT_BITS; + int r = (*p >> shift) & 1; + *p ^= ((i & 1) ^ r) << shift; + return r; +} + +/* In O (or in the default if O is null), + set the value of the quoting options flag to I, which can be a + bitwise combination of enum quoting_flags, or 0 for default + behavior. Return the old value. */ +int +set_quoting_flags (struct quoting_options *o, int i) +{ + int r; + if (!o) + o = &default_quoting_options; + r = o->flags; + o->flags = i; + return r; +} + +/* Return quoting options for STYLE, with no extra quoting. */ +static struct quoting_options +quoting_options_from_style (enum quoting_style style) +{ + struct quoting_options o; + o.style = style; + o.flags = 0; + memset (o.quote_these_too, 0, sizeof o.quote_these_too); + return o; +} + +/* MSGID approximates a quotation mark. Return its translation if it + has one; otherwise, return either it or "\"", depending on S. */ +static char const * +gettext_quote (char const *msgid, enum quoting_style s) +{ + char const *translation = _(msgid); + if (translation == msgid && s == clocale_quoting_style) + translation = "\""; + return translation; +} + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using QUOTING_STYLE, FLAGS, and + QUOTE_THESE_TOO to control quoting. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE. + + This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG, + ARGSIZE, O), except it breaks O into its component pieces and is + not careful about errno. */ + +static size_t +quotearg_buffer_restyled (char *buffer, size_t buffersize, + char const *arg, size_t argsize, + enum quoting_style quoting_style, int flags, + unsigned int const *quote_these_too) +{ + size_t i; + size_t len = 0; + char const *quote_string = 0; + size_t quote_string_len = 0; + bool backslash_escapes = false; + bool unibyte_locale = MB_CUR_MAX == 1; + bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0; + +#define STORE(c) \ + do \ + { \ + if (len < buffersize) \ + buffer[len] = (c); \ + len++; \ + } \ + while (0) + + switch (quoting_style) + { + case c_maybe_quoting_style: + quoting_style = c_quoting_style; + elide_outer_quotes = true; + /* Fall through. */ + case c_quoting_style: + if (!elide_outer_quotes) + STORE ('"'); + backslash_escapes = true; + quote_string = "\""; + quote_string_len = 1; + break; + + case escape_quoting_style: + backslash_escapes = true; + elide_outer_quotes = false; + break; + + case locale_quoting_style: + case clocale_quoting_style: + { + /* TRANSLATORS: + Get translations for open and closing quotation marks. + + The message catalog should translate "`" to a left + quotation mark suitable for the locale, and similarly for + "'". If the catalog has no translation, + locale_quoting_style quotes `like this', and + clocale_quoting_style quotes "like this". + + For example, an American English Unicode locale should + translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and + should translate "'" to U+201D (RIGHT DOUBLE QUOTATION + MARK). A British English Unicode locale should instead + translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and + U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. + + If you don't know what to put here, please see + + and use glyphs suitable for your language. */ + + char const *left = gettext_quote (N_("`"), quoting_style); + char const *right = gettext_quote (N_("'"), quoting_style); + if (!elide_outer_quotes) + for (quote_string = left; *quote_string; quote_string++) + STORE (*quote_string); + backslash_escapes = true; + quote_string = right; + quote_string_len = strlen (quote_string); + } + break; + + case shell_quoting_style: + quoting_style = shell_always_quoting_style; + elide_outer_quotes = true; + /* Fall through. */ + case shell_always_quoting_style: + if (!elide_outer_quotes) + STORE ('\''); + quote_string = "'"; + quote_string_len = 1; + break; + + case literal_quoting_style: + elide_outer_quotes = false; + break; + + default: + abort (); + } + + for (i = 0; ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize); i++) + { + unsigned char c; + unsigned char esc; + + if (backslash_escapes + && quote_string_len + && i + quote_string_len <= argsize + && memcmp (arg + i, quote_string, quote_string_len) == 0) + { + if (elide_outer_quotes) + goto force_outer_quoting_style; + STORE ('\\'); + } + + c = arg[i]; + switch (c) + { + case '\0': + if (backslash_escapes) + { + if (elide_outer_quotes) + goto force_outer_quoting_style; + STORE ('\\'); + if (i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9') + { + STORE ('0'); + STORE ('0'); + } + c = '0'; + } + else if (flags & QA_ELIDE_NULL_BYTES) + continue; + break; + + case '?': + switch (quoting_style) + { + case shell_always_quoting_style: + if (elide_outer_quotes) + goto force_outer_quoting_style; + break; + + case c_quoting_style: + if ((flags & QA_SPLIT_TRIGRAPHS) + && i + 2 < argsize && arg[i + 1] == '?') + switch (arg[i + 2]) + { + case '!': case '\'': + case '(': case ')': case '-': case '/': + case '<': case '=': case '>': + /* Escape the second '?' in what would otherwise be + a trigraph. */ + if (elide_outer_quotes) + goto force_outer_quoting_style; + c = arg[i + 2]; + i += 2; + STORE ('?'); + STORE ('"'); + STORE ('"'); + STORE ('?'); + break; + + default: + break; + } + break; + + default: + break; + } + break; + + case '\a': esc = 'a'; goto c_escape; + case '\b': esc = 'b'; goto c_escape; + case '\f': esc = 'f'; goto c_escape; + case '\n': esc = 'n'; goto c_and_shell_escape; + case '\r': esc = 'r'; goto c_and_shell_escape; + case '\t': esc = 't'; goto c_and_shell_escape; + case '\v': esc = 'v'; goto c_escape; + case '\\': esc = c; + /* No need to escape the escape if we are trying to elide + outer quotes and nothing else is problematic. */ + if (backslash_escapes && elide_outer_quotes && quote_string_len) + goto store_c; + + c_and_shell_escape: + if (quoting_style == shell_always_quoting_style + && elide_outer_quotes) + goto force_outer_quoting_style; + /* Fall through. */ + c_escape: + if (backslash_escapes) + { + c = esc; + goto store_escape; + } + break; + + case '{': case '}': /* sometimes special if isolated */ + if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1)) + break; + /* Fall through. */ + case '#': case '~': + if (i != 0) + break; + /* Fall through. */ + case ' ': + case '!': /* special in bash */ + case '"': case '$': case '&': + case '(': case ')': case '*': case ';': + case '<': + case '=': /* sometimes special in 0th or (with "set -k") later args */ + case '>': case '[': + case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */ + case '`': case '|': + /* A shell special character. In theory, '$' and '`' could + be the first bytes of multibyte characters, which means + we should check them with mbrtowc, but in practice this + doesn't happen so it's not worth worrying about. */ + if (quoting_style == shell_always_quoting_style + && elide_outer_quotes) + goto force_outer_quoting_style; + break; + + case '\'': + if (quoting_style == shell_always_quoting_style) + { + if (elide_outer_quotes) + goto force_outer_quoting_style; + STORE ('\''); + STORE ('\\'); + STORE ('\''); + } + break; + + case '%': case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': case ':': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': case ']': case '_': case 'a': case 'b': + case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': + case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': + case 'o': case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': + /* These characters don't cause problems, no matter what the + quoting style is. They cannot start multibyte sequences. */ + break; + + default: + /* If we have a multibyte sequence, copy it until we reach + its end, find an error, or come back to the initial shift + state. For C-like styles, if the sequence has + unprintable characters, escape the whole sequence, since + we can't easily escape single characters within it. */ + { + /* Length of multibyte sequence found so far. */ + size_t m; + + bool printable; + + if (unibyte_locale) + { + m = 1; + printable = isprint (c) != 0; + } + else + { + mbstate_t mbstate; + memset (&mbstate, 0, sizeof mbstate); + + m = 0; + printable = true; + if (argsize == SIZE_MAX) + argsize = strlen (arg); + + do + { + wchar_t w; + size_t bytes = mbrtowc (&w, &arg[i + m], + argsize - (i + m), &mbstate); + if (bytes == 0) + break; + else if (bytes == (size_t) -1) + { + printable = false; + break; + } + else if (bytes == (size_t) -2) + { + printable = false; + while (i + m < argsize && arg[i + m]) + m++; + break; + } + else + { + /* Work around a bug with older shells that "see" a '\' + that is really the 2nd byte of a multibyte character. + In practice the problem is limited to ASCII + chars >= '@' that are shell special chars. */ + if ('[' == 0x5b && elide_outer_quotes + && quoting_style == shell_always_quoting_style) + { + size_t j; + for (j = 1; j < bytes; j++) + switch (arg[i + m + j]) + { + case '[': case '\\': case '^': + case '`': case '|': + goto force_outer_quoting_style; + + default: + break; + } + } + + if (! iswprint (w)) + printable = false; + m += bytes; + } + } + while (! mbsinit (&mbstate)); + } + + if (1 < m || (backslash_escapes && ! printable)) + { + /* Output a multibyte sequence, or an escaped + unprintable unibyte character. */ + size_t ilim = i + m; + + for (;;) + { + if (backslash_escapes && ! printable) + { + if (elide_outer_quotes) + goto force_outer_quoting_style; + STORE ('\\'); + STORE ('0' + (c >> 6)); + STORE ('0' + ((c >> 3) & 7)); + c = '0' + (c & 7); + } + if (ilim <= i + 1) + break; + STORE (c); + c = arg[++i]; + } + + goto store_c; + } + } + } + + if (! ((backslash_escapes || elide_outer_quotes) + && quote_these_too + && quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))) + goto store_c; + + store_escape: + if (elide_outer_quotes) + goto force_outer_quoting_style; + STORE ('\\'); + + store_c: + STORE (c); + } + + if (len == 0 && quoting_style == shell_always_quoting_style + && elide_outer_quotes) + goto force_outer_quoting_style; + + if (quote_string && !elide_outer_quotes) + for (; *quote_string; quote_string++) + STORE (*quote_string); + + if (len < buffersize) + buffer[len] = '\0'; + return len; + + force_outer_quoting_style: + /* Don't reuse quote_these_too, since the addition of outer quotes + sufficiently quotes the specified characters. */ + return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, + quoting_style, + flags & ~QA_ELIDE_OUTER_QUOTES, NULL); +} + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using O to control quoting. + If O is null, use the default. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is SIZE_MAX, use the string length of the argument for + ARGSIZE. */ +size_t +quotearg_buffer (char *buffer, size_t buffersize, + char const *arg, size_t argsize, + struct quoting_options const *o) +{ + struct quoting_options const *p = o ? o : &default_quoting_options; + int e = errno; + size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize, + p->style, p->flags, p->quote_these_too); + errno = e; + return r; +} + +/* Equivalent to quotearg_alloc (ARG, ARGSIZE, NULL, O). */ +char * +quotearg_alloc (char const *arg, size_t argsize, + struct quoting_options const *o) +{ + return quotearg_alloc_mem (arg, argsize, NULL, o); +} + +/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly + allocated storage containing the quoted string, and store the + resulting size into *SIZE, if non-NULL. The result can contain + embedded null bytes only if ARGSIZE is not SIZE_MAX, SIZE is not + NULL, and set_quoting_flags has not set the null byte elision + flag. */ +char * +quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size, + struct quoting_options const *o) +{ + struct quoting_options const *p = o ? o : &default_quoting_options; + int e = errno; + /* Elide embedded null bytes if we can't return a size. */ + int flags = p->flags | (size ? 0 : QA_ELIDE_NULL_BYTES); + size_t bufsize = quotearg_buffer_restyled (0, 0, arg, argsize, p->style, + flags, p->quote_these_too) + 1; + char *buf = xcharalloc (bufsize); + quotearg_buffer_restyled (buf, bufsize, arg, argsize, p->style, flags, + p->quote_these_too); + errno = e; + if (size) + *size = bufsize - 1; + return buf; +} + +/* A storage slot with size and pointer to a value. */ +struct slotvec +{ + size_t size; + char *val; +}; + +/* Preallocate a slot 0 buffer, so that the caller can always quote + one small component of a "memory exhausted" message in slot 0. */ +static char slot0[256]; +static unsigned int nslots = 1; +static struct slotvec slotvec0 = {sizeof slot0, slot0}; +static struct slotvec *slotvec = &slotvec0; + +void +quotearg_free (void) +{ + struct slotvec *sv = slotvec; + unsigned int i; + for (i = 1; i < nslots; i++) + free (sv[i].val); + if (sv[0].val != slot0) + { + free (sv[0].val); + slotvec0.size = sizeof slot0; + slotvec0.val = slot0; + } + if (sv != &slotvec0) + { + free (sv); + slotvec = &slotvec0; + } + nslots = 1; +} + +/* Use storage slot N to return a quoted version of argument ARG. + ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a + null-terminated string. + OPTIONS specifies the quoting options. + The returned value points to static storage that can be + reused by the next call to this function with the same value of N. + N must be nonnegative. N is deliberately declared with type "int" + to allow for future extensions (using negative values). */ +static char * +quotearg_n_options (int n, char const *arg, size_t argsize, + struct quoting_options const *options) +{ + int e = errno; + + unsigned int n0 = n; + struct slotvec *sv = slotvec; + + if (n < 0) + abort (); + + if (nslots <= n0) + { + /* FIXME: technically, the type of n1 should be `unsigned int', + but that evokes an unsuppressible warning from gcc-4.0.1 and + older. If gcc ever provides an option to suppress that warning, + revert to the original type, so that the test in xalloc_oversized + is once again performed only at compile time. */ + size_t n1 = n0 + 1; + bool preallocated = (sv == &slotvec0); + + if (xalloc_oversized (n1, sizeof *sv)) + xalloc_die (); + + slotvec = sv = xrealloc (preallocated ? NULL : sv, n1 * sizeof *sv); + if (preallocated) + *sv = slotvec0; + memset (sv + nslots, 0, (n1 - nslots) * sizeof *sv); + nslots = n1; + } + + { + size_t size = sv[n].size; + char *val = sv[n].val; + /* Elide embedded null bytes since we don't return a size. */ + int flags = options->flags | QA_ELIDE_NULL_BYTES; + size_t qsize = quotearg_buffer_restyled (val, size, arg, argsize, + options->style, flags, + options->quote_these_too); + + if (size <= qsize) + { + sv[n].size = size = qsize + 1; + if (val != slot0) + free (val); + sv[n].val = val = xcharalloc (size); + quotearg_buffer_restyled (val, size, arg, argsize, options->style, + flags, options->quote_these_too); + } + + errno = e; + return val; + } +} + +char * +quotearg_n (int n, char const *arg) +{ + return quotearg_n_options (n, arg, SIZE_MAX, &default_quoting_options); +} + +char * +quotearg_n_mem (int n, char const *arg, size_t argsize) +{ + return quotearg_n_options (n, arg, argsize, &default_quoting_options); +} + +char * +quotearg (char const *arg) +{ + return quotearg_n (0, arg); +} + +char * +quotearg_mem (char const *arg, size_t argsize) +{ + return quotearg_n_mem (0, arg, argsize); +} + +char * +quotearg_n_style (int n, enum quoting_style s, char const *arg) +{ + struct quoting_options const o = quoting_options_from_style (s); + return quotearg_n_options (n, arg, SIZE_MAX, &o); +} + +char * +quotearg_n_style_mem (int n, enum quoting_style s, + char const *arg, size_t argsize) +{ + struct quoting_options const o = quoting_options_from_style (s); + return quotearg_n_options (n, arg, argsize, &o); +} + +char * +quotearg_style (enum quoting_style s, char const *arg) +{ + return quotearg_n_style (0, s, arg); +} + +char * +quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize) +{ + return quotearg_n_style_mem (0, s, arg, argsize); +} + +char * +quotearg_char_mem (char const *arg, size_t argsize, char ch) +{ + struct quoting_options options; + options = default_quoting_options; + set_char_quoting (&options, ch, 1); + return quotearg_n_options (0, arg, argsize, &options); +} + +char * +quotearg_char (char const *arg, char ch) +{ + return quotearg_char_mem (arg, SIZE_MAX, ch); +} + +char * +quotearg_colon (char const *arg) +{ + return quotearg_char (arg, ':'); +} + +char * +quotearg_colon_mem (char const *arg, size_t argsize) +{ + return quotearg_char_mem (arg, argsize, ':'); +} diff --git a/lib/quotearg.h b/lib/quotearg.h new file mode 100644 index 0000000..7700107 --- /dev/null +++ b/lib/quotearg.h @@ -0,0 +1,305 @@ +/* quotearg.h - quote arguments for output + + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006, 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 . */ + +/* Written by Paul Eggert */ + +#ifndef QUOTEARG_H_ +# define QUOTEARG_H_ 1 + +# include + +/* Basic quoting styles. For each style, an example is given on the + input strings "simple", "\0 \t\n'\"\033?""?/\\", and "a:b", using + quotearg_buffer, quotearg_mem, and quotearg_colon_mem with that + style and the default flags and quoted characters. Note that the + examples are shown here as valid C strings rather than what + displays on a terminal (with "??/" as a trigraph for "\\"). */ +enum quoting_style + { + /* Output names as-is (ls --quoting-style=literal). Can result in + embedded null bytes if QA_ELIDE_NULL_BYTES is not in + effect. + + quotearg_buffer: + "simple", "\0 \t\n'\"\033??/\\", "a:b" + quotearg: + "simple", " \t\n'\"\033??/\\", "a:b" + quotearg_colon: + "simple", " \t\n'\"\033??/\\", "a:b" + */ + literal_quoting_style, + + /* Quote names for the shell if they contain shell metacharacters + or would cause ambiguous output (ls --quoting-style=shell). + Can result in embedded null bytes if QA_ELIDE_NULL_BYTES is not + in effect. + + quotearg_buffer: + "simple", "'\0 \t\n'\\''\"\033??/\\'", "a:b" + quotearg: + "simple", "' \t\n'\\''\"\033??/\\'", "a:b" + quotearg_colon: + "simple", "' \t\n'\\''\"\033??/\\'", "'a:b'" + */ + shell_quoting_style, + + /* Quote names for the shell, even if they would normally not + require quoting (ls --quoting-style=shell-always). Can result + in embedded null bytes if QA_ELIDE_NULL_BYTES is not in effect. + Behaves like shell_quoting_style if QA_ELIDE_OUTER_QUOTES is in + effect. + + quotearg_buffer: + "'simple'", "'\0 \t\n'\\''\"\033??/\\'", "'a:b'" + quotearg: + "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'" + quotearg_colon: + "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'" + */ + shell_always_quoting_style, + + /* Quote names as for a C language string (ls --quoting-style=c). + Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is + in effect. Split into consecutive strings if + QA_SPLIT_TRIGRAPHS. + + quotearg_buffer: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + quotearg: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + quotearg_colon: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\"" + */ + c_quoting_style, + + /* Like c_quoting_style except omit the surrounding double-quote + characters if no quoted characters are encountered. + + quotearg_buffer: + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b" + quotearg: + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b" + quotearg_colon: + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + */ + c_maybe_quoting_style, + + /* Like c_quoting_style except always omit the surrounding + double-quote characters (ls --quoting-style=escape). + + quotearg_buffer: + "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b" + quotearg: + "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b" + quotearg_colon: + "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a\\:b" + */ + escape_quoting_style, + + /* Like clocale_quoting_style, but quote `like this' instead of + "like this" in the default C locale (ls --quoting-style=locale). + + LC_MESSAGES=C + quotearg_buffer: + "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'" + quotearg: + "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'" + quotearg_colon: + "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a\\:b'" + + LC_MESSAGES=pt_PT.utf8 + quotearg_buffer: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" + quotearg: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" + quotearg_colon: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273" + */ + locale_quoting_style, + + /* Like c_quoting_style except use quotation marks appropriate for + the locale (ls --quoting-style=clocale). + + LC_MESSAGES=C + quotearg_buffer: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + quotearg: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + quotearg_colon: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\"" + + LC_MESSAGES=pt_PT.utf8 + quotearg_buffer: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" + quotearg: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" + quotearg_colon: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273" + */ + clocale_quoting_style + }; + +/* Flags for use in set_quoting_flags. */ +enum quoting_flags + { + /* Always elide null bytes from styles that do not quote them, + even when the length of the result is available to the + caller. */ + QA_ELIDE_NULL_BYTES = 0x01, + + /* Omit the surrounding quote characters if no escaped characters + are encountered. Note that if no other character needs + escaping, then neither does the escape character. */ + QA_ELIDE_OUTER_QUOTES = 0x02, + + /* In the c_quoting_style and c_maybe_quoting_style, split ANSI + trigraph sequences into concatenated strings (for example, + "?""?/" rather than "??/", which could be confused with + "\\"). */ + QA_SPLIT_TRIGRAPHS = 0x04 + }; + +/* For now, --quoting-style=literal is the default, but this may change. */ +# ifndef DEFAULT_QUOTING_STYLE +# define DEFAULT_QUOTING_STYLE literal_quoting_style +# endif + +/* Names of quoting styles and their corresponding values. */ +extern char const *const quoting_style_args[]; +extern enum quoting_style const quoting_style_vals[]; + +struct quoting_options; + +/* The functions listed below set and use a hidden variable + that contains the default quoting style options. */ + +/* Allocate a new set of quoting options, with contents initially identical + to O if O is not null, or to the default if O is null. + It is the caller's responsibility to free the result. */ +struct quoting_options *clone_quoting_options (struct quoting_options *o); + +/* Get the value of O's quoting style. If O is null, use the default. */ +enum quoting_style get_quoting_style (struct quoting_options *o); + +/* In O (or in the default if O is null), + set the value of the quoting style to S. */ +void set_quoting_style (struct quoting_options *o, enum quoting_style s); + +/* In O (or in the default if O is null), + set the value of the quoting options for character C to I. + Return the old value. Currently, the only values defined for I are + 0 (the default) and 1 (which means to quote the character even if + it would not otherwise be quoted). */ +int set_char_quoting (struct quoting_options *o, char c, int i); + +/* In O (or in the default if O is null), + set the value of the quoting options flag to I, which can be a + bitwise combination of enum quoting_flags, or 0 for default + behavior. Return the old value. */ +int set_quoting_flags (struct quoting_options *o, int i); + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using O to control quoting. + If O is null, use the default. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is -1, use the string length of the argument for ARGSIZE. + On output, BUFFER might contain embedded null bytes if ARGSIZE was + not -1, the style of O does not use backslash escapes, and the + flags of O do not request elision of null bytes.*/ +size_t quotearg_buffer (char *buffer, size_t buffersize, + char const *arg, size_t argsize, + struct quoting_options const *o); + +/* Like quotearg_buffer, except return the result in a newly allocated + buffer. It is the caller's responsibility to free the result. The + result will not contain embedded null bytes. */ +char *quotearg_alloc (char const *arg, size_t argsize, + struct quoting_options const *o); + +/* Like quotearg_alloc, except that the length of the result, + excluding the terminating null byte, is stored into SIZE if it is + non-NULL. The result might contain embedded null bytes if ARGSIZE + was not -1, SIZE was not NULL, the style of O does not use + backslash escapes, and the flags of O do not request elision of + null bytes.*/ +char *quotearg_alloc_mem (char const *arg, size_t argsize, + size_t *size, struct quoting_options const *o); + +/* Use storage slot N to return a quoted version of the string ARG. + Use the default quoting options. + The returned value points to static storage that can be + reused by the next call to this function with the same value of N. + N must be nonnegative. The output of all functions in the + quotearg_n family are guaranteed to not contain embedded null + bytes.*/ +char *quotearg_n (int n, char const *arg); + +/* Equivalent to quotearg_n (0, ARG). */ +char *quotearg (char const *arg); + +/* Use storage slot N to return a quoted version of the argument ARG + of size ARGSIZE. This is like quotearg_n (N, ARG), except it can + quote null bytes. */ +char *quotearg_n_mem (int n, char const *arg, size_t argsize); + +/* Equivalent to quotearg_n_mem (0, ARG, ARGSIZE). */ +char *quotearg_mem (char const *arg, size_t argsize); + +/* Use style S and storage slot N to return a quoted version of the string ARG. + This is like quotearg_n (N, ARG), except that it uses S with no other + options to specify the quoting method. */ +char *quotearg_n_style (int n, enum quoting_style s, char const *arg); + +/* Use style S and storage slot N to return a quoted version of the + argument ARG of size ARGSIZE. This is like quotearg_n_style + (N, S, ARG), except it can quote null bytes. */ +char *quotearg_n_style_mem (int n, enum quoting_style s, + char const *arg, size_t argsize); + +/* Equivalent to quotearg_n_style (0, S, ARG). */ +char *quotearg_style (enum quoting_style s, char const *arg); + +/* Equivalent to quotearg_n_style_mem (0, S, ARG, ARGSIZE). */ +char *quotearg_style_mem (enum quoting_style s, + char const *arg, size_t argsize); + +/* Like quotearg (ARG), except also quote any instances of CH. */ +char *quotearg_char (char const *arg, char ch); + +/* Like quotearg_char (ARG, CH), except it can quote null bytes. */ +char *quotearg_char_mem (char const *arg, size_t argsize, char ch); + +/* Equivalent to quotearg_char (ARG, ':'). */ +char *quotearg_colon (char const *arg); + +/* Like quotearg_colon (ARG), except it can quote null bytes. */ +char *quotearg_colon_mem (char const *arg, size_t argsize); + +/* Free any dynamically allocated memory. */ +void quotearg_free (void); + +#endif /* !QUOTEARG_H_ */ diff --git a/lib/ref-add.sin b/lib/ref-add.sin new file mode 100644 index 0000000..222d752 --- /dev/null +++ b/lib/ref-add.sin @@ -0,0 +1,30 @@ +# Add this package to a list of references stored in a text file. +# +# Copyright (C) 2000 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, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Written by Bruno Haible . +# +/^# Packages using this file: / { + s/# Packages using this file:// + ta + :a + s/ @PACKAGE@ / @PACKAGE@ / + tb + s/ $/ @PACKAGE@ / + :b + s/^/# Packages using this file:/ +} diff --git a/lib/ref-del.sin b/lib/ref-del.sin new file mode 100644 index 0000000..1bf073e --- /dev/null +++ b/lib/ref-del.sin @@ -0,0 +1,25 @@ +# Remove this package from a list of references stored in a text file. +# +# Copyright (C) 2000 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, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Written by Bruno Haible . +# +/^# Packages using this file: / { + s/# Packages using this file:// + s/ @PACKAGE@ / / + s/^/# Packages using this file:/ +} diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h new file mode 100644 index 0000000..d95f723 --- /dev/null +++ b/lib/stdbool.in.h @@ -0,0 +1,121 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. + Written by Bruno Haible , 2001. + + 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_STDBOOL_H +#define _GL_STDBOOL_H + +/* ISO C 99 for platforms that lack it. */ + +/* Usage suggestions: + + Programs that use should be aware of some limitations + and standards compliance issues. + + Standards compliance: + + - must be #included before 'bool', 'false', 'true' + can be used. + + - You cannot assume that sizeof (bool) == 1. + + - Programs should not undefine the macros bool, true, and false, + as C99 lists that as an "obsolescent feature". + + Limitations of this substitute, when used in a C89 environment: + + - must be #included before the '_Bool' type can be used. + + - You cannot assume that _Bool is a typedef; it might be a macro. + + - Bit-fields of type 'bool' are not supported. Portable code + should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. + + - In C99, casts and automatic conversions to '_Bool' or 'bool' are + performed in such a way that every nonzero value gets converted + to 'true', and zero gets converted to 'false'. This doesn't work + with this substitute. With this substitute, only the values 0 and 1 + give the expected result when converted to _Bool' or 'bool'. + + Also, it is suggested that programs use 'bool' rather than '_Bool'; + this isn't required, but 'bool' is more common. */ + + +/* 7.16. Boolean type and values */ + +/* BeOS already #defines false 0, true 1. We use the same + definitions below, but temporarily we have to #undef them. */ +#if defined __BEOS__ && !defined __HAIKU__ +# include /* defines bool but not _Bool */ +# undef false +# undef true +#endif + +/* For the sake of symbolic names in gdb, we define true and false as + enum constants, not only as macros. + It is tempting to write + typedef enum { false = 0, true = 1 } _Bool; + so that gdb prints values of type 'bool' symbolically. But if we do + this, values of type '_Bool' may promote to 'int' or 'unsigned int' + (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' + (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the + enum; this ensures that '_Bool' promotes to 'int'. */ +#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) + /* A compiler known to have 'bool'. */ + /* If the compiler already has both 'bool' and '_Bool', we can assume they + are the same types. */ +# if !@HAVE__BOOL@ +typedef bool _Bool; +# endif +#else +# if !defined __GNUC__ + /* If @HAVE__BOOL@: + Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when + the built-in _Bool type is used. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + Similar bugs are likely with other compilers as well; this file + wouldn't be used if was working. + So we override the _Bool type. + If !@HAVE__BOOL@: + Need to define _Bool ourselves. As 'signed char' or as an enum type? + Use of a typedef, with SunPRO C, leads to a stupid + "warning: _Bool is a keyword in ISO C99". + Use of an enum type, with IRIX cc, leads to a stupid + "warning(1185): enumerated type mixed with another type". + Even the existence of an enum type, without a typedef, + "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. + The only benefit of the enum, debuggability, is not important + with these compilers. So use 'signed char' and no enum. */ +# define _Bool signed char +# else + /* With this compiler, trust the _Bool type if the compiler has it. */ +# if !@HAVE__BOOL@ +typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; +# endif +# endif +#endif +#define bool _Bool + +/* The other macros must be usable in preprocessor directives. */ +#define false 0 +#define true 1 +#define __bool_true_false_are_defined 1 + +#endif /* _GL_STDBOOL_H */ diff --git a/lib/stdint.in.h b/lib/stdint.in.h new file mode 100644 index 0000000..5682dad --- /dev/null +++ b/lib/stdint.in.h @@ -0,0 +1,551 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Copyright (C) 2001-2002, 2004-2008 Free Software Foundation, Inc. + Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. + This file is part of gnulib. + + 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* + * ISO C 99 for platforms that lack it. + * + */ + +#ifndef _GL_STDINT_H + +/* When including a system file that in turn includes , + use the system , not our substitute. This avoids + problems with (for example) VMS, whose includes + . */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Get those types that are already defined in other system include + files, so that we can "#define int8_t signed char" below without + worrying about a later system include file containing a "typedef + signed char int8_t;" that will get messed up by our macro. Our + macros should all be consistent with the system versions, except + for the "fast" types and macros, which we recommend against using + in public interfaces due to compiler differences. */ + +#if @HAVE_STDINT_H@ +# if defined __sgi && ! defined __c99 + /* Bypass IRIX's if in C89 mode, since it merely annoys users + with "This header file is to be used only for c99 mode compilations" + diagnostics. */ +# define __STDINT_H__ +# endif + /* Other systems may have an incomplete or buggy . + Include it before , since any "#include " + in would reinclude us, skipping our contents because + _GL_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +# if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +# endif +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#endif + +#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _GL_STDINT_H + +/* defines some of the stdint.h types as well, on glibc, + IRIX 6.5, and OpenBSD 3.8 (via ). + AIX 5.2 isn't needed and causes troubles. + MacOS X 10.4.6 includes (which is us), but + relies on the system definitions, so include + after @NEXT_STDINT_H@. */ +#if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include +#endif + +/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ +#include + +#if @HAVE_INTTYPES_H@ + /* In OpenBSD 3.8, includes , which defines + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + also defines intptr_t and uintptr_t. */ +# include +#elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 has the types except the *_fast*_t types, and + the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ +# include +#endif + +#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ + /* Linux libc4 >= 4.6.7 and libc5 have a that defines + int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is + included by . */ +# include +#endif + +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS + +/* Get WCHAR_MIN, WCHAR_MAX. */ +# if ! (defined WCHAR_MIN && defined WCHAR_MAX) +# include +# endif + +#endif + +#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Minimum and maximum values for a integer type under the usual assumption. + Return an unspecified value if BITS == 0, adding a check to pacify + picky compilers. */ + +#define _STDINT_MIN(signed, bits, zero) \ + ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) + +#define _STDINT_MAX(signed, bits, zero) \ + ((signed) \ + ? ~ _STDINT_MIN (signed, bits, zero) \ + : /* The expression for the unsigned case. The subtraction of (signed) \ + is a nop in the unsigned case and avoids "signed integer overflow" \ + warnings in the signed case. */ \ + ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) + +/* 7.18.1.1. Exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef int8_t +#undef uint8_t +typedef signed char gl_int8_t; +typedef unsigned char gl_uint8_t; +#define int8_t gl_int8_t +#define uint8_t gl_uint8_t + +#undef int16_t +#undef uint16_t +typedef short int gl_int16_t; +typedef unsigned short int gl_uint16_t; +#define int16_t gl_int16_t +#define uint16_t gl_uint16_t + +#undef int32_t +#undef uint32_t +typedef int gl_int32_t; +typedef unsigned int gl_uint32_t; +#define int32_t gl_int32_t +#define uint32_t gl_uint32_t + +/* Do not undefine int64_t if gnulib is not being used with 64-bit + types, since otherwise it breaks platforms like Tandem/NSK. */ +#if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t +typedef long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +#elif defined _MSC_VER +# undef int64_t +typedef __int64 gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +#elif @HAVE_LONG_LONG_INT@ +# undef int64_t +typedef long long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +#endif + +#if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +#elif defined _MSC_VER +# undef uint64_t +typedef unsigned __int64 gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +#elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t +typedef unsigned long long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +#endif + +/* Avoid collision with Solaris 2.5.1 etc. */ +#define _UINT8_T +#define _UINT32_T +#define _UINT64_T + + +/* 7.18.1.2. Minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +#undef int_least8_t +#undef uint_least8_t +#undef int_least16_t +#undef uint_least16_t +#undef int_least32_t +#undef uint_least32_t +#undef int_least64_t +#undef uint_least64_t +#define int_least8_t int8_t +#define uint_least8_t uint8_t +#define int_least16_t int16_t +#define uint_least16_t uint16_t +#define int_least32_t int32_t +#define uint_least32_t uint32_t +#ifdef GL_INT64_T +# define int_least64_t int64_t +#endif +#ifdef GL_UINT64_T +# define uint_least64_t uint64_t +#endif + +/* 7.18.1.3. Fastest minimum-width integer types */ + +/* Note: Other substitutes may define these types differently. + It is not recommended to use these types in public header files. */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. Assume that 'long int' + is fast enough for all narrower integers. */ + +#undef int_fast8_t +#undef uint_fast8_t +#undef int_fast16_t +#undef uint_fast16_t +#undef int_fast32_t +#undef uint_fast32_t +#undef int_fast64_t +#undef uint_fast64_t +typedef long int gl_int_fast8_t; +typedef unsigned long int gl_uint_fast8_t; +typedef long int gl_int_fast16_t; +typedef unsigned long int gl_uint_fast16_t; +typedef long int gl_int_fast32_t; +typedef unsigned long int gl_uint_fast32_t; +#define int_fast8_t gl_int_fast8_t +#define uint_fast8_t gl_uint_fast8_t +#define int_fast16_t gl_int_fast16_t +#define uint_fast16_t gl_uint_fast16_t +#define int_fast32_t gl_int_fast32_t +#define uint_fast32_t gl_uint_fast32_t +#ifdef GL_INT64_T +# define int_fast64_t int64_t +#endif +#ifdef GL_UINT64_T +# define uint_fast64_t uint64_t +#endif + +/* 7.18.1.4. Integer types capable of holding object pointers */ + +#undef intptr_t +#undef uintptr_t +typedef long int gl_intptr_t; +typedef unsigned long int gl_uintptr_t; +#define intptr_t gl_intptr_t +#define uintptr_t gl_uintptr_t + +/* 7.18.1.5. Greatest-width integer types */ + +/* Note: These types are compiler dependent. It may be unwise to use them in + public header files. */ + +#undef intmax_t +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +typedef long long int gl_intmax_t; +# define intmax_t gl_intmax_t +#elif defined GL_INT64_T +# define intmax_t int64_t +#else +typedef long int gl_intmax_t; +# define intmax_t gl_intmax_t +#endif + +#undef uintmax_t +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +typedef unsigned long long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +#elif defined GL_UINT64_T +# define uintmax_t uint64_t +#else +typedef unsigned long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +#endif + +/* Verify that intmax_t and uintmax_t have the same size. Too much code + breaks if this is not the case. If this check fails, the reason is likely + to be found in the autoconf macros. */ +typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1]; + +/* 7.18.2. Limits of specified-width integer types */ + +#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS + +/* 7.18.2.1. Limits of exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef INT8_MIN +#undef INT8_MAX +#undef UINT8_MAX +#define INT8_MIN (~ INT8_MAX) +#define INT8_MAX 127 +#define UINT8_MAX 255 + +#undef INT16_MIN +#undef INT16_MAX +#undef UINT16_MAX +#define INT16_MIN (~ INT16_MAX) +#define INT16_MAX 32767 +#define UINT16_MAX 65535 + +#undef INT32_MIN +#undef INT32_MAX +#undef UINT32_MAX +#define INT32_MIN (~ INT32_MAX) +#define INT32_MAX 2147483647 +#define UINT32_MAX 4294967295U + +#undef INT64_MIN +#undef INT64_MAX +#ifdef GL_INT64_T +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 + evaluates the latter incorrectly in preprocessor expressions. */ +# define INT64_MIN (- INTMAX_C (1) << 63) +# define INT64_MAX INTMAX_C (9223372036854775807) +#endif + +#undef UINT64_MAX +#ifdef GL_UINT64_T +# define UINT64_MAX UINTMAX_C (18446744073709551615) +#endif + +/* 7.18.2.2. Limits of minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +#undef INT_LEAST8_MIN +#undef INT_LEAST8_MAX +#undef UINT_LEAST8_MAX +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define UINT_LEAST8_MAX UINT8_MAX + +#undef INT_LEAST16_MIN +#undef INT_LEAST16_MAX +#undef UINT_LEAST16_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define UINT_LEAST16_MAX UINT16_MAX + +#undef INT_LEAST32_MIN +#undef INT_LEAST32_MAX +#undef UINT_LEAST32_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define UINT_LEAST32_MAX UINT32_MAX + +#undef INT_LEAST64_MIN +#undef INT_LEAST64_MAX +#ifdef GL_INT64_T +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +#endif + +#undef UINT_LEAST64_MAX +#ifdef GL_UINT64_T +# define UINT_LEAST64_MAX UINT64_MAX +#endif + +/* 7.18.2.3. Limits of fastest minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. */ + +#undef INT_FAST8_MIN +#undef INT_FAST8_MAX +#undef UINT_FAST8_MAX +#define INT_FAST8_MIN LONG_MIN +#define INT_FAST8_MAX LONG_MAX +#define UINT_FAST8_MAX ULONG_MAX + +#undef INT_FAST16_MIN +#undef INT_FAST16_MAX +#undef UINT_FAST16_MAX +#define INT_FAST16_MIN LONG_MIN +#define INT_FAST16_MAX LONG_MAX +#define UINT_FAST16_MAX ULONG_MAX + +#undef INT_FAST32_MIN +#undef INT_FAST32_MAX +#undef UINT_FAST32_MAX +#define INT_FAST32_MIN LONG_MIN +#define INT_FAST32_MAX LONG_MAX +#define UINT_FAST32_MAX ULONG_MAX + +#undef INT_FAST64_MIN +#undef INT_FAST64_MAX +#ifdef GL_INT64_T +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +#endif + +#undef UINT_FAST64_MAX +#ifdef GL_UINT64_T +# define UINT_FAST64_MAX UINT64_MAX +#endif + +/* 7.18.2.4. Limits of integer types capable of holding object pointers */ + +#undef INTPTR_MIN +#undef INTPTR_MAX +#undef UINTPTR_MAX +#define INTPTR_MIN LONG_MIN +#define INTPTR_MAX LONG_MAX +#define UINTPTR_MAX ULONG_MAX + +/* 7.18.2.5. Limits of greatest-width integer types */ + +#undef INTMAX_MIN +#undef INTMAX_MAX +#ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +#else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +#endif + +#undef UINTMAX_MAX +#ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +#else +# define UINTMAX_MAX UINT32_MAX +#endif + +/* 7.18.3. Limits of other integer types */ + +/* ptrdiff_t limits */ +#undef PTRDIFF_MIN +#undef PTRDIFF_MAX +#define PTRDIFF_MIN \ + _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +#define PTRDIFF_MAX \ + _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) + +/* sig_atomic_t limits */ +#undef SIG_ATOMIC_MIN +#undef SIG_ATOMIC_MAX +#define SIG_ATOMIC_MIN \ + _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) +#define SIG_ATOMIC_MAX \ + _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) + + +/* size_t limit */ +#undef SIZE_MAX +#define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) + +/* wchar_t limits */ +#undef WCHAR_MIN +#undef WCHAR_MAX +#define WCHAR_MIN \ + _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +#define WCHAR_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) + +/* wint_t limits */ +#undef WINT_MIN +#undef WINT_MAX +#define WINT_MIN \ + _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +#define WINT_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) + +#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ + +/* 7.18.4. Macros for integer constants */ + +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS + +/* 7.18.4.1. Macros for minimum-width integer constants */ +/* According to ISO C 99 Technical Corrigendum 1 */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ + +#undef INT8_C +#undef UINT8_C +#define INT8_C(x) x +#define UINT8_C(x) x + +#undef INT16_C +#undef UINT16_C +#define INT16_C(x) x +#define UINT16_C(x) x + +#undef INT32_C +#undef UINT32_C +#define INT32_C(x) x +#define UINT32_C(x) x ## U + +#undef INT64_C +#undef UINT64_C +#if LONG_MAX >> 31 >> 31 == 1 +# define INT64_C(x) x##L +#elif defined _MSC_VER +# define INT64_C(x) x##i64 +#elif @HAVE_LONG_LONG_INT@ +# define INT64_C(x) x##LL +#endif +#if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +#elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# define UINT64_C(x) x##ULL +#endif + +/* 7.18.4.2. Macros for greatest-width integer constants */ + +#undef INTMAX_C +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +#elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +#else +# define INTMAX_C(x) x##L +#endif + +#undef UINTMAX_C +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +#elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +#else +# define UINTMAX_C(x) x##UL +#endif + +#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ + +#endif /* _GL_STDINT_H */ +#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ diff --git a/lib/stdio--.h b/lib/stdio--.h new file mode 100644 index 0000000..39fca29 --- /dev/null +++ b/lib/stdio--.h @@ -0,0 +1,27 @@ +/* Like stdio.h, but redefine some names to avoid glitches. + + Copyright (C) 2005, 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 . */ + +/* Written by Paul Eggert. */ + +#include +#include "stdio-safer.h" + +#undef fopen +#define fopen fopen_safer + +#undef tmpfile +#define tmpfile tmpfile_safer diff --git a/lib/stdio-safer.h b/lib/stdio-safer.h new file mode 100644 index 0000000..c881d5a --- /dev/null +++ b/lib/stdio-safer.h @@ -0,0 +1,23 @@ +/* Invoke stdio functions, but avoid some glitches. + + Copyright (C) 2001, 2003, 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 . */ + +/* Written by Paul Eggert. */ + +#include + +FILE *fopen_safer (char const *, char const *); +FILE *tmpfile_safer (void); diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h new file mode 100644 index 0000000..f6ebe25 --- /dev/null +++ b/lib/stdlib.in.h @@ -0,0 +1,377 @@ +/* A GNU-like . + + Copyright (C) 1995, 2001-2004, 2006-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 . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +#if defined __need_malloc_and_calloc +/* Special invocation convention inside glibc header files. */ + +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_STDLIB_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ + +#ifndef _GL_STDLIB_H +#define _GL_STDLIB_H + + +/* Solaris declares getloadavg() in . */ +#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@ +# include +#endif + +#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@ +# include +#endif + +#if !@HAVE_STRUCT_RANDOM_DATA@ +struct random_data +{ + int32_t *fptr; /* Front pointer. */ + int32_t *rptr; /* Rear pointer. */ + int32_t *state; /* Array of state values. */ + int rand_type; /* Type of random number generator. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ + int32_t *end_ptr; /* Pointer behind state table. */ +}; +#endif + +/* The definition of GL_LINK_WARNING is copied here. */ + + +/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +#endif +/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere + with proper operation of xargs. */ +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#elif EXIT_FAILURE != 1 +# undef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if @GNULIB_MALLOC_POSIX@ +# if !@HAVE_MALLOC_POSIX@ +# undef malloc +# define malloc rpl_malloc +extern void * malloc (size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef malloc +# define malloc(s) \ + (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \ + "use gnulib module malloc-posix for portability"), \ + malloc (s)) +#endif + + +#if @GNULIB_REALLOC_POSIX@ +# if !@HAVE_REALLOC_POSIX@ +# undef realloc +# define realloc rpl_realloc +extern void * realloc (void *ptr, size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef realloc +# define realloc(p,s) \ + (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \ + "use gnulib module realloc-posix for portability"), \ + realloc (p, s)) +#endif + + +#if @GNULIB_CALLOC_POSIX@ +# if !@HAVE_CALLOC_POSIX@ +# undef calloc +# define calloc rpl_calloc +extern void * calloc (size_t nmemb, size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef calloc +# define calloc(n,s) \ + (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \ + "use gnulib module calloc-posix for portability"), \ + calloc (n, s)) +#endif + + +#if @GNULIB_ATOLL@ +# if !@HAVE_ATOLL@ +/* Parse a signed decimal integer. + Returns the value of the integer. Errors are not detected. */ +extern long long atoll (const char *string); +# endif +#elif defined GNULIB_POSIXCHECK +# undef atoll +# define atoll(s) \ + (GL_LINK_WARNING ("atoll is unportable - " \ + "use gnulib module atoll for portability"), \ + atoll (s)) +#endif + + +#if @GNULIB_GETLOADAVG@ +# if !@HAVE_DECL_GETLOADAVG@ +/* Store max(NELEM,3) load average numbers in LOADAVG[]. + The three numbers are the load average of the last 1 minute, the last 5 + minutes, and the last 15 minutes, respectively. + LOADAVG is an array of NELEM numbers. */ +extern int getloadavg (double loadavg[], int nelem); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getloadavg +# define getloadavg(l,n) \ + (GL_LINK_WARNING ("getloadavg is not portable - " \ + "use gnulib module getloadavg for portability"), \ + getloadavg (l, n)) +#endif + + +#if @GNULIB_GETSUBOPT@ +/* Assuming *OPTIONP is a comma separated list of elements of the form + "token" or "token=value", getsubopt parses the first of these elements. + If the first element refers to a "token" that is member of the given + NULL-terminated array of tokens: + - It replaces the comma with a NUL byte, updates *OPTIONP to point past + the first option and the comma, sets *VALUEP to the value of the + element (or NULL if it doesn't contain an "=" sign), + - It returns the index of the "token" in the given array of tokens. + Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. + For more details see the POSIX:2001 specification. + http://www.opengroup.org/susv3xsh/getsubopt.html */ +# if !@HAVE_GETSUBOPT@ +extern int getsubopt (char **optionp, char *const *tokens, char **valuep); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getsubopt +# define getsubopt(o,t,v) \ + (GL_LINK_WARNING ("getsubopt is unportable - " \ + "use gnulib module getsubopt for portability"), \ + getsubopt (o, t, v)) +#endif + + +#if @GNULIB_MKDTEMP@ +# if !@HAVE_MKDTEMP@ +/* Create a unique temporary directory from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the directory name unique. + Returns TEMPLATE, or a null pointer if it cannot get a unique name. + The directory is created mode 700. */ +extern char * mkdtemp (char * /*template*/); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mkdtemp +# define mkdtemp(t) \ + (GL_LINK_WARNING ("mkdtemp is unportable - " \ + "use gnulib module mkdtemp for portability"), \ + mkdtemp (t)) +#endif + + +#if @GNULIB_MKSTEMP@ +# if @REPLACE_MKSTEMP@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The file is then created, ensuring it didn't exist before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# define mkstemp rpl_mkstemp +extern int mkstemp (char * /*template*/); +# else +/* On MacOS X 10.3, only declares mkstemp. */ +# include +# endif +#elif defined GNULIB_POSIXCHECK +# undef mkstemp +# define mkstemp(t) \ + (GL_LINK_WARNING ("mkstemp is unportable - " \ + "use gnulib module mkstemp for portability"), \ + mkstemp (t)) +#endif + + +#if @GNULIB_PUTENV@ +# if @REPLACE_PUTENV@ +# undef putenv +# define putenv rpl_putenv +extern int putenv (char *string); +# endif +#endif + + +#if @GNULIB_RANDOM_R@ +# if !@HAVE_RANDOM_R@ + +# ifndef RAND_MAX +# define RAND_MAX 2147483647 +# endif + +int srandom_r (unsigned int seed, struct random_data *rand_state); +int initstate_r (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state); +int setstate_r (char *arg_state, struct random_data *rand_state); +int random_r (struct random_data *buf, int32_t *result); +# endif +#elif defined GNULIB_POSIXCHECK +# undef random_r +# define random_r(b,r) \ + (GL_LINK_WARNING ("random_r is unportable - " \ + "use gnulib module random_r for portability"), \ + random_r (b,r)) +# undef initstate_r +# define initstate_r(s,b,sz,r) \ + (GL_LINK_WARNING ("initstate_r is unportable - " \ + "use gnulib module random_r for portability"), \ + initstate_r (s,b,sz,r)) +# undef srandom_r +# define srandom_r(s,r) \ + (GL_LINK_WARNING ("srandom_r is unportable - " \ + "use gnulib module random_r for portability"), \ + srandom_r (s,r)) +# undef setstate_r +# define setstate_r(a,r) \ + (GL_LINK_WARNING ("setstate_r is unportable - " \ + "use gnulib module random_r for portability"), \ + setstate_r (a,r)) +#endif + + +#if @GNULIB_RPMATCH@ +# if !@HAVE_RPMATCH@ +/* Test a user response to a question. + Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ +extern int rpmatch (const char *response); +# endif +#elif defined GNULIB_POSIXCHECK +# undef rpmatch +# define rpmatch(r) \ + (GL_LINK_WARNING ("rpmatch is unportable - " \ + "use gnulib module rpmatch for portability"), \ + rpmatch (r)) +#endif + + +#if @GNULIB_SETENV@ +# if !@HAVE_SETENV@ +/* Set NAME to VALUE in the environment. + If REPLACE is nonzero, overwrite an existing value. */ +extern int setenv (const char *name, const char *value, int replace); +# endif +#endif + + +#if @GNULIB_UNSETENV@ +# if @HAVE_UNSETENV@ +# if @VOID_UNSETENV@ +/* On some systems, unsetenv() returns void. + This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */ +# define unsetenv(name) ((unsetenv)(name), 0) +# endif +# else +/* Remove the variable NAME from the environment. */ +extern int unsetenv (const char *name); +# endif +#endif + + +#if @GNULIB_STRTOD@ +# if @REPLACE_STRTOD@ +# define strtod rpl_strtod +# endif +# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@ + /* Parse a double from STRING, updating ENDP if appropriate. */ +extern double strtod (const char *str, char **endp); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtod +# define strtod(s, e) \ + (GL_LINK_WARNING ("strtod is unportable - " \ + "use gnulib module strtod for portability"), \ + strtod (s, e)) +#endif + + +#if @GNULIB_STRTOLL@ +# if !@HAVE_STRTOLL@ +/* Parse a signed integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set + to ERANGE. */ +extern long long strtoll (const char *string, char **endptr, int base); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtoll +# define strtoll(s,e,b) \ + (GL_LINK_WARNING ("strtoll is unportable - " \ + "use gnulib module strtoll for portability"), \ + strtoll (s, e, b)) +#endif + + +#if @GNULIB_STRTOULL@ +# if !@HAVE_STRTOULL@ +/* Parse an unsigned integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is ULLONG_MAX, and errno is set to + ERANGE. */ +extern unsigned long long strtoull (const char *string, char **endptr, int base); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtoull +# define strtoull(s,e,b) \ + (GL_LINK_WARNING ("strtoull is unportable - " \ + "use gnulib module strtoull for portability"), \ + strtoull (s, e, b)) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_STDLIB_H */ +#endif /* _GL_STDLIB_H */ +#endif diff --git a/lib/stpcpy.c b/lib/stpcpy.c new file mode 100644 index 0000000..1e70013 --- /dev/null +++ b/lib/stpcpy.c @@ -0,0 +1,48 @@ +/* stpcpy.c -- copy a string and return pointer to end of new string + Copyright (C) 1992, 1995, 1997-1998, 2006 Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@prep.ai.mit.edu. + + 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 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 . */ + +#include + +#include + +#undef __stpcpy +#ifdef _LIBC +# undef stpcpy +#endif + +#ifndef weak_alias +# define __stpcpy stpcpy +#endif + +/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */ +char * +__stpcpy (char *dest, const char *src) +{ + register char *d = dest; + register const char *s = src; + + do + *d++ = *s; + while (*s++ != '\0'); + + return d - 1; +} +#ifdef weak_alias +weak_alias (__stpcpy, stpcpy) +#endif diff --git a/lib/streq.h b/lib/streq.h new file mode 100644 index 0000000..e3b0c3f --- /dev/null +++ b/lib/streq.h @@ -0,0 +1,178 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Optimized string comparison. + Copyright (C) 2001-2002, 2007 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 + Lesser 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 . */ + +/* Written by Bruno Haible . */ + +#ifndef _GL_STREQ_H +#define _GL_STREQ_H + +#include + +/* STREQ allows to optimize string comparison with a small literal string. + STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + is semantically equivalent to + strcmp (s, "EUC-KR") == 0 + just faster. */ + +/* Help GCC to generate good code for string comparisons with + immediate strings. */ +#if defined (__GNUC__) && defined (__OPTIMIZE__) + +static inline int +streq9 (const char *s1, const char *s2) +{ + return strcmp (s1 + 9, s2 + 9) == 0; +} + +static inline int +streq8 (const char *s1, const char *s2, char s28) +{ + if (s1[8] == s28) + { + if (s28 == 0) + return 1; + else + return streq9 (s1, s2); + } + else + return 0; +} + +static inline int +streq7 (const char *s1, const char *s2, char s27, char s28) +{ + if (s1[7] == s27) + { + if (s27 == 0) + return 1; + else + return streq8 (s1, s2, s28); + } + else + return 0; +} + +static inline int +streq6 (const char *s1, const char *s2, char s26, char s27, char s28) +{ + if (s1[6] == s26) + { + if (s26 == 0) + return 1; + else + return streq7 (s1, s2, s27, s28); + } + else + return 0; +} + +static inline int +streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28) +{ + if (s1[5] == s25) + { + if (s25 == 0) + return 1; + else + return streq6 (s1, s2, s26, s27, s28); + } + else + return 0; +} + +static inline int +streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28) +{ + if (s1[4] == s24) + { + if (s24 == 0) + return 1; + else + return streq5 (s1, s2, s25, s26, s27, s28); + } + else + return 0; +} + +static inline int +streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28) +{ + if (s1[3] == s23) + { + if (s23 == 0) + return 1; + else + return streq4 (s1, s2, s24, s25, s26, s27, s28); + } + else + return 0; +} + +static inline int +streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28) +{ + if (s1[2] == s22) + { + if (s22 == 0) + return 1; + else + return streq3 (s1, s2, s23, s24, s25, s26, s27, s28); + } + else + return 0; +} + +static inline int +streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28) +{ + if (s1[1] == s21) + { + if (s21 == 0) + return 1; + else + return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28); + } + else + return 0; +} + +static inline int +streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28) +{ + if (s1[0] == s20) + { + if (s20 == 0) + return 1; + else + return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28); + } + else + return 0; +} + +#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ + streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28) + +#else + +#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ + (strcmp (s1, s2) == 0) + +#endif + +#endif /* _GL_STREQ_H */ diff --git a/lib/strerror.c b/lib/strerror.c new file mode 100644 index 0000000..787575f --- /dev/null +++ b/lib/strerror.c @@ -0,0 +1,273 @@ +/* strerror.c --- POSIX compatible system error routine + + Copyright (C) 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 . */ + +#include + +#include + +#if REPLACE_STRERROR + +# include +# include + +# if GNULIB_defined_ESOCK /* native Windows platforms */ +# if HAVE_WINSOCK2_H +# include +# endif +# endif + +# include "intprops.h" + +# undef strerror +# if ! HAVE_DECL_STRERROR +# define strerror(n) NULL +# endif + +char * +rpl_strerror (int n) +{ + /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ + switch (n) + { +# if GNULIB_defined_ETXTBSY + case ETXTBSY: + return "Text file busy"; +# endif + +# if GNULIB_defined_ESOCK /* native Windows platforms */ + /* EWOULDBLOCK is the same as EAGAIN. */ + case EINPROGRESS: + return "Operation now in progress"; + case EALREADY: + return "Operation already in progress"; + case ENOTSOCK: + return "Socket operation on non-socket"; + case EDESTADDRREQ: + return "Destination address required"; + case EMSGSIZE: + return "Message too long"; + case EPROTOTYPE: + return "Protocol wrong type for socket"; + case ENOPROTOOPT: + return "Protocol not available"; + case EPROTONOSUPPORT: + return "Protocol not supported"; + case ESOCKTNOSUPPORT: + return "Socket type not supported"; + case EOPNOTSUPP: + return "Operation not supported"; + case EPFNOSUPPORT: + return "Protocol family not supported"; + case EAFNOSUPPORT: + return "Address family not supported by protocol"; + case EADDRINUSE: + return "Address already in use"; + case EADDRNOTAVAIL: + return "Cannot assign requested address"; + case ENETDOWN: + return "Network is down"; + case ENETUNREACH: + return "Network is unreachable"; + case ENETRESET: + return "Network dropped connection on reset"; + case ECONNABORTED: + return "Software caused connection abort"; + case ECONNRESET: + return "Connection reset by peer"; + case ENOBUFS: + return "No buffer space available"; + case EISCONN: + return "Transport endpoint is already connected"; + case ENOTCONN: + return "Transport endpoint is not connected"; + case ESHUTDOWN: + return "Cannot send after transport endpoint shutdown"; + case ETOOMANYREFS: + return "Too many references: cannot splice"; + case ETIMEDOUT: + return "Connection timed out"; + case ECONNREFUSED: + return "Connection refused"; + case ELOOP: + return "Too many levels of symbolic links"; + case EHOSTDOWN: + return "Host is down"; + case EHOSTUNREACH: + return "No route to host"; + case EPROCLIM: + return "Too many processes"; + case EUSERS: + return "Too many users"; + case EDQUOT: + return "Disk quota exceeded"; + case ESTALE: + return "Stale NFS file handle"; + case EREMOTE: + return "Object is remote"; +# if HAVE_WINSOCK2_H + /* WSA_INVALID_HANDLE maps to EBADF */ + /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ + /* WSA_INVALID_PARAMETER maps to EINVAL */ + case WSA_OPERATION_ABORTED: + return "Overlapped operation aborted"; + case WSA_IO_INCOMPLETE: + return "Overlapped I/O event object not in signaled state"; + case WSA_IO_PENDING: + return "Overlapped operations will complete later"; + /* WSAEINTR maps to EINTR */ + /* WSAEBADF maps to EBADF */ + /* WSAEACCES maps to EACCES */ + /* WSAEFAULT maps to EFAULT */ + /* WSAEINVAL maps to EINVAL */ + /* WSAEMFILE maps to EMFILE */ + /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ + /* WSAEINPROGRESS is EINPROGRESS */ + /* WSAEALREADY is EALREADY */ + /* WSAENOTSOCK is ENOTSOCK */ + /* WSAEDESTADDRREQ is EDESTADDRREQ */ + /* WSAEMSGSIZE is EMSGSIZE */ + /* WSAEPROTOTYPE is EPROTOTYPE */ + /* WSAENOPROTOOPT is ENOPROTOOPT */ + /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */ + /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ + /* WSAEOPNOTSUPP is EOPNOTSUPP */ + /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ + /* WSAEAFNOSUPPORT is EAFNOSUPPORT */ + /* WSAEADDRINUSE is EADDRINUSE */ + /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */ + /* WSAENETDOWN is ENETDOWN */ + /* WSAENETUNREACH is ENETUNREACH */ + /* WSAENETRESET is ENETRESET */ + /* WSAECONNABORTED is ECONNABORTED */ + /* WSAECONNRESET is ECONNRESET */ + /* WSAENOBUFS is ENOBUFS */ + /* WSAEISCONN is EISCONN */ + /* WSAENOTCONN is ENOTCONN */ + /* WSAESHUTDOWN is ESHUTDOWN */ + /* WSAETOOMANYREFS is ETOOMANYREFS */ + /* WSAETIMEDOUT is ETIMEDOUT */ + /* WSAECONNREFUSED is ECONNREFUSED */ + /* WSAELOOP is ELOOP */ + /* WSAENAMETOOLONG maps to ENAMETOOLONG */ + /* WSAEHOSTDOWN is EHOSTDOWN */ + /* WSAEHOSTUNREACH is EHOSTUNREACH */ + /* WSAENOTEMPTY maps to ENOTEMPTY */ + /* WSAEPROCLIM is EPROCLIM */ + /* WSAEUSERS is EUSERS */ + /* WSAEDQUOT is EDQUOT */ + /* WSAESTALE is ESTALE */ + /* WSAEREMOTE is EREMOTE */ + case WSASYSNOTREADY: + return "Network subsystem is unavailable"; + case WSAVERNOTSUPPORTED: + return "Winsock.dll version out of range"; + case WSANOTINITIALISED: + return "Successful WSAStartup not yet performed"; + case WSAEDISCON: + return "Graceful shutdown in progress"; + case WSAENOMORE: case WSA_E_NO_MORE: + return "No more results"; + case WSAECANCELLED: case WSA_E_CANCELLED: + return "Call was canceled"; + case WSAEINVALIDPROCTABLE: + return "Procedure call table is invalid"; + case WSAEINVALIDPROVIDER: + return "Service provider is invalid"; + case WSAEPROVIDERFAILEDINIT: + return "Service provider failed to initialize"; + case WSASYSCALLFAILURE: + return "System call failure"; + case WSASERVICE_NOT_FOUND: + return "Service not found"; + case WSATYPE_NOT_FOUND: + return "Class type not found"; + case WSAEREFUSED: + return "Database query was refused"; + case WSAHOST_NOT_FOUND: + return "Host not found"; + case WSATRY_AGAIN: + return "Nonauthoritative host not found"; + case WSANO_RECOVERY: + return "Nonrecoverable error"; + case WSANO_DATA: + return "Valid name, no data record of requested type"; + /* WSA_QOS_* omitted */ +# endif +# endif + +# if GNULIB_defined_ENOMSG + case ENOMSG: + return "No message of desired type"; +# endif + +# if GNULIB_defined_EIDRM + case EIDRM: + return "Identifier removed"; +# endif + +# if GNULIB_defined_ENOLINK + case ENOLINK: + return "Link has been severed"; +# endif + +# if GNULIB_defined_EPROTO + case EPROTO: + return "Protocol error"; +# endif + +# if GNULIB_defined_EMULTIHOP + case EMULTIHOP: + return "Multihop attempted"; +# endif + +# if GNULIB_defined_EBADMSG + case EBADMSG: + return "Bad message"; +# endif + +# if GNULIB_defined_EOVERFLOW + case EOVERFLOW: + return "Value too large for defined data type"; +# endif + +# if GNULIB_defined_ENOTSUP + case ENOTSUP: + return "Not supported"; +# endif + +# if GNULIB_defined_ + case ECANCELED: + return "Operation canceled"; +# endif + } + + { + char *result = strerror (n); + + if (result == NULL || result[0] == '\0') + { + static char const fmt[] = "Unknown error (%d)"; + static char mesg[sizeof fmt + INT_STRLEN_BOUND (n)]; + sprintf (mesg, fmt, n); + return mesg; + } + + return result; + } +} + +#endif diff --git a/lib/string.in.h b/lib/string.in.h new file mode 100644 index 0000000..a300dad --- /dev/null +++ b/lib/string.in.h @@ -0,0 +1,607 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* A GNU-like . + + Copyright (C) 1995-1996, 2001-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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_STRING_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STRING_H@ + +#ifndef _GL_STRING_H +#define _GL_STRING_H + + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# define __attribute__(Spec) /* empty */ +# endif +/* The attribute __pure__ was added in gcc 2.96. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) +# define __pure__ /* empty */ +# endif +#endif + + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Return the first occurrence of NEEDLE in HAYSTACK. */ +#if @GNULIB_MEMMEM@ +# if @REPLACE_MEMMEM@ +# define memmem rpl_memmem +# endif +# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@ +extern void *memmem (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memmem +# define memmem(a,al,b,bl) \ + (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \ + "use gnulib module memmem-simple for portability, " \ + "and module memmem for speed" ), \ + memmem (a, al, b, bl)) +#endif + +/* Copy N bytes of SRC to DEST, return pointer to bytes after the + last written byte. */ +#if @GNULIB_MEMPCPY@ +# if ! @HAVE_MEMPCPY@ +extern void *mempcpy (void *restrict __dest, void const *restrict __src, + size_t __n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mempcpy +# define mempcpy(a,b,n) \ + (GL_LINK_WARNING ("mempcpy is unportable - " \ + "use gnulib module mempcpy for portability"), \ + mempcpy (a, b, n)) +#endif + +/* Search backwards through a block for a byte (specified as an int). */ +#if @GNULIB_MEMRCHR@ +# if ! @HAVE_DECL_MEMRCHR@ +extern void *memrchr (void const *, int, size_t) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memrchr +# define memrchr(a,b,c) \ + (GL_LINK_WARNING ("memrchr is unportable - " \ + "use gnulib module memrchr for portability"), \ + memrchr (a, b, c)) +#endif + +/* Find the first occurrence of C in S. More efficient than + memchr(S,C,N), at the expense of undefined behavior if C does not + occur within N bytes. */ +#if @GNULIB_RAWMEMCHR@ +# if ! @HAVE_RAWMEMCHR@ +extern void *rawmemchr (void const *__s, int __c_in) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef rawmemchr +# define rawmemchr(a,b) \ + (GL_LINK_WARNING ("rawmemchr is unportable - " \ + "use gnulib module rawmemchr for portability"), \ + rawmemchr (a, b)) +#endif + +/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ +#if @GNULIB_STPCPY@ +# if ! @HAVE_STPCPY@ +extern char *stpcpy (char *restrict __dst, char const *restrict __src); +# endif +#elif defined GNULIB_POSIXCHECK +# undef stpcpy +# define stpcpy(a,b) \ + (GL_LINK_WARNING ("stpcpy is unportable - " \ + "use gnulib module stpcpy for portability"), \ + stpcpy (a, b)) +#endif + +/* Copy no more than N bytes of SRC to DST, returning a pointer past the + last non-NUL byte written into DST. */ +#if @GNULIB_STPNCPY@ +# if ! @HAVE_STPNCPY@ +# define stpncpy gnu_stpncpy +extern char *stpncpy (char *restrict __dst, char const *restrict __src, + size_t __n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef stpncpy +# define stpncpy(a,b,n) \ + (GL_LINK_WARNING ("stpncpy is unportable - " \ + "use gnulib module stpncpy for portability"), \ + stpncpy (a, b, n)) +#endif + +#if defined GNULIB_POSIXCHECK +/* strchr() does not work with multibyte strings if the locale encoding is + GB18030 and the character to be searched is a digit. */ +# undef strchr +# define strchr(s,c) \ + (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \ + "in some multibyte locales - " \ + "use mbschr if you care about internationalization"), \ + strchr (s, c)) +#endif + +/* Find the first occurrence of C in S or the final NUL byte. */ +#if @GNULIB_STRCHRNUL@ +# if ! @HAVE_STRCHRNUL@ +extern char *strchrnul (char const *__s, int __c_in) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strchrnul +# define strchrnul(a,b) \ + (GL_LINK_WARNING ("strchrnul is unportable - " \ + "use gnulib module strchrnul for portability"), \ + strchrnul (a, b)) +#endif + +/* Duplicate S, returning an identical malloc'd string. */ +#if @GNULIB_STRDUP@ +# if @REPLACE_STRDUP@ +# undef strdup +# define strdup rpl_strdup +# endif +# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@ +extern char *strdup (char const *__s); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strdup +# define strdup(a) \ + (GL_LINK_WARNING ("strdup is unportable - " \ + "use gnulib module strdup for portability"), \ + strdup (a)) +#endif + +/* Return a newly allocated copy of at most N bytes of STRING. */ +#if @GNULIB_STRNDUP@ +# if ! @HAVE_STRNDUP@ +# undef strndup +# define strndup rpl_strndup +# endif +# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@ +extern char *strndup (char const *__string, size_t __n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strndup +# define strndup(a,n) \ + (GL_LINK_WARNING ("strndup is unportable - " \ + "use gnulib module strndup for portability"), \ + strndup (a, n)) +#endif + +/* Find the length (number of bytes) of STRING, but scan at most + MAXLEN bytes. If no '\0' terminator is found in that many bytes, + return MAXLEN. */ +#if @GNULIB_STRNLEN@ +# if ! @HAVE_DECL_STRNLEN@ +extern size_t strnlen (char const *__string, size_t __maxlen) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strnlen +# define strnlen(a,n) \ + (GL_LINK_WARNING ("strnlen is unportable - " \ + "use gnulib module strnlen for portability"), \ + strnlen (a, n)) +#endif + +#if defined GNULIB_POSIXCHECK +/* strcspn() assumes the second argument is a list of single-byte characters. + Even in this simple case, it does not work with multibyte strings if the + locale encoding is GB18030 and one of the characters to be searched is a + digit. */ +# undef strcspn +# define strcspn(s,a) \ + (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbscspn if you care about internationalization"), \ + strcspn (s, a)) +#endif + +/* Find the first occurrence in S of any character in ACCEPT. */ +#if @GNULIB_STRPBRK@ +# if ! @HAVE_STRPBRK@ +extern char *strpbrk (char const *__s, char const *__accept) + __attribute__ ((__pure__)); +# endif +# if defined GNULIB_POSIXCHECK +/* strpbrk() assumes the second argument is a list of single-byte characters. + Even in this simple case, it does not work with multibyte strings if the + locale encoding is GB18030 and one of the characters to be searched is a + digit. */ +# undef strpbrk +# define strpbrk(s,a) \ + (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbspbrk if you care about internationalization"), \ + strpbrk (s, a)) +# endif +#elif defined GNULIB_POSIXCHECK +# undef strpbrk +# define strpbrk(s,a) \ + (GL_LINK_WARNING ("strpbrk is unportable - " \ + "use gnulib module strpbrk for portability"), \ + strpbrk (s, a)) +#endif + +#if defined GNULIB_POSIXCHECK +/* strspn() assumes the second argument is a list of single-byte characters. + Even in this simple case, it cannot work with multibyte strings. */ +# undef strspn +# define strspn(s,a) \ + (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbsspn if you care about internationalization"), \ + strspn (s, a)) +#endif + +#if defined GNULIB_POSIXCHECK +/* strrchr() does not work with multibyte strings if the locale encoding is + GB18030 and the character to be searched is a digit. */ +# undef strrchr +# define strrchr(s,c) \ + (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \ + "in some multibyte locales - " \ + "use mbsrchr if you care about internationalization"), \ + strrchr (s, c)) +#endif + +/* Search the next delimiter (char listed in DELIM) starting at *STRINGP. + If one is found, overwrite it with a NUL, and advance *STRINGP + to point to the next char after it. Otherwise, set *STRINGP to NULL. + If *STRINGP was already NULL, nothing happens. + Return the old value of *STRINGP. + + This is a variant of strtok() that is multithread-safe and supports + empty fields. + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + Caveat: It doesn't work with multibyte strings unless all of the delimiter + characters are ASCII characters < 0x30. + + See also strtok_r(). */ +#if @GNULIB_STRSEP@ +# if ! @HAVE_STRSEP@ +extern char *strsep (char **restrict __stringp, char const *restrict __delim); +# endif +# if defined GNULIB_POSIXCHECK +# undef strsep +# define strsep(s,d) \ + (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbssep if you care about internationalization"), \ + strsep (s, d)) +# endif +#elif defined GNULIB_POSIXCHECK +# undef strsep +# define strsep(s,d) \ + (GL_LINK_WARNING ("strsep is unportable - " \ + "use gnulib module strsep for portability"), \ + strsep (s, d)) +#endif + +#if @GNULIB_STRSTR@ +# if @REPLACE_STRSTR@ +# define strstr rpl_strstr +char *strstr (const char *haystack, const char *needle) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +/* strstr() does not work with multibyte strings if the locale encoding is + different from UTF-8: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ +# undef strstr +# define strstr(a,b) \ + (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \ + "work correctly on character strings in most " \ + "multibyte locales - " \ + "use mbsstr if you care about internationalization, " \ + "or use strstr if you care about speed"), \ + strstr (a, b)) +#endif + +/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive + comparison. */ +#if @GNULIB_STRCASESTR@ +# if @REPLACE_STRCASESTR@ +# define strcasestr rpl_strcasestr +# endif +# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@ +extern char *strcasestr (const char *haystack, const char *needle) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +/* strcasestr() does not work with multibyte strings: + It is a glibc extension, and glibc implements it only for unibyte + locales. */ +# undef strcasestr +# define strcasestr(a,b) \ + (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \ + "in multibyte locales - " \ + "use mbscasestr if you care about " \ + "internationalization, or use c-strcasestr if you want " \ + "a locale independent function"), \ + strcasestr (a, b)) +#endif + +/* Parse S into tokens separated by characters in DELIM. + If S is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = strtok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" + + This is a variant of strtok() that is multithread-safe. + + For the POSIX documentation for this function, see: + http://www.opengroup.org/susv3xsh/strtok.html + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + Caveat: It doesn't work with multibyte strings unless all of the delimiter + characters are ASCII characters < 0x30. + + See also strsep(). */ +#if @GNULIB_STRTOK_R@ +# if ! @HAVE_DECL_STRTOK_R@ +extern char *strtok_r (char *restrict s, char const *restrict delim, + char **restrict save_ptr); +# endif +# if defined GNULIB_POSIXCHECK +# undef strtok_r +# define strtok_r(s,d,p) \ + (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbstok_r if you care about internationalization"), \ + strtok_r (s, d, p)) +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtok_r +# define strtok_r(s,d,p) \ + (GL_LINK_WARNING ("strtok_r is unportable - " \ + "use gnulib module strtok_r for portability"), \ + strtok_r (s, d, p)) +#endif + + +/* The following functions are not specified by POSIX. They are gnulib + extensions. */ + +#if @GNULIB_MBSLEN@ +/* Return the number of multibyte characters in the character string STRING. + This considers multibyte characters, unlike strlen, which counts bytes. */ +extern size_t mbslen (const char *string); +#endif + +#if @GNULIB_MBSNLEN@ +/* Return the number of multibyte characters in the character string starting + at STRING and ending at STRING + LEN. */ +extern size_t mbsnlen (const char *string, size_t len); +#endif + +#if @GNULIB_MBSCHR@ +/* Locate the first single-byte character C in the character string STRING, + and return a pointer to it. Return NULL if C is not found in STRING. + Unlike strchr(), this function works correctly in multibyte locales with + encodings such as GB18030. */ +# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ +extern char * mbschr (const char *string, int c); +#endif + +#if @GNULIB_MBSRCHR@ +/* Locate the last single-byte character C in the character string STRING, + and return a pointer to it. Return NULL if C is not found in STRING. + Unlike strrchr(), this function works correctly in multibyte locales with + encodings such as GB18030. */ +# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ +extern char * mbsrchr (const char *string, int c); +#endif + +#if @GNULIB_MBSSTR@ +/* Find the first occurrence of the character string NEEDLE in the character + string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. + Unlike strstr(), this function works correctly in multibyte locales with + encodings different from UTF-8. */ +extern char * mbsstr (const char *haystack, const char *needle); +#endif + +#if @GNULIB_MBSCASECMP@ +/* Compare the character strings S1 and S2, ignoring case, returning less than, + equal to or greater than zero if S1 is lexicographically less than, equal to + or greater than S2. + Note: This function may, in multibyte locales, return 0 for strings of + different lengths! + Unlike strcasecmp(), this function works correctly in multibyte locales. */ +extern int mbscasecmp (const char *s1, const char *s2); +#endif + +#if @GNULIB_MBSNCASECMP@ +/* Compare the initial segment of the character string S1 consisting of at most + N characters with the initial segment of the character string S2 consisting + of at most N characters, ignoring case, returning less than, equal to or + greater than zero if the initial segment of S1 is lexicographically less + than, equal to or greater than the initial segment of S2. + Note: This function may, in multibyte locales, return 0 for initial segments + of different lengths! + Unlike strncasecmp(), this function works correctly in multibyte locales. + But beware that N is not a byte count but a character count! */ +extern int mbsncasecmp (const char *s1, const char *s2, size_t n); +#endif + +#if @GNULIB_MBSPCASECMP@ +/* Compare the initial segment of the character string STRING consisting of + at most mbslen (PREFIX) characters with the character string PREFIX, + ignoring case, returning less than, equal to or greater than zero if this + initial segment is lexicographically less than, equal to or greater than + PREFIX. + Note: This function may, in multibyte locales, return 0 if STRING is of + smaller length than PREFIX! + Unlike strncasecmp(), this function works correctly in multibyte + locales. */ +extern char * mbspcasecmp (const char *string, const char *prefix); +#endif + +#if @GNULIB_MBSCASESTR@ +/* Find the first occurrence of the character string NEEDLE in the character + string HAYSTACK, using case-insensitive comparison. + Note: This function may, in multibyte locales, return success even if + strlen (haystack) < strlen (needle) ! + Unlike strcasestr(), this function works correctly in multibyte locales. */ +extern char * mbscasestr (const char *haystack, const char *needle); +#endif + +#if @GNULIB_MBSCSPN@ +/* Find the first occurrence in the character string STRING of any character + in the character string ACCEPT. Return the number of bytes from the + beginning of the string to this occurrence, or to the end of the string + if none exists. + Unlike strcspn(), this function works correctly in multibyte locales. */ +extern size_t mbscspn (const char *string, const char *accept); +#endif + +#if @GNULIB_MBSPBRK@ +/* Find the first occurrence in the character string STRING of any character + in the character string ACCEPT. Return the pointer to it, or NULL if none + exists. + Unlike strpbrk(), this function works correctly in multibyte locales. */ +# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ +extern char * mbspbrk (const char *string, const char *accept); +#endif + +#if @GNULIB_MBSSPN@ +/* Find the first occurrence in the character string STRING of any character + not in the character string REJECT. Return the number of bytes from the + beginning of the string to this occurrence, or to the end of the string + if none exists. + Unlike strspn(), this function works correctly in multibyte locales. */ +extern size_t mbsspn (const char *string, const char *reject); +#endif + +#if @GNULIB_MBSSEP@ +/* Search the next delimiter (multibyte character listed in the character + string DELIM) starting at the character string *STRINGP. + If one is found, overwrite it with a NUL, and advance *STRINGP to point + to the next multibyte character after it. Otherwise, set *STRINGP to NULL. + If *STRINGP was already NULL, nothing happens. + Return the old value of *STRINGP. + + This is a variant of mbstok_r() that supports empty fields. + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + + See also mbstok_r(). */ +extern char * mbssep (char **stringp, const char *delim); +#endif + +#if @GNULIB_MBSTOK_R@ +/* Parse the character string STRING into tokens separated by characters in + the character string DELIM. + If STRING is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = mbstok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + + See also mbssep(). */ +extern char * mbstok_r (char *string, const char *delim, char **save_ptr); +#endif + +/* Map any int, typically from errno, into an error message. */ +#if @GNULIB_STRERROR@ +# if @REPLACE_STRERROR@ +# undef strerror +# define strerror rpl_strerror +extern char *strerror (int); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror +# define strerror(e) \ + (GL_LINK_WARNING ("strerror is unportable - " \ + "use gnulib module strerror to guarantee non-NULL result"), \ + strerror (e)) +#endif + +#if @GNULIB_STRSIGNAL@ +# if @REPLACE_STRSIGNAL@ +# define strsignal rpl_strsignal +# endif +# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@ +extern char *strsignal (int __sig); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strsignal +# define strsignal(a) \ + (GL_LINK_WARNING ("strsignal is unportable - " \ + "use gnulib module strsignal for portability"), \ + strsignal (a)) +#endif + +#if @GNULIB_STRVERSCMP@ +# if !@HAVE_STRVERSCMP@ +extern int strverscmp (const char *, const char *); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strverscmp +# define strverscmp(a, b) \ + (GL_LINK_WARNING ("strverscmp is unportable - " \ + "use gnulib module strverscmp for portability"), \ + strverscmp (a, b)) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_STRING_H */ +#endif /* _GL_STRING_H */ diff --git a/lib/stripslash.c b/lib/stripslash.c new file mode 100644 index 0000000..4084410 --- /dev/null +++ b/lib/stripslash.c @@ -0,0 +1,44 @@ +/* stripslash.c -- remove redundant trailing slashes from a file name + + Copyright (C) 1990, 2001, 2003-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 . */ + +#include + +#include "dirname.h" + +/* Remove trailing slashes from FILE. Return true if a trailing slash + was removed. This is useful when using file name completion from a + shell that adds a "/" after directory names (such as tcsh and + bash), because on symlinks to directories, several system calls + have different semantics according to whether a trailing slash is + present. */ + +bool +strip_trailing_slashes (char *file) +{ + char *base = last_component (file); + char *base_lim; + bool had_slash; + + /* last_component returns "" for file system roots, but we need to turn + `///' into `/'. */ + if (! *base) + base = file; + base_lim = base + base_len (base); + had_slash = (*base_lim != '\0'); + *base_lim = '\0'; + return had_slash; +} diff --git a/lib/strndup.c b/lib/strndup.c new file mode 100644 index 0000000..239c625 --- /dev/null +++ b/lib/strndup.c @@ -0,0 +1,39 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* A replacement function, for systems that lack strndup. + + Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006, 2007 + 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#include + +#include + +char * +strndup (char const *s, size_t n) +{ + size_t len = strnlen (s, n); + char *new = malloc (len + 1); + + if (new == NULL) + return NULL; + + new[len] = '\0'; + return memcpy (new, s, len); +} diff --git a/lib/strnlen.c b/lib/strnlen.c new file mode 100644 index 0000000..dec9587 --- /dev/null +++ b/lib/strnlen.c @@ -0,0 +1,33 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Find the length of STRING, but scan at most MAXLEN characters. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. + Written by Simon Josefsson. + + 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#include + +/* Find the length of STRING, but scan at most MAXLEN characters. + If no '\0' terminator is found in that many characters, return MAXLEN. */ + +size_t +strnlen (const char *string, size_t maxlen) +{ + const char *end = memchr (string, '\0', maxlen); + return end ? (size_t) (end - string) : maxlen; +} diff --git a/lib/strtol.c b/lib/strtol.c new file mode 100644 index 0000000..0b2c82a --- /dev/null +++ b/lib/strtol.c @@ -0,0 +1,435 @@ +/* Convert string representation of a number into an integer value. + + Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005, + 2006, 2007 + Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C + Library. Bugs can be reported to bug-glibc@gnu.org. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or 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 . */ + +#ifdef _LIBC +# define USE_NUMBER_GROUPING +#else +# include +#endif + +#include +#include +#ifndef __set_errno +# define __set_errno(Val) errno = (Val) +#endif + +#include +#include +#include +#include + +#ifdef USE_NUMBER_GROUPING +# include "../locale/localeinfo.h" +#endif + +/* Nonzero if we are defining `strtoul' or `strtoull', operating on + unsigned integers. */ +#ifndef UNSIGNED +# define UNSIGNED 0 +# define INT LONG int +#else +# define INT unsigned LONG int +#endif + +/* Determine the name. */ +#ifdef USE_IN_EXTENDED_LOCALE_MODEL +# if UNSIGNED +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol __wcstoull_l +# else +# define strtol __wcstoul_l +# endif +# else +# ifdef QUAD +# define strtol __strtoull_l +# else +# define strtol __strtoul_l +# endif +# endif +# else +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol __wcstoll_l +# else +# define strtol __wcstol_l +# endif +# else +# ifdef QUAD +# define strtol __strtoll_l +# else +# define strtol __strtol_l +# endif +# endif +# endif +#else +# if UNSIGNED +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol wcstoull +# else +# define strtol wcstoul +# endif +# else +# ifdef QUAD +# define strtol strtoull +# else +# define strtol strtoul +# endif +# endif +# else +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol wcstoll +# else +# define strtol wcstol +# endif +# else +# ifdef QUAD +# define strtol strtoll +# endif +# endif +# endif +#endif + +/* If QUAD is defined, we are defining `strtoll' or `strtoull', + operating on `long long int's. */ +#ifdef QUAD +# define LONG long long +# define STRTOL_LONG_MIN LONG_LONG_MIN +# define STRTOL_LONG_MAX LONG_LONG_MAX +# define STRTOL_ULONG_MAX ULONG_LONG_MAX + +/* The extra casts in the following macros work around compiler bugs, + e.g., in Cray C 5.0.3.0. */ + +/* True if negative values of the signed integer type T use two's + complement, ones' complement, or signed magnitude representation, + respectively. Much GNU code assumes two's complement, but some + people like to be portable to all possible C hosts. */ +# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) + +/* True if the arithmetic type T is signed. */ +# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* The maximum and minimum values for the integer type T. These + macros have undefined behavior if T is signed and has padding bits. + If this is a problem for you, please let us know how to fix it for + your host. */ +# define TYPE_MINIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ + : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +# define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + +# ifndef ULONG_LONG_MAX +# define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long) +# endif +# ifndef LONG_LONG_MAX +# define LONG_LONG_MAX TYPE_MAXIMUM (long long int) +# endif +# ifndef LONG_LONG_MIN +# define LONG_LONG_MIN TYPE_MINIMUM (long long int) +# endif + +# if __GNUC__ == 2 && __GNUC_MINOR__ < 7 + /* Work around gcc bug with using this constant. */ + static const unsigned long long int maxquad = ULONG_LONG_MAX; +# undef STRTOL_ULONG_MAX +# define STRTOL_ULONG_MAX maxquad +# endif +#else +# define LONG long +# define STRTOL_LONG_MIN LONG_MIN +# define STRTOL_LONG_MAX LONG_MAX +# define STRTOL_ULONG_MAX ULONG_MAX +#endif + + +/* We use this code also for the extended locale handling where the + function gets as an additional argument the locale which has to be + used. To access the values we have to redefine the _NL_CURRENT + macro. */ +#ifdef USE_IN_EXTENDED_LOCALE_MODEL +# undef _NL_CURRENT +# define _NL_CURRENT(category, item) \ + (current->values[_NL_ITEM_INDEX (item)].string) +# define LOCALE_PARAM , loc +# define LOCALE_PARAM_PROTO , __locale_t loc +#else +# define LOCALE_PARAM +# define LOCALE_PARAM_PROTO +#endif + +#include + +#ifdef USE_WIDE_CHAR +# include +# define L_(Ch) L##Ch +# define UCHAR_TYPE wint_t +# define STRING_TYPE wchar_t +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define ISSPACE(Ch) __iswspace_l ((Ch), loc) +# define ISALPHA(Ch) __iswalpha_l ((Ch), loc) +# define TOUPPER(Ch) __towupper_l ((Ch), loc) +# else +# define ISSPACE(Ch) iswspace (Ch) +# define ISALPHA(Ch) iswalpha (Ch) +# define TOUPPER(Ch) towupper (Ch) +# endif +#else +# define L_(Ch) Ch +# define UCHAR_TYPE unsigned char +# define STRING_TYPE char +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define ISSPACE(Ch) __isspace_l ((Ch), loc) +# define ISALPHA(Ch) __isalpha_l ((Ch), loc) +# define TOUPPER(Ch) __toupper_l ((Ch), loc) +# else +# define ISSPACE(Ch) isspace (Ch) +# define ISALPHA(Ch) isalpha (Ch) +# define TOUPPER(Ch) toupper (Ch) +# endif +#endif + +#define INTERNAL(X) INTERNAL1(X) +#define INTERNAL1(X) __##X##_internal +#define WEAKNAME(X) WEAKNAME1(X) + +#ifdef USE_NUMBER_GROUPING +/* This file defines a function to check for correct grouping. */ +# include "grouping.h" +#endif + + + +/* Convert NPTR to an `unsigned long int' or `long int' in base BASE. + If BASE is 0 the base is determined by the presence of a leading + zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal. + If BASE is < 2 or > 36, it is reset to 10. + If ENDPTR is not NULL, a pointer to the character after the last + one converted is stored in *ENDPTR. */ + +INT +INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr, + int base, int group LOCALE_PARAM_PROTO) +{ + int negative; + register unsigned LONG int cutoff; + register unsigned int cutlim; + register unsigned LONG int i; + register const STRING_TYPE *s; + register UCHAR_TYPE c; + const STRING_TYPE *save, *end; + int overflow; + +#ifdef USE_NUMBER_GROUPING +# ifdef USE_IN_EXTENDED_LOCALE_MODEL + struct locale_data *current = loc->__locales[LC_NUMERIC]; +# endif + /* The thousands character of the current locale. */ + wchar_t thousands = L'\0'; + /* The numeric grouping specification of the current locale, + in the format described in . */ + const char *grouping; + + if (group) + { + grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); + if (*grouping <= 0 || *grouping == CHAR_MAX) + grouping = NULL; + else + { + /* Figure out the thousands separator character. */ +# if defined _LIBC || defined _HAVE_BTOWC + thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); + if (thousands == WEOF) + thousands = L'\0'; +# endif + if (thousands == L'\0') + grouping = NULL; + } + } + else + grouping = NULL; +#endif + + if (base < 0 || base == 1 || base > 36) + { + __set_errno (EINVAL); + return 0; + } + + save = s = nptr; + + /* Skip white space. */ + while (ISSPACE (*s)) + ++s; + if (*s == L_('\0')) + goto noconv; + + /* Check for a sign. */ + if (*s == L_('-')) + { + negative = 1; + ++s; + } + else if (*s == L_('+')) + { + negative = 0; + ++s; + } + else + negative = 0; + + /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ + if (*s == L_('0')) + { + if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X')) + { + s += 2; + base = 16; + } + else if (base == 0) + base = 8; + } + else if (base == 0) + base = 10; + + /* Save the pointer so we can check later if anything happened. */ + save = s; + +#ifdef USE_NUMBER_GROUPING + if (group) + { + /* Find the end of the digit string and check its grouping. */ + end = s; + for (c = *end; c != L_('\0'); c = *++end) + if ((wchar_t) c != thousands + && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9')) + && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base)) + break; + if (*s == thousands) + end = s; + else + end = correctly_grouped_prefix (s, end, thousands, grouping); + } + else +#endif + end = NULL; + + cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base; + cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base; + + overflow = 0; + i = 0; + for (c = *s; c != L_('\0'); c = *++s) + { + if (s == end) + break; + if (c >= L_('0') && c <= L_('9')) + c -= L_('0'); + else if (ISALPHA (c)) + c = TOUPPER (c) - L_('A') + 10; + else + break; + if ((int) c >= base) + break; + /* Check for overflow. */ + if (i > cutoff || (i == cutoff && c > cutlim)) + overflow = 1; + else + { + i *= (unsigned LONG int) base; + i += c; + } + } + + /* Check if anything actually happened. */ + if (s == save) + goto noconv; + + /* Store in ENDPTR the address of one character + past the last character we converted. */ + if (endptr != NULL) + *endptr = (STRING_TYPE *) s; + +#if !UNSIGNED + /* Check for a value that is within the range of + `unsigned LONG int', but outside the range of `LONG int'. */ + if (overflow == 0 + && i > (negative + ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1 + : (unsigned LONG int) STRTOL_LONG_MAX)) + overflow = 1; +#endif + + if (overflow) + { + __set_errno (ERANGE); +#if UNSIGNED + return STRTOL_ULONG_MAX; +#else + return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX; +#endif + } + + /* Return the result of the appropriate sign. */ + return negative ? -i : i; + +noconv: + /* We must handle a special case here: the base is 0 or 16 and the + first two characters are '0' and 'x', but the rest are no + hexadecimal digits. This is no error case. We return 0 and + ENDPTR points to the `x`. */ + if (endptr != NULL) + { + if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X') + && save[-2] == L_('0')) + *endptr = (STRING_TYPE *) &save[-1]; + else + /* There was no number to convert. */ + *endptr = (STRING_TYPE *) nptr; + } + + return 0L; +} + +/* External user entry point. */ + + +INT +#ifdef weak_function +weak_function +#endif +strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr, + int base LOCALE_PARAM_PROTO) +{ + return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM); +} diff --git a/lib/strtoul.c b/lib/strtoul.c new file mode 100644 index 0000000..88dbfc0 --- /dev/null +++ b/lib/strtoul.c @@ -0,0 +1,19 @@ +/* Copyright (C) 1991, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +#define UNSIGNED 1 + +#include "strtol.c" diff --git a/lib/strverscmp.c b/lib/strverscmp.c new file mode 100644 index 0000000..6bfda3b --- /dev/null +++ b/lib/strverscmp.c @@ -0,0 +1,133 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Compare strings while treating digits characters numerically. + Copyright (C) 1997, 2000, 2002, 2004, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jean-François Bignolles , 1997. + + 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if !_LIBC +# include +#endif + +#include +#include + +/* states: S_N: normal, S_I: comparing integral part, S_F: comparing + fractional parts, S_Z: idem but with leading Zeroes only */ +#define S_N 0x0 +#define S_I 0x4 +#define S_F 0x8 +#define S_Z 0xC + +/* result_type: CMP: return diff; LEN: compare using len_diff/diff */ +#define CMP 2 +#define LEN 3 + + +/* ISDIGIT differs from isdigit, as follows: + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. + - It's typically faster. + POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to + isdigit unless it's important to use the locale's definition + of `digit' even when the host does not conform to POSIX. */ +#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) + +#undef __strverscmp +#undef strverscmp + +#ifndef weak_alias +# define __strverscmp strverscmp +#endif + +/* Compare S1 and S2 as strings holding indices/version numbers, + returning less than, equal to or greater than zero if S1 is less than, + equal to or greater than S2 (for more info, see the texinfo doc). +*/ + +int +__strverscmp (const char *s1, const char *s2) +{ + const unsigned char *p1 = (const unsigned char *) s1; + const unsigned char *p2 = (const unsigned char *) s2; + unsigned char c1, c2; + int state; + int diff; + + /* Symbol(s) 0 [1-9] others (padding) + Transition (10) 0 (01) d (00) x (11) - */ + static const unsigned int next_state[] = + { + /* state x d 0 - */ + /* S_N */ S_N, S_I, S_Z, S_N, + /* S_I */ S_N, S_I, S_I, S_I, + /* S_F */ S_N, S_F, S_F, S_F, + /* S_Z */ S_N, S_F, S_Z, S_Z + }; + + static const int result_type[] = + { + /* state x/x x/d x/0 x/- d/x d/d d/0 d/- + 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */ + + /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, + CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, + /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP, + 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP, + /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, + CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, + /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP, + -1, CMP, CMP, CMP + }; + + if (p1 == p2) + return 0; + + c1 = *p1++; + c2 = *p2++; + /* Hint: '0' is a digit too. */ + state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0)); + + while ((diff = c1 - c2) == 0 && c1 != '\0') + { + state = next_state[state]; + c1 = *p1++; + c2 = *p2++; + state |= (c1 == '0') + (ISDIGIT (c1) != 0); + } + + state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))]; + + switch (state) + { + case CMP: + return diff; + + case LEN: + while (ISDIGIT (*p1++)) + if (!ISDIGIT (*p2++)) + return 1; + + return ISDIGIT (*p2) ? -1 : diff; + + default: + return state; + } +} +#ifdef weak_alias +weak_alias (__strverscmp, strverscmp) +#endif diff --git a/lib/subpipe.c b/lib/subpipe.c new file mode 100644 index 0000000..a0cfc81 --- /dev/null +++ b/lib/subpipe.c @@ -0,0 +1,176 @@ +/* Subprocesses with pipes. + + Copyright (C) 2002, 2004, 2005, 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 . */ + +/* Written by Paul Eggert + and Florian Krohm . */ + +#include + +#include "subpipe.h" + +#include + +#include +#if ! defined SIGCHLD && defined SIGCLD +# define SIGCHLD SIGCLD +#endif + +#include + +#include +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +# define STDOUT_FILENO 1 +#endif +#if ! HAVE_DUP2 && ! defined dup2 +# include +# define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t)) +#endif + +#if HAVE_SYS_WAIT_H +# include +#endif +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +#if HAVE_VFORK_H +# include +#endif +#if ! HAVE_WORKING_VFORK +# define vfork fork +#endif + +#include "error.h" +#include "unistd-safer.h" + +#include "gettext.h" +#define _(Msgid) gettext (Msgid) + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if ! defined __GNUC__ || __GNUC__ < 2 || \ +(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# define __attribute__(Spec) /* empty */ +# endif +#endif + +#ifndef ATTRIBUTE_UNUSED +# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#endif + + +/* Initialize this module. */ + +void +init_subpipe (void) +{ +#ifdef SIGCHLD + /* System V fork+wait does not work if SIGCHLD is ignored. */ + signal (SIGCHLD, SIG_DFL); +#endif +} + + +/* Create a subprocess that is run as a filter. ARGV is the + NULL-terminated argument vector for the subprocess. Store read and + write file descriptors for communication with the subprocess into + FD[0] and FD[1]: input meant for the process can be written into + FD[0], and output from the process can be read from FD[1]. Return + the subprocess id. + + To avoid deadlock, the invoker must not let incoming data pile up + in FD[1] while writing data to FD[0]. */ + +pid_t +create_subpipe (char const * const *argv, int fd[2]) +{ + int pipe_fd[2]; + int child_fd[2]; + pid_t pid; + + if (pipe_safer (child_fd) != 0 || pipe_safer (pipe_fd) != 0) + error (EXIT_FAILURE, errno, "pipe"); + fd[0] = child_fd[1]; + fd[1] = pipe_fd[0]; + child_fd[1] = pipe_fd[1]; + + pid = vfork (); + if (pid < 0) + error (EXIT_FAILURE, errno, "fork"); + + if (! pid) + { + /* Child. */ + close (fd[0]); + close (fd[1]); + dup2 (child_fd[0], STDIN_FILENO); + close (child_fd[0]); + dup2 (child_fd[1], STDOUT_FILENO); + close (child_fd[1]); + + /* The cast to (char **) rather than (char * const *) is needed + for portability to older hosts with a nonstandard prototype + for execvp. */ + execvp (argv[0], (char **) argv); + + _exit (errno == ENOENT ? 127 : 126); + } + + /* Parent. */ + close (child_fd[0]); + close (child_fd[1]); + return pid; +} + + +/* Wait for the subprocess to exit. */ + +void +reap_subpipe (pid_t pid, char const *program) +{ +#if HAVE_WAITPID || defined waitpid + int wstatus; + if (waitpid (pid, &wstatus, 0) < 0) + error (EXIT_FAILURE, errno, "waitpid"); + else + { + int status = WIFEXITED (wstatus) ? WEXITSTATUS (wstatus) : -1; + if (status) + error (EXIT_FAILURE, 0, + _(status == 126 + ? "subsidiary program `%s' could not be invoked" + : status == 127 + ? "subsidiary program `%s' not found" + : status < 0 + ? "subsidiary program `%s' failed" + : "subsidiary program `%s' failed (exit status %d)"), + program, status); + } +#endif +} + +void +end_of_output_subpipe (pid_t pid ATTRIBUTE_UNUSED, + int fd[2] ATTRIBUTE_UNUSED) +{ +} diff --git a/lib/subpipe.h b/lib/subpipe.h new file mode 100644 index 0000000..cd1e444 --- /dev/null +++ b/lib/subpipe.h @@ -0,0 +1,27 @@ +/* Subprocesses with pipes. + Copyright (C) 2002, 2004, 2005 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 . */ + +/* Written by Paul Eggert + and Florian Krohm . */ + +#if HAVE_SYS_TYPES_H +# include +#endif + +void init_subpipe (void); +pid_t create_subpipe (char const * const *, int[2]); +void end_of_output_subpipe (pid_t, int[2]); +void reap_subpipe (pid_t, char const *); diff --git a/lib/timevar.c b/lib/timevar.c new file mode 100644 index 0000000..c79252b --- /dev/null +++ b/lib/timevar.c @@ -0,0 +1,562 @@ +/* Timing variables for measuring compiler performance. + Copyright (C) 2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. + Contributed by Alex Samuel + + 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 . */ + +#include + +#if IN_GCC + +#include "system.h" +#include "intl.h" +#include "rtl.h" + +#else + +/* This source file is taken from the GCC source code, with slight + modifications that are under control of the IN_GCC preprocessor + variable. The !IN_GCC part of this file is specific to Bison. */ + +# include "../src/system.h" +# if HAVE_SYS_TIME_H +# include +# endif +int timevar_report = 0; + +#endif + + +#ifdef HAVE_SYS_TIMES_H +# include +#endif +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif + +#ifndef HAVE_CLOCK_T +typedef int clock_t; +#endif + +#ifndef HAVE_STRUCT_TMS +struct tms +{ + clock_t tms_utime; + clock_t tms_stime; + clock_t tms_cutime; + clock_t tms_cstime; +}; +#endif + +#if defined HAVE_DECL_GETRUSAGE && !HAVE_DECL_GETRUSAGE +extern int getrusage (int, struct rusage *); +#endif +#if defined HAVE_DECL_TIMES && !HAVE_DECL_TIMES +extern clock_t times (struct tms *); +#endif +#if defined HAVE_DECL_CLOCK && !HAVE_DECL_CLOCK +extern clock_t clock (void); +#endif + +#ifndef RUSAGE_SELF +# define RUSAGE_SELF 0 +#endif + +/* Calculation of scale factor to convert ticks to microseconds. + We mustn't use CLOCKS_PER_SEC except with clock(). */ +#if HAVE_SYSCONF && defined _SC_CLK_TCK +# define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */ +#else +# ifdef CLK_TCK +# define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */ +# else +# ifdef HZ +# define TICKS_PER_SECOND HZ /* traditional UNIX */ +# else +# define TICKS_PER_SECOND 100 /* often the correct value */ +# endif +# endif +#endif + +/* Prefer times to getrusage to clock (each gives successively less + information). */ +#ifdef HAVE_TIMES +# define USE_TIMES +# define HAVE_USER_TIME +# define HAVE_SYS_TIME +# define HAVE_WALL_TIME +#else +#ifdef HAVE_GETRUSAGE +# define USE_GETRUSAGE +# define HAVE_USER_TIME +# define HAVE_SYS_TIME +#else +#ifdef HAVE_CLOCK +# define USE_CLOCK +# define HAVE_USER_TIME +#endif +#endif +#endif + +/* libc is very likely to have snuck a call to sysconf() into one of + the underlying constants, and that can be very slow, so we have to + precompute them. Whose wonderful idea was it to make all those + _constants_ variable at run time, anyway? */ +#ifdef USE_TIMES +static float ticks_to_msec; +#define TICKS_TO_MSEC (1.0 / TICKS_PER_SECOND) +#endif + +#ifdef USE_CLOCK +static float clocks_to_msec; +#define CLOCKS_TO_MSEC (1.0 / CLOCKS_PER_SEC) +#endif + +#if IN_GCC +#include "flags.h" +#endif +#include "timevar.h" + +/* See timevar.h for an explanation of timing variables. */ + +/* This macro evaluates to nonzero if timing variables are enabled. */ +#define TIMEVAR_ENABLE (timevar_report) + +/* A timing variable. */ + +struct timevar_def +{ + /* Elapsed time for this variable. */ + struct timevar_time_def elapsed; + + /* If this variable is timed independently of the timing stack, + using timevar_start, this contains the start time. */ + struct timevar_time_def start_time; + + /* The name of this timing variable. */ + const char *name; + + /* Non-zero if this timing variable is running as a standalone + timer. */ + unsigned standalone : 1; + + /* Non-zero if this timing variable was ever started or pushed onto + the timing stack. */ + unsigned used : 1; +}; + +/* An element on the timing stack. Elapsed time is attributed to the + topmost timing variable on the stack. */ + +struct timevar_stack_def +{ + /* The timing variable at this stack level. */ + struct timevar_def *timevar; + + /* The next lower timing variable context in the stack. */ + struct timevar_stack_def *next; +}; + +/* Declared timing variables. Constructed from the contents of + timevar.def. */ +static struct timevar_def timevars[TIMEVAR_LAST]; + +/* The top of the timing stack. */ +static struct timevar_stack_def *stack; + +/* A list of unused (i.e. allocated and subsequently popped) + timevar_stack_def instances. */ +static struct timevar_stack_def *unused_stack_instances; + +/* The time at which the topmost element on the timing stack was + pushed. Time elapsed since then is attributed to the topmost + element. */ +static struct timevar_time_def start_time; + +static void get_time (struct timevar_time_def *); +static void timevar_accumulate (struct timevar_time_def *, + struct timevar_time_def *, + struct timevar_time_def *); + +/* Fill the current times into TIME. The definition of this function + also defines any or all of the HAVE_USER_TIME, HAVE_SYS_TIME, and + HAVE_WALL_TIME macros. */ + +static void +get_time (now) + struct timevar_time_def *now; +{ + now->user = 0; + now->sys = 0; + now->wall = 0; + + if (!TIMEVAR_ENABLE) + return; + + { +#ifdef USE_TIMES + struct tms tms; + now->wall = times (&tms) * ticks_to_msec; +#if IN_GCC + now->user = tms.tms_utime * ticks_to_msec; + now->sys = tms.tms_stime * ticks_to_msec; +#else + now->user = (tms.tms_utime + tms.tms_cutime) * ticks_to_msec; + now->sys = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec; +#endif +#endif +#ifdef USE_GETRUSAGE + struct rusage rusage; +#if IN_GCC + getrusage (RUSAGE_SELF, &rusage); +#else + getrusage (RUSAGE_CHILDREN, &rusage); +#endif + now->user = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec * 1e-6; + now->sys = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec * 1e-6; +#endif +#ifdef USE_CLOCK + now->user = clock () * clocks_to_msec; +#endif + } +} + +/* Add the difference between STOP and START to TIMER. */ + +static void +timevar_accumulate (timer, start, stop) + struct timevar_time_def *timer; + struct timevar_time_def *start; + struct timevar_time_def *stop; +{ + timer->user += stop->user - start->user; + timer->sys += stop->sys - start->sys; + timer->wall += stop->wall - start->wall; +} + +/* Initialize timing variables. */ + +void +init_timevar () +{ + if (!TIMEVAR_ENABLE) + return; + + /* Zero all elapsed times. */ + memset ((void *) timevars, 0, sizeof (timevars)); + + /* Initialize the names of timing variables. */ +#define DEFTIMEVAR(identifier__, name__) \ + timevars[identifier__].name = name__; +#include "timevar.def" +#undef DEFTIMEVAR + +#ifdef USE_TIMES + ticks_to_msec = TICKS_TO_MSEC; +#endif +#ifdef USE_CLOCK + clocks_to_msec = CLOCKS_TO_MSEC; +#endif +} + +/* Push TIMEVAR onto the timing stack. No further elapsed time is + attributed to the previous topmost timing variable on the stack; + subsequent elapsed time is attributed to TIMEVAR, until it is + popped or another element is pushed on top. + + TIMEVAR cannot be running as a standalone timer. */ + +void +timevar_push (timevar) + timevar_id_t timevar; +{ + struct timevar_def *tv = &timevars[timevar]; + struct timevar_stack_def *context; + struct timevar_time_def now; + + if (!TIMEVAR_ENABLE) + return; + + /* Mark this timing variable as used. */ + tv->used = 1; + + /* Can't push a standalone timer. */ + if (tv->standalone) + abort (); + + /* What time is it? */ + get_time (&now); + + /* If the stack isn't empty, attribute the current elapsed time to + the old topmost element. */ + if (stack) + timevar_accumulate (&stack->timevar->elapsed, &start_time, &now); + + /* Reset the start time; from now on, time is attributed to + TIMEVAR. */ + start_time = now; + + /* See if we have a previously-allocated stack instance. If so, + take it off the list. If not, malloc a new one. */ + if (unused_stack_instances != NULL) + { + context = unused_stack_instances; + unused_stack_instances = unused_stack_instances->next; + } + else + context = (struct timevar_stack_def *) + xmalloc (sizeof (struct timevar_stack_def)); + + /* Fill it in and put it on the stack. */ + context->timevar = tv; + context->next = stack; + stack = context; +} + +/* Pop the topmost timing variable element off the timing stack. The + popped variable must be TIMEVAR. Elapsed time since the that + element was pushed on, or since it was last exposed on top of the + stack when the element above it was popped off, is credited to that + timing variable. */ + +void +timevar_pop (timevar) + timevar_id_t timevar; +{ + struct timevar_time_def now; + struct timevar_stack_def *popped = stack; + + if (!TIMEVAR_ENABLE) + return; + + if (&timevars[timevar] != stack->timevar) + abort (); + + /* What time is it? */ + get_time (&now); + + /* Attribute the elapsed time to the element we're popping. */ + timevar_accumulate (&popped->timevar->elapsed, &start_time, &now); + + /* Reset the start time; from now on, time is attributed to the + element just exposed on the stack. */ + start_time = now; + + /* Take the item off the stack. */ + stack = stack->next; + + /* Don't delete the stack element; instead, add it to the list of + unused elements for later use. */ + popped->next = unused_stack_instances; + unused_stack_instances = popped; +} + +/* Start timing TIMEVAR independently of the timing stack. Elapsed + time until timevar_stop is called for the same timing variable is + attributed to TIMEVAR. */ + +void +timevar_start (timevar) + timevar_id_t timevar; +{ + struct timevar_def *tv = &timevars[timevar]; + + if (!TIMEVAR_ENABLE) + return; + + /* Mark this timing variable as used. */ + tv->used = 1; + + /* Don't allow the same timing variable to be started more than + once. */ + if (tv->standalone) + abort (); + tv->standalone = 1; + + get_time (&tv->start_time); +} + +/* Stop timing TIMEVAR. Time elapsed since timevar_start was called + is attributed to it. */ + +void +timevar_stop (timevar) + timevar_id_t timevar; +{ + struct timevar_def *tv = &timevars[timevar]; + struct timevar_time_def now; + + if (!TIMEVAR_ENABLE) + return; + + /* TIMEVAR must have been started via timevar_start. */ + if (!tv->standalone) + abort (); + + get_time (&now); + timevar_accumulate (&tv->elapsed, &tv->start_time, &now); +} + +/* Fill the elapsed time for TIMEVAR into ELAPSED. Returns + update-to-date information even if TIMEVAR is currently running. */ + +void +timevar_get (timevar, elapsed) + timevar_id_t timevar; + struct timevar_time_def *elapsed; +{ + struct timevar_def *tv = &timevars[timevar]; + struct timevar_time_def now; + + *elapsed = tv->elapsed; + + /* Is TIMEVAR currently running as a standalone timer? */ + if (tv->standalone) + { + get_time (&now); + timevar_accumulate (elapsed, &tv->start_time, &now); + } + /* Or is TIMEVAR at the top of the timer stack? */ + else if (stack->timevar == tv) + { + get_time (&now); + timevar_accumulate (elapsed, &start_time, &now); + } +} + +/* Summarize timing variables to FP. The timing variable TV_TOTAL has + a special meaning -- it's considered to be the total elapsed time, + for normalizing the others, and is displayed last. */ + +void +timevar_print (fp) + FILE *fp; +{ + /* Only print stuff if we have some sort of time information. */ +#if defined HAVE_USER_TIME || defined HAVE_SYS_TIME || defined HAVE_WALL_TIME + unsigned int /* timevar_id_t */ id; + struct timevar_time_def *total = &timevars[TV_TOTAL].elapsed; + struct timevar_time_def now; + + if (!TIMEVAR_ENABLE) + return; + + /* Update timing information in case we're calling this from GDB. */ + + if (fp == 0) + fp = stderr; + + /* What time is it? */ + get_time (&now); + + /* If the stack isn't empty, attribute the current elapsed time to + the old topmost element. */ + if (stack) + timevar_accumulate (&stack->timevar->elapsed, &start_time, &now); + + /* Reset the start time; from now on, time is attributed to + TIMEVAR. */ + start_time = now; + + fputs (_("\nExecution times (seconds)\n"), fp); + for (id = 0; id < (unsigned int) TIMEVAR_LAST; ++id) + { + struct timevar_def *tv = &timevars[(timevar_id_t) id]; + const float tiny = 5e-3; + + /* Don't print the total execution time here; that goes at the + end. */ + if ((timevar_id_t) id == TV_TOTAL) + continue; + + /* Don't print timing variables that were never used. */ + if (!tv->used) + continue; + + /* Don't print timing variables if we're going to get a row of + zeroes. */ + if (tv->elapsed.user < tiny + && tv->elapsed.sys < tiny + && tv->elapsed.wall < tiny) + continue; + + /* The timing variable name. */ + fprintf (fp, " %-22s:", tv->name); + +#ifdef HAVE_USER_TIME + /* Print user-mode time for this process. */ + fprintf (fp, "%7.2f (%2.0f%%) usr", + tv->elapsed.user, + (total->user == 0 ? 0 : tv->elapsed.user / total->user) * 100); +#endif /* HAVE_USER_TIME */ + +#ifdef HAVE_SYS_TIME + /* Print system-mode time for this process. */ + fprintf (fp, "%7.2f (%2.0f%%) sys", + tv->elapsed.sys, + (total->sys == 0 ? 0 : tv->elapsed.sys / total->sys) * 100); +#endif /* HAVE_SYS_TIME */ + +#ifdef HAVE_WALL_TIME + /* Print wall clock time elapsed. */ + fprintf (fp, "%7.2f (%2.0f%%) wall", + tv->elapsed.wall, + (total->wall == 0 ? 0 : tv->elapsed.wall / total->wall) * 100); +#endif /* HAVE_WALL_TIME */ + + putc ('\n', fp); + } + + /* Print total time. */ + fputs (_(" TOTAL :"), fp); +#ifdef HAVE_USER_TIME + fprintf (fp, "%7.2f ", total->user); +#endif +#ifdef HAVE_SYS_TIME + fprintf (fp, "%7.2f ", total->sys); +#endif +#ifdef HAVE_WALL_TIME + fprintf (fp, "%7.2f\n", total->wall); +#endif + +#endif /* defined (HAVE_USER_TIME) || defined (HAVE_SYS_TIME) + || defined (HAVE_WALL_TIME) */ +} + +/* Returns time (user + system) used so far by the compiler process, + in microseconds. */ + +long +get_run_time () +{ + struct timevar_time_def total_elapsed; + timevar_get (TV_TOTAL, &total_elapsed); + return total_elapsed.user + total_elapsed.sys; +} + +/* Prints a message to stderr stating that time elapsed in STR is + TOTAL (given in microseconds). */ + +void +print_time (str, total) + const char *str; + long total; +{ + long all_time = get_run_time (); + fprintf (stderr, + _("time in %s: %ld.%06ld (%ld%%)\n"), + str, total / 1000000, total % 1000000, + all_time == 0 ? 0 + : (long) (((100.0 * (double) total) / (double) all_time) + .5)); +} diff --git a/lib/timevar.def b/lib/timevar.def new file mode 100644 index 0000000..3a4128f --- /dev/null +++ b/lib/timevar.def @@ -0,0 +1,55 @@ +/* This file contains the definitions for timing variables used to -*- C -*- + measure run-time performance of the compiler. + Copyright (C) 2002, 2007 Free Software Foundation, Inc. + Contributed by Akim Demaille . + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +/* This file contains timing variable definitions, used by timevar.h + and timevar.c. + + Syntax: + + DEFTIMEVAR (id, name) + + where ID is the enumeral value used to identify the timing + variable, and NAME is a character string describing its purpose. */ + +/* The total execution time. */ +DEFTIMEVAR (TV_TOTAL , "total time") + +/* Time spent in the reader. */ +DEFTIMEVAR (TV_READER , "reader") +DEFTIMEVAR (TV_SCANNING , "scanner") +DEFTIMEVAR (TV_PARSING , "parser") + +/* Time spent handling the grammar. */ +DEFTIMEVAR (TV_REDUCE , "reducing the grammar") +DEFTIMEVAR (TV_SETS , "computing the sets") +DEFTIMEVAR (TV_LR0 , "LR(0)") +DEFTIMEVAR (TV_LALR , "LALR(1)") +DEFTIMEVAR (TV_CONFLICTS , "conflicts") + +/* Time spent outputing results. */ +DEFTIMEVAR (TV_REPORT , "outputing report") +DEFTIMEVAR (TV_GRAPH , "outputing graph") +DEFTIMEVAR (TV_XML , "outputing xml") +DEFTIMEVAR (TV_ACTIONS , "parser action tables") +DEFTIMEVAR (TV_PARSER , "outputing parser") +DEFTIMEVAR (TV_M4 , "running m4") + +/* Time spent by freeing the memory :). */ +DEFTIMEVAR (TV_FREE , "freeing") diff --git a/lib/timevar.h b/lib/timevar.h new file mode 100644 index 0000000..57dc203 --- /dev/null +++ b/lib/timevar.h @@ -0,0 +1,89 @@ +/* Timing variables for measuring compiler performance. + Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc. + Contributed by Alex Samuel + + 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 . */ + +#ifndef GCC_TIMEVAR_H +#define GCC_TIMEVAR_H + +/* Timing variables are used to measure elapsed time in various + portions of the compiler. Each measures elapsed user, system, and + wall-clock time, as appropriate to and supported by the host + system. + + Timing variables are defined using the DEFTIMEVAR macro in + timevar.def. Each has an enumeral identifier, used when referring + to the timing variable in code, and a character string name. + + Timing variables can be used in two ways: + + - On the timing stack, using timevar_push and timevar_pop. + Timing variables may be pushed onto the stack; elapsed time is + attributed to the topmost timing variable on the stack. When + another variable is pushed on, the previous topmost variable is + `paused' until the pushed variable is popped back off. + + - As a standalone timer, using timevar_start and timevar_stop. + All time elapsed between the two calls is attributed to the + variable. +*/ + +/* This structure stores the various varieties of time that can be + measured. Times are stored in seconds. The time may be an + absolute time or a time difference; in the former case, the time + base is undefined, except that the difference between two times + produces a valid time difference. */ + +struct timevar_time_def +{ + /* User time in this process. */ + float user; + + /* System time (if applicable for this host platform) in this + process. */ + float sys; + + /* Wall clock time. */ + float wall; +}; + +/* An enumeration of timing variable identifiers. Constructed from + the contents of timevar.def. */ + +#define DEFTIMEVAR(identifier__, name__) \ + identifier__, +typedef enum +{ +#include "timevar.def" + TIMEVAR_LAST +} +timevar_id_t; +#undef DEFTIMEVAR + +extern void init_timevar (void); +extern void timevar_push (timevar_id_t); +extern void timevar_pop (timevar_id_t); +extern void timevar_start (timevar_id_t); +extern void timevar_stop (timevar_id_t); +extern void timevar_get (timevar_id_t, struct timevar_time_def *); +extern void timevar_print (FILE *); + +/* Provided for backward compatibility. */ +extern long get_run_time (void); +extern void print_time (const char *, long); + +extern int timevar_report; + +#endif /* ! GCC_TIMEVAR_H */ diff --git a/lib/unistd--.h b/lib/unistd--.h new file mode 100644 index 0000000..1a7fd78 --- /dev/null +++ b/lib/unistd--.h @@ -0,0 +1,27 @@ +/* Like unistd.h, but redefine some names to avoid glitches. + + Copyright (C) 2005 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 . */ + +/* Written by Paul Eggert. */ + +#include +#include "unistd-safer.h" + +#undef dup +#define dup dup_safer + +#undef pipe +#define pipe pipe_safer diff --git a/lib/unistd-safer.h b/lib/unistd-safer.h new file mode 100644 index 0000000..033e857 --- /dev/null +++ b/lib/unistd-safer.h @@ -0,0 +1,22 @@ +/* Invoke unistd-like functions, but avoid some glitches. + + Copyright (C) 2001, 2003, 2005 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 . */ + +/* Written by Paul Eggert. */ + +int dup_safer (int); +int fd_safer (int); +int pipe_safer (int[2]); diff --git a/lib/unistd.in.h b/lib/unistd.in.h new file mode 100644 index 0000000..768d4e6 --- /dev/null +++ b/lib/unistd.in.h @@ -0,0 +1,555 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Substitute for and wrapper around . + Copyright (C) 2003-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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_UNISTD_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_UNISTD_H@ +# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ +#endif + +#ifndef _GL_UNISTD_H +#define _GL_UNISTD_H + +/* mingw doesn't define the SEEK_* macros in . */ +#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) +# include +#endif + +/* mingw fails to declare _exit in . */ +#include + +#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ +/* Get ssize_t. */ +# include +#endif + +#if @GNULIB_GETHOSTNAME@ +/* Get all possible declarations of gethostname(). */ +# if @UNISTD_H_HAVE_WINSOCK2_H@ +# include +# if !defined _GL_SYS_SOCKET_H +# undef socket +# define socket socket_used_without_including_sys_socket_h +# undef connect +# define connect connect_used_without_including_sys_socket_h +# undef accept +# define accept accept_used_without_including_sys_socket_h +# undef bind +# define bind bind_used_without_including_sys_socket_h +# undef getpeername +# define getpeername getpeername_used_without_including_sys_socket_h +# undef getsockname +# define getsockname getsockname_used_without_including_sys_socket_h +# undef getsockopt +# define getsockopt getsockopt_used_without_including_sys_socket_h +# undef listen +# define listen listen_used_without_including_sys_socket_h +# undef recv +# define recv recv_used_without_including_sys_socket_h +# undef send +# define send send_used_without_including_sys_socket_h +# undef recvfrom +# define recvfrom recvfrom_used_without_including_sys_socket_h +# undef sendto +# define sendto sendto_used_without_including_sys_socket_h +# undef setsockopt +# define setsockopt setsockopt_used_without_including_sys_socket_h +# undef shutdown +# define shutdown shutdown_used_without_including_sys_socket_h +# endif +# if !defined _GL_SYS_SELECT_H +# undef select +# define select select_used_without_including_sys_select_h +# endif +# endif +#endif + +/* The definition of GL_LINK_WARNING is copied here. */ + + +/* Declare overridden functions. */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#if @GNULIB_CHOWN@ +# if @REPLACE_CHOWN@ +# ifndef REPLACE_CHOWN +# define REPLACE_CHOWN 1 +# endif +# if REPLACE_CHOWN +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE + to GID (if GID is not -1). Follow symbolic links. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +# define chown rpl_chown +extern int chown (const char *file, uid_t uid, gid_t gid); +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef chown +# define chown(f,u,g) \ + (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \ + "doesn't treat a uid or gid of -1 on some systems - " \ + "use gnulib module chown for portability"), \ + chown (f, u, g)) +#endif + + +#if @GNULIB_CLOSE@ +# if @UNISTD_H_HAVE_WINSOCK2_H@ +/* Need a gnulib internal function. */ +# define HAVE__GL_CLOSE_FD_MAYBE_SOCKET 1 +# endif +# if @REPLACE_CLOSE@ +/* Automatically included by modules that need a replacement for close. */ +# undef close +# define close rpl_close +extern int close (int); +# endif +#elif @UNISTD_H_HAVE_WINSOCK2_H@ +# undef close +# define close close_used_without_requesting_gnulib_module_close +#elif defined GNULIB_POSIXCHECK +# undef close +# define close(f) \ + (GL_LINK_WARNING ("close does not portably work on sockets - " \ + "use gnulib module close for portability"), \ + close (f)) +#endif + + +#if @GNULIB_DUP2@ +# if !@HAVE_DUP2@ +/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if + NEWFD = OLDFD, otherwise close NEWFD first if it is open. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +extern int dup2 (int oldfd, int newfd); +# endif +#elif defined GNULIB_POSIXCHECK +# undef dup2 +# define dup2(o,n) \ + (GL_LINK_WARNING ("dup2 is unportable - " \ + "use gnulib module dup2 for portability"), \ + dup2 (o, n)) +#endif + + +#if @GNULIB_ENVIRON@ +# if !@HAVE_DECL_ENVIRON@ +/* Set of environment variables and values. An array of strings of the form + "VARIABLE=VALUE", terminated with a NULL. */ +# if defined __APPLE__ && defined __MACH__ +# include +# define environ (*_NSGetEnviron ()) +# else +extern char **environ; +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef environ +# define environ \ + (GL_LINK_WARNING ("environ is unportable - " \ + "use gnulib module environ for portability"), \ + environ) +#endif + + +#if @GNULIB_EUIDACCESS@ +# if !@HAVE_EUIDACCESS@ +/* Like access(), except that is uses the effective user id and group id of + the current process. */ +extern int euidaccess (const char *filename, int mode); +# endif +#elif defined GNULIB_POSIXCHECK +# undef euidaccess +# define euidaccess(f,m) \ + (GL_LINK_WARNING ("euidaccess is unportable - " \ + "use gnulib module euidaccess for portability"), \ + euidaccess (f, m)) +#endif + + +#if @GNULIB_FCHDIR@ +# if @REPLACE_FCHDIR@ + +/* Change the process' current working directory to the directory on which + the given file descriptor is open. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +extern int fchdir (int /*fd*/); + +# define dup rpl_dup +extern int dup (int); +# define dup2 rpl_dup2 +extern int dup2 (int, int); + +# endif +#elif defined GNULIB_POSIXCHECK +# undef fchdir +# define fchdir(f) \ + (GL_LINK_WARNING ("fchdir is unportable - " \ + "use gnulib module fchdir for portability"), \ + fchdir (f)) +#endif + + +#if @GNULIB_FSYNC@ +/* Synchronize changes to a file. + Return 0 if successful, otherwise -1 and errno set. + See POSIX:2001 specification + . */ +# if !@HAVE_FSYNC@ +extern int fsync (int fd); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fsync +# define fsync(fd) \ + (GL_LINK_WARNING ("fsync is unportable - " \ + "use gnulib module fsync for portability"), \ + fsync (fd)) +#endif + + +#if @GNULIB_FTRUNCATE@ +# if !@HAVE_FTRUNCATE@ +/* Change the size of the file to which FD is opened to become equal to LENGTH. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +extern int ftruncate (int fd, off_t length); +# endif +#elif defined GNULIB_POSIXCHECK +# undef ftruncate +# define ftruncate(f,l) \ + (GL_LINK_WARNING ("ftruncate is unportable - " \ + "use gnulib module ftruncate for portability"), \ + ftruncate (f, l)) +#endif + + +#if @GNULIB_GETCWD@ +/* Include the headers that might declare getcwd so that they will not + cause confusion if included after this file. */ +# include +# if @REPLACE_GETCWD@ +/* Get the name of the current working directory, and put it in SIZE bytes + of BUF. + Return BUF if successful, or NULL if the directory couldn't be determined + or SIZE was too small. + See the POSIX:2001 specification + . + Additionally, the gnulib module 'getcwd' guarantees the following GNU + extension: If BUF is NULL, an array is allocated with 'malloc'; the array + is SIZE bytes long, unless SIZE == 0, in which case it is as big as + necessary. */ +# define getcwd rpl_getcwd +extern char * getcwd (char *buf, size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getcwd +# define getcwd(b,s) \ + (GL_LINK_WARNING ("getcwd is unportable - " \ + "use gnulib module getcwd for portability"), \ + getcwd (b, s)) +#endif + + +#if @GNULIB_GETDOMAINNAME@ +/* Return the NIS domain name of the machine. + WARNING! The NIS domain name is unrelated to the fully qualified host name + of the machine. It is also unrelated to email addresses. + WARNING! The NIS domain name is usually the empty string or "(none)" when + not using NIS. + + Put up to LEN bytes of the NIS domain name into NAME. + Null terminate it if the name is shorter than LEN. + If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. + Return 0 if successful, otherwise set errno and return -1. */ +# if !@HAVE_GETDOMAINNAME@ +extern int getdomainname(char *name, size_t len); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getdomainname +# define getdomainname(n,l) \ + (GL_LINK_WARNING ("getdomainname is unportable - " \ + "use gnulib module getdomainname for portability"), \ + getdomainname (n, l)) +#endif + + +#if @GNULIB_GETDTABLESIZE@ +# if !@HAVE_GETDTABLESIZE@ +/* Return the maximum number of file descriptors in the current process. */ +extern int getdtablesize (void); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getdtablesize +# define getdtablesize() \ + (GL_LINK_WARNING ("getdtablesize is unportable - " \ + "use gnulib module getdtablesize for portability"), \ + getdtablesize ()) +#endif + + +#if @GNULIB_GETHOSTNAME@ +/* Return the standard host name of the machine. + WARNING! The host name may or may not be fully qualified. + + Put up to LEN bytes of the host name into NAME. + Null terminate it if the name is shorter than LEN. + If the host name is longer than LEN, set errno = EINVAL and return -1. + Return 0 if successful, otherwise set errno and return -1. */ +# if @UNISTD_H_HAVE_WINSOCK2_H@ +# undef gethostname +# define gethostname rpl_gethostname +# endif +# if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@ +extern int gethostname(char *name, size_t len); +# endif +#elif @UNISTD_H_HAVE_WINSOCK2_H@ +# undef gethostname +# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname +#elif defined GNULIB_POSIXCHECK +# undef gethostname +# define gethostname(n,l) \ + (GL_LINK_WARNING ("gethostname is unportable - " \ + "use gnulib module gethostname for portability"), \ + gethostname (n, l)) +#endif + + +#if @GNULIB_GETLOGIN_R@ +/* Copies the user's login name to NAME. + The array pointed to by NAME has room for SIZE bytes. + + Returns 0 if successful. Upon error, an error number is returned, or -1 in + the case that the login name cannot be found but no specific error is + provided (this case is hopefully rare but is left open by the POSIX spec). + + See . + */ +# if !@HAVE_DECL_GETLOGIN_R@ +# include +extern int getlogin_r (char *name, size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getlogin_r +# define getlogin_r(n,s) \ + (GL_LINK_WARNING ("getlogin_r is unportable - " \ + "use gnulib module getlogin_r for portability"), \ + getlogin_r (n, s)) +#endif + + +#if @GNULIB_GETPAGESIZE@ +# if @REPLACE_GETPAGESIZE@ +# define getpagesize rpl_getpagesize +extern int getpagesize (void); +# elif !@HAVE_GETPAGESIZE@ +/* This is for POSIX systems. */ +# if !defined getpagesize && defined _SC_PAGESIZE +# if ! (defined __VMS && __VMS_VER < 70000000) +# define getpagesize() sysconf (_SC_PAGESIZE) +# endif +# endif +/* This is for older VMS. */ +# if !defined getpagesize && defined __VMS +# ifdef __ALPHA +# define getpagesize() 8192 +# else +# define getpagesize() 512 +# endif +# endif +/* This is for BeOS. */ +# if !defined getpagesize && @HAVE_OS_H@ +# include +# if defined B_PAGE_SIZE +# define getpagesize() B_PAGE_SIZE +# endif +# endif +/* This is for AmigaOS4.0. */ +# if !defined getpagesize && defined __amigaos4__ +# define getpagesize() 2048 +# endif +/* This is for older Unix systems. */ +# if !defined getpagesize && @HAVE_SYS_PARAM_H@ +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else +# ifdef NBPG +# ifndef CLSIZE +# define CLSIZE 1 +# endif +# define getpagesize() (NBPG * CLSIZE) +# else +# ifdef NBPC +# define getpagesize() NBPC +# endif +# endif +# endif +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef getpagesize +# define getpagesize() \ + (GL_LINK_WARNING ("getpagesize is unportable - " \ + "use gnulib module getpagesize for portability"), \ + getpagesize ()) +#endif + + +#if @GNULIB_GETUSERSHELL@ +# if !@HAVE_GETUSERSHELL@ +/* Return the next valid login shell on the system, or NULL when the end of + the list has been reached. */ +extern char *getusershell (void); +/* Rewind to pointer that is advanced at each getusershell() call. */ +extern void setusershell (void); +/* Free the pointer that is advanced at each getusershell() call and + associated resources. */ +extern void endusershell (void); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getusershell +# define getusershell() \ + (GL_LINK_WARNING ("getusershell is unportable - " \ + "use gnulib module getusershell for portability"), \ + getusershell ()) +# undef setusershell +# define setusershell() \ + (GL_LINK_WARNING ("setusershell is unportable - " \ + "use gnulib module getusershell for portability"), \ + setusershell ()) +# undef endusershell +# define endusershell() \ + (GL_LINK_WARNING ("endusershell is unportable - " \ + "use gnulib module getusershell for portability"), \ + endusershell ()) +#endif + + +#if @GNULIB_LCHOWN@ +# if @REPLACE_LCHOWN@ +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE + to GID (if GID is not -1). Do not follow symbolic links. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +# define lchown rpl_lchown +extern int lchown (char const *file, uid_t owner, gid_t group); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lchown +# define lchown(f,u,g) \ + (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \ + "systems - use gnulib module lchown for portability"), \ + lchown (f, u, g)) +#endif + + +#if @GNULIB_LSEEK@ +# if @REPLACE_LSEEK@ +/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. + Return the new offset if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +# define lseek rpl_lseek + extern off_t lseek (int fd, off_t offset, int whence); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lseek +# define lseek(f,o,w) \ + (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \ + "systems - use gnulib module lseek for portability"), \ + lseek (f, o, w)) +#endif + + +#if @GNULIB_READLINK@ +/* Read the contents of the symbolic link FILE and place the first BUFSIZE + bytes of it into BUF. Return the number of bytes placed into BUF if + successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +# if !@HAVE_READLINK@ +# include +extern int readlink (const char *file, char *buf, size_t bufsize); +# endif +#elif defined GNULIB_POSIXCHECK +# undef readlink +# define readlink(f,b,s) \ + (GL_LINK_WARNING ("readlink is unportable - " \ + "use gnulib module readlink for portability"), \ + readlink (f, b, s)) +#endif + + +#if @GNULIB_SLEEP@ +/* Pause the execution of the current thread for N seconds. + Returns the number of seconds left to sleep. + See the POSIX:2001 specification + . */ +# if !@HAVE_SLEEP@ +extern unsigned int sleep (unsigned int n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef sleep +# define sleep(n) \ + (GL_LINK_WARNING ("sleep is unportable - " \ + "use gnulib module sleep for portability"), \ + sleep (n)) +#endif + + +#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ +/* Write up to COUNT bytes starting at BUF to file descriptor FD. + See the POSIX:2001 specification + . */ +# undef write +# define write rpl_write +extern ssize_t write (int fd, const void *buf, size_t count); +#endif + + +#ifdef FCHDIR_REPLACEMENT +/* gnulib internal function. */ +extern void _gl_unregister_fd (int fd); +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* _GL_UNISTD_H */ +#endif /* _GL_UNISTD_H */ diff --git a/lib/unitypes.h b/lib/unitypes.h new file mode 100644 index 0000000..aa96393 --- /dev/null +++ b/lib/unitypes.h @@ -0,0 +1,28 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Elementary types for the GNU UniString library. + Copyright (C) 2002, 2005-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 + Lesser 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 . */ + +#ifndef _UNITYPES_H +#define _UNITYPES_H + +/* Get uint8_t, uint16_t, uint32_t. */ +#include + +/* Type representing a Unicode character. */ +typedef uint32_t ucs4_t; + +#endif /* _UNITYPES_H */ diff --git a/lib/uniwidth.h b/lib/uniwidth.h new file mode 100644 index 0000000..81e7b92 --- /dev/null +++ b/lib/uniwidth.h @@ -0,0 +1,66 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Display width functions. + Copyright (C) 2001-2002, 2005, 2007 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 + Lesser 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 . */ + +#ifndef _UNIWIDTH_H +#define _UNIWIDTH_H + +#include "unitypes.h" + +/* Get size_t. */ +#include + +/* Get locale_charset() declaration. */ +#include "localcharset.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Display width. */ + +/* These functions are locale dependent. The encoding argument identifies + the encoding (e.g. "ISO-8859-2" for Polish). */ + +/* Determine number of column positions required for UC. */ +extern int + uc_width (ucs4_t uc, const char *encoding); + +/* Determine number of column positions required for first N units + (or fewer if S ends before this) in S. */ +extern int + u8_width (const uint8_t *s, size_t n, const char *encoding); +extern int + u16_width (const uint16_t *s, size_t n, const char *encoding); +extern int + u32_width (const uint32_t *s, size_t n, const char *encoding); + +/* Determine number of column positions required for S. */ +extern int + u8_strwidth (const uint8_t *s, const char *encoding); +extern int + u16_strwidth (const uint16_t *s, const char *encoding); +extern int + u32_strwidth (const uint32_t *s, const char *encoding); + + +#ifdef __cplusplus +} +#endif + +#endif /* _UNIWIDTH_H */ diff --git a/lib/uniwidth/cjk.h b/lib/uniwidth/cjk.h new file mode 100644 index 0000000..c4ed036 --- /dev/null +++ b/lib/uniwidth/cjk.h @@ -0,0 +1,39 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Test for CJK encoding. + Copyright (C) 2001-2002, 2005-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + 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 + Lesser 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 . */ + +#include "streq.h" + +static int +is_cjk_encoding (const char *encoding) +{ + if (0 + /* Legacy Japanese encodings */ + || STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0) + /* Legacy Chinese encodings */ + || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) + || STREQ (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0) + || STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0) + || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0) + /* Legacy Korean encodings */ + || STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + || STREQ (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0) + || STREQ (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0)) + return 1; + return 0; +} diff --git a/lib/uniwidth/width.c b/lib/uniwidth/width.c new file mode 100644 index 0000000..29aaf2a --- /dev/null +++ b/lib/uniwidth/width.c @@ -0,0 +1,325 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Determine display width of Unicode character. + Copyright (C) 2001-2002, 2006-2008 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + 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 + Lesser 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 . */ + +#include + +/* Specification. */ +#include "uniwidth.h" + +#include "cjk.h" + +/* + * Non-spacing attribute table. + * Consists of: + * - Non-spacing characters; generated from PropList.txt or + * "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt" + * - Format control characters; generated from + * "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt" + * - Zero width characters; generated from + * "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt" + */ +static const unsigned char nonspacing_table_data[22*64] = { + /* 0x0000-0x01ff */ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, /* 0x0080-0x00bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00c0-0x00ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0100-0x013f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0140-0x017f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0180-0x01bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x01c0-0x01ff */ + /* 0x0200-0x03ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0200-0x023f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0240-0x027f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0280-0x02bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x02c0-0x02ff */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x0300-0x033f */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x0340-0x037f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0380-0x03bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x03c0-0x03ff */ + /* 0x0400-0x05ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0400-0x043f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0440-0x047f */ + 0x78, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0480-0x04bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04c0-0x04ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0500-0x053f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0540-0x057f */ + 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, /* 0x0580-0x05bf */ + 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */ + /* 0x0600-0x07ff */ + 0x0f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */ + 0x00, 0xf8, 0xff, 0x7f, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */ + 0x00, 0x00, 0xc0, 0xff, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */ + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */ + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */ + 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x07c0-0x07ff */ + /* 0x0800-0x09ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0800-0x083f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08c0-0x08ff */ + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0900-0x093f */ + 0xfe, 0x21, 0x1e, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */ + 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x09c0-0x09ff */ + /* 0x0a00-0x0bff */ + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a00-0x0a3f */ + 0x86, 0x39, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0x0a40-0x0a7f */ + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a80-0x0abf */ + 0xbe, 0x21, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0ac0-0x0aff */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0x0b00-0x0b3f */ + 0x0e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b40-0x0b7f */ + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */ + 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */ + /* 0x0c00-0x0dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x0c00-0x0c3f */ + 0xc1, 0x3d, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */ + 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d00-0x0d3f */ + 0x0e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */ + 0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */ + /* 0x0e00-0x0fff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x07, /* 0x0e00-0x0e3f */ + 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0e40-0x0e7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1b, /* 0x0e80-0x0ebf */ + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */ + 0xdf, 0x00, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */ + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */ + /* 0x1000-0x11ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc5, 0x02, /* 0x1000-0x103f */ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* 0x1040-0x107f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1140-0x117f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1180-0x11bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c0-0x11ff */ + /* 0x1200-0x13ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1200-0x123f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1240-0x127f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1280-0x12bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x12c0-0x12ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1300-0x133f */ + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1380-0x13bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13c0-0x13ff */ + /* 0x1600-0x17ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1600-0x163f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1640-0x167f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1680-0x16bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16c0-0x16ff */ + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, /* 0x1700-0x173f */ + 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1740-0x177f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */ + 0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */ + /* 0x1800-0x19ff */ + 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */ + 0x00, 0x00, 0x00, 0x00, 0x87, 0x0f, 0x04, 0x0e, /* 0x1900-0x193f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */ + /* 0x1a00-0x1bff */ + 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1a40-0x1a7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1a80-0x1abf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ac0-0x1aff */ + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */ + 0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1b80-0x1bbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc0-0x1bff */ + /* 0x1c00-0x1dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c00-0x1c3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cc0-0x1cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */ + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x1dc0-0x1dff */ + /* 0x2000-0x21ff */ + 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */ + 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc, 0x00, 0x00, /* 0x2040-0x207f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */ + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x20c0-0x20ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2140-0x217f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2180-0x21bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x21c0-0x21ff */ + /* 0x3000-0x31ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, /* 0x3000-0x303f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */ + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3100-0x313f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3140-0x317f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3180-0x31bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */ + /* 0xa800-0xa9ff */ + 0x44, 0x08, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0xa800-0xa83f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8c0-0xa8ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa900-0xa93f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa980-0xa9bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */ + /* 0xfa00-0xfbff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa80-0xfabf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfac0-0xfaff */ + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0xfb00-0xfb3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb40-0xfb7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */ + /* 0xfe00-0xffff */ + 0xff, 0xff, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, /* 0xfe00-0xfe3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff00-0xff3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff40-0xff7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff80-0xffbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, /* 0xffc0-0xffff */ + /* 0x10a00-0x10bff */ + 0x6e, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, /* 0x10a00-0x10a3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a40-0x10a7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a80-0x10abf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b00-0x10b3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */ + /* 0x1d000-0x1d1ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xf8, /* 0x1d140-0x1d17f */ + 0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d1c0-0x1d1ff */ + /* 0x1d200-0x1d3ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d200-0x1d23f */ + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d240-0x1d27f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d280-0x1d2bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d2c0-0x1d2ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d300-0x1d33f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d340-0x1d37f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d380-0x1d3bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1d3c0-0x1d3ff */ +}; +static const signed char nonspacing_table_ind[240] = { + 0, 1, 2, 3, 4, 5, 6, 7, /* 0x0000-0x0fff */ + 8, 9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */ + 14, -1, -1, -1, -1, -1, -1, -1, /* 0x2000-0x2fff */ + 15, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */ + -1, -1, -1, -1, 16, -1, -1, -1, /* 0xa000-0xafff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xd000-0xdfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */ + -1, -1, -1, -1, -1, 17, -1, 18, /* 0xf000-0xffff */ + -1, -1, -1, -1, -1, 19, -1, -1, /* 0x10000-0x10fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x11000-0x11fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x16000-0x16fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1b000-0x1bfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */ + 20, 21, -1, -1, -1, -1, -1, -1 /* 0x1d000-0x1dfff */ +}; + +/* Determine number of column positions required for UC. */ +int +uc_width (ucs4_t uc, const char *encoding) +{ + /* Test for non-spacing or control character. */ + if ((uc >> 9) < 240) + { + int ind = nonspacing_table_ind[uc >> 9]; + if (ind >= 0) + if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1) + { + if (uc > 0 && uc < 0xa0) + return -1; + else + return 0; + } + } + else if ((uc >> 9) == (0xe0000 >> 9)) + { + if (uc >= 0xe0100) + { + if (uc <= 0xe01ef) + return 0; + } + else + { + if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001) + return 0; + } + } + /* Test for double-width character. + * Generated from "grep '^....;[WF]' EastAsianWidth.txt" + * and "grep '^....;[^WF]' EastAsianWidth.txt" + */ + if (uc >= 0x1100 + && ((uc < 0x1160) /* Hangul Jamo */ + || (uc >= 0x2329 && uc < 0x232b) /* Angle Brackets */ + || (uc >= 0x2e80 && uc < 0xa4d0 /* CJK ... Yi */ + && !(uc == 0x303f) && !(uc >= 0x4dc0 && uc < 0x4e00)) + || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */ + || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */ + || (uc >= 0xfe10 && uc < 0xfe20) /* Presentation Forms for Vertical */ + || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */ + || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */ + || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */ + || (uc >= 0x20000 && uc <= 0x2a6d6) /* CJK */ + || (uc >= 0x2f800 && uc <= 0x2fa1d) /* CJK Compatibility Ideographs */ + ) ) + return 2; + /* In ancient CJK encodings, Cyrillic and most other characters are + double-width as well. */ + if (uc >= 0x00A1 && uc < 0xFF61 && uc != 0x20A9 + && is_cjk_encoding (encoding)) + return 2; + return 1; +} diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h new file mode 100644 index 0000000..6b2939e --- /dev/null +++ b/lib/unlocked-io.h @@ -0,0 +1,136 @@ +/* Prefer faster, non-thread-safe stdio functions if available. + + Copyright (C) 2001, 2002, 2003, 2004 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 . */ + +/* Written by Jim Meyering. */ + +#ifndef UNLOCKED_IO_H +# define UNLOCKED_IO_H 1 + +/* These are wrappers for functions/macros from the GNU C library, and + from other C libraries supporting POSIX's optional thread-safe functions. + + The standard I/O functions are thread-safe. These *_unlocked ones are + more efficient but not thread-safe. That they're not thread-safe is + fine since all of the applications in this package are single threaded. + + Also, some code that is shared with the GNU C library may invoke + the *_unlocked functions directly. On hosts that lack those + functions, invoke the non-thread-safe versions instead. */ + +# include + +# if HAVE_DECL_CLEARERR_UNLOCKED +# undef clearerr +# define clearerr(x) clearerr_unlocked (x) +# else +# define clearerr_unlocked(x) clearerr (x) +# endif + +# if HAVE_DECL_FEOF_UNLOCKED +# undef feof +# define feof(x) feof_unlocked (x) +# else +# define feof_unlocked(x) feof (x) +# endif + +# if HAVE_DECL_FERROR_UNLOCKED +# undef ferror +# define ferror(x) ferror_unlocked (x) +# else +# define ferror_unlocked(x) ferror (x) +# endif + +# if HAVE_DECL_FFLUSH_UNLOCKED +# undef fflush +# define fflush(x) fflush_unlocked (x) +# else +# define fflush_unlocked(x) fflush (x) +# endif + +# if HAVE_DECL_FGETS_UNLOCKED +# undef fgets +# define fgets(x,y,z) fgets_unlocked (x,y,z) +# else +# define fgets_unlocked(x,y,z) fgets (x,y,z) +# endif + +# if HAVE_DECL_FPUTC_UNLOCKED +# undef fputc +# define fputc(x,y) fputc_unlocked (x,y) +# else +# define fputc_unlocked(x,y) fputc (x,y) +# endif + +# if HAVE_DECL_FPUTS_UNLOCKED +# undef fputs +# define fputs(x,y) fputs_unlocked (x,y) +# else +# define fputs_unlocked(x,y) fputs (x,y) +# endif + +# if HAVE_DECL_FREAD_UNLOCKED +# undef fread +# define fread(w,x,y,z) fread_unlocked (w,x,y,z) +# else +# define fread_unlocked(w,x,y,z) fread (w,x,y,z) +# endif + +# if HAVE_DECL_FWRITE_UNLOCKED +# undef fwrite +# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) +# else +# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) +# endif + +# if HAVE_DECL_GETC_UNLOCKED +# undef getc +# define getc(x) getc_unlocked (x) +# else +# define getc_unlocked(x) getc (x) +# endif + +# if HAVE_DECL_GETCHAR_UNLOCKED +# undef getchar +# define getchar() getchar_unlocked () +# else +# define getchar_unlocked() getchar () +# endif + +# if HAVE_DECL_PUTC_UNLOCKED +# undef putc +# define putc(x,y) putc_unlocked (x,y) +# else +# define putc_unlocked(x,y) putc (x,y) +# endif + +# if HAVE_DECL_PUTCHAR_UNLOCKED +# undef putchar +# define putchar(x) putchar_unlocked (x) +# else +# define putchar_unlocked(x) putchar (x) +# endif + +# undef flockfile +# define flockfile(x) ((void) 0) + +# undef ftrylockfile +# define ftrylockfile(x) 0 + +# undef funlockfile +# define funlockfile(x) ((void) 0) + +#endif /* UNLOCKED_IO_H */ diff --git a/lib/unsetenv.c b/lib/unsetenv.c new file mode 100644 index 0000000..73ea878 --- /dev/null +++ b/lib/unsetenv.c @@ -0,0 +1,90 @@ +/* Copyright (C) 1992,1995-1999,2000-2002,2005-2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 . */ + +#include + +/* Specification. */ +#include + +#include +#if !_LIBC +# define __set_errno(ev) ((errno) = (ev)) +#endif + +#include +#include + +#if !_LIBC +# define __environ environ +#endif + +#if _LIBC +/* This lock protects against simultaneous modifications of `environ'. */ +# include +__libc_lock_define_initialized (static, envlock) +# define LOCK __libc_lock_lock (envlock) +# define UNLOCK __libc_lock_unlock (envlock) +#else +# define LOCK +# define UNLOCK +#endif + +/* In the GNU C library we must keep the namespace clean. */ +#ifdef _LIBC +# define unsetenv __unsetenv +#endif + + +int +unsetenv (const char *name) +{ + size_t len; + char **ep; + + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + __set_errno (EINVAL); + return -1; + } + + len = strlen (name); + + LOCK; + + ep = __environ; + while (*ep != NULL) + if (!strncmp (*ep, name, len) && (*ep)[len] == '=') + { + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; + + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ + } + else + ++ep; + + UNLOCK; + + return 0; +} + +#ifdef _LIBC +# undef unsetenv +weak_alias (__unsetenv, unsetenv) +#endif diff --git a/lib/vbitset.c b/lib/vbitset.c new file mode 100644 index 0000000..802fdae --- /dev/null +++ b/lib/vbitset.c @@ -0,0 +1,1138 @@ +/* Variable array bitsets. + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#include + +#include "vbitset.h" + +#include +#include + +/* This file implements variable size bitsets stored as a variable + length array of words. Any unused bits in the last word must be + zero. + + Note that binary or ternary operations assume that each bitset operand + has the same size. +*/ + +static void vbitset_unused_clear (bitset); + +static void vbitset_set (bitset, bitset_bindex); +static void vbitset_reset (bitset, bitset_bindex); +static bool vbitset_test (bitset, bitset_bindex); +static bitset_bindex vbitset_list (bitset, bitset_bindex *, + bitset_bindex, bitset_bindex *); +static bitset_bindex vbitset_list_reverse (bitset, bitset_bindex *, + bitset_bindex, bitset_bindex *); + +#define VBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS) +#define VBITSET_WORDS(X) ((X)->b.cdata) +#define VBITSET_SIZE(X) ((X)->b.csize) +#define VBITSET_ASIZE(X) ((X)->v.size) + +#undef min +#undef max +#define min(a, b) ((a) > (b) ? (b) : (a)) +#define max(a, b) ((a) > (b) ? (a) : (b)) + +static bitset_bindex +vbitset_resize (bitset src, bitset_bindex n_bits) +{ + bitset_windex oldsize; + bitset_windex newsize; + + if (n_bits == BITSET_NBITS_ (src)) + return n_bits; + + oldsize = VBITSET_SIZE (src); + newsize = VBITSET_N_WORDS (n_bits); + + if (oldsize < newsize) + { + bitset_windex size; + + /* The bitset needs to grow. If we already have enough memory + allocated, then just zero what we need. */ + if (newsize > VBITSET_ASIZE (src)) + { + /* We need to allocate more memory. When oldsize is + non-zero this means that we are changing the size, so + grow the bitset 25% larger than requested to reduce + number of reallocations. */ + + if (oldsize == 0) + size = newsize; + else + size = newsize + newsize / 4; + + VBITSET_WORDS (src) + = realloc (VBITSET_WORDS (src), size * sizeof (bitset_word)); + VBITSET_ASIZE (src) = size; + } + + memset (VBITSET_WORDS (src) + oldsize, 0, + (newsize - oldsize) * sizeof (bitset_word)); + VBITSET_SIZE (src) = newsize; + } + else + { + /* The bitset needs to shrink. There's no point deallocating + the memory unless it is shrinking by a reasonable amount. */ + if ((oldsize - newsize) >= oldsize / 2) + { + VBITSET_WORDS (src) + = realloc (VBITSET_WORDS (src), newsize * sizeof (bitset_word)); + VBITSET_ASIZE (src) = newsize; + } + + /* Need to prune any excess bits. FIXME. */ + + VBITSET_SIZE (src) = newsize; + } + + BITSET_NBITS_ (src) = n_bits; + return n_bits; +} + + +/* Set bit BITNO in bitset DST. */ +static void +vbitset_set (dst, bitno) + bitset dst; + bitset_bindex bitno; +{ + bitset_windex windex = bitno / BITSET_WORD_BITS; + + /* Perhaps we should abort. The user should explicitly call + bitset_resize since this will not catch the case when we set a + bit larger than the current size but smaller than the allocated + size. */ + vbitset_resize (dst, bitno); + + dst->b.cdata[windex - dst->b.cindex] |= + (bitset_word) 1 << (bitno % BITSET_WORD_BITS); +} + + +/* Reset bit BITNO in bitset DST. */ +static void +vbitset_reset (dst, bitno) + bitset dst ATTRIBUTE_UNUSED; + bitset_bindex bitno ATTRIBUTE_UNUSED; +{ + /* We must be accessing outside the cache so the bit is + zero anyway. */ +} + + +/* Test bit BITNO in bitset SRC. */ +static bool +vbitset_test (src, bitno) + bitset src ATTRIBUTE_UNUSED; + bitset_bindex bitno ATTRIBUTE_UNUSED; +{ + /* We must be accessing outside the cache so the bit is + zero anyway. */ + return 0; +} + + +/* Find list of up to NUM bits set in BSET in reverse order, starting + from and including NEXT and store in array LIST. Return with + actual number of bits found and with *NEXT indicating where search + stopped. */ +static bitset_bindex +vbitset_list_reverse (src, list, num, next) + bitset src; + bitset_bindex *list; + bitset_bindex num; + bitset_bindex *next; +{ + bitset_bindex bitno; + bitset_bindex rbitno; + bitset_bindex count; + bitset_windex windex; + unsigned int bitcnt; + bitset_bindex bitoff; + bitset_word *srcp = VBITSET_WORDS (src); + bitset_bindex n_bits = BITSET_SIZE_ (src); + + rbitno = *next; + + /* If num is 1, we could speed things up with a binary search + of the word of interest. */ + + if (rbitno >= n_bits) + return 0; + + count = 0; + + bitno = n_bits - (rbitno + 1); + + windex = bitno / BITSET_WORD_BITS; + bitcnt = bitno % BITSET_WORD_BITS; + bitoff = windex * BITSET_WORD_BITS; + + do + { + bitset_word word; + + word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt); + for (; word; bitcnt--) + { + if (word & BITSET_MSB) + { + list[count++] = bitoff + bitcnt; + if (count >= num) + { + *next = n_bits - (bitoff + bitcnt); + return count; + } + } + word <<= 1; + } + bitoff -= BITSET_WORD_BITS; + bitcnt = BITSET_WORD_BITS - 1; + } + while (windex--); + + *next = n_bits - (bitoff + 1); + return count; +} + + +/* Find list of up to NUM bits set in BSET starting from and including + *NEXT and store in array LIST. Return with actual number of bits + found and with *NEXT indicating where search stopped. */ +static bitset_bindex +vbitset_list (src, list, num, next) + bitset src; + bitset_bindex *list; + bitset_bindex num; + bitset_bindex *next; +{ + bitset_bindex bitno; + bitset_bindex count; + bitset_windex windex; + bitset_bindex bitoff; + bitset_windex size = VBITSET_SIZE (src); + bitset_word *srcp = VBITSET_WORDS (src); + bitset_word word; + + bitno = *next; + + count = 0; + if (!bitno) + { + /* Many bitsets are zero, so make this common case fast. */ + for (windex = 0; windex < size && !srcp[windex]; windex++) + continue; + if (windex >= size) + return 0; + + /* If num is 1, we could speed things up with a binary search + of the current word. */ + + bitoff = windex * BITSET_WORD_BITS; + } + else + { + if (bitno >= BITSET_SIZE_ (src)) + return 0; + + windex = bitno / BITSET_WORD_BITS; + bitno = bitno % BITSET_WORD_BITS; + + if (bitno) + { + /* Handle the case where we start within a word. + Most often, this is executed with large bitsets + with many set bits where we filled the array + on the previous call to this function. */ + + bitoff = windex * BITSET_WORD_BITS; + word = srcp[windex] >> bitno; + for (bitno = bitoff + bitno; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + *next = bitno + 1; + return count; + } + } + word >>= 1; + } + windex++; + } + bitoff = windex * BITSET_WORD_BITS; + } + + for (; windex < size; windex++, bitoff += BITSET_WORD_BITS) + { + if (!(word = srcp[windex])) + continue; + + if ((count + BITSET_WORD_BITS) < num) + { + for (bitno = bitoff; word; bitno++) + { + if (word & 1) + list[count++] = bitno; + word >>= 1; + } + } + else + { + for (bitno = bitoff; word; bitno++) + { + if (word & 1) + { + list[count++] = bitno; + if (count >= num) + { + *next = bitno + 1; + return count; + } + } + word >>= 1; + } + } + } + + *next = bitoff; + return count; +} + + +/* Ensure that any unused bits within the last word are clear. */ +static inline void +vbitset_unused_clear (dst) + bitset dst; +{ + unsigned int last_bit; + + last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS; + if (last_bit) + VBITSET_WORDS (dst)[VBITSET_SIZE (dst) - 1] &= + ((bitset_word) 1 << last_bit) - 1; +} + + +static void +vbitset_ones (bitset dst) +{ + bitset_word *dstp = VBITSET_WORDS (dst); + unsigned int bytes; + + bytes = sizeof (bitset_word) * VBITSET_SIZE (dst); + + memset (dstp, -1, bytes); + vbitset_unused_clear (dst); +} + + +static void +vbitset_zero (bitset dst) +{ + bitset_word *dstp = VBITSET_WORDS (dst); + unsigned int bytes; + + bytes = sizeof (bitset_word) * VBITSET_SIZE (dst); + + memset (dstp, 0, bytes); +} + + +static bool +vbitset_empty_p (bitset dst) +{ + unsigned int i; + bitset_word *dstp = VBITSET_WORDS (dst); + + for (i = 0; i < VBITSET_SIZE (dst); i++) + if (dstp[i]) + return 0; + + return 1; +} + + +static void +vbitset_copy1 (bitset dst, bitset src) +{ + bitset_word *srcp; + bitset_word *dstp; + bitset_windex ssize; + bitset_windex dsize; + + if (src == dst) + return; + + vbitset_resize (dst, BITSET_SIZE_ (src)); + + srcp = VBITSET_WORDS (src); + dstp = VBITSET_WORDS (dst); + ssize = VBITSET_SIZE (src); + dsize = VBITSET_SIZE (dst); + + memcpy (dstp, srcp, sizeof (bitset_word) * ssize); + + memset (dstp + sizeof (bitset_word) * ssize, 0, + sizeof (bitset_word) * (dsize - ssize)); +} + + +static void +vbitset_not (bitset dst, bitset src) +{ + unsigned int i; + bitset_word *srcp; + bitset_word *dstp; + bitset_windex ssize; + bitset_windex dsize; + + vbitset_resize (dst, BITSET_SIZE_ (src)); + + srcp = VBITSET_WORDS (src); + dstp = VBITSET_WORDS (dst); + ssize = VBITSET_SIZE (src); + dsize = VBITSET_SIZE (dst); + + for (i = 0; i < ssize; i++) + *dstp++ = ~(*srcp++); + + vbitset_unused_clear (dst); + memset (dstp + sizeof (bitset_word) * ssize, 0, + sizeof (bitset_word) * (dsize - ssize)); +} + + +static bool +vbitset_equal_p (bitset dst, bitset src) +{ + unsigned int i; + bitset_word *srcp = VBITSET_WORDS (src); + bitset_word *dstp = VBITSET_WORDS (dst); + bitset_windex ssize = VBITSET_SIZE (src); + bitset_windex dsize = VBITSET_SIZE (dst); + + for (i = 0; i < min (ssize, dsize); i++) + if (*srcp++ != *dstp++) + return 0; + + if (ssize > dsize) + { + for (; i < ssize; i++) + if (*srcp++) + return 0; + } + else + { + for (; i < dsize; i++) + if (*dstp++) + return 0; + } + + return 1; +} + + +static bool +vbitset_subset_p (bitset dst, bitset src) +{ + unsigned int i; + bitset_word *srcp = VBITSET_WORDS (src); + bitset_word *dstp = VBITSET_WORDS (dst); + bitset_windex ssize = VBITSET_SIZE (src); + bitset_windex dsize = VBITSET_SIZE (dst); + + for (i = 0; i < min (ssize, dsize); i++, dstp++, srcp++) + if (*dstp != (*srcp | *dstp)) + return 0; + + if (ssize > dsize) + { + for (; i < ssize; i++) + if (*srcp++) + return 0; + } + + return 1; +} + + +static bool +vbitset_disjoint_p (bitset dst, bitset src) +{ + unsigned int i; + bitset_word *srcp = VBITSET_WORDS (src); + bitset_word *dstp = VBITSET_WORDS (dst); + bitset_windex ssize = VBITSET_SIZE (src); + bitset_windex dsize = VBITSET_SIZE (dst); + + for (i = 0; i < min (ssize, dsize); i++) + if (*srcp++ & *dstp++) + return 0; + + return 1; +} + + +static void +vbitset_and (bitset dst, bitset src1, bitset src2) +{ + unsigned int i; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *dstp; + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + + vbitset_resize (dst, max (BITSET_SIZE_ (src1), BITSET_SIZE_ (src2))); + + dsize = VBITSET_SIZE (dst); + ssize1 = VBITSET_SIZE (src1); + ssize2 = VBITSET_SIZE (src2); + dstp = VBITSET_WORDS (dst); + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + + for (i = 0; i < min (ssize1, ssize2); i++) + *dstp++ = *src1p++ & *src2p++; + + memset (dstp, 0, sizeof (bitset_word) * (dsize - min (ssize1, ssize2))); +} + + +static bool +vbitset_and_cmp (bitset dst, bitset src1, bitset src2) +{ + unsigned int i; + int changed = 0; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *dstp; + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + + vbitset_resize (dst, max (BITSET_SIZE_ (src1), BITSET_SIZE_ (src2))); + + dsize = VBITSET_SIZE (dst); + ssize1 = VBITSET_SIZE (src1); + ssize2 = VBITSET_SIZE (src2); + dstp = VBITSET_WORDS (dst); + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + + for (i = 0; i < min (ssize1, ssize2); i++, dstp++) + { + bitset_word tmp = *src1p++ & *src2p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + + if (ssize2 > ssize1) + { + src1p = src2p; + ssize1 = ssize2; + } + + for (; i < ssize1; i++, dstp++) + { + if (*dstp != 0) + { + changed = 1; + *dstp = 0; + } + } + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1)); + + return changed; +} + + +static void +vbitset_andn (bitset dst, bitset src1, bitset src2) +{ + unsigned int i; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *dstp; + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + + vbitset_resize (dst, max (BITSET_SIZE_ (src1), BITSET_SIZE_ (src2))); + + dsize = VBITSET_SIZE (dst); + ssize1 = VBITSET_SIZE (src1); + ssize2 = VBITSET_SIZE (src2); + dstp = VBITSET_WORDS (dst); + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + + for (i = 0; i < min (ssize1, ssize2); i++) + *dstp++ = *src1p++ & ~(*src2p++); + + if (ssize2 > ssize1) + { + for (; i < ssize2; i++) + *dstp++ = 0; + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize2)); + } + else + { + for (; i < ssize1; i++) + *dstp++ = *src1p++; + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1)); + } +} + + +static bool +vbitset_andn_cmp (bitset dst, bitset src1, bitset src2) +{ + unsigned int i; + int changed = 0; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *dstp; + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + + vbitset_resize (dst, max (BITSET_SIZE_ (src1), BITSET_SIZE_ (src2))); + + dsize = VBITSET_SIZE (dst); + ssize1 = VBITSET_SIZE (src1); + ssize2 = VBITSET_SIZE (src2); + dstp = VBITSET_WORDS (dst); + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + + for (i = 0; i < min (ssize1, ssize2); i++, dstp++) + { + bitset_word tmp = *src1p++ & ~(*src2p++); + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + + if (ssize2 > ssize1) + { + for (; i < ssize2; i++, dstp++) + { + if (*dstp != 0) + { + changed = 1; + *dstp = 0; + } + } + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize2)); + } + else + { + for (; i < ssize1; i++, dstp++) + { + bitset_word tmp = *src1p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1)); + } + + return changed; +} + + +static void +vbitset_or (bitset dst, bitset src1, bitset src2) +{ + unsigned int i; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *dstp; + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + + vbitset_resize (dst, max (BITSET_SIZE_ (src1), BITSET_SIZE_ (src2))); + + dsize = VBITSET_SIZE (dst); + ssize1 = VBITSET_SIZE (src1); + ssize2 = VBITSET_SIZE (src2); + dstp = VBITSET_WORDS (dst); + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + + for (i = 0; i < min (ssize1, ssize2); i++) + *dstp++ = *src1p++ | *src2p++; + + if (ssize2 > ssize1) + { + src1p = src2p; + ssize1 = ssize2; + } + + for (; i < ssize1; i++) + *dstp++ = *src1p++; + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1)); +} + + +static bool +vbitset_or_cmp (bitset dst, bitset src1, bitset src2) +{ + unsigned int i; + int changed = 0; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *dstp; + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + + vbitset_resize (dst, max (BITSET_SIZE_ (src1), BITSET_SIZE_ (src2))); + + dsize = VBITSET_SIZE (dst); + ssize1 = VBITSET_SIZE (src1); + ssize2 = VBITSET_SIZE (src2); + dstp = VBITSET_WORDS (dst); + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + + for (i = 0; i < min (ssize1, ssize2); i++, dstp++) + { + bitset_word tmp = *src1p++ | *src2p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + + if (ssize2 > ssize1) + { + src1p = src2p; + ssize1 = ssize2; + } + + for (; i < ssize1; i++, dstp++) + { + bitset_word tmp = *src1p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1)); + + return changed; +} + + +static void +vbitset_xor (bitset dst, bitset src1, bitset src2) +{ + unsigned int i; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *dstp; + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + + vbitset_resize (dst, max (BITSET_SIZE_ (src1), BITSET_SIZE_ (src2))); + + dsize = VBITSET_SIZE (dst); + ssize1 = VBITSET_SIZE (src1); + ssize2 = VBITSET_SIZE (src2); + dstp = VBITSET_WORDS (dst); + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + + for (i = 0; i < min (ssize1, ssize2); i++) + *dstp++ = *src1p++ ^ *src2p++; + + if (ssize2 > ssize1) + { + src1p = src2p; + ssize1 = ssize2; + } + + for (; i < ssize1; i++) + *dstp++ = *src1p++; + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1)); +} + + +static bool +vbitset_xor_cmp (bitset dst, bitset src1, bitset src2) +{ + unsigned int i; + int changed = 0; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *dstp; + bitset_windex ssize1; + bitset_windex ssize2; + bitset_windex dsize; + + vbitset_resize (dst, max (BITSET_SIZE_ (src1), BITSET_SIZE_ (src2))); + + dsize = VBITSET_SIZE (dst); + ssize1 = VBITSET_SIZE (src1); + ssize2 = VBITSET_SIZE (src2); + dstp = VBITSET_WORDS (dst); + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + + for (i = 0; i < min (ssize1, ssize2); i++, dstp++) + { + bitset_word tmp = *src1p++ ^ *src2p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + + if (ssize2 > ssize1) + { + src1p = src2p; + ssize1 = ssize2; + } + + for (; i < ssize1; i++, dstp++) + { + bitset_word tmp = *src1p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + + memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1)); + + return changed; +} + + +/* FIXME, these operations need fixing for different size + bitsets. */ + +static void +vbitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3) +{ + unsigned int i; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *src3p; + bitset_word *dstp; + bitset_windex size; + + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) + || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) + { + bitset_and_or_ (dst, src1, src2, src3); + return; + } + + vbitset_resize (dst, BITSET_NBITS_ (src1)); + + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + src3p = VBITSET_WORDS (src3); + dstp = VBITSET_WORDS (dst); + size = VBITSET_SIZE (dst); + + for (i = 0; i < size; i++) + *dstp++ = (*src1p++ & *src2p++) | *src3p++; +} + + +static bool +vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + unsigned int i; + int changed = 0; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *src3p; + bitset_word *dstp; + bitset_windex size; + + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) + || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) + return bitset_and_or_cmp_ (dst, src1, src2, src3); + + vbitset_resize (dst, BITSET_NBITS_ (src1)); + + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + src3p = VBITSET_WORDS (src3); + dstp = VBITSET_WORDS (dst); + size = VBITSET_SIZE (dst); + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = (*src1p++ & *src2p++) | *src3p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + return changed; +} + + +static void +vbitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3) +{ + unsigned int i; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *src3p; + bitset_word *dstp; + bitset_windex size; + + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) + || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) + { + bitset_andn_or_ (dst, src1, src2, src3); + return; + } + + vbitset_resize (dst, BITSET_NBITS_ (src1)); + + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + src3p = VBITSET_WORDS (src3); + dstp = VBITSET_WORDS (dst); + size = VBITSET_SIZE (dst); + + for (i = 0; i < size; i++) + *dstp++ = (*src1p++ & ~(*src2p++)) | *src3p++; +} + + +static bool +vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + unsigned int i; + int changed = 0; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *src3p; + bitset_word *dstp; + bitset_windex size; + + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) + || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) + return bitset_andn_or_cmp_ (dst, src1, src2, src3); + + vbitset_resize (dst, BITSET_NBITS_ (src1)); + + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + src3p = VBITSET_WORDS (src3); + dstp = VBITSET_WORDS (dst); + size = VBITSET_SIZE (dst); + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + return changed; +} + + +static void +vbitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3) +{ + unsigned int i; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *src3p; + bitset_word *dstp; + bitset_windex size; + + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) + || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) + { + bitset_or_and_ (dst, src1, src2, src3); + return; + } + + vbitset_resize (dst, BITSET_NBITS_ (src1)); + + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + src3p = VBITSET_WORDS (src3); + dstp = VBITSET_WORDS (dst); + size = VBITSET_SIZE (dst); + + for (i = 0; i < size; i++) + *dstp++ = (*src1p++ | *src2p++) & *src3p++; +} + + +static bool +vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3) +{ + unsigned int i; + int changed = 0; + bitset_word *src1p; + bitset_word *src2p; + bitset_word *src3p; + bitset_word *dstp; + bitset_windex size; + + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) + || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) + return bitset_or_and_cmp_ (dst, src1, src2, src3); + + vbitset_resize (dst, BITSET_NBITS_ (src1)); + + src1p = VBITSET_WORDS (src1); + src2p = VBITSET_WORDS (src2); + src3p = VBITSET_WORDS (src3); + dstp = VBITSET_WORDS (dst); + size = VBITSET_SIZE (dst); + + for (i = 0; i < size; i++, dstp++) + { + bitset_word tmp = (*src1p++ | *src2p++) & *src3p++; + + if (*dstp != tmp) + { + changed = 1; + *dstp = tmp; + } + } + return changed; +} + + +static void +vbitset_copy (bitset dst, bitset src) +{ + if (BITSET_COMPATIBLE_ (dst, src)) + vbitset_copy1 (dst, src); + else + bitset_copy_ (dst, src); +} + + +/* Vector of operations for multiple word bitsets. */ +struct bitset_vtable vbitset_vtable = { + vbitset_set, + vbitset_reset, + bitset_toggle_, + vbitset_test, + vbitset_resize, + bitset_size_, + bitset_count_, + vbitset_empty_p, + vbitset_ones, + vbitset_zero, + vbitset_copy, + vbitset_disjoint_p, + vbitset_equal_p, + vbitset_not, + vbitset_subset_p, + vbitset_and, + vbitset_and_cmp, + vbitset_andn, + vbitset_andn_cmp, + vbitset_or, + vbitset_or_cmp, + vbitset_xor, + vbitset_xor_cmp, + vbitset_and_or, + vbitset_and_or_cmp, + vbitset_andn_or, + vbitset_andn_or_cmp, + vbitset_or_and, + vbitset_or_and_cmp, + vbitset_list, + vbitset_list_reverse, + NULL, + BITSET_VARRAY +}; + + +size_t +vbitset_bytes (n_bits) + bitset_bindex n_bits ATTRIBUTE_UNUSED; +{ + return sizeof (struct vbitset_struct); +} + + +bitset +vbitset_init (bset, n_bits) + bitset bset; + bitset_bindex n_bits; +{ + bset->b.vtable = &vbitset_vtable; + + bset->b.cindex = 0; + + VBITSET_SIZE (bset) = 0; + vbitset_resize (bset, n_bits); + return bset; +} diff --git a/lib/vbitset.h b/lib/vbitset.h new file mode 100644 index 0000000..53361be --- /dev/null +++ b/lib/vbitset.h @@ -0,0 +1,27 @@ +/* Functions to support vbitsets. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). + + 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 . */ + +#ifndef _VBITSET_H +#define _VBITSET_H + +#include "bitset.h" + +extern size_t vbitset_bytes (bitset_bindex); + +extern bitset vbitset_init (bitset, bitset_bindex); + +#endif diff --git a/lib/verify.h b/lib/verify.h new file mode 100644 index 0000000..fac53f6 --- /dev/null +++ b/lib/verify.h @@ -0,0 +1,140 @@ +/* Compile-time assert-like macros. + + Copyright (C) 2005, 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 . */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#ifndef VERIFY_H +# define VERIFY_H 1 + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. + + Symbols ending in "__" are private to this header. + + The code below uses several ideas. + + * The first step is ((R) ? 1 : -1). Given an expression R, of + integral or boolean or floating-point type, this yields an + expression of integral type, whose value is later verified to be + constant and nonnegative. + + * Next this expression W is wrapped in a type + struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. + If W is negative, this yields a compile-time error. No compiler can + deal with a bit-field of negative size. + + One might think that an array size check would have the same + effect, that is, that the type struct { unsigned int dummy[W]; } + would work as well. However, inside a function, some compilers + (such as C++ compilers and GNU C) allow local parameters and + variables inside array size expressions. With these compilers, + an array size check would not properly diagnose this misuse of + the verify macro: + + void function (int n) { verify (n < 0); } + + * For the verify macro, the struct verify_type__ will need to + somehow be embedded into a declaration. To be portable, this + declaration must declare an object, a constant, a function, or a + typedef name. If the declared entity uses the type directly, + such as in + + struct dummy {...}; + typedef struct {...} dummy; + extern struct {...} *dummy; + extern void dummy (struct {...} *); + extern struct {...} *dummy (void); + + two uses of the verify macro would yield colliding declarations + if the entity names are not disambiguated. A workaround is to + attach the current line number to the entity name: + + #define GL_CONCAT0(x, y) x##y + #define GL_CONCAT(x, y) GL_CONCAT0 (x, y) + extern struct {...} * GL_CONCAT(dummy,__LINE__); + + But this has the problem that two invocations of verify from + within the same macro would collide, since the __LINE__ value + would be the same for both invocations. + + A solution is to use the sizeof operator. It yields a number, + getting rid of the identity of the type. Declarations like + + extern int dummy [sizeof (struct {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + + can be repeated. + + * Should the implementation use a named struct or an unnamed struct? + Which of the following alternatives can be used? + + extern int dummy [sizeof (struct {...})]; + extern int dummy [sizeof (struct verify_type__ {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern void dummy (int [sizeof (struct verify_type__ {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; + + In the second and sixth case, the struct type is exported to the + outer scope; two such declarations therefore collide. GCC warns + about the first, third, and fourth cases. So the only remaining + possibility is the fifth case: + + extern int (*dummy (void)) [sizeof (struct {...})]; + + * This implementation exploits the fact that GCC does not warn about + the last declaration mentioned above. If a future version of GCC + introduces a warning for this, the problem could be worked around + by using code specialized to GCC, e.g.,: + + #if 4 <= __GNUC__ + # define verify(R) \ + extern int (* verify_function__ (void)) \ + [__builtin_constant_p (R) && (R) ? 1 : -1] + #endif + + * In C++, any struct definition inside sizeof is invalid. + Use a template type to work around the problem. */ + + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. */ + +# ifdef __cplusplus +template + struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; +# define verify_true(R) \ + (!!sizeof (verify_type__<(R) ? 1 : -1>)) +# else +# define verify_true(R) \ + (!!sizeof \ + (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) +# endif + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. */ + +# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)] + +#endif diff --git a/lib/wchar.in.h b/lib/wchar.in.h new file mode 100644 index 0000000..dcb87b9 --- /dev/null +++ b/lib/wchar.in.h @@ -0,0 +1,103 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* A substitute for ISO C99 , for platforms that have issues. + + Copyright (C) 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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake. */ + +/* + * ISO C 99 for platforms that have issues. + * + * + * For now, this just ensures proper prerequisite inclusion order and + * the declaration of wcwidth(). + */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +#ifdef __need_mbstate_t +/* Special invocation convention inside uClibc header files. */ + +#@INCLUDE_NEXT@ @NEXT_WCHAR_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_WCHAR_H + +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include + +/* Include the original if it exists. + Some builds of uClibc lack it. */ +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_WCHAR_H@ +# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ +#endif + +#ifndef _GL_WCHAR_H +#define _GL_WCHAR_H + +/* The definition of GL_LINK_WARNING is copied here. */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Define wint_t. (Also done in wctype.in.h.) */ +#if !@HAVE_WINT_T@ && !defined wint_t +# define wint_t int +#endif + + +/* Return the number of screen columns needed for WC. */ +#if @GNULIB_WCWIDTH@ +# if @REPLACE_WCWIDTH@ +# undef wcwidth +# define wcwidth rpl_wcwidth +extern int wcwidth (wchar_t); +# else +# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@ +/* wcwidth exists but is not declared. */ +extern int wcwidth (int /* actually wchar_t */); +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcwidth +# define wcwidth(w) \ + (GL_LINK_WARNING ("wcwidth is unportable - " \ + "use gnulib module wcwidth for portability"), \ + wcwidth (w)) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_WCHAR_H */ +#endif /* _GL_WCHAR_H */ +#endif diff --git a/lib/wctype.in.h b/lib/wctype.in.h new file mode 100644 index 0000000..4a4f5a0 --- /dev/null +++ b/lib/wctype.in.h @@ -0,0 +1,183 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* A substitute for ISO C99 , for platforms that lack it. + + Copyright (C) 2006-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, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible and Paul Eggert. */ + +/* + * ISO C 99 for platforms that lack it. + * + * + * iswctype, towctrans, towlower, towupper, wctrans, wctype, + * wctrans_t, and wctype_t are not yet implemented. + */ + +#ifndef _GL_WCTYPE_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +#if @HAVE_WINT_T@ +/* Solaris 2.5 has a bug: must be included before . + Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +# include +# include +# include +# include +#endif + +/* Include the original if it exists. + BeOS 5 has the functions but no . */ +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_WCTYPE_H@ +# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@ +#endif + +#ifndef _GL_WCTYPE_H +#define _GL_WCTYPE_H + +/* Define wint_t. (Also done in wchar.in.h.) */ +#if !@HAVE_WINT_T@ && !defined wint_t +# define wint_t int +#endif + +/* FreeBSD 4.4 to 4.11 has but lacks the functions. + Linux libc5 has and the functions but they are broken. + Assume all 12 functions are implemented the same way, or not at all. */ +#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ + +/* IRIX 5.3 has macros but no functions, its isw* macros refer to an + undefined variable _ctmp_ and to macros like _P, and they + refer to system functions like _iswctype that are not in the + standard C library. Rather than try to get ancient buggy + implementations like this to work, just disable them. */ +# undef iswalnum +# undef iswalpha +# undef iswblank +# undef iswcntrl +# undef iswdigit +# undef iswgraph +# undef iswlower +# undef iswprint +# undef iswpunct +# undef iswspace +# undef iswupper +# undef iswxdigit + +/* Linux libc5 has and the functions but they are broken. */ +# if @REPLACE_ISWCNTRL@ +# define iswalnum rpl_iswalnum +# define iswalpha rpl_iswalpha +# define iswblank rpl_iswblank +# define iswcntrl rpl_iswcntrl +# define iswdigit rpl_iswdigit +# define iswgraph rpl_iswgraph +# define iswlower rpl_iswlower +# define iswprint rpl_iswprint +# define iswpunct rpl_iswpunct +# define iswspace rpl_iswspace +# define iswupper rpl_iswupper +# define iswxdigit rpl_iswxdigit +# endif + +static inline int +iswalnum (wint_t wc) +{ + return ((wc >= '0' && wc <= '9') + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); +} + +static inline int +iswalpha (wint_t wc) +{ + return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; +} + +static inline int +iswblank (wint_t wc) +{ + return wc == ' ' || wc == '\t'; +} + +static inline int +iswcntrl (wint_t wc) +{ + return (wc & ~0x1f) == 0 || wc == 0x7f; +} + +static inline int +iswdigit (wint_t wc) +{ + return wc >= '0' && wc <= '9'; +} + +static inline int +iswgraph (wint_t wc) +{ + return wc >= '!' && wc <= '~'; +} + +static inline int +iswlower (wint_t wc) +{ + return wc >= 'a' && wc <= 'z'; +} + +static inline int +iswprint (wint_t wc) +{ + return wc >= ' ' && wc <= '~'; +} + +static inline int +iswpunct (wint_t wc) +{ + return (wc >= '!' && wc <= '~' + && !((wc >= '0' && wc <= '9') + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); +} + +static inline int +iswspace (wint_t wc) +{ + return (wc == ' ' || wc == '\t' + || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); +} + +static inline int +iswupper (wint_t wc) +{ + return wc >= 'A' && wc <= 'Z'; +} + +static inline int +iswxdigit (wint_t wc) +{ + return ((wc >= '0' && wc <= '9') + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); +} + +# endif /* ! HAVE_ISWCNTRL */ + +#endif /* _GL_WCTYPE_H */ +#endif /* _GL_WCTYPE_H */ diff --git a/lib/wcwidth.c b/lib/wcwidth.c new file mode 100644 index 0000000..4885071 --- /dev/null +++ b/lib/wcwidth.c @@ -0,0 +1,51 @@ +/* Determine the number of screen columns needed for a character. + Copyright (C) 2006, 2007 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 . */ + +#include + +/* Specification. */ +#include + +/* Get iswprint. */ +#include + +#include "localcharset.h" +#include "streq.h" +#include "uniwidth.h" + +#undef wcwidth + +int +rpl_wcwidth (wchar_t wc) +{ + /* In UTF-8 locales, use a Unicode aware width function. */ + const char *encoding = locale_charset (); + if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0 ,0)) + { + /* We assume that in a UTF-8 locale, a wide character is the same as a + Unicode character. */ + return uc_width (wc, encoding); + } + else + { + /* Otherwise, fall back to the system's wcwidth function. */ +#if HAVE_WCWIDTH + return wcwidth (wc); +#else + return wc == 0 ? 0 : iswprint (wc) ? 1 : -1; +#endif + } +} diff --git a/lib/xalloc-die.c b/lib/xalloc-die.c new file mode 100644 index 0000000..0a0694f --- /dev/null +++ b/lib/xalloc-die.c @@ -0,0 +1,41 @@ +/* Report a memory allocation failure and exit. + + Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 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 . */ + +#include + +#include "xalloc.h" + +#include + +#include "error.h" +#include "exitfail.h" + +#include "gettext.h" +#define _(msgid) gettext (msgid) + +void +xalloc_die (void) +{ + error (exit_failure, 0, "%s", _("memory exhausted")); + + /* The `noreturn' cannot be given to error, since it may return if + its first argument is 0. To help compilers understand the + xalloc_die does not return, call abort. Also, the abort is a + safety feature if exit_failure is 0 (which shouldn't happen). */ + abort (); +} diff --git a/lib/xalloc.h b/lib/xalloc.h new file mode 100644 index 0000000..57a13e0 --- /dev/null +++ b/lib/xalloc.h @@ -0,0 +1,280 @@ +/* xalloc.h -- malloc with out-of-memory checking + + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2003, 2004, 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 . */ + +#ifndef XALLOC_H_ +# define XALLOC_H_ + +# include + + +# ifdef __cplusplus +extern "C" { +# endif + + +# ifndef __attribute__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) +# define __attribute__(x) +# endif +# endif + +# ifndef ATTRIBUTE_NORETURN +# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# endif + +# ifndef ATTRIBUTE_MALLOC +# if __GNUC__ >= 3 +# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define ATTRIBUTE_MALLOC +# endif +# endif + +/* This function is always triggered when memory is exhausted. + It must be defined by the application, either explicitly + or by using gnulib's xalloc-die module. This is the + function to call when one wants the program to die because of a + memory allocation failure. */ +extern void xalloc_die (void) ATTRIBUTE_NORETURN; + +void *xmalloc (size_t s) ATTRIBUTE_MALLOC; +void *xzalloc (size_t s) ATTRIBUTE_MALLOC; +void *xcalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; +void *xrealloc (void *p, size_t s); +void *x2realloc (void *p, size_t *pn); +void *xmemdup (void const *p, size_t s) ATTRIBUTE_MALLOC; +char *xstrdup (char const *str) ATTRIBUTE_MALLOC; + +/* Return 1 if an array of N objects, each of size S, cannot exist due + to size arithmetic overflow. S must be positive and N must be + nonnegative. This is a macro, not an inline function, so that it + works correctly even when SIZE_MAX < N. + + By gnulib convention, SIZE_MAX represents overflow in size + calculations, so the conservative dividend to use here is + SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. + However, malloc (SIZE_MAX) fails on all known hosts where + sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for + exactly-SIZE_MAX allocations on such hosts; this avoids a test and + branch when S is known to be 1. */ +# define xalloc_oversized(n, s) \ + ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) + + +/* In the following macros, T must be an elementary or structure/union or + typedef'ed type, or a pointer to such a type. To apply one of the + following macros to a function pointer or array type, you need to typedef + it first and use the typedef name. */ + +/* Allocate an object of type T dynamically, with error checking. */ +/* extern t *XMALLOC (typename t); */ +# define XMALLOC(t) ((t *) xmalloc (sizeof (t))) + +/* Allocate memory for N elements of type T, with error checking. */ +/* extern t *XNMALLOC (size_t n, typename t); */ +# define XNMALLOC(n, t) \ + ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t)))) + +/* Allocate an object of type T dynamically, with error checking, + and zero it. */ +/* extern t *XZALLOC (typename t); */ +# define XZALLOC(t) ((t *) xzalloc (sizeof (t))) + +/* Allocate memory for N elements of type T, with error checking, + and zero it. */ +/* extern t *XCALLOC (size_t n, typename t); */ +# define XCALLOC(n, t) \ + ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t)))) + + +# if HAVE_INLINE +# define static_inline static inline +# else + void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; + void *xnrealloc (void *p, size_t n, size_t s); + void *x2nrealloc (void *p, size_t *pn, size_t s); + char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; +# endif + +# ifdef static_inline + +/* Allocate an array of N objects, each with S bytes of memory, + dynamically, with error checking. S must be nonzero. */ + +static_inline void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; +static_inline void * +xnmalloc (size_t n, size_t s) +{ + if (xalloc_oversized (n, s)) + xalloc_die (); + return xmalloc (n * s); +} + +/* Change the size of an allocated block of memory P to an array of N + objects each of S bytes, with error checking. S must be nonzero. */ + +static_inline void * +xnrealloc (void *p, size_t n, size_t s) +{ + if (xalloc_oversized (n, s)) + xalloc_die (); + return xrealloc (p, n * s); +} + +/* If P is null, allocate a block of at least *PN such objects; + otherwise, reallocate P so that it contains more than *PN objects + each of S bytes. *PN must be nonzero unless P is null, and S must + be nonzero. Set *PN to the new number of objects, and return the + pointer to the new block. *PN is never set to zero, and the + returned pointer is never null. + + Repeated reallocations are guaranteed to make progress, either by + allocating an initial block with a nonzero size, or by allocating a + larger block. + + In the following implementation, nonzero sizes are increased by a + factor of approximately 1.5 so that repeated reallocations have + O(N) overall cost rather than O(N**2) cost, but the + specification for this function does not guarantee that rate. + + Here is an example of use: + + int *p = NULL; + size_t used = 0; + size_t allocated = 0; + + void + append_int (int value) + { + if (used == allocated) + p = x2nrealloc (p, &allocated, sizeof *p); + p[used++] = value; + } + + This causes x2nrealloc to allocate a block of some nonzero size the + first time it is called. + + To have finer-grained control over the initial size, set *PN to a + nonzero value before calling this function with P == NULL. For + example: + + int *p = NULL; + size_t used = 0; + size_t allocated = 0; + size_t allocated1 = 1000; + + void + append_int (int value) + { + if (used == allocated) + { + p = x2nrealloc (p, &allocated1, sizeof *p); + allocated = allocated1; + } + p[used++] = value; + } + + */ + +static_inline void * +x2nrealloc (void *p, size_t *pn, size_t s) +{ + size_t n = *pn; + + if (! p) + { + if (! n) + { + /* The approximate size to use for initial small allocation + requests, when the invoking code specifies an old size of + zero. 64 bytes is the largest "small" request for the + GNU C library malloc. */ + enum { DEFAULT_MXFAST = 64 }; + + n = DEFAULT_MXFAST / s; + n += !n; + } + } + else + { + /* Set N = ceil (1.5 * N) so that progress is made if N == 1. + Check for overflow, so that N * S stays in size_t range. + The check is slightly conservative, but an exact check isn't + worth the trouble. */ + if ((size_t) -1 / 3 * 2 / s <= n) + xalloc_die (); + n += (n + 1) / 2; + } + + *pn = n; + return xrealloc (p, n * s); +} + +/* Return a pointer to a new buffer of N bytes. This is like xmalloc, + except it returns char *. */ + +static_inline char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; +static_inline char * +xcharalloc (size_t n) +{ + return XNMALLOC (n, char); +} + +# endif + +# ifdef __cplusplus +} + +/* C++ does not allow conversions from void * to other pointer types + without a cast. Use templates to work around the problem when + possible. */ + +template inline T * +xrealloc (T *p, size_t s) +{ + return (T *) xrealloc ((void *) p, s); +} + +template inline T * +xnrealloc (T *p, size_t n, size_t s) +{ + return (T *) xnrealloc ((void *) p, n, s); +} + +template inline T * +x2realloc (T *p, size_t *pn) +{ + return (T *) x2realloc ((void *) p, pn); +} + +template inline T * +x2nrealloc (T *p, size_t *pn, size_t s) +{ + return (T *) x2nrealloc ((void *) p, pn, s); +} + +template inline T * +xmemdup (T const *p, size_t s) +{ + return (T *) xmemdup ((void const *) p, s); +} + +# endif + + +#endif /* !XALLOC_H_ */ diff --git a/lib/xmalloc.c b/lib/xmalloc.c new file mode 100644 index 0000000..89ecf17 --- /dev/null +++ b/lib/xmalloc.c @@ -0,0 +1,122 @@ +/* xmalloc.c -- malloc with out of memory checking + + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2002, 2003, 2004, 2005, 2006, 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 . */ + +#include + +#if ! HAVE_INLINE +# define static_inline +#endif +#include "xalloc.h" +#undef static_inline + +#include +#include + +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + +/* 1 if calloc is known to be compatible with GNU calloc. This + matters if we are not also using the calloc module, which defines + HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ +#if defined HAVE_CALLOC || defined __GLIBC__ +enum { HAVE_GNU_CALLOC = 1 }; +#else +enum { HAVE_GNU_CALLOC = 0 }; +#endif + +/* Allocate N bytes of memory dynamically, with error checking. */ + +void * +xmalloc (size_t n) +{ + void *p = malloc (n); + if (!p && n != 0) + xalloc_die (); + return p; +} + +/* Change the size of an allocated block of memory P to N bytes, + with error checking. */ + +void * +xrealloc (void *p, size_t n) +{ + p = realloc (p, n); + if (!p && n != 0) + xalloc_die (); + return p; +} + +/* If P is null, allocate a block of at least *PN bytes; otherwise, + reallocate P so that it contains more than *PN bytes. *PN must be + nonzero unless P is null. Set *PN to the new block's size, and + return the pointer to the new block. *PN is never set to zero, and + the returned pointer is never null. */ + +void * +x2realloc (void *p, size_t *pn) +{ + return x2nrealloc (p, pn, 1); +} + +/* Allocate S bytes of zeroed memory dynamically, with error checking. + There's no need for xnzalloc (N, S), since it would be equivalent + to xcalloc (N, S). */ + +void * +xzalloc (size_t s) +{ + return memset (xmalloc (s), 0, s); +} + +/* Allocate zeroed memory for N elements of S bytes, with error + checking. S must be nonzero. */ + +void * +xcalloc (size_t n, size_t s) +{ + void *p; + /* Test for overflow, since some calloc implementations don't have + proper overflow checks. But omit overflow and size-zero tests if + HAVE_GNU_CALLOC, since GNU calloc catches overflow and never + returns NULL if successful. */ + if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) + || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) + xalloc_die (); + return p; +} + +/* Clone an object P of size S, with error checking. There's no need + for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any + need for an arithmetic overflow check. */ + +void * +xmemdup (void const *p, size_t s) +{ + return memcpy (xmalloc (s), p, s); +} + +/* Clone STRING. */ + +char * +xstrdup (char const *string) +{ + return xmemdup (string, strlen (string) + 1); +} diff --git a/lib/xstrndup.c b/lib/xstrndup.c new file mode 100644 index 0000000..37488cd --- /dev/null +++ b/lib/xstrndup.c @@ -0,0 +1,36 @@ +/* Duplicate a bounded initial segment of a string, with out-of-memory + checking. + Copyright (C) 2003, 2006, 2007 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 . */ + +#include + +/* Specification. */ +#include "xstrndup.h" + +#include +#include "xalloc.h" + +/* Return a newly allocated copy of at most N bytes of STRING. + In other words, return a copy of the initial segment of length N of + STRING. */ +char * +xstrndup (const char *string, size_t n) +{ + char *s = strndup (string, n); + if (! s) + xalloc_die (); + return s; +} diff --git a/lib/xstrndup.h b/lib/xstrndup.h new file mode 100644 index 0000000..4882e39 --- /dev/null +++ b/lib/xstrndup.h @@ -0,0 +1,23 @@ +/* Duplicate a bounded initial segment of a string, with out-of-memory + checking. + Copyright (C) 2003 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 . */ + +#include + +/* Return a newly allocated copy of at most N bytes of STRING. + In other words, return a copy of the initial segment of length N of + STRING. */ +extern char *xstrndup (const char *string, size_t n); diff --git a/lib/yyerror.c b/lib/yyerror.c new file mode 100644 index 0000000..88632ef --- /dev/null +++ b/lib/yyerror.c @@ -0,0 +1,28 @@ +/* Yacc library error-printing function. + + Copyright (C) 2002 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include + +int yyerror (char const *); + +int +yyerror (char const *message) +{ + return fprintf (stderr, "%s\n", message); +} diff --git a/m4/argmatch.m4 b/m4/argmatch.m4 new file mode 100644 index 0000000..beda5a1 --- /dev/null +++ b/m4/argmatch.m4 @@ -0,0 +1,10 @@ +#serial 3 +dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_ARGMATCH], +[ + AC_LIBOBJ([argmatch]) +]) diff --git a/m4/bison-i18n.m4 b/m4/bison-i18n.m4 new file mode 100644 index 0000000..7571712 --- /dev/null +++ b/m4/bison-i18n.m4 @@ -0,0 +1,48 @@ +# bison-i18n.m4 serial 2 +dnl Copyright (C) 2005-2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl Support for internationalization of bison-generated parsers. + +dnl BISON_I18N +dnl should be used in configure.ac, after AM_GNU_GETTEXT. If USE_NLS is yes, it +dnl sets BISON_LOCALEDIR to indicate where to find the bison-runtime.mo files +dnl and defines YYENABLE_NLS if there are bison-runtime.mo files at all. +AC_DEFUN([BISON_I18N], +[ + if test -z "$USE_NLS"; then + echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." 1>&2 + exit 1 + fi + BISON_LOCALEDIR= + BISON_USE_NLS=no + if test "$USE_NLS" = yes; then + dnl Determine bison's localedir. + dnl AC_PROG_YACC sets the YACC variable; other macros set the BISON variable. + dnl But even is YACC is called "yacc", it may be a script that invokes bison + dnl and accepts the --print-localedir option. + dnl YACC's default value is empty; BISON's default value is :. + if (${YACC-${BISON-:}} --print-localedir) >/dev/null 2>&1; then + BISON_LOCALEDIR=`${YACC-${BISON-:}} --print-localedir` + fi + AC_SUBST([BISON_LOCALEDIR]) + if test -n "$BISON_LOCALEDIR"; then + dnl There is no need to enable internationalization if the user doesn't + dnl want message catalogs. So look at the language/locale names for + dnl which the user wants message catalogs. This is $LINGUAS. If unset + dnl or empty, he wants all of them. + USER_LINGUAS="${LINGUAS-%UNSET%}" + if test -n "$USER_LINGUAS"; then + BISON_USE_NLS=yes + fi + fi + fi + if test $BISON_USE_NLS = yes; then + AC_DEFINE([YYENABLE_NLS], 1, + [Define to 1 to internationalize bison runtime messages.]) + fi +]) diff --git a/m4/c-working.m4 b/m4/c-working.m4 new file mode 100644 index 0000000..8cd7d4f --- /dev/null +++ b/m4/c-working.m4 @@ -0,0 +1,27 @@ +# Sanity test a C compiler. + +# Copyright (C) 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 . + +# Written by Paul Eggert. + +AC_DEFUN([BISON_TEST_FOR_WORKING_C_COMPILER], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int test_array[CHAR_BIT];]])], + [], + [AC_MSG_FAILURE([cannot compile a simple C program])]) +]) diff --git a/m4/config-h.m4 b/m4/config-h.m4 new file mode 100644 index 0000000..807d515 --- /dev/null +++ b/m4/config-h.m4 @@ -0,0 +1,13 @@ +# Say that -DHAVE_CONFIG_H is not needed. + +dnl Copyright (C) 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Paul Eggert. + +# This package's source files all include config.h unconditionally, +# so there's no need to pass -DHAVE_CONFIG_H to the compiler. +AC_DEFUN([gl_CONFIG_H], + [AC_CONFIG_COMMANDS_PRE([test "X$DEFS" = X-DHAVE_CONFIG_H && DEFS=])]) diff --git a/m4/cxx.m4 b/m4/cxx.m4 new file mode 100644 index 0000000..8c88874 --- /dev/null +++ b/m4/cxx.m4 @@ -0,0 +1,60 @@ +# -*- Autoconf -*- +# Sanity-test a C++ compiler. +# +# Copyright (C) 2004, 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 . + +# Written by Paul Eggert. + +AC_DEFUN([BISON_TEST_FOR_WORKING_CXX_COMPILER], +[ + AC_CACHE_CHECK([whether $CXX builds executables that work], + bison_cv_cxx_works, + [AC_LANG_PUSH([C++]) + bison_cv_cxx_works=no + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include + #include + #include + #include + using namespace std;], + [std::cerr << ""; + cout << ""; + typedef std::pair uipair; + std::map m; + std::map::iterator i; + m.insert (uipair (4, -4)); + for (i = m.begin (); i != m.end (); ++i) + if (i->first != 4) + return 1;])], + [AS_IF([AC_TRY_COMMAND([$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD])], + [AS_IF([test "$cross_compiling" = yes], + [bison_cv_cxx_works=cross], + [AS_IF([AC_TRY_COMMAND(./conftest$ac_exeext)], + [bison_cv_cxx_works=yes])])]) + rm -f conftest$ac_exeext]) + AC_LANG_POP([C++])]) + + case $bison_cv_cxx_works in + yes) + BISON_CXX_WORKS=':';; + no | cross) + BISON_CXX_WORKS='exit 77';; + esac + + AC_SUBST([BISON_CXX_WORKS]) + AM_CONDITIONAL(BISON_CXX_WORKS, test $bison_cv_cxx_works = yes) +]) diff --git a/m4/dirname.m4 b/m4/dirname.m4 new file mode 100644 index 0000000..e35da96 --- /dev/null +++ b/m4/dirname.m4 @@ -0,0 +1,18 @@ +#serial 7 -*- autoconf -*- +dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_DIRNAME], +[ + AC_LIBOBJ([basename]) + AC_LIBOBJ([dirname]) + AC_LIBOBJ([stripslash]) + + dnl Prerequisites of lib/dirname.h. + AC_REQUIRE([gl_AC_DOS]) + AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) + + dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c. +]) diff --git a/m4/dmalloc.m4 b/m4/dmalloc.m4 new file mode 100644 index 0000000..f724670 --- /dev/null +++ b/m4/dmalloc.m4 @@ -0,0 +1,22 @@ +## ----------------------------------- ## +## Check if --with-dmalloc was given. ## +## From Franc,ois Pinard ## +## ----------------------------------- ## + +# serial 1 + +AC_DEFUN([AM_WITH_DMALLOC], +[AC_MSG_CHECKING([if malloc debugging is wanted]) +AC_ARG_WITH(dmalloc, +[ --with-dmalloc use dmalloc, as in + http://www.dmalloc.com/dmalloc.tar.gz], +[if test "$withval" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(WITH_DMALLOC,1, + [Define if using the dmalloc debugging malloc package]) + LIBS="$LIBS -ldmalloc" + LDFLAGS="$LDFLAGS -g" +else + AC_MSG_RESULT(no) +fi], [AC_MSG_RESULT(no)]) +]) diff --git a/m4/dos.m4 b/m4/dos.m4 new file mode 100644 index 0000000..dd59571 --- /dev/null +++ b/m4/dos.m4 @@ -0,0 +1,71 @@ +#serial 10 -*- autoconf -*- + +# Define some macros required for proper operation of code in lib/*.c +# on MSDOS/Windows systems. + +# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# From Jim Meyering. + +AC_DEFUN([gl_AC_DOS], + [ + AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos], + [ + AC_TRY_COMPILE([], + [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ +neither MSDOS nor Windows +#endif], + [ac_cv_win_or_dos=yes], + [ac_cv_win_or_dos=no]) + ]) + + if test x"$ac_cv_win_or_dos" = xyes; then + ac_fs_accepts_drive_letter_prefix=1 + ac_fs_backslash_is_file_name_separator=1 + AC_CACHE_CHECK([whether drive letter can start relative path], + [ac_cv_drive_letter_can_be_relative], + [ + AC_TRY_COMPILE([], + [#if defined __CYGWIN__ +drive letters are always absolute +#endif], + [ac_cv_drive_letter_can_be_relative=yes], + [ac_cv_drive_letter_can_be_relative=no]) + ]) + if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then + ac_fs_drive_letter_can_be_relative=1 + else + ac_fs_drive_letter_can_be_relative=0 + fi + else + ac_fs_accepts_drive_letter_prefix=0 + ac_fs_backslash_is_file_name_separator=0 + ac_fs_drive_letter_can_be_relative=0 + fi + + AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX], + $ac_fs_accepts_drive_letter_prefix, + [Define on systems for which file names may have a so-called + `drive letter' prefix, define this to compute the length of that + prefix, including the colon.]) + + AH_VERBATIM(ISSLASH, + [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#else +# define ISSLASH(C) ((C) == '/') +#endif]) + + AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR], + $ac_fs_backslash_is_file_name_separator, + [Define if the backslash character may also serve as a file name + component separator.]) + + AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE], + $ac_fs_drive_letter_can_be_relative, + [Define if a drive letter prefix denotes a relative path if it is + not followed by a file name component separator.]) + ]) diff --git a/m4/double-slash-root.m4 b/m4/double-slash-root.m4 new file mode 100644 index 0000000..23bf5b0 --- /dev/null +++ b/m4/double-slash-root.m4 @@ -0,0 +1,38 @@ +# double-slash-root.m4 serial 3 -*- Autoconf -*- +dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_DOUBLE_SLASH_ROOT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], + [ if test x"$cross_compiling" = xyes ; then + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # . + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac + else + set x `ls -di / // 2>/dev/null` + if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi + fi]) + if test "$gl_cv_double_slash_root" = yes; then + AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], 1, + [Define to 1 if // is a file system root distinct from /.]) + fi +]) diff --git a/m4/environ.m4 b/m4/environ.m4 new file mode 100644 index 0000000..fac0c05 --- /dev/null +++ b/m4/environ.m4 @@ -0,0 +1,36 @@ +# environ.m4 serial 1 +dnl Copyright (C) 2001-2004, 2006-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_ENVIRON], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl Persuade glibc to declare environ. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + gt_CHECK_VAR_DECL([#include ], environ) + if test $gt_cv_var_environ_declaration != yes; then + HAVE_DECL_ENVIRON=0 + fi +]) + +# Check if a variable is properly declared. +# gt_CHECK_VAR_DECL(includes,variable) +AC_DEFUN([gt_CHECK_VAR_DECL], +[ + define([gt_cv_var], [gt_cv_var_]$2[_declaration]) + AC_MSG_CHECKING([if $2 is properly declared]) + AC_CACHE_VAL(gt_cv_var, [ + AC_TRY_COMPILE([$1 + extern struct { int foo; } $2;], + [$2.foo = 1;], + gt_cv_var=no, + gt_cv_var=yes)]) + AC_MSG_RESULT($gt_cv_var) + if test $gt_cv_var = yes; then + AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_DECL], 1, + [Define if you have the declaration of $2.]) + fi + undefine([gt_cv_var]) +]) diff --git a/m4/errno_h.m4 b/m4/errno_h.m4 new file mode 100644 index 0000000..b5af078 --- /dev/null +++ b/m4/errno_h.m4 @@ -0,0 +1,113 @@ +# errno_h.m4 serial 1 +dnl Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_HEADER_ERRNO_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_HEADER_ERRNO_H_BODY]) +]) + +AC_DEFUN([gl_HEADER_ERRNO_H_BODY], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([for complete errno.h], gl_cv_header_errno_h_complete, [ + AC_EGREP_CPP(booboo,[ +#include +#if !defined ENOMSG +booboo +#endif +#if !defined EIDRM +booboo +#endif +#if !defined ENOLINK +booboo +#endif +#if !defined EPROTO +booboo +#endif +#if !defined EMULTIHOP +booboo +#endif +#if !defined EBADMSG +booboo +#endif +#if !defined EOVERFLOW +booboo +#endif +#if !defined ENOTSUP +booboo +#endif +#if !defined ECANCELED +booboo +#endif + ], + [gl_cv_header_errno_h_complete=no], + [gl_cv_header_errno_h_complete=yes]) + ]) + if test $gl_cv_header_errno_h_complete = yes; then + ERRNO_H='' + else + gl_CHECK_NEXT_HEADERS([errno.h]) + ERRNO_H='errno.h' + fi + AC_SUBST([ERRNO_H]) + gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) + gl_REPLACE_ERRNO_VALUE([ENOLINK]) + gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) +]) + +# Assuming $1 = EOVERFLOW. +# The EOVERFLOW errno value ought to be defined in , according to +# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and +# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. +# Check for the value of EOVERFLOW. +# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. +AC_DEFUN([gl_REPLACE_ERRNO_VALUE], +[ + if test -n "$ERRNO_H"; then + AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ + AC_EGREP_CPP(yes,[ +#include +#ifdef ]$1[ +yes +#endif + ], + [gl_cv_header_errno_h_]$1[=yes], + [gl_cv_header_errno_h_]$1[=no]) + if test $gl_cv_header_errno_h_]$1[ = no; then + AC_EGREP_CPP(yes,[ +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef ]$1[ +yes +#endif + ], [gl_cv_header_errno_h_]$1[=hidden]) + if test $gl_cv_header_errno_h_]$1[ = hidden; then + dnl The macro exists but is hidden. + dnl Define it to the same value. + AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [ +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +]) + fi + fi + ]) + case $gl_cv_header_errno_h_]$1[ in + yes | no) + ]$1[_HIDDEN=0; ]$1[_VALUE= + ;; + *) + ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1[" + ;; + esac + AC_SUBST($1[_HIDDEN]) + AC_SUBST($1[_VALUE]) + fi +]) diff --git a/m4/error.m4 b/m4/error.m4 new file mode 100644 index 0000000..7c7746e --- /dev/null +++ b/m4/error.m4 @@ -0,0 +1,22 @@ +#serial 11 + +# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_ERROR], +[ + AC_FUNC_ERROR_AT_LINE + dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). + gl_PREREQ_ERROR +]) + +# Prerequisites of lib/error.c. +AC_DEFUN([gl_PREREQ_ERROR], +[ + AC_REQUIRE([AC_FUNC_STRERROR_R]) + : +]) diff --git a/m4/exitfail.m4 b/m4/exitfail.m4 new file mode 100644 index 0000000..b7a691e --- /dev/null +++ b/m4/exitfail.m4 @@ -0,0 +1,13 @@ +# exitfail.m4 serial 6 +dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_EXITFAIL], +[ + AC_LIBOBJ([exitfail]) + + dnl No prerequisites of lib/exitfail.c. + : +]) diff --git a/m4/extensions.m4 b/m4/extensions.m4 new file mode 100644 index 0000000..917af94 --- /dev/null +++ b/m4/extensions.m4 @@ -0,0 +1,82 @@ +# serial 5 -*- Autoconf -*- +# Enable extensions on systems that normally disable them. + +# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS +# Autoconf. Perhaps we can remove this once we can assume Autoconf +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly +# enough in this area it's likely we'll need to redefine +# AC_USE_SYSTEM_EXTENSIONS for quite some time. + +# AC_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +# Remember that #undef in AH_VERBATIM gets replaced with #define by +# AC_DEFINE. The goal here is to define all known feature-enabling +# macros, then, if reports of conflicts are made, disable macros that +# cause problems on some platforms (such as __EXTENSIONS__). +AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl + + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) + if test "$MINIX" = yes; then + AC_DEFINE([_POSIX_SOURCE], [1], + [Define to 1 if you need to in order for `stat' and other + things to work.]) + AC_DEFINE([_POSIX_1_SOURCE], [2], + [Define to 2 if the system does not provide POSIX.1 features + except with this defined.]) + AC_DEFINE([_MINIX], [1], + [Define to 1 if on MINIX.]) + fi + + AH_VERBATIM([__EXTENSIONS__], +[/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +]) + AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], + [ac_cv_safe_to_define___extensions__], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +# define __EXTENSIONS__ 1 + ]AC_INCLUDES_DEFAULT])], + [ac_cv_safe_to_define___extensions__=yes], + [ac_cv_safe_to_define___extensions__=no])]) + test $ac_cv_safe_to_define___extensions__ = yes && + AC_DEFINE([__EXTENSIONS__]) + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) + AC_DEFINE([_TANDEM_SOURCE]) +])# AC_USE_SYSTEM_EXTENSIONS + +# gl_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) diff --git a/m4/getopt.m4 b/m4/getopt.m4 new file mode 100644 index 0000000..9b683c2 --- /dev/null +++ b/m4/getopt.m4 @@ -0,0 +1,83 @@ +# getopt.m4 serial 14 +dnl Copyright (C) 2002-2006, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# The getopt module assume you want GNU getopt, with getopt_long etc, +# rather than vanilla POSIX getopt. This means your code should +# always include for the getopt prototypes. + +AC_DEFUN([gl_GETOPT_SUBSTITUTE], +[ + AC_LIBOBJ([getopt]) + AC_LIBOBJ([getopt1]) + gl_GETOPT_SUBSTITUTE_HEADER + gl_PREREQ_GETOPT +]) + +AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], +[ + GETOPT_H=getopt.h + AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], + [Define to rpl_ if the getopt replacement functions and variables + should be used.]) + AC_SUBST([GETOPT_H]) +]) + +AC_DEFUN([gl_GETOPT_CHECK_HEADERS], +[ + if test -z "$GETOPT_H"; then + AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) + fi + + if test -z "$GETOPT_H"; then + AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) + fi + + dnl BSD getopt_long uses an incompatible method to reset option processing, + dnl and (as of 2004-10-15) mishandles optional option-arguments. + if test -z "$GETOPT_H"; then + AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include ]) + fi + + dnl Solaris 10 getopt doesn't handle `+' as a leading character in an + dnl option string (as of 2005-05-05). + if test -z "$GETOPT_H"; then + AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + char *myargv[3]; + myargv[0] = "conftest"; + myargv[1] = "-+"; + myargv[2] = 0; + return getopt (2, myargv, "+a") != '?'; + ]])], + [gl_cv_func_gnu_getopt=yes], + [gl_cv_func_gnu_getopt=no], + [dnl cross compiling - pessimistically guess based on decls + dnl Solaris 10 getopt doesn't handle `+' as a leading character in an + dnl option string (as of 2005-05-05). + AC_CHECK_DECL([getopt_clip], + [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], + [#include ])])]) + if test "$gl_cv_func_gnu_getopt" = "no"; then + GETOPT_H=getopt.h + fi + fi +]) + +AC_DEFUN([gl_GETOPT_IFELSE], +[ + AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) + AS_IF([test -n "$GETOPT_H"], [$1], [$2]) +]) + +AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])]) + +# Prerequisites of lib/getopt*. +AC_DEFUN([gl_PREREQ_GETOPT], +[ + AC_CHECK_DECLS_ONCE([getenv]) +]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 0000000..b4511ce --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,382 @@ +# gettext.m4 serial 60 (gettext-0.17) +dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2006. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define([gt_included_intl], + ifelse([$1], [external], + ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), + [yes])) + define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) + gt_NEEDS_INIT + AM_GNU_GETTEXT_NEED([$2]) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. + gt_INTL_MACOSX + + dnl Set USE_NLS. + AC_REQUIRE([AM_NLS]) + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl Add a version number to the cache macros. + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], + [AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], + [eval "$gt_func_gnugettext_libc=yes"], + [eval "$gt_func_gnugettext_libc=no"])]) + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + [$gt_func_gnugettext_libintl], + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *);], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [eval "$gt_func_gnugettext_libintl=yes"], + [eval "$gt_func_gnugettext_libintl=no"]) + dnl Now see whether libintl exists and depends on libiconv. + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *);], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + CATOBJEXT= + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Some extra flags are needed during linking. + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATOBJEXT) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLOBJS= + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST(INTLOBJS) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) +]) + + +dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. +m4_define([gt_NEEDS_INIT], +[ + m4_divert_text([DEFAULTS], [gt_needs=]) + m4_define([gt_NEEDS_INIT], []) +]) + + +dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) +AC_DEFUN([AM_GNU_GETTEXT_NEED], +[ + m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) + AC_DEFUN([gl_LOCK_EARLY], []) diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 new file mode 100644 index 0000000..c73db14 --- /dev/null +++ b/m4/gnulib-common.m4 @@ -0,0 +1,101 @@ +# gnulib-common.m4 serial 6 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# gl_COMMON +# is expanded unconditionally through gnulib-tool magic. +AC_DEFUN([gl_COMMON], [ + dnl Use AC_REQUIRE here, so that the code is expanded once only. + AC_REQUIRE([gl_COMMON_BODY]) +]) +AC_DEFUN([gl_COMMON_BODY], [ + AH_VERBATIM([isoc99_inline], +[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports + the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of + earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. + __APPLE__ && __MACH__ test for MacOS X. + __APPLE_CC__ tests for the Apple compiler and its version. + __STDC_VERSION__ tests for the C99 mode. */ +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ +# define __GNUC_STDC_INLINE__ 1 +#endif]) + AH_VERBATIM([unused_parameter], +[/* Define as a marker that can be attached to function parameter declarations + for parameters that are not used. This helps to reduce warnings, such as + from GCC -Wunused-parameter. */ +#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _UNUSED_PARAMETER_ __attribute__ ((__unused__)) +#else +# define _UNUSED_PARAMETER_ +#endif +]) +]) + +# gl_MODULE_INDICATOR([modulename]) +# defines a C macro indicating the presence of the given module. +AC_DEFUN([gl_MODULE_INDICATOR], +[ + AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], + [Define to 1 when using the gnulib module ]$1[.]) +]) + +# m4_foreach_w +# is a backport of autoconf-2.59c's m4_foreach_w. +# Remove this macro when we can assume autoconf >= 2.60. +m4_ifndef([m4_foreach_w], + [m4_define([m4_foreach_w], + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) + +# AC_PROG_MKDIR_P +# is a backport of autoconf-2.60's AC_PROG_MKDIR_P. +# Remove this macro when we can assume autoconf >= 2.60. +m4_ifdef([AC_PROG_MKDIR_P], [], [ + AC_DEFUN([AC_PROG_MKDIR_P], + [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + MKDIR_P='$(mkdir_p)' + AC_SUBST([MKDIR_P])])]) + +# AC_C_RESTRICT +# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, +# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ +# works. +# This definition can be removed once autoconf >= 2.62 can be assumed. +AC_DEFUN([AC_C_RESTRICT], +[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict, + [ac_cv_c_restrict=no + # The order here caters to the fact that C++ does not require restrict. + for ac_kw in __restrict __restrict__ _Restrict restrict; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + }]], + [[int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t)]])], + [ac_cv_c_restrict=$ac_kw]) + test "$ac_cv_c_restrict" != no && break + done + ]) + AH_VERBATIM([restrict], +[/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif]) + case $ac_cv_c_restrict in + restrict) ;; + no) AC_DEFINE([restrict], []) ;; + *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; + esac +]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 new file mode 100644 index 0000000..97ee635 --- /dev/null +++ b/m4/gnulib-comp.m4 @@ -0,0 +1,417 @@ +# -*- buffer-read-only: t -*- vi: set ro: +# DO NOT EDIT! GENERATED AUTOMATICALLY! +# DO NOT EDIT! GENERATED AUTOMATICALLY! +# Copyright (C) 2002-2008 Free Software Foundation, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# +# This file represents the compiled summary of the specification in +# gnulib-cache.m4. It lists the computed macro invocations that need +# to be invoked from configure.ac. +# In projects using CVS, this file can be treated like other built files. + + +# This macro should be invoked from ./configure.ac, in the section +# "Checks for programs", right after AC_PROG_CC, and certainly before +# any checks for libraries, header files, types and library functions. +AC_DEFUN([gl_EARLY], +[ + m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace + m4_pattern_allow([^gl_ES$])dnl a valid locale name + m4_pattern_allow([^gl_LIBOBJS$])dnl a variable + m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable + AC_REQUIRE([AC_PROG_RANLIB]) + AC_REQUIRE([AM_PROG_CC_C_O]) + AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) +]) + +# This macro should be invoked from ./configure.ac, in the section +# "Check for header files, types and library functions". +AC_DEFUN([gl_INIT], +[ + AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) + gl_cond_libtool=false + gl_libdeps= + gl_ltlibdeps= + m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) + m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) + m4_pushdef([gl_LIBSOURCES_LIST], []) + m4_pushdef([gl_LIBSOURCES_DIR], []) + gl_COMMON + gl_source_base='lib' + gl_ARGMATCH + gl_CONFIG_H + gl_DIRNAME + gl_DOUBLE_SLASH_ROOT + gl_ENVIRON + gl_UNISTD_MODULE_INDICATOR([environ]) + gl_HEADER_ERRNO_H + gl_ERROR + m4_ifdef([AM_XGETTEXT_OPTION], + [AM_XGETTEXT_OPTION([--flag=error:3:c-format]) + AM_XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) + gl_EXITFAIL + gl_FOPEN_SAFER + gl_MODULE_INDICATOR([fopen-safer]) + gl_GETOPT + dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. + AM_GNU_GETTEXT_VERSION([0.17]) + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) + # Autoconf 2.61a.99 and earlier don't support linking a file only + # in VPATH builds. But since GNUmakefile is for maintainer use + # only, it does not matter if we skip the link with older autoconf. + # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH + # builds, so use a shell variable to bypass this. + GNUmakefile=GNUmakefile + m4_if(m4_version_compare([2.61a.100], + m4_defn([m4_PACKAGE_VERSION])), [1], [], + [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [], + [GNUmakefile=$GNUmakefile])]) + gl_HASH + gl_INLINE + gl_INTTYPES_H + # You need to invoke gt_JAVACOMP yourself, possibly with arguments. + AC_CONFIG_FILES([javacomp.sh:build-aux/javacomp.sh.in]) + # You need to invoke gt_JAVAEXEC yourself, possibly with arguments. + AC_CONFIG_FILES([javaexec.sh:build-aux/javaexec.sh.in]) + gl_LOCALCHARSET + LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" + AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) + AC_FUNC_MALLOC + AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.]) + gl_FUNC_MALLOC_POSIX + gl_STDLIB_MODULE_INDICATOR([malloc-posix]) + gl_MBSWIDTH + AC_FUNC_OBSTACK + dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). + gl_QUOTE + gl_QUOTEARG + AM_STDBOOL_H + gl_STDINT_H + gl_STDLIB_H + gl_FUNC_STPCPY + gl_STRING_MODULE_INDICATOR([stpcpy]) + gl_FUNC_STRERROR + gl_STRING_MODULE_INDICATOR([strerror]) + gl_HEADER_STRING_H + gl_FUNC_STRNDUP + gl_STRING_MODULE_INDICATOR([strndup]) + gl_FUNC_STRNLEN + gl_STRING_MODULE_INDICATOR([strnlen]) + gl_FUNC_STRTOL + gl_FUNC_STRTOUL + gl_FUNC_STRVERSCMP + gl_STRING_MODULE_INDICATOR([strverscmp]) + gl_UNISTD_H + gl_UNISTD_SAFER + gl_FUNC_GLIBC_UNLOCKED_IO + gl_FUNC_UNSETENV + gl_STDLIB_MODULE_INDICATOR([unsetenv]) + AC_SUBST([WARN_CFLAGS]) + gl_WCHAR_H + gl_WCTYPE_H + gl_FUNC_WCWIDTH + gl_WCHAR_MODULE_INDICATOR([wcwidth]) + gl_XALLOC + gl_XSTRNDUP + m4_ifval(gl_LIBSOURCES_LIST, [ + m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || + for gl_file in ]gl_LIBSOURCES_LIST[ ; do + if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then + echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2 + exit 1 + fi + done])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) + ]) + m4_popdef([gl_LIBSOURCES_DIR]) + m4_popdef([gl_LIBSOURCES_LIST]) + m4_popdef([AC_LIBSOURCES]) + m4_popdef([AC_REPLACE_FUNCS]) + m4_popdef([AC_LIBOBJ]) + AC_CONFIG_COMMANDS_PRE([ + gl_libobjs= + gl_ltlibobjs= + if test -n "$gl_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + gl_libobjs="$gl_libobjs $i.$ac_objext" + gl_ltlibobjs="$gl_ltlibobjs $i.lo" + done + fi + AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) + AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) + ]) + gltests_libdeps= + gltests_ltlibdeps= + m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) + m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) + m4_pushdef([gltests_LIBSOURCES_LIST], []) + m4_pushdef([gltests_LIBSOURCES_DIR], []) + gl_COMMON + gl_source_base='tests' + m4_ifval(gltests_LIBSOURCES_LIST, [ + m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || + for gl_file in ]gltests_LIBSOURCES_LIST[ ; do + if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then + echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2 + exit 1 + fi + done])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) + ]) + m4_popdef([gltests_LIBSOURCES_DIR]) + m4_popdef([gltests_LIBSOURCES_LIST]) + m4_popdef([AC_LIBSOURCES]) + m4_popdef([AC_REPLACE_FUNCS]) + m4_popdef([AC_LIBOBJ]) + AC_CONFIG_COMMANDS_PRE([ + gltests_libobjs= + gltests_ltlibobjs= + if test -n "$gltests_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + gltests_libobjs="$gltests_libobjs $i.$ac_objext" + gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" + done + fi + AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) + AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) + ]) + LIBBISON_LIBDEPS="$gl_libdeps" + AC_SUBST([LIBBISON_LIBDEPS]) + LIBBISON_LTLIBDEPS="$gl_ltlibdeps" + AC_SUBST([LIBBISON_LTLIBDEPS]) +]) + +# Like AC_LIBOBJ, except that the module name goes +# into gl_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gl_LIBOBJ], [ + AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl + gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" +]) + +# Like AC_REPLACE_FUNCS, except that the module name goes +# into gl_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gl_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) +]) + +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parameterization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([gl_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_define([gl_LIBSOURCES_DIR], [lib]) + m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ]) + ]) + ]) +]) + +# Like AC_LIBOBJ, except that the module name goes +# into gltests_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gltests_LIBOBJ], [ + AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl + gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" +]) + +# Like AC_REPLACE_FUNCS, except that the module name goes +# into gltests_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gltests_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)]) +]) + +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parameterization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([gltests_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_define([gltests_LIBSOURCES_DIR], [tests]) + m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ]) + ]) + ]) +]) + +# This macro records the list of files which have been installed by +# gnulib-tool and may be removed by future gnulib-tool invocations. +AC_DEFUN([gl_FILE_LIST], [ + build-aux/announce-gen + build-aux/config.rpath + build-aux/git-version-gen + build-aux/javacomp.sh.in + build-aux/javaexec.sh.in + build-aux/link-warning.h + lib/argmatch.c + lib/argmatch.h + lib/basename.c + lib/c-ctype.c + lib/c-ctype.h + lib/c-strcase.h + lib/c-strcasecmp.c + lib/c-strncasecmp.c + lib/config.charset + lib/dirname.c + lib/dirname.h + lib/dup-safer.c + lib/errno.in.h + lib/error.c + lib/error.h + lib/exitfail.c + lib/exitfail.h + lib/fd-safer.c + lib/fopen-safer.c + lib/getopt.c + lib/getopt.in.h + lib/getopt1.c + lib/getopt_int.h + lib/gettext.h + lib/hash.c + lib/hash.h + lib/intprops.h + lib/inttypes.in.h + lib/localcharset.c + lib/localcharset.h + lib/malloc.c + lib/mbswidth.c + lib/mbswidth.h + lib/obstack.c + lib/obstack.h + lib/pipe-safer.c + lib/quote.c + lib/quote.h + lib/quotearg.c + lib/quotearg.h + lib/ref-add.sin + lib/ref-del.sin + lib/stdbool.in.h + lib/stdint.in.h + lib/stdio--.h + lib/stdio-safer.h + lib/stdlib.in.h + lib/stpcpy.c + lib/streq.h + lib/strerror.c + lib/string.in.h + lib/stripslash.c + lib/strndup.c + lib/strnlen.c + lib/strtol.c + lib/strtoul.c + lib/strverscmp.c + lib/unistd--.h + lib/unistd-safer.h + lib/unistd.in.h + lib/unitypes.h + lib/uniwidth.h + lib/uniwidth/cjk.h + lib/uniwidth/width.c + lib/unlocked-io.h + lib/unsetenv.c + lib/verify.h + lib/wchar.in.h + lib/wctype.in.h + lib/wcwidth.c + lib/xalloc-die.c + lib/xalloc.h + lib/xmalloc.c + lib/xstrndup.c + lib/xstrndup.h + m4/argmatch.m4 + m4/codeset.m4 + m4/config-h.m4 + m4/dirname.m4 + m4/dos.m4 + m4/double-slash-root.m4 + m4/environ.m4 + m4/errno_h.m4 + m4/error.m4 + m4/exitfail.m4 + m4/extensions.m4 + m4/getopt.m4 + m4/gettext.m4 + m4/glibc2.m4 + m4/glibc21.m4 + m4/gnulib-common.m4 + m4/hash.m4 + m4/iconv.m4 + m4/include_next.m4 + m4/inline.m4 + m4/intdiv0.m4 + m4/intl.m4 + m4/intldir.m4 + m4/intlmacosx.m4 + m4/intmax.m4 + m4/inttypes-pri.m4 + m4/inttypes.m4 + m4/inttypes_h.m4 + m4/javacomp.m4 + m4/javaexec.m4 + m4/lcmessage.m4 + m4/lib-ld.m4 + m4/lib-link.m4 + m4/lib-prefix.m4 + m4/localcharset.m4 + m4/lock.m4 + m4/longlong.m4 + m4/malloc.m4 + m4/mbrtowc.m4 + m4/mbstate_t.m4 + m4/mbswidth.m4 + m4/nls.m4 + m4/po.m4 + m4/printf-posix.m4 + m4/progtest.m4 + m4/quote.m4 + m4/quotearg.m4 + m4/setenv.m4 + m4/size_max.m4 + m4/stdbool.m4 + m4/stdint.m4 + m4/stdint_h.m4 + m4/stdio-safer.m4 + m4/stdlib_h.m4 + m4/stpcpy.m4 + m4/strerror.m4 + m4/string_h.m4 + m4/strndup.m4 + m4/strnlen.m4 + m4/strtol.m4 + m4/strtoul.m4 + m4/strverscmp.m4 + m4/threadlib.m4 + m4/uintmax_t.m4 + m4/unistd-safer.m4 + m4/unistd_h.m4 + m4/unlocked-io.m4 + m4/visibility.m4 + m4/warnings.m4 + m4/wchar.m4 + m4/wchar_t.m4 + m4/wctype.m4 + m4/wcwidth.m4 + m4/wint_t.m4 + m4/xalloc.m4 + m4/xsize.m4 + m4/xstrndup.m4 + top/GNUmakefile +]) diff --git a/m4/hash.m4 b/m4/hash.m4 new file mode 100644 index 0000000..1b1873c --- /dev/null +++ b/m4/hash.m4 @@ -0,0 +1,13 @@ +# hash.m4 serial 6 +dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_HASH], +[ + AC_LIBOBJ([hash]) + + dnl Prerequisites of lib/hash.c. + AC_REQUIRE([AM_STDBOOL_H]) +]) diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 0000000..66bc76f --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,180 @@ +# iconv.m4 serial AM6 (gettext-0.17) +dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [ + dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + AC_TRY_RUN([ +#include +#include +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) diff --git a/m4/include_next.m4 b/m4/include_next.m4 new file mode 100644 index 0000000..062753c --- /dev/null +++ b/m4/include_next.m4 @@ -0,0 +1,170 @@ +# include_next.m4 serial 10 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert and Derek Price. + +dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER. +dnl +dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to +dnl 'include' otherwise. +dnl +dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler +dnl supports it in the special case that it is the first include directive in +dnl the given file, or to 'include' otherwise. +dnl +dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next, +dnl so as to avoid GCC warnings when the gcc option -pedantic is used. +dnl '#pragma GCC system_header' has the same effect as if the file was found +dnl through the include search path specified with '-isystem' options (as +dnl opposed to the search path specified with '-I' options). Namely, gcc +dnl does not warn about some things, and on some systems (Solaris and Interix) +dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side +dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead +dnl of plain '__STDC__'. + +AC_DEFUN([gl_INCLUDE_NEXT], +[ + AC_LANG_PREPROC_REQUIRE() + AC_CACHE_CHECK([whether the preprocessor supports include_next], + [gl_cv_have_include_next], + [rm -rf conftestd1a conftestd1b conftestd2 + mkdir conftestd1a conftestd1b conftestd2 + dnl The include of is because IBM C 9.0 on AIX 6.1 supports + dnl include_next when used as first preprocessor directive in a file, + dnl but not when preceded by another include directive. Additionally, + dnl with this same compiler, include_next is a no-op when used in a + dnl header file that was included by specifying its absolute file name. + dnl Despite these two bugs, include_next is used in the compiler's + dnl . By virtue of the second bug, we need to use include_next + dnl as well in this case. + cat < conftestd1a/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd1b/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd2/conftest.h +#ifndef DEFINED_IN_CONFTESTD1 +#error "include_next test doesn't work" +#endif +#define DEFINED_IN_CONFTESTD2 +EOF + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" + AC_COMPILE_IFELSE([#include ], + [gl_cv_have_include_next=yes], + [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" + AC_COMPILE_IFELSE([#include ], + [gl_cv_have_include_next=buggy], + [gl_cv_have_include_next=no]) + ]) + CPPFLAGS="$gl_save_CPPFLAGS" + rm -rf conftestd1a conftestd1b conftestd2 + ]) + PRAGMA_SYSTEM_HEADER= + if test $gl_cv_have_include_next = yes; then + INCLUDE_NEXT=include_next + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + if test -n "$GCC"; then + PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' + fi + else + if test $gl_cv_have_include_next = buggy; then + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + else + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include + fi + fi + AC_SUBST([INCLUDE_NEXT]) + AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) + AC_SUBST([PRAGMA_SYSTEM_HEADER]) +]) + +# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) +# ------------------------------------------ +# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be +# ''; otherwise define it to be +# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. +# That way, a header file with the following line: +# #@INCLUDE_NEXT@ @NEXT_FOO_H@ +# behaves (after sed substitution) as if it contained +# #include_next +# even if the compiler does not support include_next. +# The three "///" are to pacify Sun C 5.8, which otherwise would say +# "warning: #include of /usr/include/... may be non-portable". +# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. +# Note: This macro assumes that the header file is not empty after +# preprocessing, i.e. it does not only define preprocessor macros but also +# provides some type/enum definitions or function/variable declarations. +AC_DEFUN([gl_CHECK_NEXT_HEADERS], +[ + AC_REQUIRE([gl_INCLUDE_NEXT]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_HEADERS_ONCE([$1]) + + m4_foreach_w([gl_HEADER_NAME], [$1], + [AS_VAR_PUSHDEF([gl_next_header], + [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME]))) + if test $gl_cv_have_include_next = yes; then + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + else + AC_CACHE_CHECK( + [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>], + m4_quote(m4_defn([gl_next_header])), + [AS_VAR_PUSHDEF([gl_header_exists], + [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME]))) + if test AS_VAR_GET(gl_header_exists) = yes; then + AC_LANG_CONFTEST( + [AC_LANG_SOURCE( + [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] + )]) + dnl AIX "xlc -E" and "cc -E" omit #line directives for header files + dnl that contain only a #include of other header files and no + dnl non-comment tokens of their own. This leads to a failure to + dnl detect the absolute name of , , + dnl and others. The workaround is to force preservation of comments + dnl through option -C. This ensures all necessary #line directives + dnl are present. GCC supports option -C as well. + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + dnl eval is necessary to expand gl_absname_cpp. + dnl Ultrix and Pyramid sh refuse to redirect output of eval, + dnl so use subshell. + AS_VAR_SET([gl_next_header], + ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{ + s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"']) + else + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + fi + AS_VAR_POPDEF([gl_header_exists])]) + fi + AC_SUBST( + AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))), + [AS_VAR_GET([gl_next_header])]) + AS_VAR_POPDEF([gl_next_header])]) +]) diff --git a/m4/inline.m4 b/m4/inline.m4 new file mode 100644 index 0000000..a07076c --- /dev/null +++ b/m4/inline.m4 @@ -0,0 +1,40 @@ +# inline.m4 serial 3 +dnl Copyright (C) 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Test for the 'inline' keyword or equivalent. +dnl Define 'inline' to a supported equivalent, or to nothing if not supported, +dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an +dnl equivalent is effectively supported, i.e. if the compiler is likely to +dnl drop unused 'static inline' functions. +AC_DEFUN([gl_INLINE], +[ + AC_REQUIRE([AC_C_INLINE]) + AC_CACHE_CHECK([whether the compiler generally respects inline], + [gl_cv_c_inline_effective], + [if test $ac_cv_c_inline = no; then + gl_cv_c_inline_effective=no + else + dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is + dnl specified. + dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result + dnl depends on optimization flags, which can be in CFLAGS. + dnl (AC_EGREP_CPP looks only at the CPPFLAGS.) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], + [[#ifdef __NO_INLINE__ + #error "inline is not effective" + #endif]])], + [gl_cv_c_inline_effective=yes], + [gl_cv_c_inline_effective=no]) + fi + ]) + if test $gl_cv_c_inline_effective = yes; then + AC_DEFINE([HAVE_INLINE], 1, + [Define to 1 if the compiler supports one of the keywords + 'inline', '__inline__', '__inline' and effectively inlines + functions marked as such.]) + fi +]) diff --git a/m4/intlmacosx.m4 b/m4/intlmacosx.m4 new file mode 100644 index 0000000..d3f0d90 --- /dev/null +++ b/m4/intlmacosx.m4 @@ -0,0 +1,51 @@ +# intlmacosx.m4 serial 1 (gettext-0.17) +dnl Copyright (C) 2004-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Checks for special options needed on MacOS X. +dnl Defines INTL_MACOSX_LIBS. +AC_DEFUN([gt_INTL_MACOSX], +[ + dnl Check for API introduced in MacOS X 10.2. + AC_CACHE_CHECK([for CFPreferencesCopyAppValue], + gt_cv_func_CFPreferencesCopyAppValue, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include ], + [CFPreferencesCopyAppValue(NULL, NULL)], + [gt_cv_func_CFPreferencesCopyAppValue=yes], + [gt_cv_func_CFPreferencesCopyAppValue=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, + [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) + fi + dnl Check for API introduced in MacOS X 10.3. + AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include ], [CFLocaleCopyCurrent();], + [gt_cv_func_CFLocaleCopyCurrent=yes], + [gt_cv_func_CFLocaleCopyCurrent=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, + [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + AC_SUBST([INTL_MACOSX_LIBS]) +]) diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4 new file mode 100644 index 0000000..7c7f894 --- /dev/null +++ b/m4/inttypes-pri.m4 @@ -0,0 +1,36 @@ +# inttypes-pri.m4 serial 4 (gettext-0.16) +dnl Copyright (C) 1997-2002, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_PREREQ(2.52) + +# Define PRI_MACROS_BROKEN if exists and defines the PRI* +# macros to non-string values. This is the case on AIX 4.3.3. + +AC_DEFUN([gt_INTTYPES_PRI], +[ + AC_CHECK_HEADERS([inttypes.h]) + if test $ac_cv_header_inttypes_h = yes; then + AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], + gt_cv_inttypes_pri_broken, + [ + AC_TRY_COMPILE([#include +#ifdef PRId32 +char *p = PRId32; +#endif +], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) + ]) + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, + [Define if exists and defines unusable PRI* macros.]) + PRI_MACROS_BROKEN=1 + else + PRI_MACROS_BROKEN=0 + fi + AC_SUBST([PRI_MACROS_BROKEN]) +]) diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 new file mode 100644 index 0000000..d84cead --- /dev/null +++ b/m4/inttypes.m4 @@ -0,0 +1,295 @@ +# inttypes.m4 serial 12 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Derek Price, Bruno Haible. +dnl Test whether is supported or must be substituted. + +AC_DEFUN([gl_INTTYPES_H], +[ + AC_REQUIRE([gl_STDINT_H]) + AC_REQUIRE([gt_INTTYPES_PRI]) + AC_CHECK_DECLS_ONCE([imaxabs]) + AC_CHECK_DECLS_ONCE([imaxdiv]) + AC_CHECK_DECLS_ONCE([strtoimax]) + AC_CHECK_DECLS_ONCE([strtoumax]) + + dnl Now see if we need a substitute . + dnl A complete requires + dnl - a complete , + dnl - the existence of an , + dnl - that imaxabs, imaxdiv, strtoimax, strtoumax are declared, + dnl - some additional tests. + AC_CACHE_CHECK([whether inttypes.h conforms to C99], + [gl_cv_header_working_inttypes_h], + [gl_cv_header_working_inttypes_h=no + if test "$gl_cv_header_working_stdint_h" = yes \ + && test $ac_cv_header_inttypes_h = yes \ + && test "$ac_cv_have_decl_imaxabs" = yes \ + && test "$ac_cv_have_decl_imaxdiv" = yes \ + && test "$ac_cv_have_decl_strtoimax" = yes \ + && test "$ac_cv_have_decl_strtoumax" = yes; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */ +#include + +/* No need to duplicate the tests of stdint.m4; they are subsumed by + $gl_cv_header_working_stdint_h = yes. */ + +/* Tests for macros supposed to be defined in inttypes.h. */ + +const char *k = /* implicit string concatenation */ +#ifdef INT8_MAX + PRId8 PRIi8 +#endif +#ifdef UINT8_MAX + PRIo8 PRIu8 PRIx8 PRIX8 +#endif +#ifdef INT16_MAX + PRId16 PRIi16 +#endif +#ifdef UINT16_MAX + PRIo16 PRIu16 PRIx16 PRIX16 +#endif +#ifdef INT32_MAX + PRId32 PRIi32 +#endif +#ifdef UINT32_MAX + PRIo32 PRIu32 PRIx32 PRIX32 +#endif +#ifdef INT64_MAX + PRId64 PRIi64 +#endif +#ifdef UINT64_MAX + PRIo64 PRIu64 PRIx64 PRIX64 +#endif + PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8 + PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16 + PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32 + PRIdLEAST64 PRIiLEAST64 + PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64 + PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8 + PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16 + PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32 + PRIdFAST64 PRIiFAST64 + PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64 + PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX +#ifdef INTPTR_MAX + PRIdPTR PRIiPTR +#endif +#ifdef UINTPTR_MAX + PRIoPTR PRIuPTR PRIxPTR PRIXPTR +#endif + ; +const char *l = /* implicit string concatenation */ +#ifdef INT8_MAX + SCNd8 SCNi8 +#endif +#ifdef UINT8_MAX + SCNo8 SCNu8 SCNx8 +#endif +#ifdef INT16_MAX + SCNd16 SCNi16 +#endif +#ifdef UINT16_MAX + SCNo16 SCNu16 SCNx16 +#endif +#ifdef INT32_MAX + SCNd32 SCNi32 +#endif +#ifdef UINT32_MAX + SCNo32 SCNu32 SCNx32 +#endif +#ifdef INT64_MAX + SCNd64 SCNi64 +#endif +#ifdef UINT64_MAX + SCNo64 SCNu64 SCNx64 +#endif + SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8 + SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16 + SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32 + SCNdLEAST64 SCNiLEAST64 + SCNoLEAST64 SCNuLEAST64 SCNxLEAST64 + SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8 + SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16 + SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32 + SCNdFAST64 SCNiFAST64 + SCNoFAST64 SCNuFAST64 SCNxFAST64 + SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX +#ifdef INTPTR_MAX + SCNdPTR SCNiPTR +#endif +#ifdef UINTPTR_MAX + SCNoPTR SCNuPTR SCNxPTR +#endif + ; + ]])], + [gl_cv_header_working_inttypes_h=yes]) + fi]) + + dnl Override always, so that the portability warnings work. + if false && test $gl_cv_header_working_inttypes_h = yes; then + dnl Use the existing . + INTTYPES_H='' + else + + AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([inttypes.h]) + + dnl Ensure that defines the limit macros, since gnulib's + dnl relies on them. This macro is only needed when a + dnl C++ compiler is in use; it has no effect for a C compiler. + dnl Also be careful to define __STDC_LIMIT_MACROS only when gnulib's + dnl is going to be created, and to avoid redefinition warnings + dnl if the __STDC_LIMIT_MACROS is already defined through the CPPFLAGS. + AC_DEFINE([GL_TRIGGER_STDC_LIMIT_MACROS], 1, + [Define to make the limit macros in visible.]) + AH_VERBATIM([__STDC_LIMIT_MACROS_ZZZ], +[/* Ensure that defines the limit macros, since gnulib's + relies on them. */ +#if defined __cplusplus && !defined __STDC_LIMIT_MACROS && GL_TRIGGER_STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS 1 +#endif +]) + + PRIPTR_PREFIX= + if test -n "$STDINT_H"; then + dnl Using the gnulib . It always defines intptr_t to 'long'. + PRIPTR_PREFIX='"l"' + else + dnl Using the system's . + for glpfx in '' l ll I64; do + case $glpfx in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + I64) gltype1='__int64';; + esac + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include + extern intptr_t foo; + extern $gltype1 foo;]])], + [PRIPTR_PREFIX='"'$glpfx'"']) + test -n "$PRIPTR_PREFIX" && break + done + fi + AC_SUBST([PRIPTR_PREFIX]) + + if test "$ac_cv_have_decl_imaxabs" = yes; then + HAVE_DECL_IMAXABS=1 + else + HAVE_DECL_IMAXABS=0 + fi + + if test "$ac_cv_have_decl_imaxdiv" = yes; then + HAVE_DECL_IMAXDIV=1 + else + HAVE_DECL_IMAXDIV=0 + fi + + if test "$ac_cv_have_decl_strtoimax" = yes; then + HAVE_DECL_STRTOIMAX=1 + else + HAVE_DECL_STRTOIMAX=0 + fi + + if test "$ac_cv_have_decl_strtoumax" = yes; then + HAVE_DECL_STRTOUMAX=1 + else + HAVE_DECL_STRTOUMAX=0 + fi + + gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( + [INT32_MAX_LT_INTMAX_MAX], + [defined INT32_MAX && defined INTMAX_MAX], + [INT32_MAX < INTMAX_MAX], + [sizeof (int) < sizeof (long long int)]) + gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( + [INT64_MAX_EQ_LONG_MAX], + [defined INT64_MAX], + [INT64_MAX == LONG_MAX], + [sizeof (long long int) == sizeof (long int)]) + gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( + [UINT32_MAX_LT_UINTMAX_MAX], + [defined UINT32_MAX && defined UINTMAX_MAX], + [UINT32_MAX < UINTMAX_MAX], + [sizeof (unsigned int) < sizeof (unsigned long long int)]) + gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( + [UINT64_MAX_EQ_ULONG_MAX], + [defined UINT64_MAX], + [UINT64_MAX == ULONG_MAX], + [sizeof (unsigned long long int) == sizeof (unsigned long int)]) + + INTTYPES_H='inttypes.h' + fi + AC_SUBST(INTTYPES_H) +]) + +# Define the symbol $1 to be 1 if the condition is true, 0 otherwise. +# If $2 is true, the condition is $3; otherwise if long long int is supported +# approximate the condition with $4; otherwise, assume the condition is false. +# The condition should work on all C99 platforms; the approximations should be +# good enough to work on all practical pre-C99 platforms. +# $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants. +AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION], +[ + AC_CACHE_CHECK([whether $3], + [gl_cv_test_$1], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if $2 + #define CONDITION ($3) + #elif HAVE_LONG_LONG_INT + #define CONDITION ($4) + #else + #define CONDITION 0 + #endif + int test[CONDITION ? 1 : -1];]])], + [gl_cv_test_$1=yes], + [gl_cv_test_$1=no])]) + if test $gl_cv_test_$1 = yes; then + $1=1; + else + $1=0; + fi + AC_SUBST([$1]) +]) + +AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_INTTYPES_H_DEFAULTS], +[ + GNULIB_IMAXABS=0; AC_SUBST([GNULIB_IMAXABS]) + GNULIB_IMAXDIV=0; AC_SUBST([GNULIB_IMAXDIV]) + GNULIB_STRTOIMAX=0; AC_SUBST([GNULIB_STRTOIMAX]) + GNULIB_STRTOUMAX=0; AC_SUBST([GNULIB_STRTOUMAX]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS]) + HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) + HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) + HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) +]) diff --git a/m4/javacomp.m4 b/m4/javacomp.m4 new file mode 100644 index 0000000..7e3e64a --- /dev/null +++ b/m4/javacomp.m4 @@ -0,0 +1,636 @@ +# javacomp.m4 serial 10 +dnl Copyright (C) 2001-2003, 2006-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Prerequisites of javacomp.sh. +# gt_JAVACOMP([source-version], [target-version]) +# Sets HAVE_JAVACOMP to nonempty if javacomp.sh will allow Java source code +# according to source-version to be compiled to Java bytecode classes in the +# target-version format. +# +# source-version can be: support for +# 1.3 inner classes +# 1.4 assert keyword +# 1.5 generic classes and methods +# 1.6 (not yet supported) +# +# target-version can be: classfile version: +# 1.1 45.3 +# 1.2 46.0 +# 1.3 47.0 +# 1.4 48.0 +# 1.5 49.0 +# 1.6 50.0 +# The classfile version of a .class file can be determined through the "file" +# command. More portably, the classfile major version can be determined through +# "od -A n -t d1 -j 7 -N 1 classfile". +# target-version can also be omitted. In this case, the required target-version +# is determined from the found JVM (see macro gt_JAVAEXEC): +# target-version for JVM +# 1.1 JDK 1.1, jview +# 1.2 JDK/JRE 1.2 +# 1.3 JDK/JRE 1.3, gij 3.3, 3.4 +# 1.4 JDK/JRE 1.4, gij 4.0, 4.1 +# 1.5 JDK/JRE 1.5 +# 1.6 JDK/JRE 1.6 +# Note: gij >= 3.3 can in some cases handle classes compiled with -target 1.4, +# and gij >= 4.1 can in some cases partially handle classes compiled with +# -target 1.5, but I have no idea how complete this support is. +# +# Specifying target-version is useful when building a library (.jar) that is +# useful outside the given package. Omitting target-version is useful when +# building an application. +# +# It is unreasonable to ask for: +# - target-version < 1.4 with source-version >= 1.4, or +# - target-version < 1.5 with source-version >= 1.5, or +# - target-version < 1.6 with source-version >= 1.6, +# because even Sun's javac doesn't support these combinations. +# +# It is redundant to ask for a target-version > source-version, since the +# smaller target-version = source-version will also always work and newer JVMs +# support the older target-versions too. Except for the case +# target-version = 1.4, source-version = 1.3, which allows gcj versions 3.0 +# to 3.2 to be used. + +AC_DEFUN([gt_JAVACOMP], +[ + ifelse([$2], [], [AC_REQUIRE([gt_JAVAEXEC])], []) + AC_EGREP_CPP(yes, [ +#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + yes +#endif +], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':') + source_version=$1 + test -n "$source_version" || { + AC_MSG_ERROR([missing source-version argument to gt_@&t@JAVACOMP]) + } + ifelse([$2], [], + [if test -n "$HAVE_JAVAEXEC"; then + dnl Use $CONF_JAVA to determine the JVM's version. +changequote(,)dnl + cat > conftestver.java <?@ABCDEFGIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzH' '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\046\050\051\052\056\057\073\074\076\103\106\114\116\117\120\123\124\126\133\141\142\143\144\145\146\147\151\152\154\155\156\157\160\162\163\164\165\166\171\261\262\266\267\270\272\276\312\376\055' \ + > conftestver.class + target_version=`{ + unset JAVA_HOME + echo "$as_me:__oline__: CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver" >&AS_MESSAGE_LOG_FD + CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver 2>&AS_MESSAGE_LOG_FD + }` + case "$target_version" in + 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6) ;; + null) + dnl JDK 1.1.X returns null. + target_version=1.1 ;; + *) AC_MSG_WARN([unknown target-version $target_version, please update gt_@&t@JAVACOMP macro]) + target_version=1.1 ;; + esac + else + target_version="1.1" + fi + ], + [target_version=$2]) + case "$source_version" in + 1.3) goodcode='class conftest {}' + failcode='class conftestfail { static { assert(true); } }' ;; + 1.4) goodcode='class conftest { static { assert(true); } }' + failcode='class conftestfail { T foo() { return null; } }' ;; + 1.5) goodcode='class conftest { T foo() { return null; } }' + failcode='class conftestfail syntax error' ;; + *) AC_MSG_ERROR([invalid source-version argument to gt_@&t@JAVACOMP: $source_version]) ;; + esac + case "$target_version" in + 1.1) cfversion=45 ;; + 1.2) cfversion=46 ;; + 1.3) cfversion=47 ;; + 1.4) cfversion=48 ;; + 1.5) cfversion=49 ;; + 1.6) cfversion=50 ;; + *) AC_MSG_ERROR([invalid target-version argument to gt_@&t@JAVACOMP: $target_version]) ;; + esac + # Function to output the classfile version of a file (8th byte) in decimal. + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_classfile_version () + { + od -A n -t d1 -j 7 -N 1 "[$]1" + } + else + # Use BSD hexdump. + func_classfile_version () + { + dd if="[$]1" bs=1 count=1 skip=7 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi + AC_MSG_CHECKING([for Java compiler]) + dnl + dnl The support of GNU gcj for target-version and source-version: + dnl + dnl gcj 3.0.4 to 4.2 does not have a way to specify the target-version. + dnl It always assumes target-version=1.4 but labels the class files as 1.1. + dnl One consequence of this is that gcj compiles GetURL.java to invalid + dnl bytecode, which crashes with a VerifyError when executed by Sun Java + dnl 1.3.1. The bug is registered as java/7066, see + dnl http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7066 + dnl gcj 4.3 and newer has an option -ftarget=1.X. + dnl + dnl For gcj < 3.3, the source-version always is 1.3. + dnl For 3.3 <= gcj < 4.3, the source-version defaults to 1.4; option + dnl "-fno-assert" switches to source-version 1.3. + dnl gcj >= 4.3 has an option -fsource=1.X. + dnl + dnl The support of Sun javac for target-version and source-version: + dnl + dnl javac 1.3: -target 1.1 1.2 1.3 default: 1.1 + dnl source always: 1.3 + dnl + dnl javac 1.4: -target 1.1 1.2 1.3 1.4 default: 1.2 + dnl -source 1.3 1.4 default: 1.3 + dnl -target 1.1/1.2/1.3 only possible with -source 1.3 or no -source + dnl + dnl javac 1.5: -target 1.1 1.2 1.3 1.4 1.5 default: 1.5 + dnl -source 1.3 1.4 1.5 default: 1.5 + dnl -target 1.1/1.2/1.3 only possible with -source 1.3 + dnl -target 1.4 only possible with -source 1.3/1.4 + dnl + dnl javac 1.6: -target 1.1 1.2 1.3 1.4 1.5 1.6 default: 1.6 + dnl -source 1.3 1.4 1.5 1.6 default: 1.5 + dnl -target 1.1/1.2/1.3 only possible with -source 1.3 + dnl -target 1.4 only possible with -source 1.3/1.4 + dnl -target 1.5 only possible with -source 1.3/1.4/1.5 or no -source + dnl + dnl The support of jikes for target-version and source-version: + dnl + dnl jikes 1.14 does not have a way to specify the target-version. It + dnl always assumes target-version=1.1. + dnl + dnl For jikes 1.14, the source-version always is 1.3. + dnl + CONF_JAVAC= + HAVE_JAVAC_ENVVAR= + HAVE_GCJ_C= + HAVE_JAVAC= + HAVE_JIKES= + HAVE_JAVACOMP= +changequote(,)dnl + cat > conftestlib.java < conftest.java + echo "$failcode" > conftestfail.java + dnl If the user has set the JAVAC environment variable, use that, if it + dnl satisfies the constraints (possibly after adding -target and -source + dnl options). + if test -n "$JAVAC"; then + dnl Try the original $JAVAC. + if $JAVAC --version 2>/dev/null | sed -e 1q | grep gcj > /dev/null; then + dnl It's a version of gcj. +changequote(,)dnl + if $JAVAC --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null; then +changequote([,])dnl + dnl It's a version of gcj >= 4.3. Assume the classfile versions are correct. + dnl Try $JAVAC. + rm -f conftest.class + if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + dnl Try adding -fsource option if it is useful. + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:__oline__: $JAVAC -fsource=$source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -fsource="$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \ + && { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:__oline__: $JAVAC -fsource=$source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + $JAVAC -fsource="$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + }; then + CONF_JAVAC="$JAVAC -fsource=$source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="$JAVAC" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + dnl Try with -fsource and -ftarget options. + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:__oline__: $JAVAC -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -fsource="$source_version" -ftarget="$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + CONF_JAVAC="$JAVAC -fsource=$source_version -ftarget=$target_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + fi + else + dnl It's a version of gcj < 4.3. Ignore the version of conftest.class. + if test "$target_version" = 1.4 && test "$source_version" = 1.4; then + dnl Try $JAVAC. + rm -f conftest.class + if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class; then + CONF_JAVAC="$JAVAC" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + if test "$target_version" = 1.4 && test "$source_version" = 1.3; then + dnl Try $JAVAC and "$JAVAC -fno-assert". But add -fno-assert only if + dnl it makes a difference. (It could already be part of $JAVAC.) + javac_works= + rm -f conftest.class + if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class; then + javac_works=1 + fi + javac_noassert_works= + rm -f conftest.class + if { echo "$as_me:__oline__: $JAVAC -fno-assert -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -fno-assert -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class; then + javac_noassert_works=1 + fi + if test -n "$javac_works" && test -n "$javac_noassert_works"; then + rm -f conftestfail.class + if { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:__oline__: $JAVAC -fno-assert -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + $JAVAC -fno-assert -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + }; then + dnl "$JAVAC -fno-assert" works better than $JAVAC. + javac_works= + fi + fi + if test -n "$javac_works"; then + CONF_JAVAC="$JAVAC" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + if test -n "$javac_noassert_works"; then + CONF_JAVAC="$JAVAC -fno-assert" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + fi + else + dnl It's not gcj. Assume the classfile versions are correct. + dnl Try $JAVAC. + rm -f conftest.class + if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + dnl Try adding -source option if it is useful. + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:__oline__: $JAVAC -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \ + && { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:__oline__: $JAVAC -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + $JAVAC -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + }; then + CONF_JAVAC="$JAVAC -source $source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="$JAVAC" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + dnl Try with -target option alone. (Sun javac 1.3.1 has the -target + dnl option but no -source option.) + rm -f conftest.class + if { echo "$as_me:__oline__: $JAVAC -target $target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -target "$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + dnl Try adding -source option if it is useful. + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \ + && { echo "$as_me:__oline__: $JAVAC -target $target_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + $JAVAC -target "$target_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + $JAVAC -target "$target_version" -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + }; then + CONF_JAVAC="$JAVAC -target $target_version -source $source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="$JAVAC -target $target_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + dnl Maybe this -target option requires a -source option? Try with + dnl -target and -source options. (Supported by Sun javac 1.4 and + dnl higher.) + rm -f conftest.class + if { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + CONF_JAVAC="$JAVAC -target $target_version -source $source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + fi + if test -z "$HAVE_JAVACOMP"; then + pushdef([AC_MSG_CHECKING],[:])dnl + pushdef([AC_CHECKING],[:])dnl + pushdef([AC_MSG_RESULT],[:])dnl + AC_CHECK_PROG(HAVE_GCJ_IN_PATH, gcj, yes) + AC_CHECK_PROG(HAVE_JAVAC_IN_PATH, javac, yes) + AC_CHECK_PROG(HAVE_JIKES_IN_PATH, jikes, yes) + popdef([AC_MSG_RESULT])dnl + popdef([AC_CHECKING])dnl + popdef([AC_MSG_CHECKING])dnl + if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_GCJ_IN_PATH"; then + dnl Test for a good gcj version (>= 3.0). +changequote(,)dnl + if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^3\.[01]/d' | grep '^[3-9]' >/dev/null; then +changequote([,])dnl + dnl See if libgcj.jar is well installed. + if { echo "$as_me:__oline__: gcj -C -d . conftestlib.java" >&AS_MESSAGE_LOG_FD + gcj -C -d . conftestlib.java >&AS_MESSAGE_LOG_FD 2>&1 + }; then + dnl OK, gcj works. +changequote(,)dnl + if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null; then +changequote([,])dnl + dnl It's a version of gcj >= 4.3. Assume the classfile versions are correct. + dnl Try gcj. + rm -f conftest.class + if { echo "$as_me:__oline__: gcj -C -d . conftest.java" >&AS_MESSAGE_LOG_FD + gcj -C -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + dnl Try adding -fsource option if it is useful. + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:__oline__: gcj -C -fsource=$source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + gcj -C -fsource="$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \ + && { echo "$as_me:__oline__: gcj -C -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + gcj -C -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:__oline__: gcj -C -fsource=$source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + gcj -C -fsource="$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + }; then + CONF_JAVAC="gcj -C -fsource=$source_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="gcj -C" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + else + dnl Try with -fsource and -ftarget options. + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:__oline__: gcj -C -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + gcj -C -fsource="$source_version" -ftarget="$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + CONF_JAVAC="gcj -C -fsource=$source_version -ftarget=$target_version" + HAVE_JAVAC_ENVVAR=1 + HAVE_JAVACOMP=1 + fi + fi + else + dnl It's a version of gcj < 4.3. Ignore the version of conftest.class. + dnl Now test whether it supports the desired target-version and + dnl source-version. + if test "$target_version" = 1.4 && test "$source_version" = 1.4; then + rm -f conftest.class + if { echo "$as_me:__oline__: gcj -C -d . conftest.java" >&AS_MESSAGE_LOG_FD + gcj -C -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class; then + CONF_JAVAC="gcj -C" + HAVE_GCJ_C=1 + HAVE_JAVACOMP=1 + fi + else + if test "$target_version" = 1.4 && test "$source_version" = 1.3; then + dnl Try gcj and "gcj -fno-assert". But add -fno-assert only if + dnl it works (not gcj < 3.3). + rm -f conftest.class + if { echo "$as_me:__oline__: gcj -C -fno-assert -d . conftest.java" >&AS_MESSAGE_LOG_FD + gcj -C -fno-assert -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class; then + CONF_JAVAC="gcj -C -fno-assert" + HAVE_GCJ_C=1 + HAVE_JAVACOMP=1 + else + rm -f conftest.class + if { echo "$as_me:__oline__: gcj -C -d . conftest.java" >&AS_MESSAGE_LOG_FD + gcj -C -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class; then + CONF_JAVAC="gcj -C" + HAVE_GCJ_C=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + fi + fi + fi + fi + if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JAVAC_IN_PATH"; then + dnl Test whether javac is usable. + if { javac -version >/dev/null 2>/dev/null || test $? -le 2; } \ + && ( if javac -help 2>&1 >/dev/null | grep at.dms.kjc.Main >/dev/null && javac -help 2>/dev/null | grep 'released.*2000' >/dev/null ; then exit 1; else exit 0; fi ); then + dnl OK, javac works. + dnl Now test whether it supports the desired target-version and + dnl source-version. + rm -f conftest.class + if { echo "$as_me:__oline__: javac -d . conftest.java" >&AS_MESSAGE_LOG_FD + javac -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + dnl Try adding -source option if it is useful. + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:__oline__: javac -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + javac -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \ + && { echo "$as_me:__oline__: javac -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + javac -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:__oline__: javac -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + javac -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + }; then + CONF_JAVAC="javac -source $source_version" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="javac" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + fi + else + dnl Try with -target option alone. (Sun javac 1.3.1 has the -target + dnl option but no -source option.) + rm -f conftest.class + if { echo "$as_me:__oline__: javac -target $target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + javac -target "$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + dnl Try adding -source option if it is useful. + rm -f conftest.class + rm -f conftestfail.class + if { echo "$as_me:__oline__: javac -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + javac -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \ + && { echo "$as_me:__oline__: javac -target $target_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + javac -target "$target_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftestfail.class \ + && ! { echo "$as_me:__oline__: javac -target $target_version -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD + javac -target "$target_version" -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1 + }; then + CONF_JAVAC="javac -target $target_version -source $source_version" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + else + CONF_JAVAC="javac -target $target_version" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + fi + else + dnl Maybe this -target option requires a -source option? Try with + dnl -target and -source options. (Supported by Sun javac 1.4 and + dnl higher.) + rm -f conftest.class + if { echo "$as_me:__oline__: javac -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD + javac -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1 + } \ + && test -f conftest.class \ + && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then + CONF_JAVAC="javac -target $target_version -source $source_version" + HAVE_JAVAC=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + fi + if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JIKES_IN_PATH"; then + dnl Test whether jikes is usable. + if { jikes >/dev/null 2>/dev/null || test $? = 1; } \ + && ( + # See if the existing CLASSPATH is sufficient to make jikes work. + unset JAVA_HOME + jikes conftestlib.java >&AS_MESSAGE_LOG_FD 2>&1 + error=$? + rm -f conftestlib.class + exit $error + ); then + dnl OK, jikes works. + dnl Now test whether it supports the desired target-version and + dnl source-version. + if test "$source_version" = 1.3; then + CONF_JAVAC="jikes" + HAVE_JIKES=1 + HAVE_JAVACOMP=1 + fi + fi + fi + fi + rm -f conftest*.java conftest*.class + if test -n "$HAVE_JAVACOMP"; then + ac_result="$CONF_JAVAC" + else + ac_result="no" + fi + AC_MSG_RESULT([$ac_result]) + AC_SUBST(CONF_JAVAC) + AC_SUBST(CLASSPATH) + AC_SUBST(CLASSPATH_SEPARATOR) + AC_SUBST(HAVE_JAVAC_ENVVAR) + AC_SUBST(HAVE_GCJ_C) + AC_SUBST(HAVE_JAVAC) + AC_SUBST(HAVE_JIKES) +]) diff --git a/m4/javaexec.m4 b/m4/javaexec.m4 new file mode 100644 index 0000000..4f3b087 --- /dev/null +++ b/m4/javaexec.m4 @@ -0,0 +1,104 @@ +# javaexec.m4 serial 4 (gettext-0.15) +dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Prerequisites of javaexec.sh. +# gt_JAVAEXEC or gt_JAVAEXEC(testclass, its-directory) +# Sets HAVE_JAVAEXEC to nonempty if javaexec.sh will work. + +AC_DEFUN([gt_JAVAEXEC], +[ + AC_MSG_CHECKING([for Java virtual machine]) + AC_EGREP_CPP(yes, [ +#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + yes +#endif +], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':') + CONF_JAVA= + HAVE_JAVA_ENVVAR= + HAVE_GIJ= + HAVE_JAVA= + HAVE_JRE= + HAVE_JVIEW= + HAVE_JAVAEXEC=1 + if test -n "$JAVA"; then + HAVE_JAVA_ENVVAR=1 + CONF_JAVA="$JAVA" + else + pushdef([AC_MSG_CHECKING],[:])dnl + pushdef([AC_CHECKING],[:])dnl + pushdef([AC_MSG_RESULT],[:])dnl + AC_CHECK_PROG(HAVE_GIJ_IN_PATH, gij, yes) + AC_CHECK_PROG(HAVE_JAVA_IN_PATH, java, yes) + AC_CHECK_PROG(HAVE_JRE_IN_PATH, jre, yes) + AC_CHECK_PROG(HAVE_JVIEW_IN_PATH, jview, yes) + popdef([AC_MSG_RESULT])dnl + popdef([AC_CHECKING])dnl + popdef([AC_MSG_CHECKING])dnl + ifelse([$1], , , [ + save_CLASSPATH="$CLASSPATH" + CLASSPATH="$2"${CLASSPATH+"$CLASSPATH_SEPARATOR$CLASSPATH"} + ]) + export CLASSPATH + if test -n "$HAVE_GIJ_IN_PATH" \ + && gij --version >/dev/null 2>/dev/null \ + ifelse([$1], , , [&& { + echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD + gij $1 >&AS_MESSAGE_LOG_FD 2>&1 + }]); then + HAVE_GIJ=1 + CONF_JAVA="gij" + else + if test -n "$HAVE_JAVA_IN_PATH" \ + && java -version >/dev/null 2>/dev/null \ + ifelse([$1], , , [&& { + echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD + java $1 >&AS_MESSAGE_LOG_FD 2>&1 + }]); then + HAVE_JAVA=1 + CONF_JAVA="java" + else + if test -n "$HAVE_JRE_IN_PATH" \ + && (jre >/dev/null 2>/dev/null || test $? = 1) \ + ifelse([$1], , , [&& { + echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD + jre $1 >&AS_MESSAGE_LOG_FD 2>&1 + }]); then + HAVE_JRE=1 + CONF_JAVA="jre" + else + if test -n "$HAVE_JVIEW_IN_PATH" \ + && (jview -? >/dev/null 2>/dev/null || test $? = 1) \ + ifelse([$1], , , [&& { + echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD + jview $1 >&AS_MESSAGE_LOG_FD 2>&1 + }]); then + HAVE_JVIEW=1 + CONF_JAVA="jview" + else + HAVE_JAVAEXEC= + fi + fi + fi + fi + ifelse([$1], , , [ + CLASSPATH="$save_CLASSPATH" + ]) + fi + if test -n "$HAVE_JAVAEXEC"; then + ac_result="$CONF_JAVA" + else + ac_result="no" + fi + AC_MSG_RESULT([$ac_result]) + AC_SUBST(CONF_JAVA) + AC_SUBST(CLASSPATH) + AC_SUBST(CLASSPATH_SEPARATOR) + AC_SUBST(HAVE_JAVA_ENVVAR) + AC_SUBST(HAVE_GIJ) + AC_SUBST(HAVE_JAVA) + AC_SUBST(HAVE_JRE) + AC_SUBST(HAVE_JVIEW) +]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 new file mode 100644 index 0000000..96c4e2c --- /dev/null +++ b/m4/lib-ld.m4 @@ -0,0 +1,110 @@ +# lib-ld.m4 serial 3 (gettext-0.13) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 new file mode 100644 index 0000000..7e07a42 --- /dev/null +++ b/m4/lib-link.m4 @@ -0,0 +1,754 @@ +# lib-link.m4 serial 16 (gettext-0.18) +dnl Copyright (C) 2001-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_PREREQ(2.54) + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname +dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + pushdef([Name],[translit([$1],[./-], [___])]) + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + AC_SUBST([LIB]NAME[_PREFIX]) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + popdef([NAME]) + popdef([Name]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname +dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + pushdef([Name],[translit([$1],[./-], [___])]) + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + LIB[]NAME[]_PREFIX= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + AC_SUBST([LIB]NAME[_PREFIX]) + popdef([NAME]) + popdef([Name]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl acl_libext, +dnl acl_shlibext, +dnl acl_hardcode_libdir_flag_spec, +dnl acl_hardcode_libdir_separator, +dnl acl_hardcode_direct, +dnl acl_hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + dnl Tell automake >= 1.10 to complain if config.rpath is missing. + m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_FROMPACKAGE(name, package) +dnl declares that libname comes from the given package. The configure file +dnl will then not have a --with-libname-prefix option but a +dnl --with-package-prefix option. Several libraries can come from the same +dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar +dnl macro call that searches for libname. +AC_DEFUN([AC_LIB_FROMPACKAGE], +[ + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + define([acl_frompackage_]NAME, [$2]) + popdef([NAME]) + pushdef([PACK],[$2]) + pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + define([acl_libsinpackage_]PACKUP, + m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1]) + popdef([PACKUP]) + popdef([PACK]) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found +dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) + pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) + dnl Autoconf >= 2.61 supports dots in --with options. + pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH(P_A_C_K[-prefix], +[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib + --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + LIB[]NAME[]_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$acl_hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + LIB[]NAME[]_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + LIB[]NAME[]_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi + popdef([P_A_C_K]) + popdef([PACKLIBS]) + popdef([PACKUP]) + popdef([PACK]) + popdef([NAME]) +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +dnl For those cases where a variable contains several -L and -l options +dnl referring to unknown libraries and directories, this macro determines the +dnl necessary additional linker options for the runtime path. +dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) +dnl sets LDADDVAR to linker options needed together with LIBSVALUE. +dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, +dnl otherwise linking without libtool is assumed. +AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], +[ + AC_REQUIRE([AC_LIB_RPATH]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + $1= + if test "$enable_rpath" != no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode directories into the resulting + dnl binary. + rpathdirs= + next= + for opt in $2; do + if test -n "$next"; then + dir="$next" + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= + else + case $opt in + -L) next=yes ;; + -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= ;; + *) next= ;; + esac + fi + done + if test "X$rpathdirs" != "X"; then + if test -n ""$3""; then + dnl libtool is used for linking. Use -R options. + for dir in $rpathdirs; do + $1="${$1}${$1:+ }-R$dir" + done + else + dnl The linker is used for linking directly. + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user + dnl must pass all path elements in one option. + alldirs= + for dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="$flag" + else + dnl The -rpath options are cumulative. + for dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="${$1}${$1:+ }$flag" + done + fi + fi + fi + fi + fi + AC_SUBST([$1]) +]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 new file mode 100644 index 0000000..3bdc0fc --- /dev/null +++ b/m4/lib-prefix.m4 @@ -0,0 +1,221 @@ +# lib-prefix.m4 serial 6 (gettext-0.18) +dnl Copyright (C) 2001-2005, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_PREPARE_MULTILIB creates +dnl - a variable acl_libdirstem, containing the basename of the libdir, either +dnl "lib" or "lib64" or "lib/64", +dnl - a variable acl_libdirstem2, as a secondary possible value for +dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or +dnl "lib/amd64". +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. + dnl On glibc systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine + dnl the compiler's default mode by looking at the compiler's library search + dnl path. If at least one of its elements ends in /lib64 or points to a + dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. + dnl Otherwise we use the default, namely "lib". + dnl On Solaris systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or + dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. + AC_REQUIRE([AC_CANONICAL_HOST]) + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl . + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], + [AC_EGREP_CPP([sixtyfour bits], [ +#ifdef _LP64 +sixtyfour bits +#endif + ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) + ]) + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" +]) diff --git a/m4/localcharset.m4 b/m4/localcharset.m4 new file mode 100644 index 0000000..b2b7733 --- /dev/null +++ b/m4/localcharset.m4 @@ -0,0 +1,16 @@ +# localcharset.m4 serial 5 +dnl Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_LOCALCHARSET], +[ + dnl Prerequisites of lib/localcharset.c. + AC_REQUIRE([AM_LANGINFO_CODESET]) + AC_CHECK_DECLS_ONCE(getc_unlocked) + + dnl Prerequisites of the lib/Makefile.am snippet. + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_GLIBC21]) +]) diff --git a/m4/longlong.m4 b/m4/longlong.m4 new file mode 100644 index 0000000..15bf9da --- /dev/null +++ b/m4/longlong.m4 @@ -0,0 +1,106 @@ +# longlong.m4 serial 13 +dnl Copyright (C) 1999-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +# Define HAVE_LONG_LONG_INT if 'long long int' works. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. + +# Note: If the type 'long long int' exists but is only 32 bits large +# (as on some very old compilers), HAVE_LONG_LONG_INT will not be +# defined. In this case you can treat 'long long int' like 'long int'. + +AC_DEFUN([AC_TYPE_LONG_LONG_INT], +[ + AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], + [AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. + dnl If cross compiling, assume the bug isn't important, since + dnl nobody cross compiles for this platform as far as we know. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include + @%:@ifndef LLONG_MAX + @%:@ define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + @%:@ define LLONG_MAX (HALF - 1 + HALF) + @%:@endif]], + [[long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0;]])], + [ac_cv_type_long_long_int=yes], + [ac_cv_type_long_long_int=no], + [ac_cv_type_long_long_int=yes])], + [ac_cv_type_long_long_int=no])]) + if test $ac_cv_type_long_long_int = yes; then + AC_DEFINE([HAVE_LONG_LONG_INT], 1, + [Define to 1 if the system has the type `long long int'.]) + fi +]) + +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. + +# Note: If the type 'unsigned long long int' exists but is only 32 bits +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT +# will not be defined. In this case you can treat 'unsigned long long int' +# like 'unsigned long int'. + +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], +[ + AC_CACHE_CHECK([for unsigned long long int], + [ac_cv_type_unsigned_long_long_int], + [AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [ac_cv_type_unsigned_long_long_int=yes], + [ac_cv_type_unsigned_long_long_int=no])]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, + [Define to 1 if the system has the type `unsigned long long int'.]) + fi +]) + +# Expands to a C program that can be used to test for simultaneous support +# of 'long long' and 'unsigned long long'. We don't want to say that +# 'long long' is available if 'unsigned long long' is not, or vice versa, +# because too many programs rely on the symmetry between signed and unsigned +# integer types (excluding 'bool'). +AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], +[ + AC_LANG_PROGRAM( + [[/* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63;]], + [[/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull));]]) +]) diff --git a/m4/m4.m4 b/m4/m4.m4 new file mode 100644 index 0000000..be0140f --- /dev/null +++ b/m4/m4.m4 @@ -0,0 +1,27 @@ +# Copyright 2000 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 . + +# BISON_PROG_GNU_M4 +# ----------------- +# Check for GNU m4, at least 1.3 (supports frozen files). +AC_DEFUN([BISON_PROG_GNU_M4], +[AC_PATH_PROGS(M4, gm4 gnum4 m4, m4) +AC_CACHE_CHECK(whether m4 supports frozen files, ac_cv_prog_gnu_m4, +[ac_cv_prog_gnu_m4=no +if test x"$M4" != x; then + case `$M4 --help < /dev/null 2>&1` in + *reload-state*) ac_cv_prog_gnu_m4=yes ;; + esac +fi])]) diff --git a/m4/malloc.m4 b/m4/malloc.m4 new file mode 100644 index 0000000..764f2a9 --- /dev/null +++ b/m4/malloc.m4 @@ -0,0 +1,41 @@ +# malloc.m4 serial 8 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# gl_FUNC_MALLOC_POSIX +# -------------------- +# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it +# fails), and replace malloc if it is not. +AC_DEFUN([gl_FUNC_MALLOC_POSIX], +[ + AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) + if test $gl_cv_func_malloc_posix = yes; then + HAVE_MALLOC_POSIX=1 + AC_DEFINE([HAVE_MALLOC_POSIX], 1, + [Define if the 'malloc' function is POSIX compliant.]) + else + AC_LIBOBJ([malloc]) + HAVE_MALLOC_POSIX=0 + fi + AC_SUBST([HAVE_MALLOC_POSIX]) +]) + +# Test whether malloc, realloc, calloc are POSIX compliant, +# Set gl_cv_func_malloc_posix to yes or no accordingly. +AC_DEFUN([gl_CHECK_MALLOC_POSIX], +[ + AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], + [gl_cv_func_malloc_posix], + [ + dnl It is too dangerous to try to allocate a large amount of memory: + dnl some systems go to their knees when you do that. So assume that + dnl all Unix implementations of the function are POSIX compliant. + AC_TRY_COMPILE([], + [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + choke me + #endif + ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no]) + ]) +]) diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4 new file mode 100644 index 0000000..a3bd911 --- /dev/null +++ b/m4/mbrtowc.m4 @@ -0,0 +1,31 @@ +# mbrtowc.m4 serial 8 +dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert + +dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with +dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere. + +AC_DEFUN([gl_FUNC_MBRTOWC], +[ + dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. + AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], + gl_cv_func_mbrtowc, + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], + gl_cv_func_mbrtowc=yes, + gl_cv_func_mbrtowc=no)]) + if test $gl_cv_func_mbrtowc = yes; then + AC_DEFINE([HAVE_MBRTOWC], 1, + [Define to 1 if mbrtowc and mbstate_t are properly declared.]) + fi +]) diff --git a/m4/mbstate_t.m4 b/m4/mbstate_t.m4 new file mode 100644 index 0000000..0da32b6 --- /dev/null +++ b/m4/mbstate_t.m4 @@ -0,0 +1,30 @@ +# mbstate_t.m4 serial 10 +dnl Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# From Paul Eggert. + +# BeOS 5 has but does not define mbstate_t, +# so you can't declare an object of that type. +# Check for this incompatibility with Standard C. + +# AC_TYPE_MBSTATE_T +# ----------------- +AC_DEFUN([AC_TYPE_MBSTATE_T], + [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT[ +# include ]], + [[mbstate_t x; return sizeof x;]])], + [ac_cv_type_mbstate_t=yes], + [ac_cv_type_mbstate_t=no])]) + if test $ac_cv_type_mbstate_t = yes; then + AC_DEFINE([HAVE_MBSTATE_T], 1, + [Define to 1 if declares mbstate_t.]) + else + AC_DEFINE([mbstate_t], int, + [Define to a type if does not define.]) + fi]) diff --git a/m4/mbswidth.m4 b/m4/mbswidth.m4 new file mode 100644 index 0000000..241865f --- /dev/null +++ b/m4/mbswidth.m4 @@ -0,0 +1,42 @@ +# mbswidth.m4 serial 14 +dnl Copyright (C) 2000-2002, 2004, 2006, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl autoconf tests required for use of mbswidth.c +dnl From Bruno Haible. + +AC_DEFUN([gl_MBSWIDTH], +[ + AC_CHECK_HEADERS_ONCE([wchar.h]) + AC_CHECK_FUNCS_ONCE([isascii mbsinit]) + gl_FUNC_MBRTOWC + + dnl UnixWare 7.1.1 has a declaration of a function mbswidth() + dnl that clashes with ours. + AC_CACHE_CHECK([whether mbswidth is declared in ], + ac_cv_have_decl_mbswidth, + [AC_TRY_COMPILE([ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include +], [ + char *p = (char *) mbswidth; + return !p; +], ac_cv_have_decl_mbswidth=yes, ac_cv_have_decl_mbswidth=no)]) + if test $ac_cv_have_decl_mbswidth = yes; then + ac_val=1 + else + ac_val=0 + fi + AC_DEFINE_UNQUOTED(HAVE_DECL_MBSWIDTH_IN_WCHAR_H, $ac_val, + [Define to 1 if you have a declaration of mbswidth() in , and to 0 otherwise.]) + + AC_TYPE_MBSTATE_T +]) diff --git a/m4/nls.m4 b/m4/nls.m4 new file mode 100644 index 0000000..7967cc2 --- /dev/null +++ b/m4/nls.m4 @@ -0,0 +1,31 @@ +# nls.m4 serial 3 (gettext-0.15) +dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ(2.50) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) +]) diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 0000000..0734762 --- /dev/null +++ b/m4/po.m4 @@ -0,0 +1,449 @@ +# po.m4 serial 15 (gettext-0.17) +dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ(2.50) + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + AC_REQUIRE([AM_NLS])dnl + + dnl Release version of the gettext macros. This is used to ensure that + dnl the gettext macros and po/Makefile.in.in are in sync. + AC_SUBST([GETTEXT_MACRO_VERSION], [0.17]) + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Test whether it is GNU msgfmt >= 0.15. +changequote(,)dnl + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([MSGFMT_015]) +changequote(,)dnl + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([GMSGFMT_015]) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Test whether it is GNU xgettext >= 0.15. +changequote(,)dnl + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac +changequote([,])dnl + AC_SUBST([XGETTEXT_015]) + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) + + dnl Installation directories. + dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we + dnl have to define it here, so that it can be used in po/Makefile. + test -n "$localedir" || localedir='${datadir}/locale' + AC_SUBST([localedir]) + + dnl Support for AM_XGETTEXT_OPTION. + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) + + AC_CONFIG_COMMANDS([po-directories], [[ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done]], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1996. + +AC_PREREQ(2.50) + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) diff --git a/m4/quote.m4 b/m4/quote.m4 new file mode 100644 index 0000000..0f08791 --- /dev/null +++ b/m4/quote.m4 @@ -0,0 +1,13 @@ +# quote.m4 serial 5 +dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_QUOTE], +[ + AC_LIBOBJ([quote]) + + dnl Prerequisites of lib/quote.c. + dnl (none) +]) diff --git a/m4/quotearg.m4 b/m4/quotearg.m4 new file mode 100644 index 0000000..db635d0 --- /dev/null +++ b/m4/quotearg.m4 @@ -0,0 +1,15 @@ +# quotearg.m4 serial 6 +dnl Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_QUOTEARG], +[ + AC_LIBOBJ([quotearg]) + + dnl Prerequisites of lib/quotearg.c. + AC_CHECK_FUNCS_ONCE([mbsinit]) + AC_TYPE_MBSTATE_T + gl_FUNC_MBRTOWC +]) diff --git a/m4/setenv.m4 b/m4/setenv.m4 new file mode 100644 index 0000000..7af13d7 --- /dev/null +++ b/m4/setenv.m4 @@ -0,0 +1,71 @@ +# setenv.m4 serial 10 +dnl Copyright (C) 2001-2004, 2006-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_SETENV], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([setenv]) + if test $ac_cv_func_setenv = no; then + HAVE_SETENV=0 + AC_LIBOBJ([setenv]) + gl_PREREQ_SETENV + fi +]) + +# Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ). +AC_DEFUN([gl_FUNC_SETENV_SEPARATE], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([setenv]) + if test $ac_cv_func_setenv = no; then + HAVE_SETENV=0 + fi + gl_PREREQ_SETENV +]) + +AC_DEFUN([gl_FUNC_UNSETENV], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_CHECK_FUNCS([unsetenv]) + if test $ac_cv_func_unsetenv = no; then + HAVE_UNSETENV=0 + AC_LIBOBJ([unsetenv]) + gl_PREREQ_UNSETENV + else + AC_CACHE_CHECK([for unsetenv() return type], gt_cv_func_unsetenv_ret, + [AC_TRY_COMPILE([#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +int unsetenv (const char *name); +#else +int unsetenv(); +#endif +], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')]) + if test $gt_cv_func_unsetenv_ret = 'void'; then + VOID_UNSETENV=1 + fi + fi +]) + +# Prerequisites of lib/setenv.c. +AC_DEFUN([gl_PREREQ_SETENV], +[ + AC_REQUIRE([AC_FUNC_ALLOCA]) + AC_REQUIRE([gl_ENVIRON]) + AC_CHECK_HEADERS_ONCE(unistd.h) + AC_CHECK_HEADERS(search.h) + AC_CHECK_FUNCS(tsearch) +]) + +# Prerequisites of lib/unsetenv.c. +AC_DEFUN([gl_PREREQ_UNSETENV], +[ + AC_REQUIRE([gl_ENVIRON]) + AC_CHECK_HEADERS_ONCE(unistd.h) +]) diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 new file mode 100644 index 0000000..2204ecd --- /dev/null +++ b/m4/stdbool.m4 @@ -0,0 +1,115 @@ +# Check for stdbool.h that conforms to C99. + +dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Prepare for substituting if it is not supported. + +AC_DEFUN([AM_STDBOOL_H], +[ + AC_REQUIRE([AC_HEADER_STDBOOL]) + + # Define two additional variables used in the Makefile substitution. + + if test "$ac_cv_header_stdbool_h" = yes; then + STDBOOL_H='' + else + STDBOOL_H='stdbool.h' + fi + AC_SUBST([STDBOOL_H]) + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi + AC_SUBST([HAVE__BOOL]) +]) + +# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. +AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) + +# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf +# have this macro built-in. + +AC_DEFUN([AC_HEADER_STDBOOL], + [AC_CACHE_CHECK([for stdbool.h that conforms to C99], + [ac_cv_header_stdbool_h], + [AC_TRY_COMPILE( + [ + #include + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + #if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a run-time + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); + #endif + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + ], + [ + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + ], + [ac_cv_header_stdbool_h=yes], + [ac_cv_header_stdbool_h=no])]) + AC_CHECK_TYPES([_Bool]) + if test $ac_cv_header_stdbool_h = yes; then + AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.]) + fi]) diff --git a/m4/stdint.m4 b/m4/stdint.m4 new file mode 100644 index 0000000..b255692 --- /dev/null +++ b/m4/stdint.m4 @@ -0,0 +1,395 @@ +# stdint.m4 serial 31 +dnl Copyright (C) 2001-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert and Bruno Haible. +dnl Test whether is supported or must be substituted. + +AC_DEFUN([gl_STDINT_H], +[ + AC_PREREQ(2.59)dnl + + dnl Check for long long int and unsigned long long int. + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + if test $ac_cv_type_long_long_int = yes; then + HAVE_LONG_LONG_INT=1 + else + HAVE_LONG_LONG_INT=0 + fi + AC_SUBST([HAVE_LONG_LONG_INT]) + AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + HAVE_UNSIGNED_LONG_LONG_INT=1 + else + HAVE_UNSIGNED_LONG_LONG_INT=0 + fi + AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) + + dnl Check for . + dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + AC_SUBST([HAVE_INTTYPES_H]) + + dnl Check for . + dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + AC_SUBST([HAVE_SYS_TYPES_H]) + + gl_CHECK_NEXT_HEADERS([stdint.h]) + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + AC_SUBST([HAVE_STDINT_H]) + + dnl Now see whether we need a substitute . + if test $ac_cv_header_stdint_h = yes; then + AC_CACHE_CHECK([whether stdint.h conforms to C99], + [gl_cv_header_working_stdint_h], + [gl_cv_header_working_stdint_h=no + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif +] +gl_STDINT_INCLUDES +[ +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + ]])], + [gl_cv_header_working_stdint_h=yes])]) + fi + if test "$gl_cv_header_working_stdint_h" = yes; then + STDINT_H= + else + dnl Check for , and for + dnl (used in Linux libc4 >= 4.6.7 and libc5). + AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + else + HAVE_SYS_INTTYPES_H=0 + fi + AC_SUBST([HAVE_SYS_INTTYPES_H]) + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + else + HAVE_SYS_BITYPES_H=0 + fi + AC_SUBST([HAVE_SYS_BITYPES_H]) + + dnl Check for (missing in Linux uClibc when built without wide + dnl character support). + AC_CHECK_HEADERS_ONCE([wchar.h]) + + gl_STDINT_TYPE_PROPERTIES + STDINT_H=stdint.h + fi + AC_SUBST(STDINT_H) +]) + +dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) +dnl Determine the size of each of the given types in bits. +AC_DEFUN([gl_STDINT_BITSIZEOF], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [Define to the number of bits in type ']gltype['.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], + [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], + [$2 +#include ], [result=unknown]) + eval gl_cv_bitsizeof_${gltype}=\$result + ]) + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, + dnl do a syntax check even on unused #if conditions and give an error + dnl on valid C code like this: + dnl #if 0 + dnl # if > 32 + dnl # endif + dnl #endif + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) + eval BITSIZEOF_${GLTYPE}=\$result + done + m4_foreach_w([gltype], [$1], + [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) +]) + +dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) +dnl Determine the signedness of each of the given types. +dnl Define HAVE_SIGNED_TYPE if type is signed. +AC_DEFUN([gl_CHECK_TYPES_SIGNED], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [Define to 1 if ']gltype[' is a signed integer type.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([$2[ + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], + result=yes, result=no) + eval gl_cv_type_${gltype}_signed=\$result + ]) + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1) + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + m4_foreach_w([gltype], [$1], + [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) +]) + +dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) +dnl Determine the suffix to use for integer constants of the given types. +dnl Define t_SUFFIX for each such type. +AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], + [Define to l, ll, u, ul, ull, etc., as suitable for + constants of type ']gltype['.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([for $gltype integer literal suffix], + [gl_cv_type_${gltype}_suffix], + [eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([$2[ + extern $gltype foo; + extern $gltype1 foo;]])], + [eval gl_cv_type_${gltype}_suffix=\$glsuf]) + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done]) + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result) + done + m4_foreach_w([gltype], [$1], + [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) +]) + +dnl gl_STDINT_INCLUDES +AC_DEFUN([gl_STDINT_INCLUDES], +[[ + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif +]]) + +dnl gl_STDINT_TYPE_PROPERTIES +dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t +dnl of interest to stdint.in.h. +AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], +[ + gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) +]) + +dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. +dnl Remove this when we can assume autoconf >= 2.61. +m4_ifdef([AC_COMPUTE_INT], [], [ + AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) +]) + +# Hey Emacs! +# Local Variables: +# indent-tabs-mode: nil +# End: diff --git a/m4/stdio-safer.m4 b/m4/stdio-safer.m4 new file mode 100644 index 0000000..3d71452 --- /dev/null +++ b/m4/stdio-safer.m4 @@ -0,0 +1,15 @@ +#serial 10 +dnl Copyright (C) 2002, 2005-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FOPEN_SAFER], +[ + AC_LIBOBJ([fopen-safer]) +]) + +AC_DEFUN([gl_TMPFILE_SAFER], +[ + AC_LIBOBJ([tmpfile-safer]) +]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 new file mode 100644 index 0000000..582db13 --- /dev/null +++ b/m4/stdlib_h.m4 @@ -0,0 +1,62 @@ +# stdlib_h.m4 serial 13 +dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STDLIB_H], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([stdlib.h]) + AC_CHECK_TYPES([struct random_data], + [], [HAVE_STRUCT_RANDOM_DATA=0], + [[#include ]]) +]) + +AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_STDLIB_H_DEFAULTS], +[ + GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) + GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) + GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) + GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) + GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) + GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) + GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) + GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) + GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) + GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) + GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) + GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) + GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) + GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) + GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) + HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX]) + HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) + HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX]) + HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) + HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) + HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) + HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) + HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) + HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) + HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) + HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) + HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) + HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) + HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) + REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV]) +]) diff --git a/m4/stpcpy.m4 b/m4/stpcpy.m4 new file mode 100644 index 0000000..c38f40e --- /dev/null +++ b/m4/stpcpy.m4 @@ -0,0 +1,26 @@ +# stpcpy.m4 serial 6 +dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STPCPY], +[ + dnl Persuade glibc to declare stpcpy(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'. + AC_REQUIRE([AC_C_RESTRICT]) + + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REPLACE_FUNCS(stpcpy) + if test $ac_cv_func_stpcpy = no; then + HAVE_STPCPY=0 + gl_PREREQ_STPCPY + fi +]) + +# Prerequisites of lib/stpcpy.c. +AC_DEFUN([gl_PREREQ_STPCPY], [ + : +]) diff --git a/m4/strerror.m4 b/m4/strerror.m4 new file mode 100644 index 0000000..8c16ca9 --- /dev/null +++ b/m4/strerror.m4 @@ -0,0 +1,68 @@ +# strerror.m4 serial 9 +dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRERROR], +[ + AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE]) + if test $REPLACE_STRERROR = 1; then + AC_LIBOBJ([strerror]) + AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR], + [Define this to 1 if strerror is broken.]) + fi +]) + +# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ). +AC_DEFUN([gl_FUNC_STRERROR_SEPARATE], +[ + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_HEADER_ERRNO_H]) + if test -z "$ERRNO_H"; then + AC_CACHE_CHECK([for working strerror function], + [gl_cv_func_working_strerror], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[return !*strerror (-2);]])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no], + [dnl Assume crossbuild works if it compiles. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[return !*strerror (-2);]])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no]) + ]) + ]) + if test $gl_cv_func_working_strerror = no; then + dnl The system's strerror() fails to return a string for out-of-range + dnl integers. Replace it. + REPLACE_STRERROR=1 + fi + else + dnl The system's strerror() cannot know about the new errno values we add + dnl to . Replace it. + REPLACE_STRERROR=1 + fi + if test $REPLACE_STRERROR = 1; then + gl_PREREQ_STRERROR + fi +]) + +# Prerequisites of lib/strerror.c. +AC_DEFUN([gl_PREREQ_STRERROR], [ + AC_CHECK_DECLS([strerror]) + AC_CHECK_HEADERS_ONCE([sys/socket.h]) + if test $ac_cv_header_sys_socket_h != yes; then + dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make + dnl the check for those headers unconditional; yet cygwin reports + dnl that the headers are present but cannot be compiled (since on + dnl cygwin, all socket information should come from sys/socket.h). + AC_CHECK_HEADERS([winsock2.h]) + fi +]) diff --git a/m4/string_h.m4 b/m4/string_h.m4 new file mode 100644 index 0000000..2d5553c --- /dev/null +++ b/m4/string_h.m4 @@ -0,0 +1,92 @@ +# Configure a GNU-like replacement for . + +# Copyright (C) 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# Written by Paul Eggert. + +AC_DEFUN([gl_HEADER_STRING_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_HEADER_STRING_H_BODY]) +]) + +AC_DEFUN([gl_HEADER_STRING_H_BODY], +[ + AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([string.h]) +]) + +AC_DEFUN([gl_STRING_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], +[ + GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) + GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) + GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) + GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) + GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) + GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) + GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) + GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) + GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) + GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) + GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) + GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) + GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) + GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) + GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) + GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) + GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) + GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) + GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) + GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) + GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) + GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) + GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) + GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) + GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) + GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) + GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) + GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) + GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) + GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) + GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) + GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) + HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) + HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) + HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) + HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) + HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) + HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) + HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) + HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP]) + HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) + HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) + HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) + HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) + HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) + HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) + HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) + HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) + HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) + REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) + REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) + REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) + REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) +]) diff --git a/m4/strndup.m4 b/m4/strndup.m4 new file mode 100644 index 0000000..1be2a85 --- /dev/null +++ b/m4/strndup.m4 @@ -0,0 +1,53 @@ +# strndup.m4 serial 15 +dnl Copyright (C) 2002-2003, 2005-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRNDUP], +[ + dnl Persuade glibc to declare strndup(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CHECK_DECLS_ONCE([strndup]) + if test $ac_cv_have_decl_strndup = no; then + HAVE_DECL_STRNDUP=0 + fi + + # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. + AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup, + [AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[#include + #include ]], [[ +#ifndef HAVE_DECL_STRNDUP + extern char *strndup (const char *, size_t); +#endif + char *s; + s = strndup ("some longer string", 15); + free (s); + s = strndup ("shorter string", 13); + return s[13] != '\0';]])], + [gl_cv_func_strndup=yes], + [gl_cv_func_strndup=no], + [AC_CHECK_FUNC([strndup], + [AC_EGREP_CPP([too risky], [ +#ifdef _AIX + too risky +#endif + ], + [gl_cv_func_strndup=no], + [gl_cv_func_strndup=yes])], + [gl_cv_func_strndup=no])])]) + if test $gl_cv_func_strndup = yes; then + AC_DEFINE([HAVE_STRNDUP], 1, + [Define if you have the strndup() function and it works.]) + else + HAVE_STRNDUP=0 + AC_LIBOBJ([strndup]) + gl_PREREQ_STRNDUP + fi +]) + +# Prerequisites of lib/strndup.c. +AC_DEFUN([gl_PREREQ_STRNDUP], [:]) diff --git a/m4/strnlen.m4 b/m4/strnlen.m4 new file mode 100644 index 0000000..d8307ed --- /dev/null +++ b/m4/strnlen.m4 @@ -0,0 +1,31 @@ +# strnlen.m4 serial 9 +dnl Copyright (C) 2002-2003, 2005-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRNLEN], +[ + dnl Persuade glibc to declare strnlen(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CHECK_DECLS_ONCE([strnlen]) + if test $ac_cv_have_decl_strnlen = no; then + HAVE_DECL_STRNLEN=0 + fi + + AC_FUNC_STRNLEN + if test $ac_cv_func_strnlen_working = no; then + # This is necessary because automake-1.6.1 doesn't understand + # that the above use of AC_FUNC_STRNLEN means we may have to use + # lib/strnlen.c. + #AC_LIBOBJ(strnlen) + AC_DEFINE(strnlen, rpl_strnlen, + [Define to rpl_strnlen if the replacement function should be used.]) + gl_PREREQ_STRNLEN + fi +]) + +# Prerequisites of lib/strnlen.c. +AC_DEFUN([gl_PREREQ_STRNLEN], [:]) diff --git a/m4/strtol.m4 b/m4/strtol.m4 new file mode 100644 index 0000000..7fbae60 --- /dev/null +++ b/m4/strtol.m4 @@ -0,0 +1,10 @@ +# strtol.m4 serial 4 +dnl Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRTOL], +[ + AC_REPLACE_FUNCS(strtol) +]) diff --git a/m4/strtoul.m4 b/m4/strtoul.m4 new file mode 100644 index 0000000..5ec54aa --- /dev/null +++ b/m4/strtoul.m4 @@ -0,0 +1,10 @@ +# strtoul.m4 serial 3 +dnl Copyright (C) 2002, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRTOUL], +[ + AC_REPLACE_FUNCS(strtoul) +]) diff --git a/m4/strverscmp.m4 b/m4/strverscmp.m4 new file mode 100644 index 0000000..a3f9aff --- /dev/null +++ b/m4/strverscmp.m4 @@ -0,0 +1,24 @@ +# strverscmp.m4 serial 6 +dnl Copyright (C) 2002, 2005, 2006, 2007, 2008 Free Software +dnl Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRVERSCMP], +[ + dnl Persuade glibc to declare strverscmp(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REPLACE_FUNCS(strverscmp) + if test $ac_cv_func_strverscmp = no; then + gl_PREREQ_STRVERSCMP + HAVE_STRVERSCMP=0 + fi +]) + +# Prerequisites of lib/strverscmp.c. +AC_DEFUN([gl_PREREQ_STRVERSCMP], [ + : +]) diff --git a/m4/subpipe.m4 b/m4/subpipe.m4 new file mode 100644 index 0000000..cf1a92d --- /dev/null +++ b/m4/subpipe.m4 @@ -0,0 +1,27 @@ +# -*- Autoconf -*- +# Checks required to run `subpipe'. +# +# Copyright (C) 2002, 2003, 2005 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 . + +# Written by Paul Eggert . + +AC_DEFUN([BISON_PREREQ_SUBPIPE], +[ + AC_TYPE_PID_T + AC_HEADER_SYS_WAIT + AC_CHECK_FUNCS(dup2 waitpid) + AC_FUNC_FORK +]) diff --git a/m4/timevar.m4 b/m4/timevar.m4 new file mode 100644 index 0000000..0006380 --- /dev/null +++ b/m4/timevar.m4 @@ -0,0 +1,59 @@ +# -*- Autoconf -*- +# Checks required to run `timevar', a time tracker. +# +# Copyright (C) 2002, 2003 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 . + +# serial 2 + +AC_DEFUN([BISON_PREREQ_TIMEVAR], +[AC_CHECK_HEADERS([sys/time.h sys/times.h]) + AC_CHECK_HEADERS([sys/resource.h],,, + [$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#ifdef HAVE_SYS_TIMES_H +# include +#endif +]) +AC_CHECK_FUNCS([times]) + +AC_CHECK_DECLS([getrusage, times, clock, sysconf], [], [], +[$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif +]) + +AC_CHECK_TYPES([clock_t, struct tms], [], [], +[$ac_includes_default +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMES_H +# include +#endif +#if HAVE_SYS_RESOURCE_H +# include +#endif +]) +]) diff --git a/m4/unistd-safer.m4 b/m4/unistd-safer.m4 new file mode 100644 index 0000000..09adf93 --- /dev/null +++ b/m4/unistd-safer.m4 @@ -0,0 +1,13 @@ +#serial 8 +dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_UNISTD_SAFER], +[ + AC_CHECK_FUNCS_ONCE([pipe]) + AC_LIBOBJ([dup-safer]) + AC_LIBOBJ([fd-safer]) + AC_LIBOBJ([pipe-safer]) +]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 new file mode 100644 index 0000000..5685273 --- /dev/null +++ b/m4/unistd_h.m4 @@ -0,0 +1,81 @@ +# unistd_h.m4 serial 16 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Simon Josefsson, Bruno Haible. + +AC_DEFUN([gl_UNISTD_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + + gl_CHECK_NEXT_HEADERS([unistd.h]) + + AC_CHECK_HEADERS_ONCE([unistd.h]) + if test $ac_cv_header_unistd_h = yes; then + HAVE_UNISTD_H=1 + else + HAVE_UNISTD_H=0 + fi + AC_SUBST([HAVE_UNISTD_H]) +]) + +AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_UNISTD_H_DEFAULTS], +[ + GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) + GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) + GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) + GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) + GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) + GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) + GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) + GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) + GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) + GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) + GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) + GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) + GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) + GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) + GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) + GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) + GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) + GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) + GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) + GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) + HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) + HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) + HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) + HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) + HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) + HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) + HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) + HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) + HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) + HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) + HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) + HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) + HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) + REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) + REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) + REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) + REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) + REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) + REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) + REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) + UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) +]) diff --git a/m4/unlocked-io.m4 b/m4/unlocked-io.m4 new file mode 100644 index 0000000..20b2da2 --- /dev/null +++ b/m4/unlocked-io.m4 @@ -0,0 +1,42 @@ +# unlocked-io.m4 serial 14 + +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl From Jim Meyering. +dnl +dnl See if the glibc *_unlocked I/O macros or functions are available. +dnl Use only those *_unlocked macros or functions that are declared +dnl (because some of them were declared in Solaris 2.5.1 but were removed +dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run +dnl on Solaris 2.6). + +AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], +[ + AC_DEFINE([USE_UNLOCKED_IO], 1, + [Define to 1 if you want getc etc. to use unlocked I/O if available. + Unlocked I/O can improve performance in unithreaded apps, + but it is not safe for multithreaded apps.]) + + dnl Persuade glibc and Solaris to declare + dnl fgets_unlocked(), fputs_unlocked() etc. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_DECLS_ONCE([clearerr_unlocked]) + AC_CHECK_DECLS_ONCE([feof_unlocked]) + AC_CHECK_DECLS_ONCE([ferror_unlocked]) + AC_CHECK_DECLS_ONCE([fflush_unlocked]) + AC_CHECK_DECLS_ONCE([fgets_unlocked]) + AC_CHECK_DECLS_ONCE([fputc_unlocked]) + AC_CHECK_DECLS_ONCE([fputs_unlocked]) + AC_CHECK_DECLS_ONCE([fread_unlocked]) + AC_CHECK_DECLS_ONCE([fwrite_unlocked]) + AC_CHECK_DECLS_ONCE([getc_unlocked]) + AC_CHECK_DECLS_ONCE([getchar_unlocked]) + AC_CHECK_DECLS_ONCE([putc_unlocked]) + AC_CHECK_DECLS_ONCE([putchar_unlocked]) +]) diff --git a/m4/warnings.m4 b/m4/warnings.m4 new file mode 100644 index 0000000..c32cf4e --- /dev/null +++ b/m4/warnings.m4 @@ -0,0 +1,44 @@ +# warnings.m4 serial 2 +dnl Copyright (C) 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson + +# gl_AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) +# ---------------------------------------------------- +# Provide the functionality of AS_VAR_IF if Autoconf does not have it. +m4_ifdef([AS_VAR_IF], +[m4_copy([AS_VAR_IF], [gl_AS_VAR_IF])], +[m4_define([gl_AS_VAR_IF], +[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) + +# gl_AS_VAR_APPEND(VAR, VALUE) +# ---------------------------- +# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. +m4_ifdef([AS_VAR_APPEND], +[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])], +[m4_define([gl_AS_VAR_APPEND], +[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) + +# gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS]) +# ------------------------------------------------ +# Adds parameter to WARN_CFLAGS if the compiler supports it. For example, +# gl_WARN_ADD([-Wparentheses]). +AC_DEFUN([gl_WARN_ADD], +[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl +AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [ + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} $1" + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], + [AS_VAR_SET([gl_Warn], [yes])], + [AS_VAR_SET([gl_Warn], [no])]) + CPPFLAGS="$save_CPPFLAGS" +]) +AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl +gl_AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])]) +AS_VAR_POPDEF([gl_Flags])dnl +AS_VAR_POPDEF([gl_Warn])dnl +m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl +]) diff --git a/m4/wchar.m4 b/m4/wchar.m4 new file mode 100644 index 0000000..5c923fa --- /dev/null +++ b/m4/wchar.m4 @@ -0,0 +1,69 @@ +dnl A placeholder for ISO C99 , for platforms that have issues. + +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Eric Blake. + +# wchar.m4 serial 6 + +AC_DEFUN([gl_WCHAR_H], +[ + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_CACHE_CHECK([whether is standalone], + [gl_cv_header_wchar_h_standalone], + [AC_COMPILE_IFELSE([[#include +wchar_t w;]], + [gl_cv_header_wchar_h_standalone=yes], + [gl_cv_header_wchar_h_standalone=no])]) + + AC_REQUIRE([gt_TYPE_WINT_T]) + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + AC_SUBST([HAVE_WINT_T]) + + if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then + WCHAR_H=wchar.h + fi + + dnl Prepare for creating substitute . + dnl Do it always: WCHAR_H may be empty here but can be set later. + dnl Check for (missing in Linux uClibc when built without wide + dnl character support). + AC_CHECK_HEADERS_ONCE([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) + gl_CHECK_NEXT_HEADERS([wchar.h]) +]) + +dnl Unconditionally enables the replacement of . +AC_DEFUN([gl_REPLACE_WCHAR_H], +[ + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + WCHAR_H=wchar.h +]) + +AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_WCHAR_H_DEFAULTS], +[ + GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) + REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) + WCHAR_H=''; AC_SUBST([WCHAR_H]) +]) diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4 new file mode 100644 index 0000000..cde2129 --- /dev/null +++ b/m4/wchar_t.m4 @@ -0,0 +1,20 @@ +# wchar_t.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Test whether has the 'wchar_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WCHAR_T], +[ + AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, + [AC_TRY_COMPILE([#include + wchar_t foo = (wchar_t)'\0';], , + gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) + if test $gt_cv_c_wchar_t = yes; then + AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) + fi +]) diff --git a/m4/wctype.m4 b/m4/wctype.m4 new file mode 100644 index 0000000..6a1b6f0 --- /dev/null +++ b/m4/wctype.m4 @@ -0,0 +1,74 @@ +# wctype.m4 serial 2 + +dnl A placeholder for ISO C99 , for platforms that lack it. + +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Paul Eggert. + +AC_DEFUN([gl_WCTYPE_H], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_CHECK_FUNCS_ONCE([iswcntrl]) + if test $ac_cv_func_iswcntrl = yes; then + HAVE_ISWCNTRL=1 + else + HAVE_ISWCNTRL=0 + fi + AC_SUBST([HAVE_ISWCNTRL]) + AC_CHECK_HEADERS_ONCE([wctype.h]) + AC_REQUIRE([AC_C_INLINE]) + + AC_REQUIRE([gt_TYPE_WINT_T]) + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + AC_SUBST([HAVE_WINT_T]) + + WCTYPE_H=wctype.h + if test $ac_cv_header_wctype_h = yes; then + if test $ac_cv_func_iswcntrl = yes; then + dnl Linux libc5 has an iswprint function that returns 0 for all arguments. + dnl The other functions are likely broken in the same way. + AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], + [ + AC_TRY_RUN([#include + #include + #include + #include + #include + int main () { return iswprint ('x') == 0; }], + [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], + [AC_TRY_COMPILE([#include + #if __GNU_LIBRARY__ == 1 + Linux libc5 i18n is broken. + #endif], [], + [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) + ]) + ]) + if test $gl_cv_func_iswcntrl_works = yes; then + WCTYPE_H= + fi + fi + dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, + dnl for the benefit of builds from non-distclean directories. + gl_CHECK_NEXT_HEADERS([wctype.h]) + HAVE_WCTYPE_H=1 + else + HAVE_WCTYPE_H=0 + fi + AC_SUBST([HAVE_WCTYPE_H]) + AC_SUBST([WCTYPE_H]) + + if test "$gl_cv_func_iswcntrl_works" = no; then + REPLACE_ISWCNTRL=1 + else + REPLACE_ISWCNTRL=0 + fi + AC_SUBST([REPLACE_ISWCNTRL]) +]) diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4 new file mode 100644 index 0000000..4bedefa --- /dev/null +++ b/m4/wcwidth.m4 @@ -0,0 +1,85 @@ +# wcwidth.m4 serial 14 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_WCWIDTH], +[ + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + + dnl Persuade glibc to declare wcwidth(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gt_TYPE_WCHAR_T]) + AC_REQUIRE([gt_TYPE_WINT_T]) + + AC_CHECK_HEADERS_ONCE([wchar.h]) + AC_CHECK_FUNCS_ONCE([wcwidth]) + + AC_CHECK_DECLS([wcwidth], [], [], [ +/* AIX 3.2.5 declares wcwidth in . */ +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include +]) + if test $ac_cv_have_decl_wcwidth != yes; then + HAVE_DECL_WCWIDTH=0 + fi + + if test $ac_cv_func_wcwidth = no; then + REPLACE_WCWIDTH=1 + else + dnl On MacOS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. + dnl On OSF/1 5.1, wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. + dnl This leads to bugs in 'ls' (coreutils). + AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales], + [gl_cv_func_wcwidth_works], + [ + AC_TRY_RUN([ +#include +/* AIX 3.2.5 declares wcwidth in . */ +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include +#if !HAVE_DECL_WCWIDTH +extern +# ifdef __cplusplus +"C" +# endif +int wcwidth (int); +#endif +int main () +{ + if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL) + if (wcwidth (0x0301) > 0 || wcwidth (0x200B) > 0) + return 1; + return 0; +}], [gl_cv_func_wcwidth_works=yes], [gl_cv_func_wcwidth_works=no], + [gl_cv_func_wcwidth_works="guessing no"]) + ]) + case "$gl_cv_func_wcwidth_works" in + *yes) ;; + *no) REPLACE_WCWIDTH=1 ;; + esac + fi + if test $REPLACE_WCWIDTH = 1; then + AC_LIBOBJ([wcwidth]) + fi + + if test $REPLACE_WCWIDTH = 1 || test $HAVE_DECL_WCWIDTH = 0; then + gl_REPLACE_WCHAR_H + fi +]) diff --git a/m4/wint_t.m4 b/m4/wint_t.m4 new file mode 100644 index 0000000..af5ed93 --- /dev/null +++ b/m4/wint_t.m4 @@ -0,0 +1,28 @@ +# wint_t.m4 serial 2 (gettext-0.17) +dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Test whether has the 'wint_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WINT_T], +[ + AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, + [AC_TRY_COMPILE([ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include + wint_t foo = (wchar_t)'\0';], , + gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) + if test $gt_cv_c_wint_t = yes; then + AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) + fi +]) diff --git a/m4/xalloc.m4 b/m4/xalloc.m4 new file mode 100644 index 0000000..837a948 --- /dev/null +++ b/m4/xalloc.m4 @@ -0,0 +1,24 @@ +# xalloc.m4 serial 16 +dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_XALLOC], +[ + AC_LIBOBJ([xmalloc]) + + gl_PREREQ_XALLOC + gl_PREREQ_XMALLOC +]) + +# Prerequisites of lib/xalloc.h. +AC_DEFUN([gl_PREREQ_XALLOC], [ + AC_REQUIRE([gl_INLINE]) + : +]) + +# Prerequisites of lib/xmalloc.c. +AC_DEFUN([gl_PREREQ_XMALLOC], [ + : +]) diff --git a/m4/xstrndup.m4 b/m4/xstrndup.m4 new file mode 100644 index 0000000..8a30ab1 --- /dev/null +++ b/m4/xstrndup.m4 @@ -0,0 +1,15 @@ +# xstrndup.m4 serial 2 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_XSTRNDUP], +[ + gl_PREREQ_XSTRNDUP +]) + +# Prerequisites of lib/xstrndup.c. +AC_DEFUN([gl_PREREQ_XSTRNDUP], [ + : +]) diff --git a/maint.mk b/maint.mk new file mode 100644 index 0000000..7b43154 --- /dev/null +++ b/maint.mk @@ -0,0 +1,858 @@ +# -*-Makefile-*- +# This Makefile fragment tries to be general-purpose enough to be +# used by at least coreutils, idutils, CPPI, Bison, and Autoconf. + +## Copyright (C) 2001-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 . + +# This is reported not to work with make-3.79.1 +# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +ME := maint.mk + +# Do not save the original name or timestamp in the .tar.gz file. +# Use --rsyncable if available. +gzip_rsyncable := \ + $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable) +GZIP_ENV = '--no-name --best $(gzip_rsyncable)' + +GIT = git +VC = $(GIT) +VC-tag = git tag -s -m '$(VERSION)' + +VC_LIST = build-aux/vc-list-files + +VC_LIST_EXCEPT = \ + $(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi + +ifeq ($(origin prev_version_file), undefined) + prev_version_file = $(srcdir)/.prev-version +endif + +PREV_VERSION := $(shell cat $(prev_version_file)) +VERSION_REGEXP = $(subst .,\.,$(VERSION)) +PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION)) + +ifeq ($(VC),$(GIT)) +this-vc-tag = v$(VERSION) +this-vc-tag-regexp = v$(VERSION_REGEXP) +else +tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') +tag-this-version = $(subst .,_,$(VERSION)) +this-vc-tag = $(tag-package)-$(tag-this-version) +this-vc-tag-regexp = $(this-vc-tag) +endif +my_distdir = $(PACKAGE)-$(VERSION) + +# Old releases are stored here. +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. ## +## --------------- ## + +# Collect the names of rules starting with `sc_'. +syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \ + $(srcdir)/$(ME)) +.PHONY: $(syntax-check-rules) + +local-checks-available = \ + po-check copyright-check m4-check author_mark_check \ + patch-check strftime-check $(syntax-check-rules) \ + makefile_path_separator_check \ + makefile-check check-AUTHORS +.PHONY: $(local-checks-available) + +local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available)) + +syntax-check: $(local-check) +# @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_avoid_if_before_free: + @$(srcdir)/build-aux/useless-if-before-free \ + $(useless_free_options) \ + $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): found useless "if" before "free" above' 1>&2; \ + exit 1; } || : + +sc_cast_of_argument_to_free: + @grep -nE '\&2; \ + exit 1; } || : + +sc_cast_of_x_alloc_return_value: + @grep -nE '\*\) *x(m|c|re)alloc\>' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ + exit 1; } || : + +sc_cast_of_alloca_return_value: + @grep -nE '\*\) *alloca\>' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): don'\''t cast alloca return value' 1>&2; \ + exit 1; } || : + +sc_space_tab: + @grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ + 1>&2; exit 1; } || : + +# Don't use *scanf or the old ato* functions in `real' code. +# They provide no error checking mechanism. +# Instead, use strto* functions. +sc_prohibit_atoi_atof: + @grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \ + 1>&2; exit 1; } || : + +# Use STREQ rather than comparing strcmp == 0, or != 0. +sc_prohibit_strcmp: + @grep -nE '! *str''cmp *\(|\&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; } || : + +# `FATAL:' should be fully upper-cased in error messages +# `WARNING:' should be fully upper-cased, or fully lower-cased +sc_error_message_warn_fatal: + @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \ + | grep -E '"Warning|"Fatal|"fatal' && \ + { echo '$(ME): use FATAL, WARNING or warning' 1>&2; \ + exit 1; } || : + +# Error messages should not start with a capital letter +sc_error_message_uppercase: + @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \ + | grep -E '"[A-Z]' \ + | grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \ + { echo '$(ME): found capitalized error message' 1>&2; \ + exit 1; } || : + +# Error messages should not end with a period +sc_error_message_period: + @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \ + | grep -E '[^."]\."' && \ + { echo '$(ME): found error message ending in period' 1>&2; \ + exit 1; } || : + +sc_file_system: + @grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): found use of "file''system";' \ + 'rewrite to use "file system"' 1>&2; \ + exit 1; } || : + +# Don't use cpp tests of this symbol. All code assumes config.h is included. +sc_no_have_config_h: + @grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): found use of HAVE''_CONFIG_H; remove' \ + 1>&2; exit 1; } || : + +# Nearly all .c files must include . +sc_require_config_h: + @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \ + grep -L '^# *include ' \ + $$($(VC_LIST_EXCEPT) | grep '\.c$$') \ + | grep . && \ + { echo '$(ME): the above files do not include ' \ + 1>&2; exit 1; } || :; \ + else :; \ + fi + +# To use this "command" macro, you must first define two shell variables: +# h: the header, enclosed in <> or "" +# re: a regular expression that matches IFF something provided by $h is used. +define _header_without_use + h_esc=`echo "$$h"|sed 's/\./\\./'`; \ + if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \ + files=$$(grep -l '^# *include '"$$h_esc" \ + $$($(VC_LIST_EXCEPT) | grep '\.c$$')) && \ + grep -LE "$$re" $$files | grep . && \ + { echo "$(ME): the above files include $$h but don't use it" \ + 1>&2; exit 1; } || :; \ + else :; \ + fi +endef + +# Prohibit the inclusion of assert.h without an actual use of assert. +sc_prohibit_assert_without_use: + @h='' re='\' \ + $$($(VC_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]' \ + $$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \ + { echo '$(ME): do not use jm_ in m4 macro names' \ + 1>&2; exit 1; } || : + +# Ensure that each root-requiring test is run via the "check-root" rule. +sc_root_tests: + @if test -d tests \ + && grep check-root tests/Makefile.am>/dev/null 2>&1; then \ + t1=sc-root.expected; t2=sc-root.actual; \ + grep -nl '^require_root_$$' \ + $$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \ + sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \ + $(srcdir)/tests/Makefile.am \ + | sed 's/^ *//;/^root_tests =/d' \ + | tr -s '\012\\' ' ' | fmt -1 | 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; } || :; \ + fi + +headers_with_interesting_macro_defs = \ + exit.h \ + fcntl_.h \ + fnmatch_.h \ + intprops.h \ + inttypes_.h \ + lchown.h \ + openat.h \ + stat-macros.h \ + stdint_.h + +# Create a list of regular expressions matching the names +# of macros that are guaranteed by parts of gnulib to be defined. +.re-defmac: + @(cd $(srcdir)/lib; \ + for f in $(headers_with_interesting_macro_defs); do \ + test -f $$f && \ + sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \ + done; \ + ) | sort -u \ + | grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \ + | sed 's/^/^# *define /' \ + > $@-t + @mv $@-t $@ + +# Don't define macros that we already get from gnulib header files. +sc_always_defined_macros: .re-defmac + @if test -f $(srcdir)/src/system.h; then \ + trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \ + grep -f .re-defmac $$($(VC_LIST)) \ + && { echo '$(ME): define the above via some gnulib .h file' \ + 1>&2; exit 1; } || :; \ + fi + +# 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 \ + $$($(VC_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 + +# Ensure that each .c file containing a "main" function also +# calls set_program_name. +sc_program_name: + @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \ + files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \ + grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files \ + | grep . && \ + { echo '$(ME): the above files do not call set_program_name' \ + 1>&2; exit 1; } || :; \ + else :; \ + fi + +# Require that the final line of each test-lib.sh-using test be this one: +# (exit $fail); exit $fail +# Note: this test requires GNU grep's --label= option. +sc_require_test_exit_idiom: + @if test -f $(srcdir)/tests/test-lib.sh; then \ + die=0; \ + for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \ + tail -n1 $$i | grep '^(exit \$$fail); exit \$$fail$$' > /dev/null \ + && : || { die=1; echo $$i; } \ + done; \ + test $$die = 1 && \ + { echo 1>&2 '$(ME): the final line in each of the above is not:'; \ + echo 1>&2 '(exit $$fail); exit $$fail'; \ + exit 1; } || :; \ + fi + +sc_sun_os_names: + @grep -nEi \ + 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \ + $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \ + exit 1; } || : + +sc_the_the: + @grep -ni '\' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): found use of "the ''the";' 1>&2; \ + exit 1; } || : + +sc_tight_scope: + $(MAKE) -C src $@ + +sc_trailing_blank: + @grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): found trailing blank(s)' \ + 1>&2; exit 1; } || : + +# Match lines like the following, but where there is only one space +# between the options and the description: +# -D, --all-repeated[=delimit-method] print all duplicate lines\n +longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)? +sc_two_space_separator_in_usage: + @grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \ + $$($(VC_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 \ + '\&2; \ + exit 1; } || : + +# Avoid useless parentheses like those in this example: +# #if defined (SYMBOL) || defined (SYM2) +sc_useless_cpp_parens: + @grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): found useless parentheses in cpp directive' \ + 1>&2; exit 1; } || : + +# Require the latest GPL. +sc_GPL_version: + @grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || : + +# Perl-based tests used to exec perl from a #!/bin/sh script. +# Now they all start with #!/usr/bin/perl and the portability +# infrastructure is in tests/Makefile.am. Make sure no old-style +# script sneaks back in. +sc_no_exec_perl_coreutils: + @if test -f $(srcdir)/tests/Coreutils.pm; then \ + grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \ + { echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \ + exit 1; } || :; \ + fi + +NEWS_hash = \ + $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \ + $(srcdir)/NEWS | md5sum -) + +# Ensure that we don't accidentally insert an entry into an old NEWS block. +sc_immutable_NEWS: + @if test -f $(srcdir)/NEWS; then \ + test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \ + { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \ + fi + +# Each program that uses proper_name_utf8 must link with +# one of the ICONV libraries. +sc_proper_name_utf8_requires_ICONV: + @progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\ + if test "x$$progs" != x; then \ + fail=0; \ + for p in $$progs; do \ + dir=$$(dirname "$$p"); \ + base=$$(basename "$$p" .c); \ + grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \ + || { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \ + done; \ + test $$fail = 1 && \ + { echo 1>&2 '$(ME): the above do not link with any ICONV library'; \ + exit 1; } || :; \ + fi + +# Warn about "c0nst struct Foo const foo[]", +# but not about "char const *const foo" or "#define const const". +sc_redundant_const: + @grep -E '\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \ + $$($(VC_LIST_EXCEPT)) && \ + { echo 1>&2 '$(ME): redundant "const" in declarations'; \ + exit 1; } || : + +sc_const_long_option: + @grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \ + | grep -Ev 'const struct option|struct option const' && { \ + echo 1>&2 '$(ME): add "const" to the above declarations'; \ + exit 1; } || : + +# Update the hash stored above. Do this after each release and +# for any corrections to old entries. +update-NEWS-hash: NEWS + perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \ + $(srcdir)/cfg.mk + +epoch_date = 1970-01-01 00:00:00.000000000 +0000 +# Ensure that the c99-to-c89 patch applies cleanly. +patch-check: + rm -rf src-c89 $@.1 $@.2 + cp -a src src-c89 + (cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \ + > $@.1 2>&1 + if test "$(REGEN_PATCH)" = yes; then \ + diff -upr src src-c89 | sed 's,src-c89/,src/,' \ + | grep -vE '^(Only in|File )' \ + | perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/;' \ + -e 's/^ $$//' \ + > new-diff || : ; fi + grep -v '^patching file ' $@.1 > $@.2 || : + msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \ + rm -f src-c89/*.o || msg='rm failed'; \ + $(MAKE) -C src-c89 CFLAGS='-Wdeclaration-after-statement -Werror' \ + || msg='compile failure with extra options'; \ + test "$$msg" = ok && rm -rf src-c89 $@.1 $@.2 || echo "$$msg" 1>&2; \ + test "$$msg" = ok + +# 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 + +check-AUTHORS: + $(MAKE) -C src $@ + +# 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 '$(ME): 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 '$(ME): quote the first arg to AC_DEFUN' 1>&2; \ + exit 1; } || : + +# Verify that all source files using _() are listed in po/POTFILES.in. +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 $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \ + case $$file in \ + *.?|*.??) ;; \ + *) 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 '\b(N?_|gettext *)\([^)"]*("|$$)' $$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 '$(ME): 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 = '$(ME): 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 \ + for file in $(distdir).tar.gz \ + $(release_archive_dir)/$(distdir).tar.gz; do \ + test -e $$file || continue; \ + test -w $$file \ + || { echo ERROR: $$file is not writable; fail=1; }; \ + done; \ + test "$$fail" && exit 1 || : ; \ + fi + +v_etc_file = lib/version-etc.c +sample-test = tests/sample-test +texi = doc/$(PACKAGE).texi +# Make sure that the copyright date in $(v_etc_file) is up to date. +# Do the same for the $(sample-test) and the main doc/.texi file. +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 + @if test -f $(sample-test); then \ + grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \ + >/dev/null \ + || { echo 'out of date copyright in $(sample-test); update it' 1>&2; \ + exit 1; }; \ + fi + @if test -f $(texi); then \ + grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \ + >/dev/null \ + || { echo 'out of date copyright in $(texi); update it' 1>&2; \ + exit 1; }; \ + fi + +vc-diff-check: + $(VC) diff > vc-diffs || : + if test -s vc-diffs; then \ + cat vc-diffs; \ + echo "Some files are locally modified:" 1>&2; \ + exit 1; \ + else \ + rm vc-diffs; \ + fi + +cvs-check: vc-diff-check + +maintainer-distcheck: + $(MAKE) distcheck + $(MAKE) my-distcheck + + +# Don't make a distribution if checks fail. +# Also, make sure the NEWS file is up-to-date. +vc-dist: $(local-check) cvs-check maintainer-distcheck + $(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 + +built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list) + +warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith +bin=bin-$$$$ + +write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)' + +TMPDIR ?= /tmp +t=$(TMPDIR)/$(PACKAGE)/test +pfx=$(t)/i + +# Verify that a twisted use of --program-transform-name=PROGRAM works. +define install-transform-check + rm -rf $(pfx); \ + $(MAKE) program_transform_name='s/.*/zyx/' \ + prefix=$(pfx) install \ + && test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \ + && test "$$(echo $(pfx)/share/man/man1/*)" = \ + "$(pfx)/share/man/man1/zyx.1" +endef + +# Install, then verify that all binaries and man pages are in place. +# Note that neither the binary, ginstall, nor the ].1 man page is installed. +define my-instcheck + $(MAKE) prefix=$(pfx) install \ + && test ! -f $(pfx)/bin/ginstall \ + && { fail=0; \ + for i in $(built_programs); do \ + test "$$i" = ginstall && i=install; \ + for j in "$(pfx)/bin/$$i" \ + "$(pfx)/share/man/man1/$$i.1"; do \ + case $$j in *'[.1') continue;; esac; \ + test -f "$$j" && : \ + || { echo "$$j not installed"; fail=1; }; \ + done; \ + done; \ + test $$fail = 1 && exit 1 || :; \ + } +endef + +# Use -Wformat -Werror to detect format-string/arg-list mismatches. +# Also, check for shadowing problems with -Wshadow, and for pointer +# arithmetic problems with -Wpointer-arith. +# These CFLAGS are pretty strict. If you build this target, you probably +# have to have a recent version of gcc and glibc headers. +# The hard-linking for-loop below ensures that there is a bin/ directory +# full of all of the programs under test (except the ones that are required +# for basic Makefile rules), all symlinked to the just-built "false" program. +# This is to ensure that if ever a test neglects to make PATH include +# the build srcdir, these always-failing programs will run. +# Otherwise, it is too easy to test the wrong programs. +# Note that "false" itself is a symlink to true, so it too will malfunction. +my-distcheck: $(DIST_ARCHIVES) $(local-check) + $(MAKE) syntax-check + $(MAKE) check + -rm -rf $(t) + mkdir -p $(t) + GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz + cd $(t)/$(distdir) \ + && ./configure --disable-nls \ + && $(MAKE) CFLAGS='$(warn_cflags)' \ + AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \ + && $(MAKE) dvi \ + && $(install-transform-check) \ + && $(my-instcheck) \ + && mkdir $(bin) \ + && ($(write_loser)) > $(bin)/loser \ + && chmod a+x $(bin)/loser \ + && for i in $(built_programs); do \ + case $$i in \ + rm|expr|basename|echo|sort|ls|tr);; \ + cat|dirname|mv|wc);; \ + *) ln $(bin)/loser $(bin)/$$i;; \ + esac; \ + done \ + && ln -sf ../src/true $(bin)/false \ + && PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \ + && { test -d gnulib-tests \ + && $(MAKE) -C gnulib-tests check \ + || :; } \ + && rm -rf $(bin) \ + && $(MAKE) distclean + (cd $(t) && mv $(distdir) $(distdir).old \ + && $(AMTAR) -zxf - ) < $(distdir).tar.gz + diff -ur $(t)/$(distdir).old $(t)/$(distdir) + if test -f $(srcdir)/src/c99-to-c89.diff; then \ + cd $(t)/$(distdir) \ + && (cd src && patch -V never --fuzz=0 $$md5_tmp; \ + md5sum -c $$md5_tmp < $$tarz + +rel-files = $(DIST_ARCHIVES) + +gnulib-version = $$(cd $(gnulib_dir) && git describe) + +announcement: NEWS ChangeLog $(rel-files) + @./build-aux/announce-gen \ + --release-type=$(RELEASE_TYPE) \ + --package=$(PACKAGE) \ + --prev=$(PREV_VERSION) \ + --curr=$(VERSION) \ + --gpg-key-id=$(gpg_key_ID) \ + --news=NEWS \ + --bootstrap-tools=autoconf,automake,flex,gnulib \ + --gnulib-version=$(gnulib-version) \ + $(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 + +emit_upload_commands: + @echo ===================================== + @echo ===================================== + @echo "$(srcdir)/build-aux/gnupload $(GNUPLOADFLAGS) \\" + @echo " --to $(gnu_rel_host):$(PACKAGE) \\" + @echo " $(rel-files)" + @echo '# send the /tmp/announcement e-mail' + @echo ===================================== + @echo ===================================== + +noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?] +define emit-commit-log + printf '%s\n' 'post-release administrivia' '' \ + '* NEWS: Add header line for next release.' \ + '* .prev-version: Record previous version.' \ + '* cfg.mk (old_NEWS_hash): Auto-update.' +endef + +.PHONY: alpha beta major +alpha beta major: $(local-check) writable-files + test $@ = major \ + && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \ + || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\ + || : + $(MAKE) vc-dist + $(MAKE) news-date-check + $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) + if test -d $(release_archive_dir); then \ + ln $(rel-files) $(release_archive_dir); \ + chmod a-w $(rel-files); \ + fi + $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@ + echo $(VERSION) > $(prev_version_file) + $(MAKE) update-NEWS-hash + perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS + $(emit-commit-log) > .ci-msg + $(VC) commit -F .ci-msg diff --git a/packaging/bison.changes b/packaging/bison.changes new file mode 100644 index 0000000..ff759f1 --- /dev/null +++ b/packaging/bison.changes @@ -0,0 +1,2 @@ +*Thu Jul 28 2011 Junfeng Dong - 2.4.1 +- Setup 2.4.1. diff --git a/packaging/bison.manifest b/packaging/bison.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/bison.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/bison.spec b/packaging/bison.spec new file mode 100644 index 0000000..e0275a9 --- /dev/null +++ b/packaging/bison.spec @@ -0,0 +1,80 @@ +Name: bison +Version: 2.4.1 +Release: 1 +License: GPLv2+ +Summary: A GNU general-purpose parser generator +Url: http://www.gnu.org/software/bison/ +Group: Development/Tools +Source: ftp://ftp.gnu.org/pub/gnu/bison/bison-%{version}.tar.bz2 +Source1001: packaging/bison.manifest +BuildRequires: m4 >= 1.4 +Requires: m4 >= 1.4 + +%description +Bison is a general purpose parser generator that converts a grammar +description for an LALR(1) context-free grammar into a C program to +parse that grammar. Bison can be used to develop a wide range of +language parsers, from ones used in simple desk calculators to complex +programming languages. Bison is upwardly compatible with Yacc, so any +correctly written Yacc grammar should work with Bison without any +changes. If you know Yacc, you shouldn't have any trouble using +Bison. You do need to be very proficient in C programming to be able +to use Bison. Bison is only needed on systems that are used for +development. + +If your system will be used for C development, you should install +Bison. + +%package devel +Summary: -ly library for development using Bison-generated parsers +Group: Development/Libraries + +%description devel +The bison-devel package contains the -ly library sometimes used by +programs using Bison-generated parsers. If you are developing programs +using Bison, you might want to link with this library. This library +is not required by all Bison-generated parsers, but may be employed by +simple programs to supply minimal support for the generated parsers. + +# -ly is kept static. It only contains two symbols: main and yyerror, +# and both of these are extremely simple (couple lines of C total). +# It doesn't really pay off to introduce a shared library for that. +# +# Therefore -devel subpackage could have been created as -static, but +# the split was done in Jan 2005, which predates current guidelines. +# Besides there is logic to that: the library is devel in the sense +# that the generated parser could be distributed together with other +# sources, and only bison-devel would be necessary to wrap the build. + +%prep +%setup -q + +%build +cp %{SOURCE1001} . +%configure --disable-nls +make + +%install +%makeinstall + +# Remove unpackaged files. +rm -f %{buildroot}/%{_bindir}/yacc +rm -f %{buildroot}/%{_mandir}/man1/yacc* +rm -rf %{buildroot}/%{_infodir} + + +# The distribution contains also source files. These are used by m4 +# when the target parser file is generated. +%files +%manifest bison.manifest +%defattr(-,root,root,-) +%doc AUTHORS NEWS README THANKS TODO +%{_mandir}/*/bison* +%{_datadir}/bison +%{_bindir}/bison +%{_datadir}/aclocal/bison*.m4 + +%files devel +%manifest bison.manifest +%defattr(-,root,root) +%{_libdir}/liby.a diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..f4a4763 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,23 @@ +da +de +el +es +et +fr +ga +hr +id +it +ja +ms +nb +nl +pl +pt_BR +ro +ru +sv +tr +uk +vi +zh_TW diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..e7d1ab2 --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,395 @@ +# -*- buffer-read-only: t -*- vi: set ro: +# DO NOT EDIT! GENERATED AUTOMATICALLY! +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License but which still want to provide support for the GNU gettext +# functionality. +# Please note that the actual code of GNU gettext is covered by the GNU +# General Public License and is *not* in the public domain. +# +# Origin: gettext-0.15 + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +localedir = @localedir@ +gettextsrcdir = $(datadir)/gettext/po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +mkinstalldirs = $(SHELL) @install_sh@ -d +mkdir_p = @mkdir_p@ + +GMSGFMT_ = @GMSGFMT@ +GMSGFMT_no = @GMSGFMT@ +GMSGFMT_yes = @GMSGFMT_015@ +GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) +MSGFMT_ = @MSGFMT@ +MSGFMT_no = @MSGFMT@ +MSGFMT_yes = @MSGFMT_015@ +MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) +XGETTEXT_ = @XGETTEXT@ +XGETTEXT_no = @XGETTEXT@ +XGETTEXT_yes = @XGETTEXT_015@ +XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) +MSGMERGE = msgmerge +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter + +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) + +POTFILES = \ + +CATALOGS = @CATALOGS@ + +# Makevars gets inserted here. (Don't remove this line!) + +.SUFFIXES: +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update + +.po.mo: + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +.po.gmo: + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ + + +all: all-@USE_NLS@ + +all-yes: stamp-po +all-no: + +# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no +# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because +# we don't want to bother translators with empty POT files). We assume that +# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. +# In this case, stamp-po is a nop (i.e. a phony target). + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + test ! -f $(srcdir)/$(DOMAIN).pot || \ + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @test ! -f $(srcdir)/$(DOMAIN).pot || { \ + echo "touch stamp-po" && \ + echo timestamp > stamp-poT && \ + mv stamp-poT stamp-po; \ + } + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ + msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ + else \ + msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ + fi; \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address="$$msgid_bugs_address" + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(srcdir)/$(DOMAIN).pot + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + if test -f "$(srcdir)/$${lang}.po"; then \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +install-data-no: all +install-data-yes: all + $(mkdir_p) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + $(mkdir_p) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done + +check: all + +info dvi ps pdf html tags TAGS ctags CTAGS ID: + +mostlyclean: + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f stamp-po $(GMOFILES) + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: + $(MAKE) update-po + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: stamp-po $(DISTFILES) + dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + dists="$$dists $(DOMAIN).pot stamp-po"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ + for file in $$dists; do \ + if test -f $$file; then \ + cp -p $$file $(distdir) || exit 1; \ + else \ + cp -p $(srcdir)/$$file $(distdir) || exit 1; \ + fi; \ + done + +update-po: Makefile + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) + $(MAKE) update-gmo + +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + +update-gmo: Makefile $(GMOFILES) + @: + +Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ + cd $(top_builddir) \ + && $(SHELL) ./config.status $(subdir)/$@.in po-directories + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..727a94d --- /dev/null +++ b/po/Makevars @@ -0,0 +1,55 @@ +# -*- buffer-read-only: t -*- vi: set ro: +# DO NOT EDIT! GENERATED AUTOMATICALLY! +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ \ + \ + --flag=_:1:pass-c-format\ + --flag=N_:1:pass-c-format\ + --flag=error:3:c-format --flag=error_at_line:5:c-format\ +\ + --from-code=UTF-8\ + --flag=asprintf:2:c-format\ + --flag=complain:1:c-format --flag=complain_at:2:c-format\ + --flag=fatal:1:c-format --flag=fatal_at:2:c-format\ + --flag=warn:1:c-format --flag=warn_at:2:c-format\ + --flag=unexpected_end:2:c-format\ + $${end_of_xgettext_options+} + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Free Software Foundation, Inc. + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = bug-bison@gnu.org + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..d39ca4c --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,25 @@ +src/complain.c +src/conflicts.c +src/files.c +src/getargs.c +src/gram.c +src/location.c +src/main.c +src/parse-gram.y +src/print.c +src/reader.c +src/reduce.c +src/scan-code.l +src/scan-gram.l +src/symlist.c +src/symtab.c + +lib/argmatch.c +lib/bitset_stats.c +lib/error.c +lib/getopt.c +lib/obstack.c +lib/quotearg.c +lib/subpipe.c +lib/timevar.c +lib/xalloc-die.c diff --git a/po/Rules-quot b/po/Rules-quot new file mode 100644 index 0000000..9c2a995 --- /dev/null +++ b/po/Rules-quot @@ -0,0 +1,47 @@ +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/po/bison.pot b/po/bison.pot new file mode 100644 index 0000000..f7ac105 --- /dev/null +++ b/po/bison.pot @@ -0,0 +1,798 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "" + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "" +msgstr[1] "" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "" +msgstr[1] "" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "" + +#: src/gram.c:112 +msgid "empty" +msgstr "" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr "" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr "" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr "" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "" + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "" + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "" + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr "" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "" diff --git a/po/boldquot.sed b/po/boldquot.sed new file mode 100644 index 0000000..4b937aa --- /dev/null +++ b/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g +s/“/“/g +s/”/”/g +s/‘/‘/g +s/’/’/g diff --git a/po/da.gmo b/po/da.gmo new file mode 100644 index 0000000..e62a784 Binary files /dev/null and b/po/da.gmo differ diff --git a/po/da.po b/po/da.po new file mode 100644 index 0000000..0389cb3 --- /dev/null +++ b/po/da.po @@ -0,0 +1,935 @@ +# Danish messages for bison. +# Copyright © 2001, 2002 Free Software Foundation, Inc. +# Keld Simonsen , 2002. +# Byrial Ole Jensen , 2002-2004. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 1.875d\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2004-05-22 11:14+0200\n" +"Last-Translator: Byrial Ole Jensen \n" +"Language-Team: Danish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "advarsel" + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "fatal fejl: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Konflikt mellem regel %d og element %s løstes som skift" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Konflikt mellem regel %d og element %s løstes som reducér" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Konflikt mellem regel %d og element %s løstes som en fejl" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "konflikter: %d skift/reducér, %d reducér/reducér\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "konflikter: %d skift/reducér\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "konflikter: %d reducér/reducér\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Tilstand %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr kan kun bruges ved GLR-fortolkere" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "forventede %d skift/reducér-konflikt" +msgstr[1] "forventede %d skift/reducér-konflikter" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "forventede %d reducér/reducér-konflikt" +msgstr[1] "forventede %d reducér/reducér-konflikter" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "kan ikke åbne filen \"%s\"" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "Fejl ved ind- eller udlæsning" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "kan ikke lukke fil" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "konfliktende uddata til filen %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Prøv med \"%s --help\" for mere information.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Brug: %s [FLAG]... FIL\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Fortolker:\n" +" -S, --skeleton=FIL angiv skeletfilen som skal bruges\n" +" -t, --debug instrumentér fortolkeren for fejlsøgning\n" +" --locations aktivér tilstandsberegning\n" +" -p, --name-prefix=PRÆFIKS tilføj PRÆFIKS for eksterne symboler\n" +" -l, --no-lines generér ikke \"#line\"-direktiver\n" +" -n, --no-parser generér kun tabellerne\n" +" -k, --token-table inkludér en tabel over elementnavne\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Uddata:\n" +" -d, --defines lav også en hovedfil\n" +" -r, --report=SAGER lav også detaljer om automaten\n" +" -v, --verbose samme som \"--report=state\"\n" +" -b, --file-prefix=PRÆFIKS angiv et PRÆFIKS for uddatafiler\n" +" -o, --output=FIL læg uddata i FIL\n" +" -g, --graph lav også en VCG-beskrivelse af automaten\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +#, fuzzy +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"TING er en liste med kommaseparerede ord som kan indeholde:\n" +" \"state\" beskriv tilstandene\n" +" \"itemset\" komplettér kerneobjektmængderne med deres afslutninger\n" +" \"lookahead\" kobl udtrykkeligt fremadkig til objekter\n" +" \"solved\" beskriv løsninger af skift/reducér-konflikter\n" +" \"all\" inkludér al ovenstående information\n" +" \"none\" deaktivér rapporten\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"Rapportér fejl til .\n" +"Rapportér synpunkter om oversættelsen til .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Skrevet af Robert Corbett og Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright © %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dette er frit programmel, se kildekoden for kopieringsbetingelser. Der\n" +"gives INGEN garanti, endog ikke for SALGBARHED eller EGNETHED FOR NOGET\n" +"BESTEMT FORMÅL.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "flere %s-deklarationer" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "fejlagtig værdi: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "flere %s-deklarationer" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "manglende operand efter \"%s\"" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "overtallig operand \"%s\"" + +#: src/gram.c:112 +msgid "empty" +msgstr "tom" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammatik" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "regel aldrig reduceret på grund af konflikter" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "manglende identifikator i parameterdeklaration" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " type %d er %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "skift, og gå til tilstand %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "gå til tilstand %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "fejl (ikke-associativ)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "reducér med regel %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "acceptér" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "tilstand %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminaler, med regler hvor de forekommer" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Ikke-terminaler, med regler hvor de forekommer" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " til venstre:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " til højre:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "regel aldrig reduceret på grund af konflikter" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "flere %s-deklarationer" + +#: src/reader.c:131 +#, fuzzy, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "resultattypekonflikt ved sammenfletningsfunktion %s: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "flere %s-deklarationer" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "regel givet for %s som er et element" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "typekonflikt for standardhandling: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "tom regel for typet ikke-terminal, og ingen handling" + +#: src/reader.c:290 +#, fuzzy, c-format +msgid "unused value: $%d" +msgstr "fejlagtig værdi: %s" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "kun en %s tilladt per regel" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s påvirker kun GLR-fortolkere" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s skal følges af et positivt tal" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "ingen regler i inddatagrammatikken" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "ingen regler i inddatagrammatikken" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Ikke-terminaler, med regler hvor de forekommer" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "ingen regler i inddatagrammatikken" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "ingen regler i inddatagrammatikken" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "ingen regler i inddatagrammatikken" +msgstr[1] "ingen regler i inddatagrammatikken" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "startsymbolet %s genererer ingen sætninger" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d for \"%s\" har ingen erklæret type" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ for \"%s\" har ingen erklæret type" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d for \"%s\" har ingen erklæret type" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "heltal uden for gyldigshedsområdet: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "Malplaceret \",\" behandlet som blanktegn" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "ugyldigt direktiv: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "ugyldigt tegn: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "ugyldigt NUL-tegn" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "ugyldig undvigesekvens: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "ugyldigt NUL-tegn: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "ukendt undvigesekvens: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "manglende \"%s\" ved slutningen af filen" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "manglende \"%s\" ved slutningen af linjen" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "fejlagtig værdi: %s" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "gentagen %s-erklæring for %s" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "gentagen %s-erklæring for %s" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "symbol %s redefineret" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "symbol %s redefineret" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "redefinition af elementnummer for %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"symbol %s bruges, men er ikke defineret som et element og har ingen regler" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "symbol \"%s\" bruges mere end en gang som en bogstavelig streng" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "symbol \"%s\" har fået mere end én bogstavelig streng" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "elementerne %s og %s har begge fået nummer %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "startsymbolet %s er udefineret" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "startsymbolet %s er et element" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "ugyldigt argument %s til %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "flertydigt argument %s til %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Gyldige argumenter er:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitmængdeallokeringer, %u frigjort (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitmængdeindstillinger, %u cachede (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitmængdenulstillinger, %u cachede (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitmængdetest, %u cachede (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitmængdelister\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "kaldsloghistogram\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "størrelsesloghistogram\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "densitetshistogram\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Bitmængdestatistik:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Akkumulerede kørsler = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Kunne ikke læse statistikfil." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Dårlig statistikfilstørrelse.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Kunne ikke skrive statistikfil." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Kunne ikke åbne statistikfil for skrivning." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Ukendt systemfejl" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: flaget \"%s\" er flertydigt\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: flaget \"--%s\" tager intet argument\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: flaget \"%c%s\" tager intet argument\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: flaget \"%s\" behøver et argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ukendt flag \"--%s\"\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ukendt flag \"%c%s\"\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ikke tilladt flag -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ugyldigt flag --%c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: flaget behøver et argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: flaget \"-W %s\" er flertydigt\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: flaget \"-W %s\" tager intet argument\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "hukommelsen opbrugt" + +# Når vi går over til Unicode mere allmænt måske vi bør oversættta båda disse +# med U+201D (RIGHT DOUBLE QUOTATION MARK) på svenska. Eller? +# +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "\"" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "hjælpeprogrammet \"%s\" kunne ikke startes" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Udførelsestider (sekunder)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTALT :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "tid i %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "warning: " +#~ msgstr "advarsel: " + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison genererer fortolkere til LALR(1)-grammatiker.\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Hvis et lang flag viser et argument som obligatorisk, er det også\n" +#~ "obligatorisk for det tilsvarende korte flag. Tilsvarende\n" +#~ "for valgfrie argumenter.\n" + +#~ msgid "" +#~ "Operation modes:\n" +#~ " -h, --help display this help and exit\n" +#~ " -V, --version output version information and exit\n" +#~ " -y, --yacc emulate POSIX yacc\n" +#~ msgstr "" +#~ "Arbejdstilstande:\n" +#~ " -h, --help vis denne hjælpetekst og afslut\n" +#~ " -V, --version vis versionsinformation og afslut\n" +#~ " -y, --yacc emulér POSIX-yacc\n" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX forbyder deklarationer i grammatikken" + +#~ msgid "Rules never reduced" +#~ msgstr "Aldrig reducerede regler" + +#~ msgid "useless rule" +#~ msgstr "ubrugelig regel" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "ubrugelig ikke-terminal: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Ubrugelige ikke-terminaler" + +#~ msgid "Terminals which are not used" +#~ msgstr "Terminaler som ikke bruges" + +#~ msgid "Useless rules" +#~ msgstr "Ubrugelige regler" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d regel reduceres aldrig\n" +#~ msgstr[1] "%d regler reduceres aldrig\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d ubrugelig ikke-terminal" +#~ msgstr[1] "%d ubrugelige ikke-terminaler" + +#~ msgid " and " +#~ msgstr " og " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d ubrugelig regel" +#~ msgstr[1] "%d ubrugelige regler" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "manglende \"{\" i \"%s\"" + +#~ msgid "invalid $ value" +#~ msgstr "fejlagtig $-værdi" + +#~ msgid "type redeclaration for %s" +#~ msgstr "gentagen typeerklæring for %s" + +#~ msgid "redefining precedence of %s" +#~ msgstr "redefinition af præcedens for %s" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "modstridige præcedenser mellem %s og %s" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "modstridige associativiteter for %s (%s) og %s (%s)" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "hjælpeprogrammet \"%s\" ikke fundet" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "hjælpeprogrammet \"%s\" fejlede" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "hjælpeprogrammet \"%s\" fejlede med afslutningskode %d" diff --git a/po/de.gmo b/po/de.gmo new file mode 100644 index 0000000..c1783d0 Binary files /dev/null and b/po/de.gmo differ diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..b736cbd --- /dev/null +++ b/po/de.po @@ -0,0 +1,1234 @@ +# This file is distributed under the same license as the bison package. +# German translation for message of GNU bison. +# Copyright (C) 1996 Free Software Foundation, Inc. +# Ulrich Drepper , 1996. +# Michael Piefel , 2002, 2003, 2004, 2005, 2006, 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.4\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-11-04 08:55+0100\n" +"Last-Translator: Michael Piefel \n" +"Language-Team: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "Warnung" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "fataler Fehler" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "" +" Konflikt zwischen Regel %d and Token %s wurde durch Schieben gelöst" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" +" Konflikt zwischen Regel %d and Token %s wurde durch Reduzierung gelöst" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" +" Konflikt zwischen Regel %d and Token %s wurde als Fehler betrachtet" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "Konflikte: %d Schiebe/Reduziere, %d Reduziere/Reduziere\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "Konflikte: %d Schiebe/Reduziere\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "Konflikte: %d Reduziere/Reduziere\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Zustand %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr betrifft nur GLR-Parser" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "erwartete %d Schiebe/Reduziere-Konflikt" +msgstr[1] "erwartete %d Schiebe/Reduziere-Konflikte" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "erwartete %d Reduziere/Reduziere-Konflikt" +msgstr[1] "erwartete %d Reduziere/Reduziere-Konflikte" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "kann Datei „%s“ nicht öffnen" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "E/A-Fehler" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "kann Datei nicht schließen" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "werde die Eingabedatei %s nicht überschreiben" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "widersprüchliche Ausgaben in Datei %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "„%s --help“ gibt weitere Informationen.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Aufruf: %s [OPTION]... DATEI\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" +"Generiert LALR(1)- und GLR-Parser.\n" +"\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" +"Erforderliche Argumente für lange Optionen sind auch für Kurzformen " +"erforderlich.\n" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "Das gleiche gilt für optionale Argumente.\n" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"\n" +"Arbeitsmodi:\n" +" -h, --help diese Hilfe anzeigen und beenden\n" +" -V, --version Versionsinformation anzeigen und beenden\n" +" --print-localedir Verzeichnis mit Locale-abhängigen Daten " +"anzeigen\n" +" --print-datadir Verzeichnis mit Skeletten und XSLT anzeigen\n" +" -y, --yacc POSIX’ Yacc emulieren\n" +" -W, --warnings[=KATEGORIE] Warnungen, die in KATEGORIE fallen, anzeigen\n" + +#: src/getargs.c:272 +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parser:\n" +" -L, --language=SPRACHE die Ausgabesprache bestimmen\n" +" (eine experimentelle Funktion)\n" +" -S, --skeleton=DATEI zu benutzende Skelettdatei angeben\n" +" -t, --debug den Parser auf Debugging-Unterstützung " +"vorbereiten\n" +" --locations Standortberechnung ermöglichen\n" +" -p, --name-prefix=PRÄFIX PRÄFIX vor alle externen Symbole setzen\n" +" -l, --no-lines keine „#line“-Direktiven erzeugen\n" +" -k, --token-table eine Tabelle der Token-Namen mit einschließen\n" +"\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Ausgabe:\n" +" --defines[=DATEI] auch eine Header-Datei herstellen\n" +" -d genauso, aber DATEI kann nicht angegeben " +"werden\n" +" -r, --report=DINGE auch Details des Automaten ausgeben\n" +" --report-file=DATEI Report in DATEI ausgeben\n" +" -v, --verbose das Gleiche wie „--report=state“\n" +" -b, --file-prefix=PRÄFIX einen PRÄFIX für Ausgabe-Dateien angeben\n" +" -o, --output=DATEI Ausgabe in DATEI schreiben\n" +" -g, --graph[=DATEI] auch einen Graphen des Automaten herstellen\n" +" -x, --xml[=DATEI] auch einen XML-Report des Automaten herstellen\n" +" (das XML-Schema ist experimentell)\n" +"\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" +"Die Warnungs-Kategorien schließen ein:\n" +" „midrule-values“ nicht gesetzte oder nicht benutzte Werte inmitten einer " +"Regel\n" +" „yacc“ Inkompatibilitäten mit POSIX’ YACC\n" +" „all“ alle Warnungen\n" +" „no-KATEGORIE“ Warnungen in KATEGORIE abschalten\n" +" „none“ alle Warnungen abschalten\n" +" „error“ Warnungen als Fehler behandeln\n" +"\n" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"DINGE ist eine Liste kommagetrennter Wörter aus:\n" +" „state“ die Zustände beschreiben\n" +" „itemset“ die Kernsymbolmengen mit ihrem Abschluss vervollständigen\n" +" „lookahead“ explizit Vorschautoken mit Symbolen verbinden\n" +" „solved“ Schiebe-/Reduzier-Konfliktlösungen beschreiben\n" +" „all“ alle oben genannten Informationen\n" +" „none“ den Report abschalten\n" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"\n" +"Berichten Sie Fehler (auf Englisch, mit LC_ALL=C) an <%s>.\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Geschrieben von Robert Corbett und Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright © %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es\n" +"gibt keine Garantie; auch nicht für VERKAUFBARKEIT oder FÜR SPEZIELLE " +"ZWECKE.\n" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "mehrfache Skelett-Deklarationen sind ungültig" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "unzulässiger Sprache: „%s“" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "mehrfache Sprach-Deklarationen sind ungültig" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "fehlender Operand nach „%s“" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "zusätzlicher Operand „%s“" + +#: src/gram.c:112 +msgid "empty" +msgstr "leer" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammatik" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "Überlauf bei den Zeilennummern" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "Überlauf bei den Spaltennummern" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "Regel nutzlos im Parser wegen Konflikten" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "fehlender Bezeichner in Parameterdeklaration" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " Typ %d ist %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "schiebe und gehe zu Zustand %d über\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "gehe zu Zustand %d über\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "Fehler (nicht assoziativ)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "reduziere mit Regel %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "annehmen" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "Zustand %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminale und die Regeln, in denen sie verwendet werden" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Nicht-Terminal und die Regeln, in denen sie verwendet werden" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " auf der linken Seite:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " auf der rechten Seite:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "Regeln nutzlos im Parser wegen Konflikten" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "mehr als eine %s-Deklaration" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "Rückgabetyp-Konflikt in merge-Funktion „%s“: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "vorhergehende Deklaration" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "Regel für %s vorhanden, welches aber ein Token ist" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "Typkonflikt bei Default-Aktion: <%s> != <%s>) " + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "leere Regel für Nicht-Terminal mit Typ und keine Aktion" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "unzulässiger Wert: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "nicht gesetzter Wert: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "nur ein %s pro Regel erlaubt" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s betrifft nur GLR-Parser" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s muss von positiver Zahl gefolgt sein" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "Regel ist zu lang" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "Eingabegrammatik enthält keine Regeln" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "Regeln nutzlos in Grammatik" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "Nicht-Terminal nutzlos in Grammatik: %s" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "Nicht-Terminale, die in Grammatik nutzlos sind" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "Terminale, die in Grammatik unbenutzt sind" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "Regeln, die in Grammatik nutzlos sind" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "%d Nicht-Terminal, das in Grammatik nutzlos ist" +msgstr[1] "%d Nicht-Terminale, die in Grammatik nutzlos sind" + +#: src/reduce.c:397 +#, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "%d Regel, die in Grammatik nutzlos ist" +msgstr[1] "%d Regeln, die in Grammatik nutzlos sind" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "es lassen sich keine Sätze vom Startsymbol %s ableiten" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "herumstreunendes „$“" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "herumstreunendes „@“" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "expliziter Typ angegeben und ungetypter Grammatik" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$$ für Regelmitte bei $%d von „%s“ hat keinen deklarierten Typ" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ von „%s“ hat keinen deklarierten Typ" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d von „%s“ hat keinen deklarierten Typ" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "Ganzzahl außerhalb des Wertebereichs: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "überzähliges „,“ als Freiraum betrachtet" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "ungültige Direktive: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "ungültiges Zeichen: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "ungültiges Null-Zeichen" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "unzulässiges Fluchtzeichen: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "ungültiges Null-Zeichen: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "unbekanntes Fluchtzeichen: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "fehlendes „%s“ am Ende der Datei" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "fehlendes „%s“ am Ende der Zeile" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "unzulässiger $-Wert: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "zu viele Symbole in Eingabegrammatik (Maximum ist %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s erneute Deklaration für %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s erneute Deklaration für <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "Symbol %s noch einmal definiert" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "Symbol %s noch einmal deklariert" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "definiere Nutzertokennummer von %s erneut" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"Symbol %s wird benutzt, ist aber nicht als Token definiert und hat keine " +"Regel" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "Symbol „%s“ wird mehr als einmal als literale Zeichenkette benutzt" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "Symbol „%s“ wird mehr als eine literale Zeichenkette gegeben" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "Token %s und %s haben die selbe Nummer %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "das Startsymbol %s ist undefiniert" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "das Startsymbol %s ist ein Token" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "erneute Deklaration für voreingestellten markierten %%destructor" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "erneute Deklaration für voreingestellten nicht-markierten %%destructor" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "erneute Deklaration für voreingestellten markierten %%printer" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "erneute Deklaration für voreingestellten nicht-markierten %%printer" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "unzulässiges Argument %s für %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "mehrdeutiges Argument %s für %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Gültige Argumente sind:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u freigegeben (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u zwischengespeichert (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u zwischengespeichert (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u zwischengespeichert (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "Zähler-Histogramm\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "Größe-Histogramm\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "Dichte-Histogramm\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Bitset-Statistiken:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Gesammelte Durchläufe = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Konnte Statistik-Datei nicht lesen." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Ungültige Statistik-Datei-Größe.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Konnte Statistik-Datei nicht schreiben." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Konnte Statistik-Datei nicht zum Schreiben öffnen." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Unbekannter Systemfehler" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: Option „%s“ ist mehrdeutig\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: Option „--%s“ erlaubt kein Argument\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: Option „%c%s“ erlaubt kein Argument\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: Option „%s“ erfordert ein Argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: unbekannte Option „--%s“\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: unbekannte Option „%c%s“\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ungültige Option -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ungültige Option -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: Option erfordert ein Argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: Option „-W %s“ ist mehrdeutig\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: Option „-W %s“ erlaubt kein Argument\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "Speicher ausgeschöpft" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "„" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "“" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "untergeordnetes Programm „%s“ konnte nicht aufgerufen werden" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Ausführungszeiten (Sekunden)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " ZUSAMMEN :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "Zeit in %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "%d nonterminal" +#~ msgid_plural "%d nonterminals" +#~ msgstr[0] "%d Nicht-Terminal" +#~ msgstr[1] "%d Nicht-Terminale" + +#~ msgid " and " +#~ msgstr " und " + +#~ msgid "%d rule" +#~ msgid_plural "%d rules" +#~ msgstr[0] "%d Regel" +#~ msgstr[1] "%d Regeln" + +#~ msgid " useless in grammar" +#~ msgstr " die in Grammatik nutzlos sind" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Wenn eine lange Option ein Argument als erforderlich anzeigt, dann ist es " +#~ "auch\n" +#~ "für die äquivalente kurze Option erforderlich. Ähnlich für optionale " +#~ "Argumente.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "niemals reduzierte Regeln" + +#~ msgid "useless rule" +#~ msgstr "nutzlose Regel" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "nutzloses Nicht-Terminal: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Nutzlose Nicht-Terminale" + +#~ msgid "Terminals which are not used" +#~ msgstr "Nicht genutzte Terminale" + +#~ msgid "Useless rules" +#~ msgstr "Nutzlose Regeln" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d Regel wurde niemals reduziert\n" +#~ msgstr[1] "%d Regeln wurden niemals reduziert\n" + +#~ msgid "warning: " +#~ msgstr "Warnung: " + +#~ msgid "missing `{' in %s" +#~ msgstr "fehlende „{“ in %s" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "untergeordnetes Programm „%s“ nicht gefunden" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "untergeordnetes Programm „%s“ fehlgeschlagen" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "untergeordnetes Programm „%s“ fehlgeschlagen (Rückgabewert %d)" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX verbietet Deklarationen in der Grammatik" + +#~ msgid "invalid $ value" +#~ msgstr "unzulässiger $-Wert" + +#~ msgid "type redeclaration for %s" +#~ msgstr "erneute Deklaration des Typs für %s" + +#~ msgid "redefining precedence of %s" +#~ msgstr "Vorrang von %s wird erneut definiert" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "Vorrang für %s und %s widersprechen sich" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "Assoziativitäts-Werte für %s (%s) und %s (%s) widersprechen sich" + +#~ msgid "%d shift/reduce conflict" +#~ msgid_plural "%d shift/reduce conflicts" +#~ msgstr[0] "%d Schiebe/Reduziere-Konflikt" +#~ msgstr[1] "%d Schiebe/Reduziere-Konflikte" + +#~ msgid "and" +#~ msgstr "und" + +#~ msgid "conflicts: " +#~ msgstr "Konflikte: " + +#~ msgid "State %d contains " +#~ msgstr "Zustand %d enthält " + +#~ msgid "too many gotos (max %d)" +#~ msgstr "zu viele Gotos (max %d)" + +#~ msgid ": unexpected end of file in a comment\n" +#~ msgstr ": Datei endet unerwartet innerhalb eines Kommentars\n" + +#~ msgid ": unexpected end of file in a string\n" +#~ msgstr ": Datei endet unerwartet innerhalb einer Zeichenkette\n" + +#~ msgid ": unexpected end of file in a character\n" +#~ msgstr ": Datei endet unerwartet innerhalb eines Zeichens\n" + +#~ msgid ": unexpected end of file in a braced code\n" +#~ msgstr ": Datei endet unerwartet innerhalb geklammerten Programmtexts\n" + +#~ msgid ": unexpected end of file in a prologue\n" +#~ msgstr ": Datei endet unerwartet innerhalb eines Prologs\n" + +#~ msgid "%s is invalid" +#~ msgstr "%s ist unzulässig" + +#~ msgid "too many states (max %d)" +#~ msgstr "zu viele Zustände (max %d)" + +#~ msgid "%s: no grammar file given\n" +#~ msgstr "%s: keine Grammatik-Datei angegeben\n" + +#~ msgid "%s: extra arguments ignored after `%s'\n" +#~ msgstr "%s: zusätzliche Argumente nach „%s“ werden ignoriert\n" + +#~ msgid "two @prec's in a row" +#~ msgstr "zwei @prec-Anweisungen nacheinander" + +#~ msgid "only one %%dprec allowed per rule" +#~ msgstr "nur ein %%dprec pro Regel erlaubt" + +#~ msgid "state_list_append (state = %d, symbol = %d (%s))\n" +#~ msgstr "state_list_append (Zustand = %d, Symbol = %d (%s))\n" + +#~ msgid "Entering new_itemsets, state = %d\n" +#~ msgstr "Betrete new_itemsets, Zustand = %d\n" + +#~ msgid "Entering get_state, symbol = %d (%s)\n" +#~ msgstr "Betrete get_state, Symbol = %d (%s)\n" + +#~ msgid "Exiting get_state => %d\n" +#~ msgstr "Verlasse get_state => %d\n" + +#~ msgid "Entering append_states, state = %d\n" +#~ msgstr "Betrete append_states, Zustand = %d\n" + +#~ msgid "Processing state %d (reached by %s)\n" +#~ msgstr "Verarbeite Zustand %d (erreicht von %s)\n" + +#~ msgid "undefined associativity" +#~ msgstr "undefinierte Assoziativität" + +#~ msgid "Closure: %s\n" +#~ msgstr "Abschluss: %s\n" + +#~ msgid " (rule %d)\n" +#~ msgstr " (Regel %d)\n" + +#~ msgid "input" +#~ msgstr "Eingabe" + +#~ msgid "output" +#~ msgstr "Ausgabe" + +#~ msgid "" +#~ "Variables\n" +#~ "---------\n" +#~ "\n" +#~ msgstr "" +#~ "Variablen\n" +#~ "---------\n" +#~ "\n" + +#~ msgid "Value Sprec Sassoc Tag\n" +#~ msgstr "Wert Spräz Sassoz Tag\n" + +#~ msgid "" +#~ "Rules\n" +#~ "-----\n" +#~ "\n" +#~ msgstr "" +#~ "Regeln\n" +#~ "-----\n" +#~ "\n" + +#~ msgid "" +#~ "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n" +#~ msgstr "" +#~ "Num (Präz, Assoz, Nützl., Ritem-Ber.) LS -> RS (Ritem-Ber.) [Num]\n" + +#~ msgid "" +#~ "Rules interpreted\n" +#~ "-----------------\n" +#~ "\n" +#~ msgstr "" +#~ "Regeln interpretiert\n" +#~ "-----------------\n" +#~ "\n" + +#~ msgid "Lookaheads: BEGIN\n" +#~ msgstr "Vorschau: ANFANG\n" + +#~ msgid "State %d: %d lookaheads\n" +#~ msgstr "Zustand %d: %d Vorschauen\n" + +#~ msgid " on %d (%s) -> rule %d\n" +#~ msgstr " auf %d (%s) -> Regel %d\n" + +#~ msgid "Lookaheads: END\n" +#~ msgstr "Vorschau: ENDE\n" + +#~ msgid "relation_transpose: input\n" +#~ msgstr "relation_transpose: Eingabe\n" + +#~ msgid "relation_transpose: output\n" +#~ msgstr "relation_transpose: Ausgabe\n" + +#~ msgid "reduce" +#~ msgstr "durch Reduzierung gelöst" + +#~ msgid "shift" +#~ msgstr "durch Schieben gelöst" + +#~ msgid "%s contains " +#~ msgstr "%s enthält " + +#~ msgid "`%s' is no longer supported" +#~ msgstr "„%s“ wird nicht länger unterstützt" + +#~ msgid "unexpected `/' found and ignored" +#~ msgstr "„/“ wird hier nicht erwartet und wird deshalb ignoriert" + +#~ msgid "unterminated comment" +#~ msgstr "unbeendeter Kommentar" + +#~ msgid "unescaped newline in constant" +#~ msgstr "nicht maskiertes Zeilenendezeichen in Konstante" + +#~ msgid "octal value outside range 0...255: `\\%o'" +#~ msgstr "oktaler Zahlenwert außerhalb des Bereichs 0...255: „\\%o“" + +#~ msgid "hexadecimal value above 255: `\\x%x'" +#~ msgstr "hexadezimaler Zahlenwert größer als 255: „\\x%x“" + +# Oder soll man den Begriff "Escapezeichen" verwenden? +#~ msgid "unknown escape sequence: `\\' followed by `%s'" +#~ msgstr "unbekanntes Escapezeichen: „\\“ gefolgt von „%s“" + +#~ msgid "unterminated type name at end of file" +#~ msgstr "unerwarteter Typname am Ende der Datei" + +#~ msgid "unterminated type name" +#~ msgstr "unerwarteter Typname" + +#~ msgid "use \"...\" for multi-character literal tokens" +#~ msgstr "für Literal mit mehreren Zeichen bitte \"...\" verwenden" + +#~ msgid "`%s' supports no argument: %s" +#~ msgstr "„%s“ unterstützt kein Argument: %s" + +#~ msgid "`%s' requires an argument" +#~ msgstr "die Option „%s“ erfordert ein Argument" + +#~ msgid " %-4s\terror (nonassociative)\n" +#~ msgstr " %-4s\tFehler (nicht assoziativ)\n" + +#~ msgid "" +#~ " $default\treduce using rule %d (%s)\n" +#~ "\n" +#~ msgstr "" +#~ " $default\treduziere mit Regel %d (%s)\n" +#~ "\n" + +#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" +#~ msgstr " %-4s\t[reduziere mit Regel %d (%s)]\n" + +#~ msgid " %-4s\treduce using rule %d (%s)\n" +#~ msgstr " %-4s\treduziere mit Regel %d (%s)\n" + +#~ msgid " $default\treduce using rule %d (%s)\n" +#~ msgstr " $default\treduziere mit Regel %d (%s)\n" + +#~ msgid " $default\taccept\n" +#~ msgstr " $default\takzeptiere\n" + +#~ msgid " NO ACTIONS\n" +#~ msgstr " KEINE AKTIONEN\n" + +#~ msgid "Number, Line, Rule" +#~ msgstr "Nummer, Zeile, Regel" + +#~ msgid " %3d %3d %s ->" +#~ msgstr " %3d %3d %s ->" + +#~ msgid " Skipping to next \\n" +#~ msgstr " Überspringe Zeichen bis zum nächsten \\n" + +#~ msgid " Skipping to next %c" +#~ msgstr " Überspringe Zeichen bis zum nächten %c" + +#~ msgid "unterminated string" +#~ msgstr "unbeendete Zeichenkette" + +#~ msgid "unterminated `%{' definition" +#~ msgstr "unbeendete „%{“-Definition" + +#~ msgid "Premature EOF after %s" +#~ msgstr "Vorzeitiges EOF nach %s" + +#~ msgid "`%s' is invalid in %s" +#~ msgstr "„%s“ ist in %s nicht erlaubt" + +#~ msgid "%type declaration has no " +#~ msgstr "%type-Deklaration hat keinen " + +#~ msgid "invalid %%type declaration due to item: %s" +#~ msgstr "ungültige %%type-Deklaration wegen: %s" + +#~ msgid "invalid text (%s) - number should be after identifier" +#~ msgstr "unzulässiger Text (%s) - Zahl sollte nach Bezeichner kommen" + +#~ msgid "unexpected item: %s" +#~ msgstr "unerwartetes Symbol: %s" + +#~ msgid "unmatched %s" +#~ msgstr "%s ohne Gegenstück" + +#~ msgid "argument of %%expect is not an integer" +#~ msgstr "Argument von %%expect ist keine ganze Zahl" + +#~ msgid "unrecognized item %s, expected an identifier" +#~ msgstr "unerwartetes Symbol %s, hier wird ein Bezeichner erwartet" + +#~ msgid "expected string constant instead of %s" +#~ msgstr "hier wird eine Zeichenkette erwartet, nicht %s" + +#~ msgid "no input grammar" +#~ msgstr "keine Eingabe-Grammatik" + +#~ msgid "unknown character: %s" +#~ msgstr "unbekanntes Zeichen: %s" + +#~ msgid "ill-formed rule: initial symbol not followed by colon" +#~ msgstr "" +#~ "falsch geformte Regel: führendes Symbol wird nicht von einem Semikolon " +#~ "gefolgt" + +#~ msgid "grammar starts with vertical bar" +#~ msgstr "Grammatik fängt mit einem vertikalen Strich („|“) an" + +#~ msgid "previous rule lacks an ending `;'" +#~ msgstr "vorangehende Regel hat kein abschließendes „;“" + +#~ msgid "%%guard present but %%semantic_parser not specified" +#~ msgstr "" +#~ "%%guard-Anweisung vorhanden, jedoch wird %%semantic_parser nicht angegeben" + +#~ msgid "two actions at end of one rule" +#~ msgstr "Zwei Aktionen am Ende einer Regel" + +#~ msgid "maximum table size (%d) exceeded" +#~ msgstr "maximale Tabellengröße (%d) überschritten" + +#~ msgid " $ \tgo to state %d\n" +#~ msgstr " $ \tgehe zu Zustand %d über\n" + +#~ msgid "unterminated %guard clause" +#~ msgstr "unbeendeter %guard-Fall" diff --git a/po/el.gmo b/po/el.gmo new file mode 100644 index 0000000..0ba96cc Binary files /dev/null and b/po/el.gmo differ diff --git a/po/el.po b/po/el.po new file mode 100644 index 0000000..745cef5 --- /dev/null +++ b/po/el.po @@ -0,0 +1,872 @@ +# translation of bison-2.3b.po to Greek +# Copyright (C) 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# +# Lefteris Dimitroulakis , 2008. +msgid "" +msgstr "" +"Project-Id-Version: bison-2.4\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-11-30 17:57+0300\n" +"Last-Translator: Lefteris Dimitroulakis \n" +"Language-Team: Greek \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=( n !=1);\n" +"X-Generator: KBabel 1.11.4\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "προειδοποίηση" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "μοιραίο σφάλμα" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "" +" Η σύγκρουση μεταξύ του κανόνα %d και της λεκτικής μονάδας %s επιλύθηκε " +"ως ολίσθηση" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" +" Η σύγκρουση μεταξύ του κανόνα %d και της λεκτικής μονάδας %s επιλύθηκε " +"ως ελάττωση" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" +" Η σύγκρουση μεταξύ του κανόνα %d και της λεκτικής μονάδας %s επιλύθηκε " +"ως σφάλμα" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "συγκρούσεις: %d ολίσθηση/ελάττωση, %d ελάττωση/ελάττωση\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "συγκρούσεις: %d ολίσθηση/ελάττωση\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "συγκρούσεις: %d ελάττωση/ελάττωση\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Κατάσταση %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr έχει εφαρμογή μόνο σε συντακτικούς αναλυτές GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "ανέμενα %d σύγκρουση ολίσθηση/ελάττωση" +msgstr[1] "ανέμενα %d συγκρούσεις ολίσθηση/ελάττωση" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "ανέμενα %d σύγκρουση ελάττωση/ελάττωση" +msgstr[1] "ανέμενα %d συγκρούσεις ελάττωση/ελάττωση" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "αδυναμία ανοίγματος του αρχείου «%s»" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "σφάλμα I/O" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "δεν μπορώ να κλείσω το αρχείο" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "άρνηση γραψίματος πάνω στο αρχείο εισόδου %s" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "αντικρουόμενες έξοδοι στο αρχείο %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Δοκίμασε «%s --help» για περισσότερες πληροφορίες.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Χρήση: %s [ΕΠΛΟΓΕΣ]... ΑΡΧΕΙΟ\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" +"Δημιουργία αναλυτών LALR(1) και GLR.\n" +"\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" +"Υποχρεωτικά ορίσματα σε μακρές επιλογές είναι υποχρεωτικά επίσης και στις " +"κοντές.\n" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "Το ίδιο ισχύει και για τα μη υποχρεωτικά ορίσματα.\n" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"\n" +"Τρόποι λειτουργίας:\n" +" -h, --help εμφάνιση αυτής εδώ της βοήθειας κι έξοδος\n" +" -V, --version πληροφορίες έκδοσης κι έξοδος\n" +" --print-localedir ο κατάλογος με τα δεδομένα των locale\n" +" --print-datadir ο κατάλογος με σκελετούς και XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[ΚΑΤΗΓΟΡΙΑ] παρουσιάζει τις προειδοποιήσεις που ανήκουν " +"στη ΚΑΤΗΓΟΡΙΑ\n" +"\n" + +#: src/getargs.c:272 +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Αναλυτής:\n" +" -L, --language=ΓΛΩΣΣΑ προσδιορίζει τη γλώσσα προγραμματισμού στην " +"έξοδο\n" +" -S, --skeleton=ΑΡΧΕΙΟ προσδιορίζει τον προς χρήση skeleton\n" +" -t, --debug ενεργοποίηση της δυνατότητας αποσφαλμάτωσης\n" +" --locations επιτρέπει τον υπολογισμό των θέσεων\n" +" -p, --name-prefix=ΠΡΟΘΕΜΑ βάλε το ΠΡΟΘΕΜΑ μπροστά από τα εξωτερικά " +"σύμβολα\n" +" -l, --no-lines να μην δημιουργούνται οδηγίες της μορφής " +"«#line»\n" +" -k, --token-table συμπεριλαμβάνει πίνακα ονομάτων λεκτικών " +"μονάδων\n" +"\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Έξοδος:\n" +" --defines[=ΑΡΧΕΙΟ] παράγει επίσης ένα αρχείο επικεφαλίδας\n" +" -d το ίδιο αλλά χωρίς ορισμό ΑΡΧΕΙΟΥ (για το POSIX Yacc)\n" +" -r, --report=ΠΡΑΓΜΑΤΑ παράγει λεπτομέρειες σχετικές με τα αυτόματα\n" +" --report-file=ΑΡΧΕΙΟ γράψιμο αναφοράς στο ΑΡΧΕΙΟ\n" +" -v, --verbose το ίδιο με «--report=state»\n" +" -b, --file-prefix=ΠΡΟΘΕΜΑ καθορίζει ΠΡΟΘΕΜΑ για τα αρχεία εξόδου\n" +" -o, --output=ΑΡΧΕΙΟ έξοδος στο ΑΡΧΕΙΟ\n" +" -g, --graph[=ΑΡΧΕΙΟ] καθορισμός σε VCG της εξόδου του αυτομάτου\n" +" -x, --xml[=ΑΡΧΕΙΟ] αναφορά από το αυτόματο σε μορφή XML\n" +" (η μορφή XML είναι σε πειραματικό στάδιο)\n" +"\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" +"Κατηγορίες προειδοποίησης περιλαμβάνουν:\n" +" `midrule-values' μη ενεργοποιημένες ή μη χρησιμοποιούμενες τιμές midrule\n" +" `yacc' ασυμβατότητες με POSIX YACC\n" +" `all' όλες οι προειδοποιήσεις\n" +" `no-CATEGORY' απενεργοποίηση προειδοποιήσεων για την CATEGORY\n" +" `none' απενεργοποίηση όλων των προειδοποιήσεων\n" +" `error' θεώρησε όλες τις προειδοποιήσεις ως σφάλματα\n" +"\n" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"ΠΡΑΓΜΑΤΑ είναι μια λίστα λέξεων που χωρίζονται από κόμματα και " +"περιλαμβάνουν:\n" +" `state' περιγράφει καταστάσεις\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' ρητή συσχέτιση ήδη διαβασμένων λεκτικών μονάδων με items\n" +" `solved' περιγράφει επίλυση συγκρούσεων με ολίσθηση/ελάττωση\n" +" `all' περιλαμβάνει όλες τις παραπάνω πληροφορίες\n" +" `none' απενεργοποίηση αναφοράς\n" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"\n" +"Αναφορά σφαλμάτων σε <%s>.\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Γράφτηκε από τους Robert Corbett και Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "πολλαπλές δηλώσεις σκελετού είναι μη έγκυρες" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "μη έγκυρη γλώσσα `%s'" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "πολλαπλές δηλώσεις γλώσσας είναι μη έγκυρες" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "λείπει τελεστέος μετά από «%s»" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "επί πλέον τελεστέος «%s»" + +#: src/gram.c:112 +msgid "empty" +msgstr "κενό" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Γραμματική" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "υπερχείλιση αριθμού γραμμών" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "υπερχείλιση αριθμού στηλών" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "ο κανόνας είναι άχρηστος στον αναλυτή λόγω συγκρούσεων" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "το όνομα λείπει στη δήλωση παραμέτρου" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr "ο τύπος %d είναι %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "ολίσθηση, και μετάβαση στη κατάσταση %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "πήγαινε στην κατάσταση %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "σφάλμα (μη προσεταιριστικό)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "ελάττωση με χρήση του κανόνα %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "αποδοχή" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "κατάσταση %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Τερματικά σύμβολα, με κανόνες όπου εμφανίζονται" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Μη τερματικά σύμβολα, με κανόνες όπου εμφανίζονται" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr "στα αριστερά:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr "στα δεξιά:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "Κανόνες άχρηστοι στον αναλυτή λόγω συγκρούσεων" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "πολλαπλές δηλώσεις του %s" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "" +"σύγκρουση παραγόμενου τύπου στη συνάρτηση συγχώνευσης «%s»: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "προηγούμενη δήλωση" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "κανόνας δοσμένος για %s, που είναι λεκτική μονάδα" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "σύγκρουση τύπων στην προεπιλεγμένη ενέργεια: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "κενός κανόνας για μη τερματικό σύμβολο με τύπο, και ουδεμία ενέργεια" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "μη χρησιμοποιούμενη τιμή: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "μη καθορισμένη τιμή: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "μόνο ένα %s ανά κανόνα έχει επιτραπεί" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s επηρεάζει μόνο αναλυτές GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s πρέπει να ακολουθείται από θετικό αριθμό" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "κανόνας πολύ επιμήκης" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "γραμματική εισόδου χωρίς κανόνες" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "άχρηστος κανόνας στη γραμματική" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "μη τερματικό σύμβολο άχρηστο στη γραμματική: %s" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "Μη τερματικά σύμβολα άχρηστα στη γραμματική" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "Τερματικά σύμβολα μη χρησιμοποιούμενα στη γραμματική" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "Άχρηστοι κανόνες στη γραμματική" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "μη τερματικό σύμβολο %d άχρηστο στη γραμματική" +msgstr[1] "μη τερματικά σύμβολα %d άχρηστα στη γραμματική" + +#: src/reduce.c:397 +#, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "ο κανόνας %d είναι άχρηστος στη γραμματική" +msgstr[1] "οι κανόνες %d είναι άχρηστοι στη γραμματική" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "το αρχικό σύμβολο %s δεν παράγει καμιά πρόταση" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "μοναχικό «$»" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "μοναχικό «@»" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "ρητή δήλωση τύπου δόθηκε σε γραμματική χωρίς τύπους" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$$ για την midrule στο $%d του «%s» δεν έχει δηλωμένο τύπο" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ του «%s» δεν έχει δηλωμένο τύπο" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d του «%s» δεν έχει δηλωμένο τύπο" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "ακέραιος εκτός ορίων: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "μοναχικό « , » θεωρήθηκε ως λευκό διάστημα" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "μη έγκυρη οδηγία: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "μη έγκυρος χαρακτήρας: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "μη έγκυρος μηδενικός χαρακτήρας" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "μη έγκυρη ακολουθία διαφυγής: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "μη έγκυρος μηδενικός χαρακτήρας: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "άγνωστη ακολουθία διαφυγής: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "στο τέλος του αρχείου λείπει «%s»" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "στο τέλος της γραμμής λείπει «%s»" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "τιμή $ μη έγκυρη: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "πάρα πολλά σύμβολα στη γραμματική εισόδου (το όριο είναι %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "δήλωση ξανά του %s για %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "δήλωση ξανά του %s για <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "το σύμβολο %s ανακαθορίστηκε" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "το σύμβολο %s ξαναδηλώθηκε" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "ορισμός ξανά του αριθμού λεκτικής μονάδας του %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"το σύμβολο %s χρησιμοποιείται, αλλά δεν καθορίζεται ως λεκτική μονάδα και " +"δεν διαθέτει κανόνες" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "" +"το σύμβολο «%s» χρησιμοποιήθηκε περισσότερες από μια φορές ως κυριολεκτικό " +"αλφαριθμητικό" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr " το σύμβολο «%s» έδωσε περισσότερα του ενός κυριολεκτικά αλφαριθμητικά" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "οι λεκτικές μονάδες %s και %s ανάθεσαν τον αριθμό %d και οι δύο" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "το σύμβολο εκκίνησης %s δεν είναι καθορισμένο" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "το σύμβολο εκκίνησης %s είναι λεκτική μονάδα" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "δήλωση ξανά του προεπιλεγμένου καταστροφέα %%" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "δήλωση ξανά του προεπιλεγμένου καταστροφέα %%" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "δήλωση ξανά του προεπιλεγμένου εκτυπωτή %%" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "δήλωση ξανά του προεπιλεγμένου εκτυπωτή %%" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "μη έγκυρο όρισμα %s για %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "ασαφές όρισμα %s για %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Έγκυρα ορίσματα είναι:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u ελευθερώθηκαν (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u στη βοηθητική μνήμη (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u στη βοηθητική μνήμη (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u στη βοηθητική μνήμη (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "ιστόγραμμα μετρήσεων\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "ιστόγραμμα μεγεθών\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "ιστόγραμμα πυκνότητας\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Στατιστικές των Bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Συσσωρευμένα τρεξίματα = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Αδυναμία ανάγνωσης αρχείου στατιστικών" + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Λάθος μέγεθος αρχείου με στατιστικά.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Δεν μπόρεσα να γράψω το αρχείο με τα στατιστικά." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Δεν μπόρεσα να ανοίξω για γράψιμο το αρχείο με τα στατιστικά." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Άγνωστο σφάλμα συστήματος" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: η επιλογή «%s» είναι ασαφής\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: η επιλογή «--%s» δεν επιτρέπει όρισμα\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: η επιλογή «%c%s» δεν επιτρέπει όρισμα\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: η επιλογή «%s» απαιτεί όρισμα\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: άγνωστη επιλογή «--%s»\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: άγνωστη επιλογή «%c%s»\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: παράνομη επιλογή -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: μη έγκυρη επιλογή -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: η επιλογή απαιτεί όρισμα -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: η επιλογή «-W %s» είναι ασαφής\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: η επιλογή «-W %s» δεν επιτρέπει όρισμα\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "εξαντλημένη μνήμη" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "«" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "»" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "το υποπρόγραμμα «%s» δεν ήταν δυνατό να κληθεί" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Χρόνος εκτέλεσης (δευτερόλεπτα)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr "ΣΥΝΟΛΟ :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "χρόνος σε %s: %ld.%06ld (%ld%%)\n" diff --git a/po/en@boldquot.header b/po/en@boldquot.header new file mode 100644 index 0000000..fedb6a0 --- /dev/null +++ b/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/po/en@quot.header b/po/en@quot.header new file mode 100644 index 0000000..a9647fc --- /dev/null +++ b/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/po/es.gmo b/po/es.gmo new file mode 100644 index 0000000..f85ef2c Binary files /dev/null and b/po/es.gmo differ diff --git a/po/es.po b/po/es.po new file mode 100644 index 0000000..ebd12b9 --- /dev/null +++ b/po/es.po @@ -0,0 +1,1234 @@ +# Mensajes en español para GNU Bison. +# Copyright (C) 1998 Free Software Foundation, Inc. +# Nicolás García-Pedrajas , 1998. +# +# Corregido por: +# +# cll - Carlos Linares López clinares@acm.org +# clinares@delicias.dia.fi.upm.es +# +# Notas: +# +# 1. Nicolás, en algunas ocasiones notarás que algunos `msgstr' no están +# indentados como los `msgid'. No te preocupes, eso es porque yo utilizo +# el `po-mode' de Emacs, ... Él es el responsable de esas indentaciones +# del `msgstr' :) +# +# 2. Todos los comentarios que contengan "Duda:" debieran revisarse. +# +# -------------------------------------------------------------------- +# En mi opinión has hecho un excelente trabajo y te animo a que sigas +# manteniendo esta traducción y a que lo intentes con otras. +# +# (¡te lo dice el tío que ha traducido el paquete más grande: 1406 +# mensajes en el clisp!) +# +# Carlos Linares +# -------------------------------------------------------------------- +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bison 2.2\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2006-06-05 13:51+0200\n" +"Last-Translator: Nicolás García-Pedrajas \n" +"Language-Team: Spanish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "aviso" + +# Duda: desconozco cuál será el convenio en la lista de correo a +# propósito de "fatal". Por favor, comprueba que "error grave" es +# preferido por todos los miembros a "error fatal" - cll +# veremos que dice la mayoría, como hay otros 2 revisores +# La verdad es que a mi lo de error fatal me suena fatal +# ngp +# +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "error grave: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "" +" El conflicto entre la regla %d y el terminal %s se resuelve como " +"desplazamiento." + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" +" El conflicto entre la regla %d y el terminal %s se resuelve como " +"reducción." + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" +" El conflicto entre la regla %d y el terminal %s se resuelve como un " +"error." + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "conflictos: %d desplazamiento/reducción, %d reducción/reducción\n" + +# Date cuenta de que `%d' puede ser cualquier número decimal. Podría +# ocurrir, por lo tanto, que tu mensaje en ejecución se vea luego como: +# +# 23845789243789 desplazamiento/reducción +# +# (¡estoy exagerando!, por supuesto :) +# +# Te sugiero por lo tanto que añadas el caso (s) tal y como se hace en +# español habitualmente. +# ok +# ngp +# +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "conflictos: %d desplazamiento(s)/reducción(ones)\n" + +# Date cuenta de que `%d' puede ser cualquier número decimal. Podría +# ocurrir, por lo tanto, que tu mensaje en ejecución se vea luego como: +# +# 23845789243789 reducción/reducción +# +# (¡estoy exagerando!, por supuesto :) +# +# Te sugiero por lo tanto que añadas el caso (s) tal y como se hace en +# español habitualmente. +# +# ok +# ngp +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "conflictos: %d reducción(ones)/reducción(ones)\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Estado %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr afecta sólo a los analizadores GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "esperado %d conflicto desplazamiento/reducción" +msgstr[1] "esperados %d conflictos desplazamiento/reducción" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "esperado %d conflicto reducción/reducción" +msgstr[1] "esperados %d conflictos reducción/reducción" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "no se puede abrir el fichero `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "Error de E/S" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "no se puede cerrar el fichero" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "salidas en conflicto al fichero %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Pruebe `%s --help' para más información.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Utilización: %s [OPCIÓN]... FICHERO\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +#, fuzzy +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"Modos de operación:\n" +" -h, --help muestra esta ayuda y termina\n" +" -V, --version informa de la versión y termina\n" +" --print-localedir informa del directorio que contiene " +"información \n" +" dependiente de la configuración local\n" +" -y, --yacc emula POSIX yacc\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Analizador:\n" +" -S, --skeleton=FICHERO especifica el skeleton a utilizar\n" +" -t, --debug instrumenta al analizador para depuración\n" +" --locations abilita la computación de localizaciones\n" +" -p, --name-prefix=PREFIJO preañade PREFIJO a los símbolos externos\n" +" -l, --no-lines no genera la directiva `#line'\n" +" -n, --no-parser solamente genera las tablas\n" +" --k, --token-table incluye una tabla de nombres de terminales\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Salida:\n" +" -d, --defines también produce un fichero de cabecera\n" +" -r, --report=THINGS también produce detalles del automaton\n" +" -v, --verbose también produce una explicación del automaton\n" +" -b, --file-prefix=PREFIJO especifia el PREFIJO para los ficheros de " +"salida\n" +" -o, --output=FICHERO almacena la salida en FICHERO\n" +" -g, --graph también produce una descripción en VCG del " +"automaton\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +#, fuzzy +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"THINGS es una lista de palabras separadas por comas que puede incluir:\n" +" `state' describe los estados\n" +" `itemset' completa los conjuntos de ítems núcleo con sus cierres\n" +" `lookahead' asocia explícitamente lookaheads a los ítems\n" +" `solved' describe la resolución de los conflictos desplazamiento/" +"reducción\n" +" `all' incluye toda la información anterior\n" +" `none' disable the report\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Informe de los errores a .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Escrito por Robert Corbett y Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Esto es software libre; mire el fuente para las condiciones de copia. No " +"hay\n" +"NINGUNA garantía; ni siquiera para COMERCIALIZACIÓN o ADAPTACIÓN PARA UN\n" +"USO PARTICULAR\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "múltiples declaraciones de %s" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "valor no válido: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "múltiples declaraciones de %s" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "falta un operando después de `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "operando extra `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "vacío" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Gramática" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "desbordamiento del número de línea" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "desbordamiento del número de columna" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "la regla nunca se redujo debido a los conflictos" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "falta el identificador el la declaración del parámetro" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " el tipo %d es %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "desplazar e ir al estado %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "ir al estado %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "error (no asociativo)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "reduce usando la regla %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "aceptar" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "estado %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminales con las reglas donde aparecen" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "No terminales con las reglas donde aparecen" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " en la izquierda:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " en la derecha:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "la regla nunca se redujo debido a los conflictos" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "múltiples declaraciones de %s" + +#: src/reader.c:131 +#, fuzzy, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "tipo resultado incompatible en la función combinada %s: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "primera declaración" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "se ha dado una regla para %s, que es un terminal" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "incompatibilidad de tipos en la acción por defecto: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "regla vacía para un no terminal con tipo y no hay ninguna acción" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "valor no usado: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "valor no fijado: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "sólo se permite un %s por regla" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s afecta sólo a los analizadores GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s debe estar seguido por un número positivo" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "la regla es demasiado larga" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "no hay reglas en la gramática de entrada" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "no hay reglas en la gramática de entrada" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "No terminales con las reglas donde aparecen" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "no hay reglas en la gramática de entrada" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "no hay reglas en la gramática de entrada" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "no hay reglas en la gramática de entrada" +msgstr[1] "no hay reglas en la gramática de entrada" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "El símbolo de inicio (axioma) %s no deriva ninguna sentencia" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "`$ extraviado" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "`@ extraviado" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d de `%s' no tiene tipo declarado" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ de `%s' no tiene tipo declarado" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d de `%s' no tiene tipo declarado" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "entero fuera de rango: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "`,' perdido se trato como un espacio en blanco" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "directiva no válida: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "carácter no válido: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "carácter nulo no válido" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "secuencia de escape no válida: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "carácter nulo no válido: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "secuencia de escape no reconocida: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "falta cadena `%s' al final del fichero" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "falta cadena `%s' al final del fichero" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "valor $ no válido: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "demasiados símbolos en la gramática de entrada (el límite es %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s redeclaración de %s" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s redeclaración de %s" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "redefinido el símbolo %s" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "redefinido el símbolo %s" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "redefinición del número del terminal del usuario de %s" + +# `token' se debe traducir como `literal' - cll +# en terminología de compiladores token es más un terminal - ngp +# +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"se usa el símbolo %s, pero no está definido como terminal y no tiene reglas" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "símbolo `%s' utilizado más de una vez como cadena literal" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "al símbolo `%s' se le ha dado más de una cadena literal" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "los terminales %s y %s tienen asignados ambos el número %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "el símbolo de inicio (axioma) %s no está definido" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "el símbolo de inicio (axioma) %s es un terminal" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "argumento no válido %s para %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "argumento %s ambigüo para %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Los argumentos válidos son:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u liberados (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u en la caché (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u en la caché (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u en la caché (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "histograma del registro de conteo\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "histograma del registro de tamaño\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "histograma de densidad\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "Estadísticas de bitset\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Ejecuciones acumuladas = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "No pude leer fichero de estadísticas" + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Fichero de estadística no válido.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "No pude escribir el fichero de estadísticas." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "No pude abrir el fichero de estadísticas para escritura" + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Error del sistema desconocido" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: la opción `%s' es ambigua\n" + +# Pongo esto como en otros .po. sv +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: la opción `--%s' no admite ningún argumento\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: la opción `%c%s' no admite ningún argumento\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: la opción `%s' requiere un argumento\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opción `--%s' no reconocida\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opción `%c%s' no reconocida\n" + +# ¿Qué encuentras de malo en traducir `illegal' como `ilegal'? Date +# cuenta de que el mensaje "opción no válida" parece ambigua y hará +# pensar al usuario de que tal vez la ha usado incorrectamente, sin +# reparar, por lo tanto, en que la opción misma es ilegal. Esto es, ¡¡no +# existe!! (porque imagino que es en este sentido como se ha programado) +# - cll +# Sobre esto hubo una discusión en la lista hace tiempo, +# quizás ilegal queda un poco fuerte, alguien decía que parecía que +# ibas a ir a la carcel por usar la opción. +# ngp +# +# Sí, era Enrique a quien no le gustaba la palabra. +# No creo que debamos dejar de decir algo por la "corrección política" +# Yo creo que si el 386 tiene instrucciones *ilegales*, también puede +# haber opciones ilegales, digo yo, y no por eso las CPUs van +# a la cárcel (como mucho se cuelgan, je, je, 0ff0 :-). sv +# +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opción -- %c ilegal\n" + +# ¡Muy bien traducido! En el grupo de traducción ha habido auténticas +# batallas con el tema "invalid - inválido/a" :) - cll +# Porque Enrique decía que le recordaba a disminuidos físicos. +# Francamente, no creo que haya que andar con estas "fobias". +# Pongo inválida. sv +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opción -- %c no válida\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: la opción -- %c requiere un argumento\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: la opción `-W %s' es ambigua\n" + +# Pongo esto como en otros .po. sv +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: la opción `-W %s' no admite ningún argumento\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "memoria agotada" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "no se pudo invocar el programa subsidiario `%s'" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Tiempos de ejecución (segundo)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTAL :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "tiempo en %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "warning: " +#~ msgstr "aviso: " + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison genera analizadores para gramáticas LALR(1).\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Si una opción larga muestra un argumento como obligatorio, entonces es " +#~ "obligatorio\n" +#~ "para la opción corta equivalente también. De igual forma para los " +#~ "argumentos opcionales.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "Reglas nunca reducidas" + +#~ msgid "useless rule" +#~ msgstr "regla sin uso" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "No terminal sin uso: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "No terminales sin uso" + +#~ msgid "Terminals which are not used" +#~ msgstr "Terminales que no se usan" + +#~ msgid "Useless rules" +#~ msgstr "Reglas sin uso" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d regla que nunca se ha reducido\n" +#~ msgstr[1] "%d reglas que nunca se han reducido\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d no terminal sin uso" +#~ msgstr[1] "%d no terminales sin uso" + +#~ msgid " and " +#~ msgstr " y " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d regla sin uso" +#~ msgstr[1] "%d reglas sin uso" + +#~ msgid "missing `{' in %s" +#~ msgstr "falta `{' en %s" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "no se encontró el programa subsidiario `%s'" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "falló el programa subsidiario `%s'" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "falló el programa subsidiario `%s' (estado de salida %d)" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX prohíbe declaraciones en a gramática" + +#~ msgid "invalid $ value" +#~ msgstr "valor $ no válido" + +#~ msgid "type redeclaration for %s" +#~ msgstr "redeclaración del tipo de %s" + +#~ msgid "redefining precedence of %s" +#~ msgstr "redefinición de la precedencia de %s" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "precedencias en conflicto entre %s y %s" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "conflicto de asociaciatividades para %s (%s) y %s (%s)" + +#~ msgid "too many states (max %d)" +#~ msgstr "demasiados estados (máximo %d)" + +#~ msgid "reduce" +#~ msgstr "reduce" + +#~ msgid "shift" +#~ msgstr "desplaza" + +#~ msgid "%d shift/reduce conflict" +#~ msgid_plural "%d shift/reduce conflicts" +#~ msgstr[0] "%d conflicto desplazamiento/reducción" +#~ msgstr[1] "%d conflictos desplazamiento/reducción" + +#~ msgid "and" +#~ msgstr "y" + +#~ msgid "State %d contains " +#~ msgstr "El estado %d contiene" + +#~ msgid "conflicts: " +#~ msgstr "conflictos: " + +#~ msgid "%s contains " +#~ msgstr "%s contiene " + +#~ msgid "`%s' is no longer supported" +#~ msgstr "`%s' ya no está soportado" + +# Me parece menos "computadora" decir "ningún fichero de gramática" - cll +# +#~ msgid "%s: no grammar file given\n" +#~ msgstr "%s: no se ha especificado ningún fichero de gramática\n" + +# Ignorar es no saber, to ignore es no hacer caso, que no es lo mismo. sv +#~ msgid "%s: extra arguments ignored after `%s'\n" +#~ msgstr "%s: los argumentos extra después de '%s' no se tendrán en cuenta\n" + +#~ msgid "too many gotos (max %d)" +#~ msgstr "demasiados gotos (máximo %d)" + +# to ignore no es ignorar. Pon otra cosa, please. sv +#~ msgid "unexpected `/' found and ignored" +#~ msgstr "se ha encontrado `/' cuando no se esperaba, no se tendrán en cuenta" + +#~ msgid "unterminated comment" +#~ msgstr "comentario sin terminar" + +#~ msgid "unexpected end of file" +#~ msgstr "fin de fichero inesperado" + +# ¿unescaped? +#~ msgid "unescaped newline in constant" +#~ msgstr "salto de línea en constante sin secuencia de escape" + +#~ msgid "octal value outside range 0...255: `\\%o'" +#~ msgstr "valor octal fuera del rango 0...255: `\\%o'" + +#~ msgid "hexadecimal value above 255: `\\x%x'" +#~ msgstr "valor hexadecimal mayor que 255: `\\x%x'" + +#~ msgid "unknown escape sequence: `\\' followed by `%s'" +#~ msgstr "secuencia de escape desconocida: `\\' seguido de `%s'" + +#~ msgid "unterminated type name at end of file" +#~ msgstr "nombre de tipo sin terminar al final del fichero" + +#~ msgid "unterminated type name" +#~ msgstr "nombre de tipo sin terminar" + +# ¿multicarácter o multicaracteres? sv +#~ msgid "use \"...\" for multi-character literal tokens" +#~ msgstr "use \"...\" para terminales literales multicarácter" + +#~ msgid "`%s' supports no argument: %s" +#~ msgstr "`%s' no soporta el argumento: %s" + +#~ msgid "`%s' requires an argument" +#~ msgstr "`%s' requiere un argumento" + +#~ msgid " (rule %d)" +#~ msgstr " (regla %d)" + +#~ msgid " %-4s\terror (nonassociative)\n" +#~ msgstr " %-4s\terror (no asociativo)\n" + +#~ msgid "" +#~ " $default\treduce using rule %d (%s)\n" +#~ "\n" +#~ msgstr "" +#~ " $default\treduce usando la regla %d (%s)\n" +#~ "\n" + +#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" +#~ msgstr " %-4s\t[reduce usando la regla %d (%s)]\n" + +#~ msgid " %-4s\treduce using rule %d (%s)\n" +#~ msgstr " %-4s\treduce usando la regla %d (%s)\n" + +#~ msgid " $default\treduce using rule %d (%s)\n" +#~ msgstr " $default\treduce usando la regla %d (%s)\n" + +#~ msgid " $default\taccept\n" +#~ msgstr " $default\taceptar\n" + +#~ msgid " NO ACTIONS\n" +#~ msgstr " SIN ACCIONES\n" + +#~ msgid "Number, Line, Rule" +#~ msgstr "Número, Línea, Regla" + +#~ msgid " %3d %3d %s ->" +#~ msgstr " %3d %3d %s ->" + +#~ msgid " Skipping to next \\n" +#~ msgstr " Saltando al siguiente \\n" + +#~ msgid " Skipping to next %c" +#~ msgstr " Saltando al siguiente %c" + +#~ msgid "unterminated string" +#~ msgstr "cadena sin terminar" + +#~ msgid "%s is invalid" +#~ msgstr "%s no es válido" + +#~ msgid "unterminated `%{' definition" +#~ msgstr "definición `%{' sin terminar" + +#~ msgid "Premature EOF after %s" +#~ msgstr "EOF prematuro después de %s" + +#~ msgid "`%s' is invalid in %s" +#~ msgstr "`%s' no es válido en %s" + +#~ msgid "%type declaration has no " +#~ msgstr "la declaración %type no tiene " + +#~ msgid "invalid %%type declaration due to item: %s" +#~ msgstr "declaración de %%type no válida debido al ítem: %s" + +# Una corrección menor: en realidad, `should' es el pasado y condicional +# de "to must" y aquí se emplea en su forma condicional. Por eso, he +# cambiado `debe' por `debería' - cll +# ahí me has pillado en un olvido del inglés - ngp +#~ msgid "invalid text (%s) - number should be after identifier" +#~ msgstr "" +#~ "texto no válido (%s) - el número debería estar después del identificador" + +# En unas ocasiones, has traducido `unexpected' como `no esperado' y, en +# otras, como `inesperado'. Cualquiera es correcta, por supuesto y, en +# este caso, la segunda me parece más apropiada - cll +# ok - ngp +#~ msgid "unexpected item: %s" +#~ msgstr "ítem inesperado: %s" + +# Cambio el orden y el sexo. Ahora está "en español". sv +#~ msgid "unmatched %s" +#~ msgstr "%s desemparejado/a" + +#~ msgid "argument of %%expect is not an integer" +#~ msgstr "el argumento de %%expect no es un entero" + +# No te recomiendo que emplees participios para expresar acciones (¡si +# me oyera mi antigua profesora de lengua, lloraría de emoción! :). En +# vez de eso, emplea las conjugaciones habituales, que para eso están :) +# - cll +# ok - ngp +# +#~ msgid "unrecognized item %s, expected an identifier" +#~ msgstr "no se reconoce el ítem %s, se esperaba un identificador" + +#~ msgid "expected string constant instead of %s" +#~ msgstr "se esperaba una cadena constante en lugar de %s" + +#~ msgid "no input grammar" +#~ msgstr "no hay gramática de entrada" + +#~ msgid "ill-formed rule: initial symbol not followed by colon" +#~ msgstr "regla mal formada: el símbolo inicial no está seguido por :" + +#~ msgid "grammar starts with vertical bar" +#~ msgstr "la gramática comienza con una barra vertical" + +#~ msgid "previous rule lacks an ending `;'" +#~ msgstr "a la regla previa le falta un `;' al final" + +#~ msgid "two @prec's in a row" +#~ msgstr "dos @prec en una línea" + +# Insisto, el empleo de participios a secas me parece como hablar en +# indio. Por favor, permíteme que añada un "está" :) - cll +# ok - ngp +#~ msgid "%%guard present but %%semantic_parser not specified" +#~ msgstr "%%guard presente pero %%semantic_parser está sin especificar" + +#~ msgid "two actions at end of one rule" +#~ msgstr "dos acciones al final de una regla" + +# Únicamente cambio la posición del adjetivo `máximo'. En vez de después +# de `tabla', después de `tamaño' - cll +# en inglés era así, pero quizás en español sea mejor como dices +# ngp +# +#~ msgid "maximum table size (%d) exceeded" +#~ msgstr "excedido el tamaño máximo de la tabla (%d)" + +#~ msgid " $ \tgo to state %d\n" +#~ msgstr " $ \tir al estado %d\n" + +# Tal vez pueda parecer pedante, pero `inconclusa' me suena muchísimo +# mejor que `sin terminar' que me parece más "computerizado" - cll +# quizás un poco cacofónico lo de claúsula inconclusa - ngp +# +#~ msgid "unterminated %guard clause" +#~ msgstr "cláusula %guard sin terminar" diff --git a/po/et.gmo b/po/et.gmo new file mode 100644 index 0000000..a3c20ba Binary files /dev/null and b/po/et.gmo differ diff --git a/po/et.po b/po/et.po new file mode 100644 index 0000000..cecf12f --- /dev/null +++ b/po/et.po @@ -0,0 +1,888 @@ +# Estonian translations for bison. +# Copyright (C) 2001 Free Software Foundation, Inc. +# Toomas Soome , 2006. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2006-09-21 11:21+0300\n" +"Last-Translator: Toomas Soome \n" +"Language-Team: Estonian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "hoiatus" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "fataalne viga" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Konflikt reegli %d ja märgi %s vahel lahendatud nihkega" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Konflikt reegli %d ja märgi %s vahel lahendatud redutseerimisega" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Konflikt reegli %d ja märgi %s vahel lahendatud veana" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "" +"konfliktid: %d nihutamine/redutseerimine, %d redutseerimine/redutseerimine\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "konfliktid: %d nihutamine/redutseerimine\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "konfliktid: %d redutseerimine/redutseerimine\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Olek %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr puudutab ainult GLR parsereid" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "eeldasime %d nihutamine/redutseerimine konflikti" +msgstr[1] "eeldasime %d nihutamine/redutseerimine konflikti" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "eeldasin %d redutseerimine/redutseerimine konflikti" +msgstr[1] "eeldasin %d redutseerimine/redutseerimine konflikti" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "faili `%s' ei saa avada" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "S/V viga" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "faili ei õnnestu sulgeda" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "konfliktsed väljundid faili %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Lisainfo saamiseks proovige `%s --help'.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Kasuta: %s [VÕTI]...FAIL\n" + +#: src/getargs.c:248 +#, fuzzy +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "GNU bison genereerib parsereid LALR(1) ja GLR grammatikatele.\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +#, fuzzy +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"Töömoodid:\n" +" -h, --help esita see abiinfo ja lõpeta töö\n" +" -V, --version esita versiooniinfo ja lõpeta töö\n" +" --print-localedir esita lokaadi infot sisaldava kataloogi nimi\n" +" -y, --yacc emuleeri POSIX yacc\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parser:\n" +" -S, --skeleton=FAIL kasutatava skeleti kirjeldus\n" +" -t, --debug varusta parser silumisinfoga\n" +" --locations luba asukohtade arvestamine\n" +" -p, --name-prefix=PREFIKS lisa välissümbolite nimedele PREFIKS\n" +" -l, --no-lines ära genereeri `#line' direktiive\n" +" -n, --no-parser genereeri ainult tabelid\n" +" -k, --token-table lisa ka sümbolite nimede tabel\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Väljund:\n" +" -d, --defines loo ka päisfail\n" +" -r, --report=ASJAD väljasta automaadi kohta selgitusi\n" +" -v, --verbose sama, kui `--report=state'\n" +" -b, --file-prefix=PREFIKS kasuta väljundfailide nimedes PREFIKSit\n" +" -o, --output-file=FAIL jäta väljund FAILi\n" +" -g, --graph loo automaadi kirjeldus VCG graafina\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"ASJAD on loend komadega eraldatud järgnevaid sõnu:\n" +" `state' olekute kirjeldus\n" +" `itemset' täienda põhilisi elemente nende sulunditega\n" +" `look-ahead' seo ettevaatamised elementidega\n" +" `solved' kirjelda nihuta/redutseeri konfliktide lahendamisi\n" +" `all' kogu ülaltoodud info\n" +" `none' blokeeri raport\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Teatage palun vigadest aadressil <" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Kirjutanud Robert Corbett ja Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Autoriõigus © %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"See on vaba tarkvara; kopeerimistingimused leiate lähtetekstidest. Garantii\n" +"PUUDUB; ka müügiks või mingil eesmärgil kasutamiseks.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "korduvad %s deklaratsioonid" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "vigased sümbolid: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "korduvad %s deklaratsioonid" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "`%s' järel puudub operand" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "Liigne operand `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "tühi" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammatika" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "rea numbri ületäitumine" + +#: src/location.c:94 +#, fuzzy, c-format +msgid "column number overflow" +msgstr "rea numbri ületäitumine" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "reeglit ei redutseerita konfliktide tõttu kunagi" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "parameetri deklaratsioonis puudub identifikaator" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " tüüp %d on %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "nihuta ja liigu olekule %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "liigu olekule %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "viga (mitteassotsiatiivne)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "redutseerin kasutades reeglit %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "nõustun" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "olek %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminalid, koos reeglitega kus nad ilmuvad" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Mitteterminalid, koos reeglitega kus nad ilmuvad" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " vasakul:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " paremal:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "reeglit ei redutseerita konfliktide tõttu kunagi" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "korduvad %s deklaratsioonid" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "tulemuse tüübikonflikt mestimise funktsioonis `%s': <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "eelmine deklaratsioon" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "%s jaoks on antud reegel, aga see on märk" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "vaikimisi tegevuse tüübikonflikt: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "tüübiga mitteterminalil on tühi reegel ja puudub tegevus" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "kasutamata väärtus: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "seadmata väärtus: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "reeglis on lubatud ainult üks %s" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s puudutab ainult GLR parsereid" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s järel peab olema positiivne number" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "reegel on liiga pikk" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "sisendgrammatikas pole reegleid" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "sisendgrammatikas pole reegleid" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Mitteterminalid, koos reeglitega kus nad ilmuvad" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "sisendgrammatikas pole reegleid" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "sisendgrammatikas pole reegleid" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "sisendgrammatikas pole reegleid" +msgstr[1] "sisendgrammatikas pole reegleid" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "stardisümbolist %s ei tuletata ühtegi lauset" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "number piiridest väljas: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "käsitlen juhuslikku `,' kui tühikut" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "vigane juhus: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "vigased sümbolid: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "vigane null sümbol" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "vigane paojada: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "vigane null sümbol: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "tundmatu paojada: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "faili lõpus puudub `%s'" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "rea lõpus puudub `%s'" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "vigane $ väärtus: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "sisendgrammatikas on liiga palju sümboleid (piirang on %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s uuesti deklareerimine %s jaoks" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s deklareeriti <%s> jaoks uuesti" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "sümbol %s on uuesti defineeritud" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "sümbol %s on uuesti deklareeritud" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "%s kasutaja märgi numbri uuesti defineerimine" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"kasutatakse sümbolit %s, mis ei ole defineeritud märgina ja millel puuduvad " +"reeglid" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "sümbolit `%s' on kasutatud enam kui kord literaal sõnena" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "sümbolile `%s' on antud enam kui üks literaal sõne" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "märkidele %s ja %s on mõlemale omistatud number %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "stardisümbol %s ei ole defineeritud" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "stardisümbol %s on märk" + +#: src/symtab.c:908 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "vaikimisi %%destructor uuesti deklareerimine" + +#: src/symtab.c:921 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "vaikimisi %%destructor uuesti deklareerimine" + +#: src/symtab.c:934 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "vaikimisi %%printer uuesti deklareerimine" + +#: src/symtab.c:947 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "vaikimisi %%printer uuesti deklareerimine" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "vigane argument %s %s'le" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "segane argument %s %s'le" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Lubatud argumendid on:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u vabastatud (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u puhverdatud (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u puhverdatud (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u puhverdatud (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "loenduri logi histogramm\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "suuruste logi histogramm\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "tiheduse histogramm\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Bitset statistika:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Salvestatud läbimisi = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Statistika faili ei saa lugeda." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Vigane statistika faili suurus.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Statistika faili ei saa kirjutada." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Statistika faili ei saa kirjutamiseks avada." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Tundmatu süsteemi viga" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: võti `%s' on segane\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: võti `--%s' ei luba argumenti\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: võti `%c%s' ei luba argumenti\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: võti `%s' nõuab argumenti\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: tundmatu võti `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: tundmatu võti `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: lubamatu võti -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: vigane võti -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: võti nõuab argumenti -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: võti `-W %s' on segane\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: võti `-W %s' ei luba argumenti\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "mälu on otsas" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "abiprogrammi `%s' ei saa käivitada" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Täitmise ajad (sekundites)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " KOKKU :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "aeg %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Kui pikk võti näitab, et argument on kohustuslik, siis on see " +#~ "kohustuslik \n" +#~ "ka lühikese võtme korral. Sama ka vabalt valitavate võtmete korral.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "Mitteredutseeruvad reeglid" + +#~ msgid "useless rule" +#~ msgstr "kasutamata reegel" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "kasutamata mitteterminal: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Kasutamata mitteterminalid" + +#~ msgid "Terminals which are not used" +#~ msgstr "Terminalid, mida ei kasutatud" + +#~ msgid "Useless rules" +#~ msgstr "Kasutamata reeglid" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d reegel ei redutseeru\n" +#~ msgstr[1] "%d reeglit ei redutseeru\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d kasutamata mitteterminal" +#~ msgstr[1] "%d kasutamata mitteterminali" + +#~ msgid " and " +#~ msgstr " ja " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d kasutamata reegel" +#~ msgstr[1] "%d kasutamata reeglit" diff --git a/po/fr.gmo b/po/fr.gmo new file mode 100644 index 0000000..9101933 Binary files /dev/null and b/po/fr.gmo differ diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..b81c7c1 --- /dev/null +++ b/po/fr.po @@ -0,0 +1,1448 @@ +# Messages français pour Bison. +# Copyright © 2004 Free Software Foundation, Inc. +# Michel Robitaille , traducteur depuis/since 1996 +# Dominique Boucher a été le traducteur de 1996 à 2000 +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bison 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2006-09-27 08:00-0500\n" +"Last-Translator: Michel Robitaille \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "AVERTISSEMENT" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "erreur fatale" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "Conflit entre la règle %d et le jeton %s résolu par décalage" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "Conflit entre la règle %d et le jeton %s résolu par réduction" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "Conflit entre la règle %d et le jeton %s résolu comme étant une erreur" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "conflits: %d décalage/réduction, %d réduction/réduction\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "conflits: %d décalage/réduction\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "conflits: %d réduction/réduction\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "État %d" + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr affecte seulement les analyseurs GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "attendait %d conflit par décalage/réduction" +msgstr[1] "attendait %d conflits par décalage/réduction" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "attendait %d conflit par réduction/réduction" +msgstr[1] "attendait %d conflits par réduction/réduction" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "ne peut ouvrir le fichier « %s »" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "une erreur d'E/S" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "ne peut fermer le fichier" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "sorties en conflit vers le fichier %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Pour en savoir davantage, faites: « %s --help ».\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Usage: %s [OPTION]... FICHIER\n" + +#: src/getargs.c:248 +#, fuzzy +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" +"GNU bison génère des analyseurs pour les grammaires de type LALR(1) et GLR.\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +#, fuzzy +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"Modes d'utilisation:\n" +" -h, --help afficher l'aide-mémoire\n" +" -V, --version afficher le nom et la version du logiciel\n" +" --print-localedir afficher le répertoire contenant les données " +"avec dépendance des locales\n" +" -y, --yacc émuler yacc en mode POSIX\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Analyseur:\n" +" -S, --skeleton=FICHIER utiliser le FICHIER squelette\n" +" -t, --debug activer le mode de mise au point\n" +" de l'analyseur\n" +" --locations permettre le calcul des localisations\n" +" -p, --name-prefix=PREFIXE accoler le PREFIXE aux symboles externes\n" +" -l, --no-lines ne pas générer les directives « #line »\n" +" -n, --no-parser générer les tables seulement\n" +" -r, --raw compter les jetons à partir de 3\n" +" -k, --token-table inclure la table des noms de jetons\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Sortie:\n" +" -d, --defines produire un fichier d'en-tête\n" +" -r, --report=CHOSES générer les détails concernant l'automate\n" +" -v, --verbose produire une explication de l'automate\n" +" -b, --file-prefix=PREFIXE utiliser le PREFIXE pour le fichier de sortie\n" +" -o, --output=FICHIER produire la sortie dans le FICHIER\n" +" -g, --graph produire aussi la description du graphe VCG de " +"l'automate\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"CHOSES est une liste de mots séparés par des virgules qui peuvent inclure:\n" +" `state' décrire des états\n" +" `itemset' compléter le corps du jeu d'items avec leur fermeture\n" +" `lookahead' associer explicitement les jetons lookahead aux items\n" +" `solved' décrire la résolution des conflits décalage/réduction\n" +" `all' inclure toutes les informations ci-haut\n" +" `none' désactiver la génération de rapport\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Rapporter toutes anomalies à <" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Écrit par Robert Corbett et Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright © %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ce logiciel est libre; voir les sources pour les conditions de\n" +"reproduction. AUCUNE garantie n'est donnée; tant pour des raisons\n" +"COMMERCIALES que pour RÉPONDRE À UN BESOIN PARTICULIER.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "déclarations multiples de %s" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "caractère invalide: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "déclarations multiples de %s" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "opérande manquante après « %s »" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "opérande superflue « %s »" + +#: src/gram.c:112 +msgid "empty" +msgstr "vide" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammaire" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "débordement du nombre de lignes" + +#: src/location.c:94 +#, fuzzy, c-format +msgid "column number overflow" +msgstr "débordement du nombre de lignes" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "la règle n'a jamais fait de réduction en raison des conflits" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "identificateur manquant dans la déclaration de paramètres" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " le type %d est %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "décalage et aller à l'état %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "aller à l'état %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "erreur (non-associative)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "réduction par utilisation de la règle %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "accepter" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$défaut" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "état %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminaux, suivis des règles où ils apparaissent" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Non-terminaux, suivis des règles où ils apparaissent" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " à gauche:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " à droite:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "la règle n'a jamais fait de réduction en raison des conflits" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "déclarations multiples de %s" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "" +"conflit dans le type clash sur la fonction de fusion `%s': <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "déclaration précédante" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "la règle pour %s, qui est un terminal" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "conflit de type pour l'action par défaut: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "règle vide pour une catégorie typée et aucune action" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "valeur inutilisée: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "valeur non initialisée: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "seul un %s est permis par règle" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s affecte seulement les analyseurs GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s doit être suivi d'un nombre positif" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "règle trop longue" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "la grammaire n'a pas de règles" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "la grammaire n'a pas de règles" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Non-terminaux, suivis des règles où ils apparaissent" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "la grammaire n'a pas de règles" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "la grammaire n'a pas de règles" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "la grammaire n'a pas de règles" +msgstr[1] "la grammaire n'a pas de règles" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "" +"symbole de départ %s ne peut permettre la dérivation de n'importe quelle " +"phrase" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d de « %s » n'a pas de type déclaré" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ de « %s » n'a pas son type déclaré" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d de « %s » n'a pas de type déclaré" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "entier hors limite: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "« , » errante traitée comme un blanc" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "directive invalide: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "caractère invalide: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "caractère nul invalide" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "séquence d'échappement invalide: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "caractère nul invalide: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "séquence d'échappement non reconnue: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "chaîne de caractères « %s » manquante en fin de fichier" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "« %s » manquant à la fin de fichier" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "valeur $ invalide: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "trop de symboles dans la grammaire d'entrée (limite est %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "redéclaration de %s pour %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "redéclaration de %s pour <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "symbole %s est redéfini" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "symbole %s est redéclaré" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "redéfinition du jeton usager numéro de %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"le symbole %s est utilisé mais ce n'est pas un terminal et il ne possède pas " +"de règle" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "symbole « %s » utilisé plus d'une fois dans une chaîne litérale" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "symbole « %s » présent dans plus d'une chaîne litérale" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "les jetons %s et %s se sont vus assigner le nombre %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "le symbole de départ %s n'est pas défini" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "le symbole de départ %s est un terminal" + +#: src/symtab.c:908 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "redéclaration pour le destructeur%% par défaut" + +#: src/symtab.c:921 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "redéclaration pour le destructeur%% par défaut" + +#: src/symtab.c:934 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "redéclaration de l'imprimante%% par défaut" + +#: src/symtab.c:947 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "redéclaration de l'imprimante%% par défaut" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "argument invalide %s pour %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "argument ambiguë %s pour %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Arguments valides sont:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u libérés (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u dans la cache (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u dans la cache (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u dans la cache (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "histogramme des compteurs\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "taille de l'histogramme des compteurs\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "densité de l'histogramme\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Statistiques des bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Exécutions accumulées = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Ne peut lire le fichier de stats." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Taille erronée du fichier de stats.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Ne peut écrire le fichier de stats." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Ne ouvrir en écriture le fichier de stats." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Erreur système inconnue" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: l'option %s est ambigüe\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: l'option « --%s » n'admet pas d'argument\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: l'option « %c%s » n'admet pas d'argument\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: l'option « %s » requiert un argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: l'option « --%s » est inconnue\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: l'option « %c%s » est inconnue\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: option illégale -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: option non valide -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: l'option requiert un argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: l'option « -W %s » est ambiguë\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: l'option « -W %s » n'admet pas d'argument\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "mémoire épuisée" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "programme subsidiaire « %s » n'a pu être invoqué" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Temps d'exécution (secondes)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTAL :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "temps dans %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Si une option de forme longue montre un arguement comme étant " +#~ "obligatoire,\n" +#~ "il est alors obligatoire également pour une option de forme courte.\n" +#~ "Il en est de même pour les arguments optionnels.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "Règles jamais réduites" + +#~ msgid "useless rule" +#~ msgstr "règle inutilisable" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "non-terminal inutilisable: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Non-terminaux inutiles" + +#~ msgid "Terminals which are not used" +#~ msgstr "Terminaux qui ne sont utilisés" + +#~ msgid "Useless rules" +#~ msgstr "Règles inutiles" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d règle n'a jamais été réduite\n" +#~ msgstr[1] "%d règles n'ont jamais été réduites\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d nonterminal inutilisable" +#~ msgstr[1] "%d nonterminals inutilisables" + +#~ msgid " and " +#~ msgstr " et " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d règle inutilisable" +#~ msgstr[1] "%d règles inutilisables" + +#~ msgid "warning: " +#~ msgstr "AVERTISSEMENT: " + +#~ msgid "syntax error: cannot back up" +#~ msgstr "ereur de syntaxe: ne peut reculer" + +#~ msgid "Stack now" +#~ msgstr "Empilé maintenant" + +#~ msgid "Reducing stack by rule %d (line %u), " +#~ msgstr "réduction de la pile par utilisation de la règle %d (ligne %u)" + +#~ msgid "parser stack overflow" +#~ msgstr "débordement de la pile de l'analyseur " + +#~ msgid "Stack size increased to %lu\n" +#~ msgstr "La taille de la pile a augmenté à %lu\n" + +#~ msgid "Entering state %d\n" +#~ msgstr "Entrant dans l'état %d\n" + +#~ msgid "Reading a token: " +#~ msgstr "Lecture d'un jeton: " + +#~ msgid "Now at end of input.\n" +#~ msgstr "Maintenant à la fin de l'entrée.\n" + +#~ msgid "Next token is" +#~ msgstr "Le prochaine jeton est" + +#~ msgid "Shifting" +#~ msgstr "décalage en cours" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX interdit les déclaration dans la grammaire" + +#~ msgid "syntax error, unexpected %s" +#~ msgstr "erreur de syntaxe, %s inattendu" + +#~ msgid "syntax error, unexpected %s, expecting %s" +#~ msgstr "erreur de syntaxe, %s inattendu, attendait %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s" +#~ msgstr "erreur de syntaxe, %s inattendu, attendait %s ou %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s" +#~ msgstr "erreur de syntaxe, %s inattendu, attendait %s ou %s ou %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +#~ msgstr "erreur de syntaxe, %s inattendu, attendait %s ou %s ou %s ou %s" + +#~ msgid "syntax error; also memory exhausted" +#~ msgstr "erreur de syntaxe; aussi mémoire épuisée" + +#~ msgid "syntax error" +#~ msgstr "erreur de syntaxe" + +#~ msgid "Error: discarding" +#~ msgstr "Erreur: rejet de" + +#~ msgid "Error: popping" +#~ msgstr "Erreur: popping" + +#~ msgid "Error: discarding lookahead" +#~ msgstr "Erreur: rejet du lookahead" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "« { » manquante dans « %s »" + +#~ msgid "invalid $ value" +#~ msgstr "la valeur de symbole $ n'est pas valide" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "programme subsidiaire « %s » n'a pas été repéré" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "programme subsidiaire « %s » a échoué" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "programme subsidiaire « %s » a échoué (statut d'exécution %d)" + +#~ msgid "type redeclaration for %s" +#~ msgstr "redéclaration du type de %s" + +#~ msgid "redefining precedence of %s" +#~ msgstr "redéfinition du niveau de priorité de %s" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "les priorités pour %s et %s entrent en conflit" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "conflits d'associativités pour %s (%s) et %s (%s)" + +#~ msgid "%d shift/reduce conflict" +#~ msgid_plural "%d shift/reduce conflicts" +#~ msgstr[0] "%d conflit par décalage/réduction" +#~ msgstr[1] "%d conflits par décalage/réduction" + +#~ msgid "and" +#~ msgstr "et" + +#~ msgid "conflicts: " +#~ msgstr "conflits: " + +#~ msgid "State %d contains " +#~ msgstr "L'état %d contient " + +#~ msgid "too many gotos (max %d)" +#~ msgstr "nombre trop grand de « goto » (Max %d)" + +#~ msgid ": unexpected end of file in a comment\n" +#~ msgstr ": fin de fichier inattendue dans un commentaire\n" + +#~ msgid ": unexpected end of file in a string\n" +#~ msgstr ": fin de fichier inattendue dans une chaîne\n" + +#~ msgid ": unexpected end of file in a character\n" +#~ msgstr ": fin de fichier inattendue dans un caractère\n" + +#~ msgid ": unexpected end of file in a braced code\n" +#~ msgstr ": fin de fichier inattendue dans du code entre accolades\n" + +#~ msgid ": unexpected end of file in a prologue\n" +#~ msgstr ": fin de fichier inattendue dans un prologue\n" + +#~ msgid "%s is invalid" +#~ msgstr "%s n'est pas valide" + +#~ msgid "too many states (max %d)" +#~ msgstr "nombre trop grand d'états (max %d)" + +#~ msgid "%s: no grammar file given\n" +#~ msgstr "%s: grammaire manquante\n" + +#~ msgid "%s: extra arguments ignored after `%s'\n" +#~ msgstr "%s: arguments supplémentaires ignorés après « %s »\n" + +#~ msgid "two @prec's in a row" +#~ msgstr "deux @prec de suite" + +#~ msgid "only one %%dprec allowed per rule" +#~ msgstr "seul un %%dprec est permis par règle" + +#~ msgid "state_list_append (state = %d, symbol = %d (%s))\n" +#~ msgstr "state_list_append (état = %d, symbole = %d (%s))\n" + +#~ msgid "Entering new_itemsets, state = %d\n" +#~ msgstr "Entrant dans new_itemsets, état = %d\n" + +#~ msgid "Entering get_state, symbol = %d (%s)\n" +#~ msgstr "Entrant dans get_state, symbole = %d (%s)\n" + +#~ msgid "Entering append_states, state = %d\n" +#~ msgstr "Entrant dans append_states, état = %d\n" + +#~ msgid "Processing state %d (reached by %s)\n" +#~ msgstr "Traitement de l'état %d (atteint par %s)\n" + +#~ msgid "undefined associativity" +#~ msgstr "associativité indéfinie" + +#~ msgid "Closure: %s\n" +#~ msgstr "Fermeture: %s\n" + +#~ msgid " (rule %d)\n" +#~ msgstr " (règle %d)\n" + +#~ msgid "RTC: Firsts Input" +#~ msgstr "RTC: premières entrées" + +#~ msgid "RTC: Firsts Output" +#~ msgstr "RTC: premières sorties" + +#~ msgid "input" +#~ msgstr "entrée" + +#~ msgid "output" +#~ msgstr "sortie" + +#~ msgid "" +#~ "Variables\n" +#~ "---------\n" +#~ "\n" +#~ msgstr "" +#~ "Variables\n" +#~ "---------\n" +#~ "\n" + +#~ msgid "Value Sprec Sassoc Tag\n" +#~ msgstr "Valeur Sprec Sassoc Étiquette\n" + +#~ msgid "" +#~ "Rules\n" +#~ "-----\n" +#~ "\n" +#~ msgstr "" +#~ "Règles\n" +#~ "------\n" +#~ "\n" + +#~ msgid "" +#~ "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n" +#~ msgstr "" +#~ "Num (Prec, Assoc, Utile, Ritem étendue) Lhs -> Rhs (Ritem étendue) " +#~ "[Num]\n" + +#~ msgid "" +#~ "Rules interpreted\n" +#~ "-----------------\n" +#~ "\n" +#~ msgstr "" +#~ "Règles interprétées\n" +#~ "-------------------\n" +#~ "\n" + +#~ msgid "Lookaheads: BEGIN\n" +#~ msgstr "Lookaheads: DÉBUT\n" + +#~ msgid "State %d: %d lookaheads\n" +#~ msgstr "État %d: %d lookaheads\n" + +#~ msgid " on %d (%s) -> rule %d\n" +#~ msgstr " sur %d (%s) -> règle %d\n" + +#~ msgid "Lookaheads: END\n" +#~ msgstr "Lookaheads: FIN\n" + +#~ msgid "relation_transpose: input\n" +#~ msgstr "relation_transpose: entrée\n" + +#~ msgid "relation_transpose: output\n" +#~ msgstr "relation_transpose: sortie\n" + +#~ msgid "growing table and check from: %lu to %lu\n" +#~ msgstr "table en croissance et vérification depuis %lu à %lu\n" + +#~ msgid "base_t too small to hold %d\n" +#~ msgstr "base_t trop petite pour contenir %d\n" + +#~ msgid "reduce" +#~ msgstr "réduction" + +#~ msgid "%s contains " +#~ msgstr "%s contient " + +#~ msgid "`%s' is no longer supported" +#~ msgstr "« %s » n'est plus supporté" + +#~ msgid "unexpected `/' found and ignored" +#~ msgstr "« / » inattendu et ignoré" + +#~ msgid "unterminated comment" +#~ msgstr "le commentaire ne se termine pas" + +#~ msgid "unescaped newline in constant" +#~ msgstr "retour de chariot sans échappement dans une constante" + +#~ msgid "octal value outside range 0...255: `\\%o'" +#~ msgstr "valeur octale à l'extérieur de l'intervalle 0...255: « \\%o »" + +#~ msgid "hexadecimal value above 255: `\\x%x'" +#~ msgstr "valeur hexadécimale supérieure à 255: « \\x%x »" + +#~ msgid "unknown escape sequence: `\\' followed by `%s'" +#~ msgstr "séquence d'échappement inconnue: « \\ » suivie de « %s »" + +#~ msgid "unterminated type name at end of file" +#~ msgstr "le nom de type ne se termine pas avant la fin de fichier" + +#~ msgid "unterminated type name" +#~ msgstr "le nom de type ne se termine pas" + +#~ msgid "use \"...\" for multi-character literal tokens" +#~ msgstr "" +#~ "utilisez \"...\" pour les terminaux litéraux de plusieurs caractères" + +#~ msgid "`%s' supports no argument: %s" +#~ msgstr "« %s » ne supporte aucun argument: %s" + +#~ msgid "`%s' requires an argument" +#~ msgstr "« %s »: requiert un argument" + +#~ msgid " %-4s\terror (nonassociative)\n" +#~ msgstr " %-4s\terreur (non-associatif)\n" + +#~ msgid "" +#~ " $default\treduce using rule %d (%s)\n" +#~ "\n" +#~ msgstr "" +#~ " $défaut\tréduction par la règle %d (%s)\n" +#~ "\n" + +#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" +#~ msgstr " %-4s\t[réduction par la règle %d (%s)]\n" + +#~ msgid " %-4s\treduce using rule %d (%s)\n" +#~ msgstr " %-4s\tréduction par la règle %d (%s)\n" + +#~ msgid " $default\treduce using rule %d (%s)\n" +#~ msgstr " $défaut\tréduction par la règle %d (%s)\n" + +#~ msgid " $default\taccept\n" +#~ msgstr " $défaut\taccepter\n" + +#~ msgid " NO ACTIONS\n" +#~ msgstr " PAS D'ACTION\n" + +#~ msgid "Number, Line, Rule" +#~ msgstr "Nombre, ligne, règle" + +#~ msgid " %3d %3d %s ->" +#~ msgstr " %3d %3d %s ->" + +#~ msgid " Skipping to next \\n" +#~ msgstr " Saut jusqu'au prochain \\n" + +#~ msgid " Skipping to next %c" +#~ msgstr " Saut jusqu'au prochain %c" + +#~ msgid "unterminated string" +#~ msgstr "chaîne de caractère non terminée" + +#~ msgid "unterminated `%{' definition" +#~ msgstr "" +#~ "La section de définition « %{ » ne termine pas avant la fin du fichier" + +#~ msgid "Premature EOF after %s" +#~ msgstr "Fin de fichier prématutée après %s" + +#~ msgid "`%s' is invalid in %s" +#~ msgstr "« %s » n'est pas valide dans %s" + +#~ msgid "%type declaration has no " +#~ msgstr "la déclaration %type n'a pas de " + +#~ msgid "invalid %%type declaration due to item: %s" +#~ msgstr "la déclaration %%type n'est pas valide en raison de l'item: %s" + +#~ msgid "invalid text (%s) - number should be after identifier" +#~ msgstr "" +#~ "le texte n'est pas valide (%s) - le nombre devrait suivre l'identificateur" + +#~ msgid "unexpected item: %s" +#~ msgstr "item inattendu: %s" + +#~ msgid "unmatched %s" +#~ msgstr "non appariement de %s" + +#~ msgid "argument of %%expect is not an integer" +#~ msgstr "l'argument de %%expect n'est pas un entier" + +#~ msgid "unrecognized item %s, expected an identifier" +#~ msgstr "item %s non reconnu, un identificateur est attendu" + +#~ msgid "expected string constant instead of %s" +#~ msgstr "chaîne de caractères constante attendue plutôt que %s" + +#~ msgid "no input grammar" +#~ msgstr "aucune grammaire en entrée" + +#~ msgid "unknown character: %s" +#~ msgstr "caractère inconnu: %s" + +#~ msgid "ill-formed rule: initial symbol not followed by colon" +#~ msgstr "règle mal formée: le symbole initial n'est pas suivi de « : »" + +#~ msgid "grammar starts with vertical bar" +#~ msgstr "la grammaire débute par une barre verticale" + +#~ msgid "previous rule lacks an ending `;'" +#~ msgstr "règle précédente manque une terminaison « ; »" + +#~ msgid "%%guard present but %%semantic_parser not specified" +#~ msgstr "%%guard est présent mais %%semantic_parser n'est pas spécifié" + +#~ msgid "two actions at end of one rule" +#~ msgstr "deux actions à la fin d'une même règle" + +#~ msgid "maximum table size (%d) exceeded" +#~ msgstr "taille maximale de la table (%d) dépassée" + +#~ msgid " $ \tgo to state %d\n" +#~ msgstr " $ \taller à l'état %d\n" + +#~ msgid "unterminated %guard clause" +#~ msgstr "clause %guard non terminée" + +#~ msgid "%s: internal error: %s\n" +#~ msgstr "%s: erreur interne: %s\n" + +#~ msgid "DERIVES" +#~ msgstr "DÉRIVES" + +#~ msgid "%s derives" +#~ msgstr "%s dérive" + +#~ msgid "Entering set_nullable" +#~ msgstr "Entré dans set_nullable" + +#~ msgid "" +#~ "reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n" +#~ msgstr "" +#~ "la réduction de %s définit %d terminal%s, %d catégorie%s et %d production%" +#~ "s.\n" + +#~ msgid " 1 shift/reduce conflict" +#~ msgstr " 1 conflit décalage/réduction" + +#~ msgid "%s contains" +#~ msgstr "%s contient" + +#~ msgid "\t\t/* empty */" +#~ msgstr "\t\t/* epsilon */" + +#~ msgid "multiple %%header_extension declarations" +#~ msgstr "multiples déclarations %%header_extension" + +#~ msgid "multiple %%source_extension declarations" +#~ msgstr "multiples déclarations %%source_extension" + +#~ msgid "vcg graph: no such color." +#~ msgstr "graphe vcg: pas de telle couleur" + +#~ msgid "vcg graph: no such text mode" +#~ msgstr "graphe vcg: pas de tel mode texte" + +#~ msgid "vcg graph: no such shape" +#~ msgstr "graphe vcg: pas de telle forme" + +#~ msgid "vcg graph: no such decision" +#~ msgstr "graphe vcg: pas de telle décision" + +#~ msgid "vcg graph: no such an orientation" +#~ msgstr "graphe vcg: pas de telle orientation" + +#~ msgid "vcg graph: no such an alignement" +#~ msgstr "graphe vcg: pas de tel alignement" + +#~ msgid "vcg graph: no such an arrow mode" +#~ msgstr "graphe vcg: pas de tel mode de flèche" + +#~ msgid "vcg graph: no such crossing_type" +#~ msgstr "graphe vcg: pas de tel type de croisement (crossing_type)" + +#~ msgid "vcg graph: no such view" +#~ msgstr "graphe vcg: pas de tel vue" + +#~ msgid "vcg graph: no such linestyle" +#~ msgstr "graphe vcg: pas de tel style de ligne" + +#~ msgid "vcg graph: no such an arrowstyle" +#~ msgstr "graphe vcg: pas de tel style de flèche" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "DERIVES\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "DERIVES\n" +#~ "\n" + +#~ msgid "unterminated comment at end of file" +#~ msgstr "le commentaire ne se termine pas avant la fin du fichier" + +#~ msgid "unmatched close-brace (`}')" +#~ msgstr "accolade fermante `}' non appariée" + +#~ msgid "@%s is invalid" +#~ msgstr "@%s n'est pas valide" + +#~ msgid "unmatched right brace (`}')" +#~ msgstr "accolade fermante `}' non appariée" + +#~ msgid "ill-formed %type declaration" +#~ msgstr "déclaration %type mal formée" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "FIRSTS\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "FIRSTS\n" +#~ "\n" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "%s firsts\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "%s firsts\n" +#~ "\n" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "%s derives\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "%s derives\n" +#~ "\n" + +#~ msgid "" +#~ "Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n" +#~ " [--debug] [--defines] [--fixed-output-files] [--no-lines]\n" +#~ " [--verbose] [--version] [--help] [--yacc]\n" +#~ " [--no-parser] [--token-table]\n" +#~ " [--file-prefix=prefix] [--name-prefix=prefix]\n" +#~ " [--output=outfile] grammar-file\n" +#~ msgstr "" +#~ "Usage: %s [-dhklntvyV] [-b préfixe-de-fichier] [-o sortie] [-p préfixe-de-" +#~ "nom]\n" +#~ " [--debug] [--defines] [--fixed-output-files] [--no-lines]\n" +#~ " [--verbose] [--version] [--help] [--yacc]\n" +#~ " [--no-parser] [--token-table]\n" +#~ " [--file-prefix=préfixe] [--name-prefix=préfixe]\n" +#~ " [--output=outfile] grammaire\n" + +#~ msgid "gotos" +#~ msgstr "gotos" + +#~ msgid "\"%s\", line %d: %s\n" +#~ msgstr "\"%s\", ligne %d: %s\n" + +#~ msgid "(\"%s\", line %d) error: %s\n" +#~ msgstr "(\"%s\", ligne %d) erreur: %s\n" + +#~ msgid "limit of %d exceeded, too many %s" +#~ msgstr "limite de %d dépassée, trop de %s" + +#~ msgid "unterminated comment in `%{' definition" +#~ msgstr "le commentaire ne se termine pas dans la section de définition (%{)" + +#~ msgid "invalid @-construct" +#~ msgstr "la construction «@» n'est pas valide" diff --git a/po/ga.gmo b/po/ga.gmo new file mode 100644 index 0000000..6d8783c Binary files /dev/null and b/po/ga.gmo differ diff --git a/po/ga.po b/po/ga.po new file mode 100644 index 0000000..1847363 --- /dev/null +++ b/po/ga.po @@ -0,0 +1,1016 @@ +# Irish translations for bison. +# Copyright (C) 2004 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Kevin Patrick Scannell , 2004, 2006, 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.4\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-11-02 18:52-0500\n" +"Last-Translator: Kevin Scannell \n" +"Language-Team: Irish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : (n>2 && n<7) ? 2 :" +"(n>6 && n<11) ? 3 : 4;\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "rabhadh" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "earráid mharfach" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "" +" Coinbhleacht idir riail %d agus teaghrán comharthach %s: réitíodh mar " +"iomlaoid" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" +" Coinbhleacht idir riail %d agus teaghrán comharthach %s: réitíodh mar " +"laghdú" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" +" Coinbhleacht idir riail %d agus teaghrán comharthach %s: réitíodh mar " +"earráid" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "coinbhleachtaí: %d iomlaoid/laghdú, %d laghdú/laghdú\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "coinbhleachtaí: %d iomlaoid/laghdú\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "coinbhleachtaí: %d laghdú/laghdú\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Staid %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "Níl %%expect-rr in úsáid ach le parsálaithe GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "bhíothas ag súil le %d coinbhleacht iomlaoid/laghdú" +msgstr[1] "bhíothas ag súil le %d choinbhleacht iomlaoid/laghdú" +msgstr[2] "bhíothas ag súil le %d choinbhleacht iomlaoid/laghdú" +msgstr[3] "bhíothas ag súil le %d gcoinbhleacht iomlaoid/laghdú" +msgstr[4] "bhíothas ag súil le %d coinbhleacht iomlaoid/laghdú" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "bhíothas ag súil le %d coinbhleacht laghdú/laghdú" +msgstr[1] "bhíothas ag súil le %d choinbhleacht laghdú/laghdú" +msgstr[2] "bhíothas ag súil le %d choinbhleacht laghdú/laghdú" +msgstr[3] "bhíothas ag súil le %d gcoinbhleacht laghdú/laghdú" +msgstr[4] "bhíothas ag súil le %d coinbhleacht laghdú/laghdú" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "ní féidir comhad `%s' a oscailt" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "Earráid I/A" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "ní féidir comhad a dhúnadh" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "diúltaítear inchomhad %s a fhorscríobh" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "aschuir chontrártha scríofa i gcomhad %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Bain triail as `%s --help' chun tuilleadh eolais a fháil.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Úsáid: %s [ROGHA]... COMHAD\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" +"Gin parsálaithe LALR(1) agus GLR.\n" +"\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" +"Is riachtanach le rogha ghearr aon argóint atá riachtanach leis an rogha " +"fhada.\n" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "Agus mar an gcéanna le haghaidh argóintí roghnacha freisin.\n" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"\n" +"Móid oibre:\n" +" -h, --help taispeáin an chabhair seo agus scoir\n" +" -V, --version taispeáin eolas faoin leagan agus scoir\n" +" --print-localedir taispeáin an chomhadlann ina bhfuil sonraí " +"logchaighdeáin\n" +" --print-datadir taispeáin an chomhadlann ina bhfuil creatlacha " +"agus XSLT\n" +" -y, --yacc déan aithris ar yacc POSIX\n" +" -W, --warnings=[CATAGÓIR] taispeáin na rabhaidh atá i gCATAGÓIR\n" +"\n" + +#: src/getargs.c:272 +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parsálaí:\n" +" -L, --language=TEANGA socraigh an ríomhtheanga le haschur\n" +" (gné thurgnamhach é seo)\n" +" -S, --skeleton=COMHAD socraigh an chreatlach le húsáid\n" +" -t, --debug ullmhaigh an parsálaí le haghaidh " +"dífhabhtaithe\n" +" --locations cumasaigh ríomh na suímh\n" +" -p, --name-prefix=RÉIMÍR cuir RÉIMÍR roimh gach siombail sheachtrach\n" +" -l, --no-lines ná gin treoracha `#line'\n" +" -k, --token-table cuir tábla d'ainmneacha teaghrán san áireamh\n" +"\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Aschur:\n" +" --defines[=COMHAD] gin comhad ceanntásca freisin\n" +" -d mar an gcéanna, ach gan COMHAD (le haghaidh " +"Yacc POSIX)\n" +" -r, --report=RUDAÍ tabhair sonraí faoin uathoibreán\n" +" --report-file=COMHAD scríobh tuairisc i gCOMHAD\n" +" -v, --verbose ar comhbhrí le `--report=state'\n" +" -b, --file-prefix=RÉIMÍR RÉIMÍR ar aschomhaid\n" +" -o, --output=COMHAD scríobh aschur sa CHOMHAD\n" +" -g, --graph[=COMHAD] scríobh graf an uathoibreáin\n" +" -x, --xml[=COMHAD] scríobh tuairisc ar an uathoibreán mar XML\n" +" (is trialach é an scéimre XML)\n" +"\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" +"Seo iad catagóirí na rabhadh:\n" +" `midrule-values' luachanna meánrialach gan socrú nó gan úsáid\n" +" `yacc' neamh-chomhoiriúintí le YACC POSIX\n" +" `all' gach rabhadh\n" +" `no-CATAGÓIR' ná taispeáin rabhaidh ó CATAGÓIR\n" +" `none' ná taispeáin rabhaidh ar bith\n" +" `error' caith le rabhaidh mar earráidí\n" +"\n" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"Is éard atá i RUDAÍ ná liosta focal, scartha le camóga, as na roghanna seo:\n" +" `state' déan cur síos ar na staideanna\n" +" `itemset' comhlíon na croíthacair míre lena gclabhsúr\n" +" `look-ahead' ceangail teaghráin réamhfheiceála le míreanna go follasach\n" +" `solved' réiteach de choinbhleachtaí iomlaoid/laghdú\n" +" `all' cuir gach sonra thuas san áireamh\n" +" `none' díchumasaigh an tuairisc\n" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"\n" +"Seol tuairiscí ar fhabhtanna chuig <%s>.\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Le Robert Corbett agus Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright © %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Is saorbhogearra an ríomhchlár seo; féach ar an bhunchód le haghaidh\n" +"coinníollacha cóipeála. Níl baránta ar bith ann; go fiú níl baránta ann\n" +"d'INDÍOLTACHT nó FEILIÚNACHT D'FHEIDHM AR LEITH.\n" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "ní cheadaítear níos mó ná creatlach amháin" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "teanga neamhbhailí `%s'" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "ní cheadaítear níos mó ná teanga amháin" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "oibreann ar iarraidh i ndiaidh `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "oibreann breise `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "folamh" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Gramadach" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "líne-uimhir thar maoil" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "uimhir an cholúin thar maoil" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "riail gan tairbhe sa pharsálaí de bhrí coinbhleachtaí" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "aitheantóir ar iarraidh i bhfógra paraiméadair" + +# don't know if alignment matters here, so use 4-letter 'sórt' vs. 'cineál'-KPS +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " de chineál %d is %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "déan iomlaoid, agus téigh go staid %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "téigh go staid %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "earráid (neamh-chomhthiomsaitheach)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "laghdaigh, ag úsáid rialach %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "glac leis" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$réamhshocraithe" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "staid %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Sloinn dolaghdaithe, le rialacha más cuí" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Sloinn inlaghdaithe, le rialacha más cuí" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " ar clé:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " ar dheis:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "Rialacha gan tairbhe sa pharsálaí de bhrí coinbhleachtaí" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "níos mó ná fógra amháin %s" + +# FRTF caismirt +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "" +"caismirt idir cineálacha toraidh i bhfeidhm chumaiscthe `%s': <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "fógra roimhe seo" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "tugadh riail i gcomhair %s atá ina theaghrán comharthach" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "caismirt idir cineálacha leis an ghníomh réamhshocraithe: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "" +"riail fholamh i gcomhair teaghrán inlaghdaithe le cineál, ach níl aon ghníomh" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "luach gan úsáid: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "luach gan socrú: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "ní cheadaítear ach %s amháin an riail" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "Níl %s curtha i bhfeidhm ach ar pharsálaithe GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "Ní foláir uimhir dheimhneach a theacht i ndiaidh %s" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "riail rófhada" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "níl aon riail sa ghramadach ionchurtha" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "riail gan tairbhe sa ghramadach" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "slonn inlaghdaithe gan tairbhe sa ghramadach: %s" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "Sloinn inlaghdaithe gan tairbhe sa ghramadach" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "Sloinn dolaghdaithe gan úsáid sa ghramadach" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "Rialacha gan tairbhe sa ghramadach" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "%d slonn inlaghdaithe gan tairbhe sa ghramadach" +msgstr[1] "%d shlonn inlaghdaithe gan tairbhe sa ghramadach" +msgstr[2] "%d shlonn inlaghdaithe gan tairbhe sa ghramadach" +msgstr[3] "%d slonn inlaghdaithe gan tairbhe sa ghramadach" +msgstr[4] "%d slonn inlaghdaithe gan tairbhe sa ghramadach" + +#: src/reduce.c:397 +#, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "%d riail gan tairbhe sa ghramadach" +msgstr[1] "%d riail gan tairbhe sa ghramadach" +msgstr[2] "%d riail gan tairbhe sa ghramadach" +msgstr[3] "%d riail gan tairbhe sa ghramadach" +msgstr[4] "%d riail gan tairbhe sa ghramadach" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "níl aon abairt díorthaithe ón siombail tosaigh %s" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "`$' ar strae" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "`@' ar strae" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "cineál follasach i ngramadach gan chineálacha" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "Níl aon chineál fógartha ag $$ na meánrialach ag $%d de `%s'" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "Níl aon chineál fógartha ag $$ de `%s'" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "Níl aon chineál fógartha ag $%d de `%s'" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "slánuimhir as raon: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "`,' ar seachrán, caith leis mar spás bán" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "treoir neamhbhailí: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "carachtar neamhbhailí: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "carachtar neamhbhailí nialasach" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "éalúchán neamhbhailí: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "carachtar neamhbhailí nialasach: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "seicheamh éalúcháin anaithnid: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "`%s' ar iarraidh ag críoch an chomhaid" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "`%s' ar iarraidh ag críoch na líne" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "luach neamhbhailí $: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "an iomarca siombailí sa ghramadach ionchurtha (uasmhéid %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "athfhógra %s ar %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "athfhógra %s ar <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "sainmhíniú nua ar shiombail %s" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "athfhógra ar shiombail %s" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "sainmhíniú nua ar an uimhir theaghráin do %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"tá siombail %s in úsáid, ach níl sé ina teaghrán comharthach agus níl aon " +"riail aici" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "siombail `%s' in úsáid níos mó ná uair amháin mar theaghrán litriúil" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "tá níos mó ná aon teaghrán litriúil amháin ag an tsiombail `%s'" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "tá teaghráin chomharthach ann (%s agus %s) leis an uimhir chéanna (%d)" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "siombail tosaigh %s gan sainmhíniú" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "is teaghrán comharthach í an tsiombail tosaigh %s" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "athfhógra ar %%destructor réamhshocraithe clibeáilte" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "athfhógra ar %%destructor réamhshocraithe gan chlib" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "athfhógra ar %%printer réamhshocraithe clibeáilte" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "athfhógra ar %%printer réamhshocraithe gan chlib" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "argóint neamhbhailí %s chun %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "argóint dhébhríoch %s chun %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Na hargóintí bailí:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u scaoilte (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u curtha i dtaisce (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u curtha i dtaisce (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u curtha i dtaisce (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "histeagram loga áirimh\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "histeagram loga méid\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "histeagram dlúithe\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Staitistic Bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Rití carnacha = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Níorbh fhéidir an comhad staitistice a léamh." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Méid comhaid staitistice earráideach.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Níorbh fhéidir scríobh ar an chomhad staitistice." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Níorbh fhéidir an comhad staitistice a oscailt chun scríobh ann." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Earráid chórais anaithnid" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: Tá an rogha `%s' débhríoch\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ní cheadaítear argóint i ndiaidh na rogha `--%s'\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ní cheadaítear argóint i ndiaidh na rogha `%c%s'\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: tá argóint de dhíth i ndiaidh na rogha `%s'\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: rogha anaithnid `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: rogha anaithnid `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: rogha neamhcheadaithe -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: rogha neamhbhailí -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: tá argóint de dhíth i ndiaidh na rogha -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: Tá an rogha `-W %s' débhríoch\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ní cheadaítear argóint i ndiaidh na rogha `-W %s'\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "cuimhne ídithe" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "níorbh fhéidir an fochlár `%s' a rith" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Agaí rite (soicindí)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " IOMLÁN :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "aga i %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "%d nonterminal" +#~ msgid_plural "%d nonterminals" +#~ msgstr[0] "%d slonn dolaghdaithe" +#~ msgstr[1] "%d shlonn dolaghdaithe" +#~ msgstr[2] "%d shlonn dolaghdaithe" +#~ msgstr[3] "%d slonn dolaghdaithe" +#~ msgstr[4] "%d slonn dolaghdaithe" + +#~ msgid " and " +#~ msgstr " agus " + +#~ msgid "%d rule" +#~ msgid_plural "%d rules" +#~ msgstr[0] "%d riail" +#~ msgstr[1] "%d riail" +#~ msgstr[2] "%d riail" +#~ msgstr[3] "%d riail" +#~ msgstr[4] "%d riail" + +#~ msgid " useless in grammar" +#~ msgstr " gan tairbhe sa ghramadach" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Is riachtanach le rogha ghearr aon argóint atá riachtanach\n" +#~ "leis an rogha fhada, agus ar an nós céanna leis na hargóintí roghnacha.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "Rialacha nach laghdaithe riamh" + +#~ msgid "Terminals which are not used" +#~ msgstr "Sloinn dolaghdaithe nach in úsáid" + +#~ msgid "warning: " +#~ msgstr "rabhadh: " + +#~ msgid "syntax error: cannot back up" +#~ msgstr "earráid chomhréire: ní féidir cúlú" + +#~ msgid "Stack now" +#~ msgstr "Cruach anois" + +#~ msgid "Reducing stack by rule %d (line %u), " +#~ msgstr "Cruach á laghdú, ag úsáid rialach %d (líne %u)" + +#~ msgid "parser stack overflow" +#~ msgstr "cruach pharsála thar maoil" + +#~ msgid "Stack size increased to %lu\n" +#~ msgstr "Méadaíodh an chruach go %lu\n" + +#~ msgid "Entering state %d\n" +#~ msgstr "Ag dul go staid %d\n" + +#~ msgid "Reading a token: " +#~ msgstr "Teaghrán comharthach á léamh: " + +#~ msgid "Now at end of input.\n" +#~ msgstr "Ag deireadh an ionchuir.\n" + +#~ msgid "Next token is" +#~ msgstr "An chéad teaghrán comharthach eile" + +#~ msgid "Shifting" +#~ msgstr "Ag déanamh iomlaoid" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "Ní cheadaítear fógraí sa ghramadach de réir POSIX" + +#~ msgid "syntax error, unexpected %s" +#~ msgstr "earráid chomhréire, %s gan choinne" + +#~ msgid "syntax error, unexpected %s, expecting %s" +#~ msgstr "earráid chomhréire, %s gan choinne, bhíothas ag súil le %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s" +#~ msgstr "earráid chomhréire, %s gan choinne, bhíothas ag súil le %s nó %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s" +#~ msgstr "" +#~ "earráid chomhréire, %s gan choinne, bhíothas ag súil le %s nó %s nó %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +#~ msgstr "" +#~ "earráid chomhréire, %s gan choinne, bhíothas ag súil le %s nó %s nó %s nó " +#~ "%s" + +#~ msgid "syntax error; also memory exhausted" +#~ msgstr "earráid chomhréire; cuimhne ídithe freisin" + +#~ msgid "syntax error" +#~ msgstr "earráid chomhréire" + +#~ msgid "Error: discarding" +#~ msgstr "Earráid: curtha i leataobh" + +#~ msgid "Error: popping" +#~ msgstr "Earráid: á phlobadh" + +#~ msgid "Error: discarding lookahead" +#~ msgstr "Earráid: réamhfheiceáil curtha i leataobh" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "`{' ar iarraidh i `%s'" + +#~ msgid "invalid $ value" +#~ msgstr "luach $ neamhbhailí" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "fochlár `%s' gan aimsiú" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "theip ar an fhochlár `%s'" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "theip ar an fhochlár `%s' (stádas scortha %d)" + +#~ msgid "type redeclaration for %s" +#~ msgstr "athfhógra cineáil ar %s" + +#~ msgid "redefining precedence of %s" +#~ msgstr "tosaíocht nua ar %s" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "tosaíochtaí contrártha idir %s agus %s" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "comhthiomsaitheacht chontrártha idir %s (%s) agus %s (%s)" diff --git a/po/hr.gmo b/po/hr.gmo new file mode 100644 index 0000000..f01f2d7 Binary files /dev/null and b/po/hr.gmo differ diff --git a/po/hr.po b/po/hr.po new file mode 100644 index 0000000..28e1229 --- /dev/null +++ b/po/hr.po @@ -0,0 +1,1075 @@ +# Translation of bision to Croatian +# Copyright (C) 2002 Free Software Foundation, Inc. +# Denis Lackovic , 2002. +# This file is distributed under the same license as the bison package. +# Denis Lackovic , 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 1.34a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2002-04-10 22:20+01\n" +"Last-Translator: Denis Lackovic \n" +"Language-Team: Croatian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n==1 ? 0 : 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +#, fuzzy +msgid "warning" +msgstr "upozorenje:" + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "fatalna gre¹ka:" + +#: src/conflicts.c:77 +#, fuzzy, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "Konflikt u stanju %d izmeðu pravila %d i znaka %s razrije¹en kao %s.\n" + +#: src/conflicts.c:86 +#, fuzzy, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "Konflikt u stanju %d izmeðu pravila %d i znaka %s razrije¹en kao %s.\n" + +#: src/conflicts.c:94 +#, fuzzy, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "Konflikt u stanju %d izmeðu pravila %d i znaka %s razrije¹en kao %s.\n" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "" + +#: src/conflicts.c:495 +#, fuzzy, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr " %d pomakni/reduciraj" + +#: src/conflicts.c:497 +#, fuzzy, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr " %d reduviraj/reduciraj" + +#: src/conflicts.c:515 +#, fuzzy, c-format +msgid "State %d " +msgstr "stanje %d" + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "" + +#: src/conflicts.c:607 +#, fuzzy, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "oèekujem %d pomakni/reduciraj konflikt\n" +msgstr[1] "oèekujem %d pomakni/reduciraj konflikata\n" + +#: src/conflicts.c:612 +#, fuzzy, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "%d reduciraj/reduciraj konflikt" +msgstr[1] "%d reduciraj/reduciraj konflikata" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "ne mogu otvoriti datoteku `%s'" + +#: src/files.c:128 +#, fuzzy, c-format +msgid "I/O error" +msgstr "gre¹ka" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "ne mogu zatvoriti datoteku" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, fuzzy, c-format +msgid "conflicting outputs to file %s" +msgstr "konfliktne asocijativne vrijednosti za %s i %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Poku¹aj `%s --help' za vi¹e informacija.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Kori¹tenje: %s [OPCIJA]... DATOTEKA\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parser:\n" +" -S, --skeleton=DATOTEKA specificiraj kostur za uporabu\n" +" -t, --debug pripremi parser za deugiranje\n" +" --locations omoguæi izraèunavanje lokacija\n" +" -p, --name-prefix=PREFIKS stavi PREFIX ispred vanjskih simbola\n" +" -l, --no-lines ne eneriraj `#line' direktive\n" +" -n, --no-parser generiraj samo tablice\n" +" -k, --token-table ukljuèi tablicu imena znakova\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Izvjesti o bugovima na .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "" + +#: src/getargs.c:345 +#, fuzzy, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "" +"Copyright 1984, 1986, 1989, 1992, 2000, 2001, 2002\n" +"Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ovo je slobodni softver; pogledajte kod kako biste doznali uvjete " +"kopiranja. NEMA\n" +"garancije; èak ni tvrdnje o ISPLATIVOSTI ili POGODNOSTI ZA NEKU SVRHU.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "vi¹estruke %s deklaracije" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "nedozvoljeni ulaz: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "vi¹estruke %s deklaracije" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "" + +#: src/gram.c:112 +msgid "empty" +msgstr "prazno" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Gramatika" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " tip %d je %s\n" + +#: src/print.c:164 +#, fuzzy, c-format +msgid "shift, and go to state %d\n" +msgstr " %-4s\tpomakni i idi u stanje %d\n" + +#: src/print.c:166 +#, fuzzy, c-format +msgid "go to state %d\n" +msgstr " $ \tidu u stanje %d\n" + +#: src/print.c:203 +#, fuzzy +msgid "error (nonassociative)\n" +msgstr "%-4s\tgre¹ka (nonassociative)" + +#: src/print.c:226 +#, fuzzy, c-format +msgid "reduce using rule %d (%s)" +msgstr "$default\treduciraj koristeæi pravilo %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "stanje %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Zavr¹ni znakovi, sa pravilima gdje se pojavljuju" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Nezavr¹ni znakovi, sa pravilima gdje se pojavljuju" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr "s lijeva:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr "s desna:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "vi¹estruke %s deklaracije" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "nedozvoljena %s deklaracija" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "pravilo dato za %s, a to je znak" + +#: src/reader.c:270 +#, fuzzy, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "sudar tipova (`%s' `%s') na deaultnoj akciji" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "prazno pravilo za nezavr¹ni znak, i nema akcije" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "nema pravila u ulaznoj gramatici" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "nema pravila u ulaznoj gramatici" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Nezavr¹ni znakovi, sa pravilima gdje se pojavljuju" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "nema pravila u ulaznoj gramatici" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "nema pravila u ulaznoj gramatici" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "nema pravila u ulaznoj gramatici" +msgstr[1] "nema pravila u ulaznoj gramatici" + +#: src/reduce.c:428 +#, fuzzy, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "Poèetni simbol %s ne daje niti jednu reèenicu" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d od `%s' nema deklarirani tip" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ od `%s' nema deklarirani tip" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d od `%s' nema deklarirani tip" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "" + +#: src/scan-gram.l:201 +#, fuzzy, c-format +msgid "invalid directive: %s" +msgstr "nedozvoljeni ulaz: %s" + +#: src/scan-gram.l:259 +#, fuzzy, c-format +msgid "invalid character: %s" +msgstr "nepoznati znak: %s" + +#: src/scan-gram.l:390 +#, fuzzy, c-format +msgid "invalid null character" +msgstr "nedozvoljena %s deklaracija" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, fuzzy, c-format +msgid "invalid escape sequence: %s" +msgstr "nedozvoljeni ulaz: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, fuzzy, c-format +msgid "invalid null character: %s" +msgstr "nedozvoljeni ulaz: %s" + +#: src/scan-gram.l:442 +#, fuzzy, c-format +msgid "unrecognized escape sequence: %s" +msgstr "neprepoznati: %s" + +#: src/scan-gram.l:763 +#, fuzzy, c-format +msgid "missing `%s' at end of file" +msgstr "nezavr¹eni znakovni niz na kraju datoteke" + +#: src/scan-gram.l:774 +#, fuzzy, c-format +msgid "missing `%s' at end of line" +msgstr "nezavr¹eni znakovni niz na kraju datoteke" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "nedozvoljena $ vrijednost" + +#: src/symtab.c:78 +#, fuzzy, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "previ¹e simbola (znakovi plus nezavr¹ni znakovi); maksimalno %d" + +#: src/symtab.c:140 +#, fuzzy, c-format +msgid "%s redeclaration for %s" +msgstr "ponovna deklaracija za %s" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "ponovna deklaracija za %s" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "simbol %s ponovo definiran" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "simbol %s ponovo definiran" + +#: src/symtab.c:367 +#, fuzzy, c-format +msgid "redefining user token number of %s" +msgstr "ponovno definiran prethodnik od %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "simbol %s je kori¹ten, ali nije definiran kao znak i nema pravila" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "simbol `%s' kori¹ten vi¹e puta kao znakovni niz" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "simbolz `%s' dat vi¹e od jednog znakovnog niza" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "objema znakovima %s i %s je pridru¾en broj %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "poèetni simbol %s nije definiran" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "poèetni simbol %s je znak" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, fuzzy, c-format +msgid "invalid argument %s for %s" +msgstr "nedozvoljeni ulaz: %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "" + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "" + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "" + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Nepoznata sistemska gre¹ka" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opcija `%s' je nejednoznaèna\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opcija `--%s' ne dopu¹ta argument\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opcija `%c%s' ne dopu¹ta argument\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opcija `%s' zahtijeva argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: neprepoznata opcija `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: neprepoznata opcija `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: nedozvoljena opcija -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: nedozvoljena opcija -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opcija zahtijeva argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opcija `-W %s' je nejednoznaèna\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opcija `-W %s' ne dopu¹ta argument\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "iscrpljeni memorijski resursi" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr "" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "" + +#~ msgid "too many states (max %d)" +#~ msgstr "previ¹e stanja (maks %d)" + +#~ msgid "reduce" +#~ msgstr "reduciraj" + +#~ msgid "shift" +#~ msgstr "pomakni" + +#~ msgid "%d shift/reduce conflict" +#~ msgid_plural "%d shift/reduce conflicts" +#~ msgstr[0] "%d pomakni/reduciraj konflikat" +#~ msgstr[1] "%d pomakni/reduciraj konflikata" + +#~ msgid "and" +#~ msgstr "i" + +#~ msgid "State %d contains " +#~ msgstr "Stanje %d sadr¾i" + +#~ msgid "conflicts: " +#~ msgstr "konflikt:" + +#~ msgid "%s contains " +#~ msgstr "%s sadr¾i" + +#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" +#~ msgstr " %-4s\t[reduciraj koristeæi pravilo %d (%s)]\n" + +#~ msgid "" +#~ " $default\treduce using rule %d (%s)\n" +#~ "\n" +#~ msgstr "" +#~ " $default\treduciraj koristeæi pravilo %d (%s)\n" +#~ "\n" + +#~ msgid " %-4s\treduce using rule %d (%s)\n" +#~ msgstr " %-4s\treduciraj koristeæi pravilo %d (%s)\n" + +#~ msgid " $default\treduce using rule %d (%s)\n" +#~ msgstr " $default\treduciraj koristeæi pravilo %d (%s)\n" + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison generira parsere za LALR(1) gramatike.\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Ako duga opcija ka¾e da je argument obavezan, tada je on obavezan\n" +#~ "i za ekvivalentnu kratku opciju. Slièno je i za opcionalne argumente.\n" + +#~ msgid "" +#~ "Operation modes:\n" +#~ " -h, --help display this help and exit\n" +#~ " -V, --version output version information and exit\n" +#~ " -y, --yacc emulate POSIX yacc\n" +#~ msgstr "" +#~ "Naèini rada:\n" +#~ " -h, --help prika¾i ovu pomoæ i izaði\n" +#~ " -V, --version prika¾i verziju i izaði\n" +#~ " -y, --yacc emuliraj POSIX yacc\n" + +#~ msgid "" +#~ "Output:\n" +#~ " -d, --defines also produce a header file\n" +#~ " -v, --verbose also produce an explanation of the " +#~ "automaton\n" +#~ " -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +#~ " -o, --output=FILE leave output to FILE\n" +#~ " -g, --graph also produce a VCG description of the " +#~ "automaton\n" +#~ msgstr "" +#~ "Izlaz:\n" +#~ " -d, --defines takoðer proizvedi header datoteku\n" +#~ " -v, --verbose takoðer proizvedi obja¹njenje automata\n" +#~ " -b, --file-prefix=PREFIKS specificiraj PREFIKS za izlazne datoteke\n" +#~ " -o, --output=DATOTEKA ispi¹i izlaz u DATOTEKU\n" +#~ " -g, --graph takoðer proizvedi VCG opis automata\n" + +#~ msgid "`%s' is no longer supported" +#~ msgstr "`%s' vi¹e nije podr¾ano" + +#~ msgid "%s: no grammar file given\n" +#~ msgstr "%s: nije data datoteka sa gramatikom\n" + +#~ msgid "%s: extra arguments ignored after `%s'\n" +#~ msgstr "%s: dodatni argumenti se ignoriraju nakon `%s'\n" + +#~ msgid "too many gotos (max %d)" +#~ msgstr "previ¹e goto-a (maksimalno %d)" + +#~ msgid "unexpected `/' found and ignored" +#~ msgstr "neoèekivan `/' naðen i zanemaren" + +#~ msgid "unterminated comment" +#~ msgstr "nezavr¹eni komentar" + +#~ msgid "unexpected end of file" +#~ msgstr "neoèekivan kraj datoteke" + +#~ msgid "unescaped newline in constant" +#~ msgstr "neoèekivan znak za novu liniju u konstanti" + +#~ msgid "octal value outside range 0...255: `\\%o'" +#~ msgstr "oktalna vrijednost izvan dosega 0...255: `\\%o'" + +#~ msgid "hexadecimal value above 255: `\\x%x'" +#~ msgstr "heksadecimalna vrijednost vi¹a od 255: `\\x%x'" + +#~ msgid "unknown escape sequence: `\\' followed by `%s'" +#~ msgstr "nepoznata escape sekvenca: `\\' koju slijedi `%s'" + +#~ msgid "unterminated type name at end of file" +#~ msgstr "nezavr¹eno ime tipa pri kraju datoteke" + +#~ msgid "unterminated type name" +#~ msgstr "nezavr¹eno ime tipa" + +#~ msgid "use \"...\" for multi-character literal tokens" +#~ msgstr "koristi \"...\" za vi¹ebajtne znakove" + +#~ msgid "`%s' supports no argument: %s" +#~ msgstr "`%s' ne podr¾ava argument: %s" + +#~ msgid "`%s' requires an argument" +#~ msgstr "`%s' zahtijeva argument" + +#~ msgid "maximum table size (%d) exceeded" +#~ msgstr "maksimalna velièina tablice (%d) prekoraèena" + +#~ msgid " (rule %d)" +#~ msgstr " (pravilo %d)" + +#~ msgid " $default\taccept\n" +#~ msgstr " $default\tprihvati\n" + +#~ msgid " NO ACTIONS\n" +#~ msgstr " NEMA AKCIJA\n" + +#~ msgid " %-4s\terror (nonassociative)\n" +#~ msgstr " %-4s\tgre¹ka (nonassociative)\n" + +#~ msgid " %-4s\tgo to state %d\n" +#~ msgstr " %-4s\tidu u stanje %d\n" + +#~ msgid "Number, Line, Rule" +#~ msgstr "Broj, Linija, Pravilo" + +#~ msgid " %3d %3d %s ->" +#~ msgstr " %3d %3d %s ->" + +#~ msgid " Skipping to next \\n" +#~ msgstr " Preskaèem na slijedeæe \\n" + +#~ msgid " Skipping to next %c" +#~ msgstr " Preskaèem na slijedeæi %c" + +#~ msgid "unterminated string" +#~ msgstr "nezavr¹eni znakovni niz" + +#~ msgid "invalid @ value" +#~ msgstr "nedozvoljena @ vrijednost" + +#~ msgid "%s is invalid" +#~ msgstr "%s je nedozvoljeno" + +#~ msgid "unterminated `%{' definition" +#~ msgstr "nezavr¹ena `%{' definicija" + +#~ msgid "Premature EOF after %s" +#~ msgstr "Preuranjeni EOF nakon %s" + +#~ msgid "`%s' is invalid in %s" +#~ msgstr "`%s' je nedozvoljen u %s" + +#~ msgid "%type declaration has no " +#~ msgstr "%type deklaracija nema " + +#~ msgid "invalid %%type declaration due to item: %s" +#~ msgstr "nedozvoljena %%type deklaracija zbog: %s" + +#~ msgid "invalid text (%s) - number should be after identifier" +#~ msgstr "nedozvoljeno tekst (%s) - broj bi trebao biti nakon identifikatora" + +#~ msgid "unexpected item: %s" +#~ msgstr "neoèekivani: %s" + +#~ msgid "unmatched %s" +#~ msgstr "nije pronaðen %s" + +#~ msgid "argument of %%expect is not an integer" +#~ msgstr "argument od %%expect nije cijeli broj" + +#~ msgid "unrecognized item %s, expected an identifier" +#~ msgstr "neprepoznati %s, oèekivan nakon identifikatora" + +#~ msgid "expected string constant instead of %s" +#~ msgstr "oèekivana znakovna konstana umjesto %s" + +#~ msgid "no input grammar" +#~ msgstr "nema ulazne gramatike" + +#~ msgid "unterminated %guard clause" +#~ msgstr "nezavr¹ena %guard klauzula" + +#~ msgid "ill-formed rule: initial symbol not followed by colon" +#~ msgstr "lo¹e pravilo: zarez ne bi trebao slijediti poèetni simbol" + +#~ msgid "grammar starts with vertical bar" +#~ msgstr "gramatika poèinje sa okomitom crtom" + +#~ msgid "previous rule lacks an ending `;'" +#~ msgstr "prethodnom pravilu nedostaje zavr¹etak `;'" + +#~ msgid "two @prec's in a row" +#~ msgstr "dva @prec's u retku" + +#~ msgid "%%guard present but %%semantic_parser not specified" +#~ msgstr "%%guard prisutan ali %%semantic_parser nije specificiran" + +#~ msgid "two actions at end of one rule" +#~ msgstr "dvije akcije pri kraju jednog pravila" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "konflikt u prethodnici za %s and %s" + +#~ msgid "Useless nonterminals:" +#~ msgstr "Beskorisni nezavr¹ni znakovi:" + +#~ msgid "Terminals which are not used:" +#~ msgstr "Zavr¹ni znakovi koji nisu kori¹teni:" + +#~ msgid "Useless rules:" +#~ msgstr "Beskorisna pravila:" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d pravilo nije nikad reducirano\n" +#~ msgstr[1] "%d pravila nisu nikad reducirana\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d beskorisan nezavr¹ni znak" +#~ msgstr[1] "%d beskorisnih nezavr¹nih znakova" + +#~ msgid " and " +#~ msgstr " i" + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d beskorisno pravilo" +#~ msgstr[1] "%d beskorisnih pravila" diff --git a/po/id.gmo b/po/id.gmo new file mode 100644 index 0000000..54f1438 Binary files /dev/null and b/po/id.gmo differ diff --git a/po/id.po b/po/id.po new file mode 100644 index 0000000..0acf8df --- /dev/null +++ b/po/id.po @@ -0,0 +1,886 @@ +# translation of bison-2.3a.po to Indonesian +# bison 1.875 (Indonesian) +# Copyright (C) 2002, 2006 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison 1.50 package. +# +# Tedi Heriyanto , 2002, 2003. +# Tedi Heriyanto , 2006. +msgid "" +msgstr "" +"Project-Id-Version: bison-2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2006-09-27 20:02+0700\n" +"Last-Translator: Tedi Heriyanto \n" +"Language-Team: Indonesian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: KBabel 1.11.2\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "peringatan" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "kesalahan fatal" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Konflik antara aturan %d dan token %s diselesaikan sebagai shift" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Konflik antara aturan %d dan token %s diselesaikan sebagai reduce" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" +" Konflik antara aturan %d dan token %s diselesaikan sebagai kesalahan" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "konflik: %d geser/kurangi, %d kurangi/kurangi\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "konflik: %d geser/kurangi\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "konflik: %d kurangi/kurangi\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "State %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr hanya berlaku bagi parser GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "mengharapkan %d shift/reduce konflik" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "diharapkan %d kurangi/kurangi konflik" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "tidak dapat membuka file `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "Kesalahan I/O" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "tidak dapat menutup file" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "output konflik ke file %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Coba `%s --help' untuk informasi lebih lanjut.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Penggunaan: %s [OPTION]... FILE\n" + +#: src/getargs.c:248 +#, fuzzy +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "GNU bison menghasilkan parser LALR(1) dan GLR.\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +#, fuzzy +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"Mode Operasi:\n" +" -h, --help tampilkan bantuan ini dan keluar\n" +" -V, --version tampilkan informasi versi dan keluar\n" +" --print-localedir direktori hasil berisikan data locale-" +"dependent\n" +" -y, --yacc emulasikan POSIX yacc\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parser:\n" +" -S, --skeleton=FILE specifikasikan rangka yang akan digunakan\n" +" -t, --debug instrumen parser untuk debugging\n" +" --locations aktifkan lokasi perhitungan\n" +" -p, --name-prefix=PREFIX tambahkan PREFIX ke simbol eksternal\n" +" -l, --no-lines jangan hasilkan direktiv `#line'\n" +" -n, --no-parser hasilkan hanya tabel\n" +" -k, --token-table sertakan tabel nama token\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Output:\n" +" -d, --defines juga hasilkan file header\n" +" -r, --report=THINGS juga hasilkan detil tentang otomaton\n" +" -v, --verbose sama seperti `--report=state'\n" +" -b, --file-prefix=PREFIX spesifikasikan PREFIX untuk file output\n" +" -o, --output=FILE simpan output ke FILE\n" +" -g, --graph juga hasilkan deskripsi VCG automaton\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"THINGS adalah daftar kata yang dipisahkan koma mencakup:\n" +" `state' menggambarkan state\n" +" `itemset' lengkapi himpunan item inti dengan klosurnya\n" +" `lookahead' asosiasikan lookaheads ke item secara eksplisit\n" +" `solved' gambarkan penyelesaian konflik shift/reduce\n" +" `all' sertakan semua informasi di atas\n" +" `none' tiadakan laporan\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Laporkan kesalahan ke <" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Written by Robert Corbett and Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "deklarasi ganda %s" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "karakter tidak valid: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "deklarasi ganda %s" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "operand hilang setelah `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "operand ekstra `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "kosong" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammar" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "overflow nomor baris" + +#: src/location.c:94 +#, fuzzy, c-format +msgid "column number overflow" +msgstr "overflow nomor baris" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "aturan tidak pernah dikurangi karena konflik" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "identifier tidak ada dalam deklarasi parameter" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " tipe %d adalah %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "geser, dan ke state %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "ke state %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "kesalahan(nonasosiatif)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "kurangi gunakan aturan %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "terima" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "state %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminal, dengan aturan tempat mereka muncul" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Nonterminal, dengan aturan tempat mereka muncul" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " di kiri:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " di kanan:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "aturan tidak pernah dikurangi karena konflik" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "deklarasi ganda %s" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "tipe hasil bentrok pada fungsi merge '%s': <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "deklarasi sebelumnya" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "aturan diberikan untuk %s, yang merupakan sebuah token" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "bentrokan tipe pada aksi baku: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "aturan kosong untuk nonterminal typed, dan tidak ada aksi" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "nilai tidak digunakan: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "nilai tidak diset: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "hanya satu %s yang dibolehkan per aturan" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s hanya mempengaruhi parser GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s harus diikuti angka positif" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "aturan terlalu panjang" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "tidak ada aturan dalam grammar input" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "tidak ada aturan dalam grammar input" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Nonterminal, dengan aturan tempat mereka muncul" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "tidak ada aturan dalam grammar input" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "tidak ada aturan dalam grammar input" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "tidak ada aturan dalam grammar input" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "simbol awal %s tidak melahirkan kalimat" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "integer ke luar batas: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "stray `,' dianggap sebagai white space" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "direktif tidak valid: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "karakter tidak valid: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "karakter null tidak valid" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "urutan escape tidak valid: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "karakter null tidak valid: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "urutan escape tidak dikenal: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "kehilangan `%s' di akhir file" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "hilang `%s' di akhir baris" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "nilai $ tidak valid: %d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "terlalu banyak simbol dalam grammar input (batasnya adalah %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s redeklarasi untuk %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s redeklarasi untuk <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "simbol %s didefinisikan ulang" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "simbol %s dideklarasikan ulang" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "mendefinisikan ulang nomor token user %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"simbol %s digunakan, namun tidak didefinisikan sebagai token dan tidak " +"memiliki aturan" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "simbol `%s' digunakan lebih dari satu kali sebagai string literal" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "simbol `%s' diberikan lebih dari satu string literal" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "token %s dan %s keduanya memiliki angka %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "simbol awal %s tidak didefinisikan" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "simbol awal %s adalah sebuah token" + +#: src/symtab.c:908 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "deklarasi ulang untuk %%destructor baku" + +#: src/symtab.c:921 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "deklarasi ulang untuk %%destructor baku" + +#: src/symtab.c:934 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "deklarasi ulang untuk %%printer baku" + +#: src/symtab.c:947 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "deklarasi ulang untuk %%printer baku" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "argument %s tidak valid untuk %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "argumen %s ambigu untuk %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Argumen valid adalah:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u freed (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u cached (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u cached (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u cached (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "hitung log histogram\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "ukuran log histogram\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "kepadatan histogram\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Statistik bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Run terakumulasi = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Tidak dapat membaca file stat." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Ukuran file stat buruk.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Tidak dapat menulis file stat." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Tidak dapat membuka file stat untuk ditulisi." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Kesalahan sistem tidak dikenal" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: option `%s' ambigu\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: option `--%s' tidak membolehkan sebuah argumen\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: option `%c%s' tidak membolehkan sebuah argumen\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: option `%s' membutuhkan sebuah argumen\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: option tidak dikenal `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: option tidak dikenal `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: option ilegal -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: option tidak valid -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: option membutuhkan sebuah argumen -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: option `-W %s' ambigu\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: option `-W %s' tidak membolehkan sebuah argumen\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "memori habis" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "program subsider `%s' tidak dapat dipanggil" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Waktu eksekusi (detik)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTAL :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "waktu dalam %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Jika option panjang menyatakan argumen sebagai mandatori, maka ia " +#~ "mandatori juga\n" +#~ "untuk option pendek. Hal yang sama untuk argumen opsional.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "Aturan tidak pernah dikurangi" + +#~ msgid "useless rule" +#~ msgstr "aturan tidak berguna" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "nonterminal tidak berguna: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Nonterminal tidak berguna" + +#~ msgid "Terminals which are not used" +#~ msgstr "Terminal yang tidak digunakan" + +#~ msgid "Useless rules" +#~ msgstr "Useless rules" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "Aturan %d tidak pernah dikurangi\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "nonterminal tidak berguna %d" + +#~ msgid " and " +#~ msgstr " dan " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "aturan tidak berguna %d" diff --git a/po/insert-header.sin b/po/insert-header.sin new file mode 100644 index 0000000..b26de01 --- /dev/null +++ b/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/it.gmo b/po/it.gmo new file mode 100644 index 0000000..09771eb Binary files /dev/null and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po new file mode 100644 index 0000000..6c3f9d1 --- /dev/null +++ b/po/it.po @@ -0,0 +1,979 @@ +# Italian translation for message of GNU bison. +# Copyright (C) 2002 Free Software Foundation, Inc. +# Paolo Bonzini , 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.0\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-05-23 12:37+0100\n" +"Last-Translator: Paolo Bonzini \n" +"Language-Team: Italian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "attenzione" + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "errore fatale: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Conflitto tra la regola %d e il token %s risolto come shift" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Conflitto tra la regola %d e il token %s risolto come riduzione" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Conflitto tra la regola %d e il token %s risolto come errore" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "conflitti: %d shift/riduzione, %d riduzione/riduzione\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr " %d conflitti shift/riduzione\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr " %d conflitti riduzione/riduzione\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Stato %d" + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr considerato solo nei parser GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "atteso %d conflitto shift/riduzione" +msgstr[1] "attesi %d conflitti shift/riduzione" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "atteso %d conflitto riduzione/riduzione" +msgstr[1] "attesi %d conflitti riduzione/riduzione" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "impossibile aprire il file `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "errore di input/output" + +#: src/files.c:131 +#, fuzzy, c-format +msgid "cannot close file" +msgstr "impossibile chiudere il file `%s'" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "conflitto nell'output sul file %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Provare `%s --help' per ulteriori informazioni.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Utilizzo: %s [OPZIONE]... FILE\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parser:\n" +" -S, --skeleton=FILE specifica lo scheletro da usare\n" +" -t, --debug aggiunge informazioni di debug al parser\n" +" --locations abilita il calcolo delle locazioni (@N)\n" +" -p, --name-prefix=PREFISSO prepone PREFIX ai simboli globali\n" +" -l, --no-lines non genera direttive `#line'\n" +" -n, --no-parser genera le sole tabelle\n" +" -k, --token-table include una tabella di nomi dei token\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Output:\n" +" -d, --defines produce anche uno header\n" +" -r, --report=PARTI produce anche dettagli sull'automa\n" +" -v, --verbose produce anche una spiegazione dell'automa\n" +" -b, --file-prefix=PREFISSO specifica un prefisso per il file di output\n" +" -o, --output=FILE lascia l'output in FILE\n" +" -g, --graph produce anche una descrizione VCG dell'automa\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +#, fuzzy +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"PARTI è un elenco di parole separate da virgola scelte tra:\n" +" `state' descrive gli stati\n" +" `itemset' completa gli insiemi dei simboli con la loro chiusura " +"transitiva\n" +" `look-ahead' associa i token di prospezione ai simboli\n" +" `solved' descrive la riduzione dei conflitti shift/riduzione\n" +" `all' include tutte queste informazioni\n" +" `none' disabilita la produzione del rapporto\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Segnalare eventuali bug a .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Scritto da Robert Corbett e Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Questo e' software libero; vedere il sorgente per le condizioni cui e'\n" +"sottoposta la copia. NON c'è ALCUNA garanzia, neanche di\n" +"COMMERCIABILITA` o di ADEGUATEZZA AD UN PARTICOLARE SCOPO.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "dichiarazioni multiple per %s" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "valore non valido: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "dichiarazioni multiple per %s" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "manca un operando dopo `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "operando non richiesto `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "vuoto" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammatica" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "regola mai ridotta a causa dei conflitti" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "manca un identificatore nella dichirazione di un parametro" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " il tipo %d è %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "shift e prosecuzione allo stato %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "prosecuzione allo stato %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "errore (non associativo)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "riduzione con la regola %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "accetta" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "stato %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Simboli terminali e regole in cui appaiono" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Simboli nonterminali e regole in cui appaiono" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " nel primo membro:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " nel secondo membro:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "regola mai ridotta a causa dei conflitti" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "dichiarazioni multiple per %s" + +#: src/reader.c:131 +#, fuzzy, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "" +"conflitto nei tipi del risultato della funzione di merge %s: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "prima dichiarazione" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "fornita una regola per il token %s" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "conflitto di tipo nell'azione di default: <%s> e <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "regola vuota e nessuna azione per un nonterminale con tipo" + +#: src/reader.c:290 +#, fuzzy, c-format +msgid "unused value: $%d" +msgstr "valore non valido: %s" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "solo un %s è permesso in una regola" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s considerato solo nei parser GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s deve essere seguito da un intero positivo" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "nessuna regola nella grammatica di input" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "nessuna regola nella grammatica di input" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Simboli nonterminali e regole in cui appaiono" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "nessuna regola nella grammatica di input" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "nessuna regola nella grammatica di input" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "nessuna regola nella grammatica di input" +msgstr[1] "nessuna regola nella grammatica di input" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "dal simbolo iniziale %s non deriva alcuna frase" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "Manca una dichiarazione di tipo per $%d di `%s'" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "Manca una dichiarazione di tipo per $$ di `%s'" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "Manca una dichiarazione di tipo per $%d di `%s'" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "intero fuori dai limiti: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "`,' inattesa interpretata come uno spazio" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "direttiva non valida: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "carattere non valido: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "carattere nullo non valido" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "escape non valido: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "carattere nullo non valido: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "escape non riconosciuto: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "manca un `%s' alla fine del file" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "manca un `%s' alla fine della linea" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "valore non valido: %s" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "troppi simboli nella grammatica (il limite è %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "dichiarazione due volte di %s per %s" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "dichiarazione due volte di %s per %s" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "simbolo %s ridefinito" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "simbolo %s ridefinito" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "numero di token definito dall'utente specificato due volte per %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "usato il simbolo %s, ma non è un token e non ha regole" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "simbolo `%s' usato più di una volta in una stringa letterale" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "il simbolo `%s' dà pi` di una stringa letterale" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "i token %s e %s hanno lo stesso numero %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "simbolo iniziale %s non definito" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "specificato il token %s come simbolo iniziale" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "argomento non valido %s per %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "argomento ambiguo %s per %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Gli argomenti validi sono:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_alloc, %u liberati (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_set, %u in cache (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_reset, %u in cache (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_test, %u in cache (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_list\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "istogramma dei conteggi\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "istogramma delle dimensioni\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "istogranna delle densità\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Statistiche dei bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Esecuzioni accumulate = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Impossibile leggere il file delle statistiche." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Dimensione errata del file delle statistiche.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Impossibile scrivere il file delle statistiche." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Impossibile aprire in scrittura il file delle statistiche." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Errore di sistema sconosciuto" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: l'opzione `%s' è ambigua\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: l'opzione `--%s' non ammette argomenti\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: l'opzione `%c%s' non ammette argomenti\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: l'opzione `%s' richiede un argomento\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opzione sconosciuta `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opzione sconosciuta `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opzione non valida -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opzione non valida -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: l'opzione richiede un argomento -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: l'opzione `-W %s' è ambigua\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: l'opzione `-W %s' non ammette un argomento\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "memoria esaurita" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "impossibile invocare il programma ausiliario `%s'" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Tempo di esecuzione (in secondi)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTALE :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "tempo in %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "warning: " +#~ msgstr "attenzione: " + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison genera parser per grammatiche LALR(1).\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Se un argomento è indicato come obbligatorio in un'opzione lunga, allora\n" +#~ "è obbligatorio anche per l'equivalente opzione corta. Analogamente per\n" +#~ "gli argomenti opzionali.\n" + +#~ msgid "" +#~ "Operation modes:\n" +#~ " -h, --help display this help and exit\n" +#~ " -V, --version output version information and exit\n" +#~ " -y, --yacc emulate POSIX yacc\n" +#~ msgstr "" +#~ "Modalità operative:\n" +#~ " -h, --help mostra questo aiuto ed esce\n" +#~ " -V, --version mostra informazioni sulla versione ed esce\n" +#~ " -y, --yacc emula il comportamento di POSIX yacc\n" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX proibisce l'uso di dichiarazioni interne alla grammatica" + +#~ msgid "Rules never reduced" +#~ msgstr "Regole mai ridotte" + +#~ msgid "useless rule" +#~ msgstr "regola inutile" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "simbolo nonterminale inutilizzato: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Simboli nonterminali inutili" + +#~ msgid "Terminals which are not used" +#~ msgstr "Simboli terminali inutilizzati" + +#~ msgid "Useless rules" +#~ msgstr "Regole inutili" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d regola non applicata\n" +#~ msgstr[1] "%d regole non applicate\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d simbolo nonterminale inutilizzato" +#~ msgstr[1] "%d simboli nonterminali inutilizzati" + +#~ msgid " and " +#~ msgstr " e " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d regola inutile" +#~ msgstr[1] "%d regole inutili" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "manca un `{' in `%s'" + +#~ msgid "invalid $ value" +#~ msgstr "valore $ non valido" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "impossibile trovare il programma ausiliario `%s'" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "esecuzione del programma ausiliario `%s' fallita" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "" +#~ "esecuzione del programma ausiliario `%s' fallita (codice di uscita %d)" + +#~ msgid "syntax error: cannot back up" +#~ msgstr "errore di sintassi: impossibile tornare indietro" + +#~ msgid "Stack now" +#~ msgstr "Contenuto dello stack" + +#~ msgid "Reducing stack by rule %d (line %u), " +#~ msgstr "riduzione con la regola %d (linea %u)" + +#~ msgid "parser stack overflow" +#~ msgstr "stack troppo grande" + +#~ msgid "Stack size increased to %lu\n" +#~ msgstr "La nuova dimensione dello stack è %lu\n" + +#~ msgid "Entering state %d\n" +#~ msgstr "Prosecuzione allo stato %d\n" + +#~ msgid "Reading a token: " +#~ msgstr "Leggo un token: " + +#~ msgid "Now at end of input.\n" +#~ msgstr "Ora alla fine del file.\n" + +#~ msgid "Next token is" +#~ msgstr "Il prossimo token è" + +#~ msgid "Shifting" +#~ msgstr "Shift" + +#~ msgid "syntax error, unexpected %s" +#~ msgstr "errore di sintassi, %s non atteso" + +#~ msgid "syntax error, unexpected %s, expecting %s" +#~ msgstr "errore di sintassi, atteso %2$s e non %1$s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s" +#~ msgstr "errore di sintassi, atteso %2$s o %3$s e non %1$s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s" +#~ msgstr "errore di sintassi, atteso %2$s o %3$s o %4$s e non %1$s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +#~ msgstr "errore di sintassi, atteso %2$s o %3$s o %4$s o %5$s e non %1$s" + +#~ msgid "syntax error; also memory exhausted" +#~ msgstr "errore di sintassi; memoria esaurita" + +#~ msgid "syntax error" +#~ msgstr "errore di sintassi" + +#~ msgid "Error: discarding" +#~ msgstr "Errore: scarto" + +#~ msgid "Error: popping" +#~ msgstr "Errore: pop di" + +#~ msgid "Error: discarding lookahead" +#~ msgstr "Errore: scarto il lookahead" diff --git a/po/ja.gmo b/po/ja.gmo new file mode 100644 index 0000000..c28966a Binary files /dev/null and b/po/ja.gmo differ diff --git a/po/ja.po b/po/ja.po new file mode 100644 index 0000000..79c8ed4 --- /dev/null +++ b/po/ja.po @@ -0,0 +1,1234 @@ +# Japanese message for GNU bison 1.30f +# Copyright (C) 2001 Free Software Foundation, Inc. +# Daisuke Yamashita , 2001. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bison 1.30f\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2002-10-29 01:00-05:00\n" +"Last-Translator: Daisuke Yamashita \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=EUC-JP\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +#, fuzzy +msgid "warning" +msgstr "·Ù¹ð: " + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "Ã×̿Ū¥¨¥é¡¼: " + +#: src/conflicts.c:77 +#, fuzzy, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "¾õÂÖ %d ¤Îµ¬Â§ %d ¤È¥È¡¼¥¯¥ó %s ¤Î¶¥¹ç¤ò%s¤È¤·¤Æ²ò·è¡£\n" + +#: src/conflicts.c:86 +#, fuzzy, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "¾õÂÖ %d ¤Îµ¬Â§ %d ¤È¥È¡¼¥¯¥ó %s ¤Î¶¥¹ç¤ò%s¤È¤·¤Æ²ò·è¡£\n" + +#: src/conflicts.c:94 +#, fuzzy, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "¾õÂÖ %d ¤Îµ¬Â§ %d ¤È¥È¡¼¥¯¥ó %s ¤Î¶¥¹ç¤ò%s¤È¤·¤Æ²ò·è¡£\n" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "" + +#: src/conflicts.c:495 +#, fuzzy, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr " %d ¥·¥Õ¥È/´Ô¸µ" + +#: src/conflicts.c:497 +#, fuzzy, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr " %d ´Ô¸µ/´Ô¸µ" + +#: src/conflicts.c:515 +#, fuzzy, c-format +msgid "State %d " +msgstr "¾õÂÖ %d" + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "" + +#: src/conflicts.c:607 +#, fuzzy, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "ËÜÍè %d ¸Ä¤Î¥·¥Õ¥È/´Ô¸µ¾×ÆͤǤ¢¤ë¤Ï¤º¤Ç¤¹\n" + +#: src/conflicts.c:612 +#, fuzzy, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "%d ´Ô¸µ/´Ô¸µ¾×ÆÍ" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "¥Õ¥¡¥¤¥ë `%s' ¤ò³«¤±¤Þ¤»¤ó" + +#: src/files.c:128 +#, fuzzy, c-format +msgid "I/O error" +msgstr "¥¨¥é¡¼" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "¥Õ¥¡¥¤¥ë¤òÊĤ¸¤ë¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, fuzzy, c-format +msgid "conflicting outputs to file %s" +msgstr "Èó·ë¹çÃÍ %s ¤È %s ¤Ç¶¥¹ç¤¬À¸¤¸¤Æ¤¤¤Þ¤¹" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "`%s --help' ¤Ç¾ÜºÙ¾ðÊó¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "»È¤¤Êý: %s [¥ª¥×¥·¥ç¥ó]... ¥Õ¥¡¥¤¥ë\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"¹½Ê¸²òÀÏ´ï:\n" +" -S, --skeleton=FILE ÍøÍѤ¹¤ë¥¹¥±¥ë¥È¥ó¤ò»ØÄꤹ¤ë\n" +" -t, --debug ¹½Ê¸²òÀϤΥǥХå°ÍѤμêÃÊ\n" +" --locations ·×»»·ë²Ì°ÌÃÖ¤òÍ­¸ú¤Ë¤¹¤ë\n" +" -p, --name-prefix=PREFIX PREFIX ¤ò³°Éô¥·¥ó¥Ü¥ë¤È¤·¤ÆÀèƬ¤ËÁÞÆþ¤¹¤ë\n" +" -l, --no-lines `#line' ¥Ç¥£¥ì¥¯¥Æ¥£¥Ö¤òÀ¸À®¤·¤Ê¤¤\n" +" -n, --no-parser ¥Æ¡¼¥Ö¥ë¤Î¤ß¤òÀ¸À®¤¹¤ë\n" +" -k, --token-table ¥È¡¼¥¯¥ó̾¤Î¥Æ¡¼¥Ö¥ë¤ò´Þ¤á¤ë\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "¥Ð¥°¥ì¥Ý¡¼¥È¤Ï ¤Þ¤Ç¡£\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "" + +#: src/getargs.c:345 +#, fuzzy, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "" +"Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +"[»²¹ÍÌõ -- ˡŪ¸úÎϤϱÑʸ¤¬Å¬ÍѤµ¤ì¤Þ¤¹]\n" +"¤³¤ì¤Ï¥Õ¥ê¡¼¥½¥Õ¥È¥¦¥§¥¢¤Ç¤¹ -- Ê£À½¤Ë¤Ä¤¤¤Æ¤Î¾ò·ï¤Ï¥½¡¼¥¹¤ò¸«¤Þ¤·¤ç¤¦¡£\n" +"°ìÀÚ¤ÎÊݾڤϤ¢¤ê¤Þ¤»¤ó -- ¾¦¶ÈÀ­¤äÌÜŪŬ¹çÀ­¤Ë¤Ä¤¤¤Æ¤ÎÊݾڤ¹¤é¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "%s ¤¬Ê£¿ô¸ÄÀë¸À¤µ¤ì¤Þ¤·¤¿" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "%s ¤¬Ê£¿ô¸ÄÀë¸À¤µ¤ì¤Þ¤·¤¿" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "" + +#: src/gram.c:112 +msgid "empty" +msgstr "¶õ" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "ʸˡ" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " ¥¿¥¤¥× %d ¤Ï %s ¤Ç¤¹\n" + +#: src/print.c:164 +#, fuzzy, c-format +msgid "shift, and go to state %d\n" +msgstr " %-4s\t¥·¥Õ¥È¡¢¤ª¤è¤Ó¾õÂÖ %d ¤Ø\n" + +#: src/print.c:166 +#, fuzzy, c-format +msgid "go to state %d\n" +msgstr " $ \t¾õÂÖ %d ¤Ø\n" + +#: src/print.c:203 +#, fuzzy +msgid "error (nonassociative)\n" +msgstr "%-4s\t¥¨¥é¡¼ (Èó·ë¹ç)" + +#: src/print.c:226 +#, fuzzy, c-format +msgid "reduce using rule %d (%s)" +msgstr "$default\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "¾õÂÖ %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "½Ð¸½°ÌÃ֤ε¬Â§¤Ë¤è¤ë½ªÃ¼" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "½Ð¸½°ÌÃ֤ε¬Â§¤Ë¤è¤ëÈó½ªÃ¼" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " º¸ÊÕ:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " ±¦ÊÕ:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "%s ¤¬Ê£¿ô¸ÄÀë¸À¤µ¤ì¤Þ¤·¤¿" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "%s ¤ÎÀë¸À¤¬ÉÔŬÀڤǤ¹" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "%s ¤Ëµ¬Â§¤¬Í¿¤¨¤é¤ì¡¢¤½¤ì¤Ï¥È¡¼¥¯¥ó¤È¤Ê¤ê¤Þ¤¹" + +#: src/reader.c:270 +#, fuzzy, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "½é´ü¾õÂÖ¤ÎÆ°ºî¤Ç¤Ï·¿ (`%s' `%s') ¤¬¾×Æͤ·¤Þ¤¹" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "¶õ¤Î·¿ÉÕ¤­Èó½ªÃ¼¥¢¥¤¥Æ¥àÍѵ¬Â§¤Ç¤¢¤ê¡¢Æ°ºî¤¬µ¯¤ê¤Þ¤»¤ó" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "ÆþÎϤ·¤¿Ê¸Ë¡¤Ëµ¬Â§¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "ÆþÎϤ·¤¿Ê¸Ë¡¤Ëµ¬Â§¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "½Ð¸½°ÌÃ֤ε¬Â§¤Ë¤è¤ëÈó½ªÃ¼" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "ÆþÎϤ·¤¿Ê¸Ë¡¤Ëµ¬Â§¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "ÆþÎϤ·¤¿Ê¸Ë¡¤Ëµ¬Â§¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "ÆþÎϤ·¤¿Ê¸Ë¡¤Ëµ¬Â§¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: src/reduce.c:428 +#, fuzzy, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "³«»Ï¥·¥ó¥Ü¥ë %s ¤Ï¤É¤Îʸ¤Ë¤âͳÍ褷¤Þ¤»¤ó" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d ¸Ä¤Î `%s' ¤¬Àë¸À¤µ¤ì¤¿·¿¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "`%s' ¤Î $$ ¤ËÀë¸À¤Î¤Ê¤¤·¿¤¬¤¢¤ê¤Þ¤¹" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d ¸Ä¤Î `%s' ¤¬Àë¸À¤µ¤ì¤¿·¿¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "" + +#: src/scan-gram.l:201 +#, fuzzy, c-format +msgid "invalid directive: %s" +msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" + +#: src/scan-gram.l:259 +#, fuzzy, c-format +msgid "invalid character: %s" +msgstr "̤ÃΤÎʸ»ú: %s" + +#: src/scan-gram.l:390 +#, fuzzy, c-format +msgid "invalid null character" +msgstr "%s ¤ÎÀë¸À¤¬ÉÔŬÀڤǤ¹" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, fuzzy, c-format +msgid "invalid escape sequence: %s" +msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, fuzzy, c-format +msgid "invalid null character: %s" +msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" + +#: src/scan-gram.l:442 +#, fuzzy, c-format +msgid "unrecognized escape sequence: %s" +msgstr "ǧ¼±¤Ç¤­¤Ê¤¤: %s" + +#: src/scan-gram.l:763 +#, fuzzy, c-format +msgid "missing `%s' at end of file" +msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤Ê¸»úÎ󤬥ե¡¥¤¥ëËöÈø¤Ë¤¢¤ê¤Þ¤¹" + +#: src/scan-gram.l:774 +#, fuzzy, c-format +msgid "missing `%s' at end of line" +msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤Ê¸»úÎ󤬥ե¡¥¤¥ëËöÈø¤Ë¤¢¤ê¤Þ¤¹" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "ÉÔŬÀÚ¤Ê $ ¤ÎÃÍ" + +#: src/symtab.c:78 +#, fuzzy, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "¥·¥ó¥Ü¥ë¤¬Â¿¤¹¤®¤Þ¤¹ (¥È¡¼¥¯¥ó + Èó½ªÃ¼¥¢¥¤¥Æ¥à) -- ºÇÂç %d" + +#: src/symtab.c:140 +#, fuzzy, c-format +msgid "%s redeclaration for %s" +msgstr "%s ¤Î·¿¤¬ºÆÄêµÁ¤µ¤ì¤Þ¤·¤¿" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s ¤Î·¿¤¬ºÆÄêµÁ¤µ¤ì¤Þ¤·¤¿" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "¥·¥ó¥Ü¥ë %s ¤¬ºÆÄêµÁ¤µ¤ì¤Þ¤·¤¿" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "¥·¥ó¥Ü¥ë %s ¤¬ºÆÄêµÁ¤µ¤ì¤Þ¤·¤¿" + +#: src/symtab.c:367 +#, fuzzy, c-format +msgid "redefining user token number of %s" +msgstr "%s ¤ËÀè¹Ô¤·¤¿ºÆÄêµÁ¤Ç¤¹" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"¥·¥ó¥Ü¥ë %s ¤¬»È¤ï¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢¥È¡¼¥¯¥ó¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ¤ª¤é¤º¡¢µ¬Â§¤ò»ý¤Á¤Þ" +"¤»¤ó" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "¥·¥ó¥Ü¥ë `%s' ¤Ï¥ê¥Æ¥é¥ëʸ»úÎó¤È¤·¤ÆÊ£¿ô²ó»È¤ï¤ì¤Þ¤·¤¿" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "¥·¥ó¥Ü¥ë `%s' ¤ÏÊ£¿ô¤Î¥ê¥Æ¥é¥ëʸ»úÎó¤¬Í¿¤¨¤é¤ì¤Þ¤·¤¿" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "¥È¡¼¥¯¥ó %s ¤È %s ¤ÎÁÐÊý¤¬ÈÖ¹æ %d ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Þ¤·¤¿" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "³«»Ï¥·¥ó¥Ü¥ë %s ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "³«»Ï¥·¥ó¥Ü¥ë %s ¤Ï¥È¡¼¥¯¥ó¤Ç¤¹" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, fuzzy, c-format +msgid "invalid argument %s for %s" +msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "" + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "" + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "" + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "ÉÔÌÀ¤Ê¥·¥¹¥Æ¥à¥¨¥é¡¼" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `%s' ¤ÏÛ£Ëæ¤Ç¤¹\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `--%s' ¤Ï°ú¿ô¤òµö¤·¤Þ¤»¤ó\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `%c%s' ¤Ï°ú¿ô¤òµö¤·¤Þ¤»¤ó\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `%s' ¤Ï°ú¿ô¤òÍ׵ᤷ¤Þ¤¹\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ǧ¼±¤Ç¤­¤Ê¤¤¥ª¥×¥·¥ç¥ó `--%s' ¤Ç¤¹\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ǧ¼±¤Ç¤­¤Ê¤¤¥ª¥×¥·¥ç¥ó `%c%s' ¤Ç¤¹\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: Äê³Ê³°¤Î¥ª¥×¥·¥ç¥ó -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ÉÔŬÀڤʥª¥×¥·¥ç¥ó -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òÍ׵ᤷ¤Þ¤¹ -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `-W %s' ¤ÏÛ£Ëæ¤Ç¤¹\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `-W %s' ¤Ï°ú¿ô¤òµö¤·¤Þ¤»¤ó\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "¥á¥â¥ê¤ò»È¤¤²Ì¤¿¤·¤Þ¤·¤¿" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr "" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "" + +#~ msgid "too many states (max %d)" +#~ msgstr "¾õÂÖ¤¬Â¿¤¹¤®¤Þ¤¹ (ºÇÂç %d)" + +#~ msgid "reduce" +#~ msgstr "´Ô¸µ" + +#~ msgid "shift" +#~ msgstr "¥·¥Õ¥È" + +#~ msgid "%d shift/reduce conflict" +#~ msgid_plural "%d shift/reduce conflicts" +#~ msgstr[0] "%d ¥·¥Õ¥È/´Ô¸µ¾×ÆÍ" + +#~ msgid "and" +#~ msgstr "¤ª¤è¤Ó" + +#~ msgid "State %d contains " +#~ msgstr "¾õÂÖ %d ¤¬´Þ¤à¤Î¤Ï " + +#~ msgid "conflicts: " +#~ msgstr "¾×ÆÍ: " + +#~ msgid "%s contains " +#~ msgstr "%s ¤ÎÃæ¿È¤Ï" + +#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" +#~ msgstr " %-4s\t[µ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)]\n" + +#~ msgid "" +#~ " $default\treduce using rule %d (%s)\n" +#~ "\n" +#~ msgstr "" +#~ " $default\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" +#~ "\n" + +#~ msgid " %-4s\treduce using rule %d (%s)\n" +#~ msgstr " %-4s\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" + +#~ msgid " $default\treduce using rule %d (%s)\n" +#~ msgstr " $default\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison ¤Ï LALR(1) ʸˡ¤Î¹½Ê¸²òÀÏ´ï¤òÀ¸À®¤·¤Þ¤¹¡£\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "¥í¥ó¥°¥ª¥×¥·¥ç¥ó¤Çɬ¿Ü¤Î°ú¿ô¤¬¼¨¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢Æ±¤¸°ÕÌ£¤Î¥·¥ç¡¼¥È¥ª¥×¥·¥ç" +#~ "¥ó\n" +#~ "¤Ç¤âƱÍͤËɬ¿Ü¤Î°ú¿ô¤È¤Ê¤ê¤Þ¤¹¡£É¬¿Ü¤Ç¤Ê¤¤ÁªÂòŪ°ú¿ô¤Ç¤âƱÍͤǤ¹¡£\n" + +#~ msgid "" +#~ "Operation modes:\n" +#~ " -h, --help display this help and exit\n" +#~ " -V, --version output version information and exit\n" +#~ " -y, --yacc emulate POSIX yacc\n" +#~ msgstr "" +#~ "Áàºî¥â¡¼¥É:\n" +#~ " -h, --help ¤³¤Î»È¤¤Êý¤òɽ¼¨¤·¤Æ½ªÎ»¤¹¤ë\n" +#~ " -V, --version ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òɽ¼¨¤·¤Æ½ªÎ»¤¹¤ë\n" +#~ " -y, --yacc POSIX yacc ¤ò¥¨¥ß¥å¥ì¥¤¥È¤¹¤ë\n" + +#~ msgid "" +#~ "Output:\n" +#~ " -d, --defines also produce a header file\n" +#~ " -v, --verbose also produce an explanation of the " +#~ "automaton\n" +#~ " -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +#~ " -o, --output=FILE leave output to FILE\n" +#~ " -g, --graph also produce a VCG description of the " +#~ "automaton\n" +#~ msgstr "" +#~ "½ÐÎÏ:\n" +#~ " -d, --defines ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤âºîÀ®¤¹¤ë\n" +#~ " -v, --verbose ¥ª¡¼¥È¥Þ¥È¥ó¤Î²òÀâ¤âºîÀ®¤¹¤ë\n" +#~ " -b, --file-prefix=PREFIX ½ÐÎÏ¥Õ¥¡¥¤¥ë¤Î PREFIX(ÀÜƬ¼­) ¤ò»ØÄꤹ¤ë\n" +#~ " -o, --output=FILE ½ÐÎÏÀè¤ò FILE ¤È¤¹¤ë\n" +#~ " -g, --graph ¥ª¡¼¥È¥Þ¥È¥ó¤Î VCG µ­½Ò»Ò¤âºîÀ®¤¹¤ë\n" + +#~ msgid "`%s' is no longer supported" +#~ msgstr "`%s' ¤ÏºÇÁ᥵¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "%s: no grammar file given\n" +#~ msgstr "%s: ʸˡ¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó\n" + +#~ msgid "%s: extra arguments ignored after `%s'\n" +#~ msgstr "%s: `%s' ¤Î¸å¤í¤Î;ʬ¤Ê°ú¿ô¤Ï̵»ë¤µ¤ì¤Þ¤·¤¿\n" + +#~ msgid "too many gotos (max %d)" +#~ msgstr "goto ¤Î¿ô¤¬Â¿¤¹¤®¤Þ¤¹ (ºÇÂç %d)" + +#~ msgid "unexpected `/' found and ignored" +#~ msgstr "ͽ´ü¤·¤Ê¤¤ `/' ¤¬¸«¤Ä¤«¤ê¡¢Ìµ»ë¤µ¤ì¤Þ¤·¤¿" + +#~ msgid "unterminated comment" +#~ msgstr "ÊĤ¸¤Æ¤¤¤Ê¤¤¥³¥á¥ó¥È¤Ç¤¹" + +#~ msgid "unexpected end of file" +#~ msgstr "ͽ´ü¤·¤Ê¤¤¥Õ¥¡¥¤¥ë¤Î½ªÃ¼¤Ç¤¹" + +#~ msgid "unescaped newline in constant" +#~ msgstr "Äê¿ô¤ÎÃæ¤Ë¥¨¥¹¥±¡¼¥×¤µ¤ì¤Æ¤¤¤Ê¤¤²þ¹Ô¤¬¤¢¤ê¤Þ¤¹" + +#~ msgid "octal value outside range 0...255: `\\%o'" +#~ msgstr "8 ¿Ê¿ô¤ÎÃͤ¬ 0...255 ¤ÎÈϰϳ°¤Ç¤¹: `\\%o'" + +#~ msgid "hexadecimal value above 255: `\\x%x'" +#~ msgstr "16 ¿Ê¿ô¤ÎÃͤ¬ 255 ¤ò±Û¤¨¤Æ¤¤¤Þ¤¹: `\\x%x'" + +#~ msgid "unknown escape sequence: `\\' followed by `%s'" +#~ msgstr "̤ÃΤΥ¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹: `\\' ¤Î¸å¤Ë `%s'" + +#~ msgid "unterminated type name at end of file" +#~ msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥¿¥¤¥×̾¤¬¡¢¥Õ¥¡¥¤¥ëËöÈø¤Ë¤¢¤ê¤Þ¤¹" + +#~ msgid "unterminated type name" +#~ msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥¿¥¤¥×̾¤¬¤¢¤ê¤Þ¤¹" + +#~ msgid "use \"...\" for multi-character literal tokens" +#~ msgstr "Ê£¿ôʸ»ú¤Î¥ê¥Æ¥é¥ë¥È¡¼¥¯¥ó¤Ë¤Ï \"...\" ¤ò»È¤¤¤Þ¤·¤ç¤¦" + +#~ msgid "`%s' supports no argument: %s" +#~ msgstr "`%s' ¤Ï°ú¿ô¤ò¼õ¤±ÉÕ¤±¤Þ¤»¤ó: %s" + +#~ msgid "`%s' requires an argument" +#~ msgstr "`%s' ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òÍ׵ᤷ¤Þ¤¹" + +#~ msgid "maximum table size (%d) exceeded" +#~ msgstr "ºÇÂç¥Æ¡¼¥Ö¥ë¥µ¥¤¥º (%d) ¤òĶ¤¨¤Þ¤·¤¿" + +#~ msgid " (rule %d)" +#~ msgstr " (µ¬Â§ %d)" + +#~ msgid " $default\taccept\n" +#~ msgstr " $default\taccept\n" + +#~ msgid " NO ACTIONS\n" +#~ msgstr " Æ°ºî̵¤·\n" + +#~ msgid " %-4s\terror (nonassociative)\n" +#~ msgstr " %-4s\t¥¨¥é¡¼ (Èó·ë¹ç)\n" + +#~ msgid " %-4s\tgo to state %d\n" +#~ msgstr " %-4s\t¾õÂÖ %d ¤Ø\n" + +#~ msgid "Number, Line, Rule" +#~ msgstr "ÈÖ¹æ, ¹Ô, µ¬Â§" + +#~ msgid " %3d %3d %s ->" +#~ msgstr " %3d %3d %s ->" + +#~ msgid " Skipping to next \\n" +#~ msgstr " ¼¡¤Î \\n ¤Ë¥¹¥­¥Ã¥×" + +#~ msgid " Skipping to next %c" +#~ msgstr " ¼¡¤Î %c ¤Ë¥¹¥­¥Ã¥×" + +#~ msgid "unterminated string" +#~ msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤Ê¸»úÎó" + +#~ msgid "%s is invalid" +#~ msgstr "%s ¤ÏÉÔŬÀڤǤ¹" + +#~ msgid "unterminated `%{' definition" +#~ msgstr "`%{' ÄêµÁ ¤¬ÊĤ¸¤é¤ì¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "Premature EOF after %s" +#~ msgstr "%s ¤Î¸å¤í¤ËÁ᤯¤â EOF ¤¬¤¢¤ê¤Þ¤¹" + +#~ msgid "`%s' is invalid in %s" +#~ msgstr "`%s' ¤Ï %s Æâ¤Ç¤ÏÉÔŬÀڤǤ¹" + +#~ msgid "%type declaration has no " +#~ msgstr "%type Àë¸À¤Ë <¥¿¥¤¥×̾> ¤¬¤¢¤ê¤Þ¤»¤ó" + +#~ msgid "invalid %%type declaration due to item: %s" +#~ msgstr "¥¢¥¤¥Æ¥à¤Î°Ù¤Î %%type Àë¸À¤¬ÉÔŬÀڤǤ¹: %s" + +#~ msgid "invalid text (%s) - number should be after identifier" +#~ msgstr "ÉÔŬÀڤʥƥ­¥¹¥È (%s) - ¿ôÃͤϼ±Ê̻Ҥθå¤í¤Ë¤¢¤ë¤Ù¤­¤Ç¤¹" + +#~ msgid "unexpected item: %s" +#~ msgstr "ͽ´ü¤»¤Ì¥¢¥¤¥Æ¥à: %s" + +#~ msgid "unmatched %s" +#~ msgstr "Âбþ¤Î¤Ê¤¤ %s ¤Ç¤¹" + +#~ msgid "argument of %%expect is not an integer" +#~ msgstr "%%expect ¤Î°ú¿ô¤¬À°¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó" + +#~ msgid "unrecognized item %s, expected an identifier" +#~ msgstr "ǧ¼±¤Ç¤­¤Ê¤¤¥¢¥¤¥Æ¥à %s¡¢¤³¤³¤Ç¤Ï¼±Ê̻Ҥ¬´üÂÔ¤µ¤ì¤Þ¤¹" + +#~ msgid "expected string constant instead of %s" +#~ msgstr "¤³¤³¤Ç¤Ï %s ¤Ç¤Ï¤Ê¤¯Ê¸»úÎóÄê¿ô¤¬´üÂÔ¤µ¤ì¤Þ¤¹" + +#~ msgid "no input grammar" +#~ msgstr "ʸˡ¤ÎÆþÎϤ¬Ìµ¤¤" + +#~ msgid "unterminated %guard clause" +#~ msgstr "%guard À᤬ÊĤ¸¤é¤ì¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "ill-formed rule: initial symbol not followed by colon" +#~ msgstr "¼Ù°­¤Êµ¬Â§: ½é´ü²½¥·¥ó¥Ü¥ë¤Ë¥³¥í¥ó (:) ¤¬Â³¤¤¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "grammar starts with vertical bar" +#~ msgstr "ʸˡ¤Ï½ÄËÀ (|) ¤Ç»Ï¤á¤Þ¤¹" + +#~ msgid "two @prec's in a row" +#~ msgstr "@prec ¤Î¤â¤ÎÆó¤Ä¤¬Æ±Îó¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹" + +#~ msgid "%%guard present but %%semantic_parser not specified" +#~ msgstr "%%guard ¤¬¤¢¤ê¤Þ¤¹¤¬ %%semantic_parser ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "two actions at end of one rule" +#~ msgstr "°ì¤Ä¤Îµ¬Â§¤Î½ª¤ê¤ËÆó¤Ä¤ÎÆ°ºî¤ò»ØÄꤷ¤Æ¤¤¤Þ¤¹" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "Àè¹Ô¤·¤Æ¤¤¤ë %s ¤È %s ¤Ç¶¥¹ç¤¬À¸¤¸¤Æ¤¤¤Þ¤¹" + +#~ msgid "Useless nonterminals:" +#~ msgstr "̵°ÕÌ£¤ÊÈó½ªÃ¼»Ò:" + +#~ msgid "Terminals which are not used:" +#~ msgstr "ÍøÍѤµ¤ì¤Ê¤¤½ªÃ¼»Ò:" + +#~ msgid "Useless rules:" +#~ msgstr "̵°ÕÌ£¤Êµ¬Â§:" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d ¸Ä¤Îµ¬Â§¤Ï·è¤·¤Æ´Ô¸µ¤µ¤ì¤Þ¤»¤ó\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d ¸Ä¤Î̵°ÕÌ£¤ÊÈó½ªÃ¼»Ò" + +#~ msgid " and " +#~ msgstr "¤ª¤è¤Ó" + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d ¸Ä¤Î̵°ÕÌ£¤Êµ¬Â§" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "FIRSTS\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "FIRSTS\n" +#~ "\n" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "%s firsts\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "%s firsts\n" +#~ "\n" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "FDERIVES\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "FDERIVES\n" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "%s derives\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "%s ¤Ï°Ê²¼¤«¤éÇÉÀ¸\n" +#~ "\n" + +#~ msgid " 1 shift/reduce conflict" +#~ msgstr " 1 ¥·¥Õ¥È/´Ô¸µ¾×ÆÍ" + +#~ msgid " 1 reduce/reduce conflict" +#~ msgstr " 1 ´Ô¸µ/´Ô¸µ¾×ÆÍ" + +#~ msgid "%s contains" +#~ msgstr "%s ¤Ë¤Ï¡¢" + +#~ msgid "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "DERIVES\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "\n" +#~ "DERIVES\n" +#~ "\n" + +#~ msgid "%s derives" +#~ msgstr "%s ¤Ï°Ê²¼¤«¤éÇÉÀ¸" + +#~ msgid "" +#~ "Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n" +#~ " [--debug] [--defines] [--fixed-output-files] [--no-lines]\n" +#~ " [--verbose] [--version] [--help] [--yacc]\n" +#~ " [--no-parser] [--token-table]\n" +#~ " [--file-prefix=prefix] [--name-prefix=prefix]\n" +#~ " [--output=outfile] grammar-file\n" +#~ "\n" +#~ "Report bugs to bug-bison@gnu.org\n" +#~ msgstr "" +#~ "»È¤¤Êý: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n" +#~ " [--debug] [--defines] [--fixed-output-files] [--no-lines]\n" +#~ " [--verbose] [--version] [--help] [--yacc]\n" +#~ " [--no-parser] [--token-table]\n" +#~ " [--file-prefix=prefix] [--name-prefix=prefix]\n" +#~ " [--output=outfile] ʸˡ¥Õ¥¡¥¤¥ë\n" +#~ "\n" +#~ "¥Ð¥°¤ò¸«¤Ä¤±¤¿¤é bug-bison@gnu.org ¤Þ¤ÇÏ¢Íí¤ò¡£\n" + +#~ msgid "gotos" +#~ msgstr "goto" + +#~ msgid "%s:%d: fatal error: " +#~ msgstr "%s:%d: Ã×̿Ū¥¨¥é¡¼: " + +#~ msgid "%s: " +#~ msgstr "%s: " + +#~ msgid "%s:%d: " +#~ msgstr "%s:%d: " + +#~ msgid "%s: internal error: %s\n" +#~ msgstr "%s: ÆâÉô¥¨¥é¡¼: %s\n" + +#~ msgid "Entering set_nullable" +#~ msgstr "set_nullable ¤ËÆþ¤ê¤Þ¤¹" + +#~ msgid "\t\t/* empty */" +#~ msgstr "\t\t/* ¶õ */" + +#~ msgid "unterminated comment in `%{' definition" +#~ msgstr "`%{' ÄêµÁ ¤ËÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥³¥á¥ó¥È¤¬¤¢¤ê¤Þ¤¹" + +#~ msgid "multiple %union declarations" +#~ msgstr "Ê£¿ô¤Î %union Àë¸À¤Ç¤¹" + +#~ msgid "unterminated comment at end of file" +#~ msgstr "¥Õ¥¡¥¤¥ëËöÈø¤ËÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥³¥á¥ó¥È¤¬¤¢¤ê¤Þ¤¹" + +#~ msgid "unmatched close-brace (`}')" +#~ msgstr "Âбþ¤Î¤Ê¤¤ÊĤ¸¥Ö¥ì¡¼¥¹ (`}') ¤Ç¤¹" + +#~ msgid "unmatched right brace (`}')" +#~ msgstr "Âбþ¤Î¤Ê¤¤±¦¥Ö¥ì¡¼¥¹ (`}') ¤Ç¤¹" + +#~ msgid "$%s is invalid" +#~ msgstr "$%s ¤ÏÉÔŬÀڤǤ¹" + +#~ msgid "invalid @-construct" +#~ msgstr "ÉÔŬÀÚ¤Ê @-¥³¥ó¥¹¥È¥é¥¯¥È¤Ç¤¹" + +#~ msgid "ill-formed %type declaration" +#~ msgstr "¼Ù°­¤Ê %type Àë¸À¤Ç¤¹" + +#~ msgid "" +#~ "reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n" +#~ msgstr "" +#~ "´Ô¸µ¥Õ¥¡¥¤¥ë %s ¤Ç %d ¸Ä¤Î½ªÃ¼»Ò%.0s, %d ¸Ä¤ÎÈó½ªÃ¼»Ò%.0s, %d ¸Ä¤Îµ¬Â§%.0s" +#~ "¤¬ÄêµÁ¤µ¤ì¤Þ¤·¤¿\n" + +#~ msgid "" +#~ "Variables\n" +#~ "---------\n" +#~ "\n" +#~ msgstr "" +#~ "ÊÑ¿ô\n" +#~ "---------\n" +#~ "\n" + +#~ msgid "Value Sprec Sassoc Tag\n" +#~ msgstr "ÃÍ Á°ÃÖ ·ë¹ç ¥¿¥°\n" + +#~ msgid "" +#~ "Rules\n" +#~ "-----\n" +#~ "\n" +#~ msgstr "" +#~ "µ¬Â§\n" +#~ "-----\n" +#~ "\n" + +#~ msgid "" +#~ "Rules interpreted\n" +#~ "-----------------\n" +#~ "\n" +#~ msgstr "" +#~ "²ò¼á¤µ¤ì¤¿µ¬Â§\n" +#~ "-----------------\n" +#~ "\n" diff --git a/po/ms.gmo b/po/ms.gmo new file mode 100644 index 0000000..ed59d88 Binary files /dev/null and b/po/ms.gmo differ diff --git a/po/ms.po b/po/ms.po new file mode 100644 index 0000000..ebd5a38 --- /dev/null +++ b/po/ms.po @@ -0,0 +1,874 @@ +# Bison Bahasa Melayu (Malay) (ms). +# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the Bison package. +# Sharuzzaman Ahmat Raslan , 2003, 2004, 2005, 2006, 2007, 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.3b\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-07-25 01:15+0800\n" +"Last-Translator: Sharuzzaman Ahmat Raslan \n" +"Language-Team: Malay \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: KBabel 0.9.5\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "amaran" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "ralat maut" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Konflik antara hukum %d dan token %s diselesaikan sebagai pindahan" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" +" Konflik antara hukum %d dan token %s diselesaikan sebagai pengurangan" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Konflik antara hukum %d dan token %s diselesaikan sebagai ralat" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "konflik: %d pemindahan/pengurangan, %d pengurangan/pengurangan\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "konflik: %d pemindahan/pengurangan\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "konflik: %d pengurangan/pengurangan\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Keadaan %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr hanya berkesan kepada parser GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "jangkaan %d konflik pemindahan/pengurangan" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "dijangkakan %d pengurangan/pengurangan konflik" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "tidak dapat membuka fail `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "Ralat I/O" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "tidak dapat menutup fail" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "keluaran berkonflik kepada fail %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Cuba `%s --help' untuk lebih maklumat.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Penggunaan: %s [PILIHAN]... FAIL\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" +"Janakan penghurai LALR(1) dan GLR.\n" +"\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" +"Hujah wajib kepada pilihan panjang adalah wajib untuk pilihan pendek juga.\n" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "Perkara yang sama bagi hujah pilihan.\n" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"\n" +"Mod operasi:\n" +" -h, --help papar bantuan ini dan keluar\n" +" -V, --version keluarkan maklumat versi dan keluar\n" +" --print-localedir keluarkan direktori mengandungi data bergantung " +"locale\n" +" --print-datadir keluarkan direktori mengandungi rangka dan " +"XSLT\n" +" -y, --yacc tiru POSIX yacc\n" +" -W, --warnings=[KATEGORI] lapor amaran yang berada dalam KATEGORI\n" +"\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Penghurai:\n" +" -L, --language=BAHASA nyatakan bahasa pengaturcaraan keluaran\n" +" -S, --skeleton=FAIL nyatakan rangka untuk digunakan\n" +" -t, --debug peralatan parser untuk nyahpepijat\n" +" --locations hidupkan pengiraan lokasi\n" +" -p, --name-prefix=AWALAN tambah AWALAN kepada simbol luaran\n" +" -l, --no-lines jangan jana arahan `#line'\n" +" -k, --token-table sertakan jadual nama token\n" +"\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Keluaran:\n" +" --defines[=FAIL] juga hasilkan fail pengepala\n" +" -d, sama juga tetapi tidak boleh menyatakan FAIL " +"(untuk Yacc POSIX)\n" +" -r, --report=PERKARA juga hasilkan butir terperinci bagi automaton\n" +" --report-file=FAIL tulis laporan ke FAIL\n" +" -v, --verbose sama seperti `--report=state'\n" +" -b, --file-prefix=AWALAN nyatakan AWALAN untuk fail keluaran\n" +" -o, --output=FAIL biarkan keluaran kepada FAIL\n" +" -g, --graph juga hasilkan graf bagi automaton\n" +" -x, --xml[=FAIL] juga hasilkan laporan XML bagi automaton\n" +" (skema XML adalah masih tahap kajian)\n" +"\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" +"Kategori amaran termasuk:\n" +" `midrule-values' nilai hukumtengah nyahtetap atau tidak digunakan\n" +" `yacc' tidak serasi dengan POSIX YACC\n" +" `all' semua amaran\n" +" `no-CATEGORY' matikan amaran dalam CATEGORY\n" +" `none' matikan semua amaran\n" +" `error' jadikan amaran sebagai ralat\n" +"\n" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"PERKARA adalah senarai perkataan dipisah koma yang boleh termasuk:\n" +" `state' nyatakan keadaan\n" +" `itemset' lengkapkan set perkara asas dengan penutupnya\n" +" `lookahead' dengan jelas kaitkan token lookahead kepada perkara\n" +" `solved' nyatakan penyelesaian konflik pemindahan/pengurangan\n" +" `all' masukkan semua maklumat diatas\n" +" `none' matikan laporan\n" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"\n" +"Lapor pepijat ke <%s>.\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Ditulis oleh Robert Corbett dan Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Hakcipta (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ini adalah perisian bebas; lihat sumber untuk syarat menyalin. TIADA\n" +"jaminan disediakan; tidak juga untuk KEBOLEHDAGANGAN atau KEUPAYAAN UNTUK " +"SESUATU TUJUAN KHUSUS.\n" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "pelbagai rangka pengisytiharan tidak sah" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "bahasa `%s' tidak sah" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "pelbagai pengisytiharan bahasa adalah tidak sah" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "operan hilang selepas `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "operan tambahan `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "kosong" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Tatabahasa" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "nombor baris melimpah" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "nombor lajur melimpah" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "hukum tidak digunakan kerana konflik" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "pengecam hilang dalam parameter pengisytiharan" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " jenis %d adalah %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "pindah, dan pergi ke keadaan %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "pergi ke keadaan %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "ralat (tidak bergabung)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "kurang menggunakan hukum %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "terima" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "keadaan %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminal, dengan hukum dimana mereka kelihatan" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Tidak terminal, dengan hukum dimana mereka kelihatan" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " pada kiri:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " pada kanan:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "Hukum tidak digunakan dalam penghurai kerana konflik" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "pelbagai pengisytiharan %s" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "jenis hasil bertelingkah pada fungsi gabung %s: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "pengisytiharan terdahulu" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "hukum diberi untuk %s, dimana ia adalah token" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "pertelingkahan jenis pada tindakan default: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "hukum kosong untuk bukan terminal ditaip, dan tiada tindakan" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "nilai tidak digunakan: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "nyahtetap nilai: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "hanya satu %s dibenarkan setiap hukum" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s hanya berkesan kepada parser GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s mesti diikuti dengan nombor positif" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "peraturan terlalu panjang" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "tiada hukum dalam masukan tatabahasa" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "hukum tidak digunakan tatabahasa" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "bukan terminal tidak berguna dalam tatabahasa: %s" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "Bukan terminal tidak digunakan dalam tatabahasa" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "Terminal tidak digunakan dalam tatabahasa" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "Hukum tidak berguna dalam tatabahasa" + +#: src/reduce.c:388 +#, fuzzy, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "Bukan terminal tidak digunakan dalam tatabahasa" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "hukum tidak digunakan tatabahasa" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "simbol permulaan %s tidak menghasilkan sebarang perkataan" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "`$' lilau" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "`@' lilau" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "Jenis tidak tersirat diberikan dalam tatabahasa tanpa jenis" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "" +"$$ untuk hukum pertengahan pada $%d bagi `%s' tidak mempunyai jenis " +"dinyatakan" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ bagi `%s' tiada jenis dinyatakan" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d bagi `%s' tiada jenis dinyatakan" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "integer diluar julat: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "`,' sesat dianggap sebagai ruang" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "arahan tidak sah: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "aksara tidak sah: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "aksara null tidak sah" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "turutan escape tidak sah: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "aksara null tidak sah: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "turutan escape tidak dikenali: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "`%s' hilang pada penghujung fail" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "`%s' hilang pada penghujung baris" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "nilai $ tidak sah: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "terlalu banyak simbol dalam tatabahasa masukan (had adalah %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s pengisytiharan semula untuk %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s pengisytiharan semula untuk <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "simbol %s ditakrif semula" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "simbol %s ditakrif semula" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "mentakrif semula nombor token pengguna %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"simbol %s digunakan, tetapi tidak ditakrifkan sebagai token atau mempunyai " +"hukum" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "simbol `%s' digunakan lebih dari sekali sebagai rentetan perkataan" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "simbol `%s' diberikan lebih daripada satu rentetan perkataan" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "token %s dan %s kedua-dunya diberi nombor %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "simbol permulaan %s tidak ditakrifkan" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "simbol permulaan %s adalah token" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "pengisytiharan semula untuk %%destructor ditag default" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "pengisytiharan semula untuk %%destructor tanpa tag default" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "pengisytiharan semula untuk %%printer ditag default" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "pengisytiharan semula untuk %%printer tanpa tag default" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "hujah tidak sah %s untuk %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "hujah kabur %s untuk %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Hujah yang sah adalah:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u dibebaskan (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u disimpan (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u disimpan (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u disimpan (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "kira histogram log\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "saiz histogram log\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "histogram kepadatan\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Statistik bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Pelaksanaan terkumpul = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Tidak dapat membaca fail stats." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Saiz fail stats tidak betul.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Tidak dapat menulis fail stats." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Tidak dapat membuka fail stats untuk menulis." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Ralat sistem tidak diketahui" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: pilihan `%s' adalah kabur\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: pilihan `--%s' tidak mengizinkan hujah\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: pilihan `%c%s' tidak mengizinkan hujah\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: pilihan `%s' memerlukan hujah\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: pilihan tidak dikenali `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: pilihan tidak dikenali '%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: pilihan salah -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: pilihan tidak sah -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: pilihan memerlukan hujah -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: pilihan `-W %s' adalah kabur\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: pilihan `-W %s' tidak mengizinkan hujah\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "kehabisan memori" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "program subsidiari `%s' tidak dapat dilaksanakan" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Masa pelaksanaan (saat)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " JUMLAH :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "masa dalam %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "%d nonterminal" +#~ msgid_plural "%d nonterminals" +#~ msgstr[0] "%d bukan terminal" + +#~ msgid " and " +#~ msgstr " dan " + +#~ msgid "%d rule" +#~ msgid_plural "%d rules" +#~ msgstr[0] "Hukum %d" + +#~ msgid " useless in grammar" +#~ msgstr " tidak berguna dalam tatabahasa" diff --git a/po/nb.gmo b/po/nb.gmo new file mode 100644 index 0000000..3bcf649 Binary files /dev/null and b/po/nb.gmo differ diff --git a/po/nb.po b/po/nb.po new file mode 100644 index 0000000..2d8f4aa --- /dev/null +++ b/po/nb.po @@ -0,0 +1,941 @@ +# Norwegian bokmål translation of GNU bison. +# Copyright (C) 2004 Free Software Foundation, Inc. +# This file is distributed under the same license as the PACKAGE package. +# Trond Endrestøl , 2004. +# +# Send this file as an gzipped attachment to: +# translation@iro.umontreal.ca +# with the subject: +# TP-Robot PACKAGE-VERSION.TEAM.po +# +# The subject for the Norwegian bokmål translation of GNU bison 2.0 +# would then be: +# TP-Robot bison-2.0.nb.po +# +# Here's the URL for the Norwegian translation team: +# http://www2.iro.umontreal.ca/~pinard/po/registry.cgi?team=no +# +# Here's the URL for the current translations of GNU bison: +# http://www2.iro.umontreal.ca/~pinard/po/registry.cgi?domain=bison +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.0\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-03-01 10:06+0100\n" +"Last-Translator: Trond Endrestøl \n" +"Language-Team: Norwegian Bokmaal \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "advarsel" + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "alvorlig feil: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Konflikt mellom regel %d og token %s ble løst som skift" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Konflikt mellom regel %d og token %s ble løst som reduksjon" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Konflikt mellom regel %d og token %s ble løst som en feil" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "konflikter: %d skift/reduksjon, %d reduksjon/reduksjon\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "konflikter: %d skift/reduksjon\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "konflikter: %d reduksjon/reduksjon\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Tilstand %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr gjelder bare for GLR-parsere" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "forventet %d skift/reduksjon-konflikt" +msgstr[1] "forventet %d skift/reduksjon-konflikter" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "forventet %d reduksjon/reduksjon-konflikt" +msgstr[1] "forventet %d reduksjon/reduksjon-konflikter" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "kan ikke åpne filen «%s»" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "I/O-feil" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "kan ikke lukke filen" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "motstridende output til fila %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Prøv «%s --help» for mer informasjon.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Bruksmåte: %s [VALG]... FIL\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parser:\n" +" -S, --skeleton=FIL angi skjelettet som skal brukes\n" +" -t, --debug legge parseren til rette for debugging\n" +" --locations slå på beregning av plassering\n" +" -p, --name-prefix=PREFIKS sette PREFIKS i forkant av navnene til\n" +" de eksterne symbolene\n" +" -l, --no-lines ikke generer «#line»-direktiver\n" +" -n, --no-parser bare generer tabellene\n" +" -k, --token-table legg ved en tabell med tokennavnene\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Output:\n" +" -d, --defines også lag en headerfil\n" +" -r, --report=TING også lag detaljer om automaten\n" +" -v, --verbose samme som «--report=state»\n" +" -b, --file-prefix=PREFIKS angi et PREFIKS for outputfiler\n" +" -o, --output=FIL send output til FIL\n" +" -g, --graph også lag en VCG-beskrivelse av automaten\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +#, fuzzy +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"TING er en liste med kommaseparerte ord hentet fra denne lista:\n" +" «state» beskrive tilstandene\n" +" «itemset» fullføre de sentrale punktmengdene med deres slutning\n" +" «lookahead» eksplisitt assosiere lookaheads med punkter\n" +" «solved» beskrive løsing av skift/reduksjon-konflikter\n" +" «all» inkludere alt av den overstående informasjonen\n" +" «none» slå av all rapportering\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Rapporter feil til .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Skrevet av Robert Corbett og Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dette er fri programvare; se i kildekoden for kopieringsbetingelser.\n" +"Det er INGEN garanti; ikke en gang for SALGBARHET eller SKIKKETHET\n" +"FOR ET BESTEMT FORMÅL.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "flere deklarasjoner av %s" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "ugyldig verdi: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "flere deklarasjoner av %s" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "mangler operand etter «%s»" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "ekstra operand «%s»" + +#: src/gram.c:112 +msgid "empty" +msgstr "tom" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammatikk" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "regel ble aldri redusert på grunn av konflikter" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "mangler identifikator i parameterdeklarasjonen" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " type %d er %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "skift og gå til tilstand %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "gå til tilstand %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "feil (ikke-assosiativ)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "reduksjon ved hjelp av regel %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "aksept" + +# Det er vel ikke så mye å oversette denne med. +# [TE, 2004-06-02] +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "tilstand %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminaler med regler hvor de opptrer" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Ikke-terminaler med regler hvor de opptrer" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " til venstre:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " til høyre:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "regel ble aldri redusert på grunn av konflikter" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "flere deklarasjoner av %s" + +# Denne oversettelsen er en smule ullen. Må sjekke kildekoden og prøve +# et eksempel for å vite hva denne strengen bør oversettes med. Dersom +# andre har gode hint, så for all del, syng ut! [TE, 2004-05-31] +#: src/reader.c:131 +#, fuzzy, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "kollisjon på resultattype for flettefunksjon %s: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "første deklarasjon" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "regel er angitt for %s, som er et token" + +# Denne oversettelsen er også en smule ullen. +# [TE, 2004-05-31] +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "kollisjon på type for standard handling: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "tom regel for typet ikke-terminal og ingen handling" + +#: src/reader.c:290 +#, fuzzy, c-format +msgid "unused value: $%d" +msgstr "ugyldig verdi: %s" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "bare en %s pr regel er tillatt" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s påvirker bare GLR-parsere" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s må bli fulgt av et positivt tall" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "ingen regler i den angitte grammatikken" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "ingen regler i den angitte grammatikken" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Ikke-terminaler med regler hvor de opptrer" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "ingen regler i den angitte grammatikken" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "ingen regler i den angitte grammatikken" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "ingen regler i den angitte grammatikken" +msgstr[1] "ingen regler i den angitte grammatikken" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "startsymbolet %s avleder ingen setninger" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d av «%s» har ingen deklarert type" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ til «%s» har ingen deklarert type" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d av «%s» har ingen deklarert type" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "heltall utenfor tallområde: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "overflødig «,» ble behandlet som tomrom" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "ugyldig direktiv: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "ugyldig tegn: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "ugyldig null-tegn" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "ugyldig escapesekvens: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "ugyldig null-tegn: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "ugjenkjennelig escapesekvens: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "mangler «%s» ved slutten av filen" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "mangler «%s» på slutten av linjen" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "ugyldig verdi: %s" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "for mange symboler i inputgrammatikken (grensen er %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s er en redeklarasjon av %s" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s er en redeklarasjon av %s" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "symbolet %s ble redefinert" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "symbolet %s ble redefinert" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "redefinerer brukertokennummeret til %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"symbolet %s er brukt, men er ikke definert som et token og har ingen regler" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "symbolet «%s» er brukt mer enn en gang som en literalstreng" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "symbolet «%s» er gitt mer enn en literalstreng" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "tokene %s og %s er begge tilordnet nummeret %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "startsymbolet %s er udefinert" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "startsymbolet %s er et token" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "ugyldig argument %s for %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "flertydig argument %s for %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Gyldige argumenter er:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u frigjort (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u mellomlagret (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u mellomlagret (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u mellomlagret (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "count log histogram\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "size log histogram\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "tetthetshistogram\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Bitmengdestatistikk:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Akkumulerte kjøringer = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Kunne ikke lese statsfilen." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Feil størrelse på statsfilen.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Kunne ikke skrive statsfilen." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Kunne ikke åpne statsfilen for skriving." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Ukjent systemfeil" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: valget «%s» er flertydig\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: valget «--%s» tillater ikke et argument\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: valget «%c%s» tillater ikke et argument\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: valget «%s» krever et argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ukjent valg «--%s»\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ukjent valg «%c%s»\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ulovlig valg -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ugyldig valg -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: valget krevet et argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: valget «-W %s» er flertydig\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: valget «-W %s» tillater ikke et argument\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "minne er uttømt" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "«" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "»" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "kunne ikke starte opp hjelpeprogrammet «%s»" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Utføringstider (sekunder)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTAL :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "tid for %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "warning: " +#~ msgstr "advarsel: " + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison genererer parsere for LALR(1)-grammatikk.\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Dersom et langt valg viser et obligatorisk argument, så er argumentet\n" +#~ "også obligatorisk for det tilsvarende korte valget. Det samme gjelder\n" +#~ "for valgfrie argumenter.\n" + +#~ msgid "" +#~ "Operation modes:\n" +#~ " -h, --help display this help and exit\n" +#~ " -V, --version output version information and exit\n" +#~ " -y, --yacc emulate POSIX yacc\n" +#~ msgstr "" +#~ "Virkemåter:\n" +#~ " -h, --help vise denne hjelpen og avslutte\n" +#~ " -V, --version skrive versjonsnummer og avslutte\n" +#~ " -y, --yacc emulere POSIX yacc\n" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX forbyr deklarasjoner i grammatikken" + +#~ msgid "Rules never reduced" +#~ msgstr "Regler som aldri ble redusert" + +#~ msgid "useless rule" +#~ msgstr "ubrukelig regel" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "ubrukelig ikke-terminal: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Ubrukelige ikke-terminaler" + +#~ msgid "Terminals which are not used" +#~ msgstr "Terminaler som er ikke er i bruk" + +#~ msgid "Useless rules" +#~ msgstr "Ubrukelige regler" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d regel ble aldri redusert\n" +#~ msgstr[1] "%d regler ble aldri redusert\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d ubrukelig ikke-terminal" +#~ msgstr[1] "%d ubrukelige ikke-terminaler" + +#~ msgid " and " +#~ msgstr " og " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d ubrukelig regel" +#~ msgstr[1] "%d ubrukelige regler" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "mangler «{» in «%s»" + +#~ msgid "invalid $ value" +#~ msgstr "ugyldig $-verdi" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "fant ikke hjelpeprogrammet «%s»" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "hjelpeprogrammet «%s» mislyktes" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "hjelpeprogrammet «%s» mislyktes (returverdi %d)" diff --git a/po/nl.gmo b/po/nl.gmo new file mode 100644 index 0000000..da4de8e Binary files /dev/null and b/po/nl.gmo differ diff --git a/po/nl.po b/po/nl.po new file mode 100644 index 0000000..30dd4e1 --- /dev/null +++ b/po/nl.po @@ -0,0 +1,875 @@ +# Dutch messages for GNU bison. +# This file is distributed under the same license as the bison package. +# Copyright (C) 1996, 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. +# Tim Van Holder , 2002, 2003, 2004, 2005, 2006, 2008. +# Erick Branderhorst , 1996. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.4\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-11-05 10:00+0100\n" +"Last-Translator: Tim Van Holder \n" +"Language-Team: Dutch \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "let op" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "fatale fout" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Conflict tussen regel %d en token %s opgelost als shift" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Conflict tussen regel %d en token %s opgelost als reductie" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Conflict tussen regel %d en token %s opgelost als een fout" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "conflicten: %d shift/reductie, %d reductie/reductie\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "conflicten: %d shift/reductie\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "conflicten: %d reductie/reductie\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Staat %d" + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr is enkel van toepassing op GLR-parsers" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "er werd %d shift/reductie conflict verwacht" +msgstr[1] "er werden %d shift/reductie conflicten verwacht" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "er werd %d reductie/reductie conflict verwacht" +msgstr[1] "er werden %d reductie/reductie conflicten verwacht" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "kan bestand `%s' niet openen" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "I/O-fout" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "kan bestand niet sluiten" + +# Betere formulering (ik-vorm vermijden)? +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "ik weiger om invoerbestand %s te overschrijven" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "conflicterende uitvoer naar bestand %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Probeer `%s --help' voor meer informatie.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Gebruik: %s [OPTIE]... BESTAND\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" +"Genereer LALR(1) en GLR parsers.\n" +"\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" +"Wanneer een lange optie een argument als verplicht aanduidt, dan is dat\n" +"argument eveneens verplicht bij de overeenkomstige korte optie.\n" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "Hetzelfde geldt voor optionele argumenten.\n" + +# Misschien beter 'een POSIX-compatibele yacc'? +# En de tekst voor -W kan beter denk ik. +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"\n" +"Werkwijzes:\n" +" -h, --help toon deze hulptekst en beëindig het programma\n" +" -V, --version toon versie-informatie en beëindig het " +"programma\n" +" --print-datadir toon de folder met skeletten en XSLT-bestanden\n" +" --print-localedir toon de folder met regio-afhankelijke gegevens\n" +" -y, --yacc emuleer POSIX Yacc\n" +" -W, --warnings[=SOORT] waarschuw over problemen (van het type SOORT)\n" + +# Correcte vervoeging van 'voorvoegen'? +# Betere vertaling voor 'directives'? +#: src/getargs.c:272 +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parser:\n" +" -L, --language=TAAL geef de te gebruiken programmeertaal op\n" +" (dit is een experimenteel feature)\n" +" -S, --skeleton=BESTAND geef het te gebruiken skeletbestand op\n" +" -t, --debug maak de parser geschikt voor debugging\n" +" --locations houd symboollokaties bij\n" +" -p, --name-prefix=PREFIX geef de externe symboolnamen deze PREFIX\n" +" -l, --no-lines genereer geen `#line' directieven\n" +" -k, --token-table genereer ook een tabel van tokennamen\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Uitvoer:\n" +" --defines[=BESTAND] genereer ook een header-bestand\n" +" -d idem, maar bestand kan niet opegegeven worden\n" +" (voor POSIX Yacc)\n" +" -r, --report=DINGEN genereer ook details over de automaat\n" +" --report-file=BESTAND schrijf het rapport weg in BESTAND\n" +" -v, --verbose hetzelfde als `--report=state'\n" +" -b, --file-prefix=PREFIX geef de uitvoerbestandsnamen deze PREFIX\n" +" -o, --output=BESTAND schrijf uitvoer naar BESTAND\n" +" -g, --graph[=BESTAND] genereer ook een graaf van de automaat\n" +" -x, --xml[=BESTAND] genereer ook een XML-rapport over de automaat\n" +" (het XML schema is experimenteel)\n" +"\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" +"Soorten van waarschuwing zijn:\n" +" `midrule-values' midrule waarden die niet gezet of gebruikt worden\n" +" `yacc' dingen die niet compatibel zijn met POSIX Yacc\n" +" `all' alle waarschuwingen\n" +" `no-SOORT' geen waarschuwingen van type SOORT\n" +" `none' helemaal geen waarschuwingen\n" +" `error' beschouw waarschuwingen als fouten\n" +"\n" + +# Verschillende dingen die beter zouden moeten kunnen - zeker de 'itemset' tekst +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"DINGEN is een door komma's gescheiden lijst van woorden; geldige woorden " +"zijn:\n" +" `state' beschrijf de toestanden van de automaat\n" +" `itemset' vervolledig de verzamelingen van kern-items met hun " +"closures\n" +" `look-ahead' verbind look-ahead tokens expliciet met items\n" +" `solved' beschrijf het oplossen van shift/reductie conflicten\n" +" `all' produceer alle bovengenoemde informatie\n" +" `none' schakel de rapportering uit\n" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"\n" +"Meld fouten in de vertaling aan .\n" +"Meld bugs aan <%s>.\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Geschreven door Robert Corbett en Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dit is vrije software; zie de broncode voor kopieercondities. Er is GEEN\n" +"garantie; zelfs niet voor VERKOOPBAARHEID of GESCHIKTHEID VOOR EEN BEPAALD\n" +"DOEL.\n" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "meerdere skeletten opgeven is niet toegestaan" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "ongeldige taal `%s'" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "meerdere talen opgeven is niet toegestaan" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "operand ontbreekt na `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "overtollige operand `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "leeg" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammatica" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "overflow van lijnnummers" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "overflow van kolomnummers" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "regel is nutteloos in de grammatica omwille van conflicten" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "naam ontbreekt in parameterdeclaratie" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " type %d is %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "shift, en ga naar toestand %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "ga naar toestand %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "fout (niet associatief)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "reduceren via regel %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "accepteer" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$standaard" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "toestand %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Eindsymbolen, met de regels waarin ze voorkomen" + +# Betere vertaling voor non-terminals? 'tussensymbolen'? +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Niet-eindsymbolen, met de regels waarin ze voorkomen" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " links:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " rechts:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "Regels die, omwille van conflicten, nutteloos zijn in de grammatica" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "meerdere %s declaraties" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "conflict tussen resultaattypes bij merge-functie `%s': <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "eerdere declaratie" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "regel opgegeven voor token (%s)" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "type-conflict bij standaardaktie: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "lege regel voor niet-eindsymbool met type, en geen actie" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "waarde niet gebruikt: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "waarde niet gezet: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "slechts één %s toegestaan per regel" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s is enkel van toepassing op GLR-parsers" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s moet gevolgd worden door een positief getal" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "regel is te lang" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "invoergrammatica bevat geen regels" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "regel is nutteloos in de grammatica" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "niet-eindsymbool is nutteloos in de grammatica: %s" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "Niet-eindsymbolen die nutteloos zijn in de grammatica" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "Eindsymbolen die niet gebruikt worden in de grammatica" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "Regels die nutteloos zijn in de grammatica" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "%d niet-eindsymbool is nutteloos in de grammatica" +msgstr[1] "%d niet-eindsymbolen zijn nutteloos in de grammatica" + +#: src/reduce.c:397 +#, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "%d regel is nutteloos in de grammatica" +msgstr[1] "%d regels zijn nutteloos in de grammatica" + +# Ik _denk_ dat dit correct weergeeft wat er bedoeld wordt (m.a.w. er is geen regel voor het startsymbool) +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "uit startsymbool %s kan geen enkele zin afgeleid worden" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "losse `$'" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "losse `@'" + +# betere vertaling voor 'untyped'? +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "expliciet type opgegeven in een typeloze grammatica" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$$ voor de midrule op $%d van `%s' heeft geen gedeclareerd type" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ van `%s' heeft geen gedeclareerd type" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d van `%s' heeft geen gedeclareerd type" + +# Hier zou wel het bereik bij vermeld mogen worden... +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "integer buiten bereik: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "losse `,' behandeld als witruimte" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "ongeldig commando: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "ongeldig teken: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "ongeldig null-teken" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "ongeldige escape: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "ongeldig null-teken: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "onbekende escape: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "`%s' ontbreekt aan einde van bestand" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "`%s' ontbreekt aan einde van regel" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "ongeldige $-waarde: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "te veel symbolen in de invoergrammatica (de limiet is %d)" + +# Dit ziet er als een potentieel slechte originele string uit - wat kan er in die eerste '%s' staan? +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s herdeclaratie voor %s" + +# Dit ziet er als een potentieel slechte originele string uit - wat kan er in die eerste '%s' staan? +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s herdeclaratie voor <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "symbool %s opnieuw gedefinieerd" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "symbool %s opnieuw gedeclareerd" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "herdefinitie van het door de gebruiker gekozen tokennummer van %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"symbool %s wordt gebruikt, maar is niet gedefinieerd als een token en heeft " +"geen regels" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "symbool `%s' meer dan eens gebruikt als een letterlijke string" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "symbool `%s' krijgt meer dan één letterlijke string toegewezen" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "tokens %s en %s hebben beide nummer %d toegewezen gekregen" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "het startsymbool %s is niet gedefinieerd" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "het startsymbool %s is een token" + +# tagged en tagless? wasdavooriet? +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "herdeclaratie van standaard \"tagged\" %%destructor" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "herdeclaratie van standaard \"tagless\" %%destructor" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "herdeclaratie van standaard \"tagged\" %%printer" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "herdeclaratie van standaard \"tagless\" %%printer" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "ongeldig argument %s voor %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "argument %s voor %s is niet eenduidig" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Geldige argumenten zijn:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u vrijgegeven (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u gecached (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u gecached (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u gecached (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "histogram van aantal gezette bits\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "histogram van bitset-groottes\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "histogram van dichtheid aan gezette bits\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Bitset-statistieken:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Aantal uitvoeringen = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Kon het statistiekenbestand niet lezen." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Het statistiekenbestand heeft een verkeerde grootte.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Kon niet schrijven naar het statistiekenbestand." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Kon het statistiekenbestand niet openen voor schrijven." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Onbekende systeemfout" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: optie `%s' is niet eenduidig\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: optie `--%s' staat geen argument toe\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: optie `%c%s' staat geen argument toe\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: optie `%s' vereist een argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: onbekende optie `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: onbekende optie `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ongeldige optie -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ongeldige optie -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: optie vereist een argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: optie `-W %s' is niet eenduidig\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: optie `-W %s' staat geen argument toe\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "geen geheugen meer beschikbaar" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "hulpprogramma `%s' kon niet opgeroepen worden" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Uitvoeringstijden (in seconden)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTAAL :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "tijd in %s: %ld.%06ld (%ld%%)\n" diff --git a/po/pl.gmo b/po/pl.gmo new file mode 100644 index 0000000..7b6fae2 Binary files /dev/null and b/po/pl.gmo differ diff --git a/po/pl.po b/po/pl.po new file mode 100644 index 0000000..e4f6c75 --- /dev/null +++ b/po/pl.po @@ -0,0 +1,1019 @@ +# Polish translations for GNU Bison package. +# Copyright (C) 2004, 2005, 2006, 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Wojciech Polak , 2004, 2005, 2006, 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.4\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-11-07 18:02+0100\n" +"Last-Translator: Wojciech Polak \n" +"Language-Team: Polish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "ostrze¿enie" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "fatalny b³±d" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "" +" Konflikt pomiêdzy regu³± %d i symbolem leksykalnym %s rozwi±zany jako " +"przesuniêcie" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" +" Konflikt pomiêdzy regu³± %d i symbolem leksykalnym %s rozwi±zany jako " +"redukcja" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" +" Konflikt pomiêdzy regu³± %d i symbolem leksykalnym %s rozwi±zany jako " +"b³±d" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "konflikty: %d przesuniêcie/redukcja, %d redukcja/redukcja\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "konflikty: %d przesuniêcie/redukcja\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "konflikty: %d redukcja/redukcja\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Stan %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr odnosi siê tylko do analizatorów sk³adni GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "spodziewano siê %d konfliktu przesuniêcie/redukcja" +msgstr[1] "spodziewano siê %d konfliktów przesuniêcie/redukcja" +msgstr[2] "spodziewano siê %d konfliktów przesuniêcie/redukcja" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "spodziewano siê %d konfliktu redukcja/redukcja" +msgstr[1] "spodziewano siê %d konfliktów redukcja/redukcja" +msgstr[2] "spodziewano siê %d konfliktów redukcja/redukcja" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "nie mo¿na otworzyæ pliku `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "b³±d wej¶cia/wyj¶cia" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "nie mo¿na zamkn±æ pliku" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "odmowa nadpisania pliku wej¶ciowego %s" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "konflikt wyj¶æ do pliku %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Spróbuj `%s --help' aby uzyskaæ wiêcej informacji.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "U¿ycie: %s [OPCJA]... PLIK\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" +"GNU Bison tworzy analizatory sk³adni LALR(1) i GLR.\n" +"\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" +"Obowi±zkowe argumenty dla d³ugich opcji s± obowi±zkowe równie¿ dla krótkich " +"opcji.\n" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "To samo dotyczy argumentów opcjonalnych.\n" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"\n" +"Tryby dzia³ania:\n" +" -h, --help wy¶wietla pomoc i koñczy pracê\n" +" -V, --version wy¶wietla informacje o wersji i koñczy pracê\n" +" --print-localedir wy¶wietla katalog z danymi dotycz±cymi " +"lokalizacji\n" +" --print-datadir wy¶wietla katalog zawieraj±cy szkielety i XSLT\n" +" -y, --yacc emuluje POSIX Yacc\n" +" -W, --warnings=[KATEGORIA] zg³asza ostrze¿enia dotycz±ce danej kategorii\n" +"\n" + +#: src/getargs.c:272 +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Analizator sk³adni:\n" +" -L, --language=JÊZYK u¿ywa wyj¶ciowy jêzyk programowania\n" +" -S, --skeleton=PLIK u¿ywa podanego szkieletu\n" +" -t, --debug produkuje analizator zdolny do odpluskwiania\n" +" --locations w³±cza obliczanie lokacji\n" +" -p, --name-prefix=PREFIKS dopisuje pocz±tkowy PREFIKS do zewnêtrznych " +"symboli\n" +" -l, --no-lines zabrania tworzenia dyrektyw `#line'\n" +" -k, --token-table do³±cza tablicê nazw symboli leksykalnych\n" +"\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Wyj¶cie:\n" +" --defines[=PLIK] produkuje tak¿e plik nag³ówkowy\n" +" -d podobnie, ale bez podania PLIKU (dla POSIX " +"Yacc)\n" +" -r, --report=LISTA produkuje tak¿e szczegó³y na temat automatu\n" +" --report-file=PLIK zapisuje raport do PLIKU\n" +" -v, --verbose to samo co `--report=state'\n" +" -b, --file-prefix=PREFIKS ustaw PREFIKS dla plików wyj¶ciowych\n" +" -o, --output=PLIK przekierowuje wyj¶cie do PLIKU\n" +" -g, --graph[=PLIK] produkuje tak¿e graf automatu\n" +" -x, --xml[=PLIK] produkuje tak¿e raport XML na temat automatu\n" +" (schemat XML jest eksperymentalny)\n" +"\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" +"Kategorie ostrze¿eñ:\n" +" `midrule-values' nieustawione lub nieu¿ywane warto¶ci regu³\n" +" `yacc' niekompatybilno¶ci z POSIX YACC\n" +" `all' wszystkie ostrze¿enia\n" +" `no-KATEGORIA' wy³±cza ostrze¿enia w KATEGORII\n" +" `none' wy³±cza wszystkie ostrze¿enia\n" +" `error' traktuje ostrze¿enia jako b³êdy\n" +"\n" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"LISTA stanowi s³owa przedzielone przecinkami. Dopuszczalne s± nastêpuj±ce " +"s³owa:\n" +" `state' opisuje stany\n" +" `itemset' dodaje symbole pochodne do listy symboli podstawowych\n" +" `look-ahead' drukuje listê mo¿liwych w ka¿dej pozycji symboli-nastêpców\n" +" `solved' opisuje rozwi±zanie konfliktów przesuniêcie/redukcja\n" +" `all' do³±cza wszystkie powy¿sze informacje\n" +" `none' wy³±cza raport\n" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"\n" +"B³êdy proszê zg³aszaæ na adres <%s>.\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Napisany przez Roberta Corbetta i Richarda Stallmana.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Niniejszy program jest wolnym oprogramowaniem; warunki kopiowania s± " +"opisane\n" +"w ¼ród³ach. Autorzy nie daj± ¯ADNYCH gwarancji, w tym równie¿ gwarancji\n" +"PRZYDATNO¦CI DO SPRZEDA¯Y LUB DO KONKRETNYCH CELÓW.\n" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "wielokrotne deklaracje szkieletu s± nieprawid³owe" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "nieprawid³owy jêzyk `%s'" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "wielokrotne deklaracje jêzykowe s± nieprawid³owe" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "brakuj±cy argument za `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "dodatkowy argument `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "pusta" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Gramatyka" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "przepe³nienie numeru linii" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "przepe³nienie numeru kolumny" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "bezu¿yteczna regu³a w analizatorze z powodu konfliktów" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "brakuj±cy identyfikator w deklaracji parametrów" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " typ %d jest %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "przesuniêcie, i przej¶cie do stanu %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "przej¶cie do stanu %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "b³±d (symbol nie³±cz±cy siê)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "redukcja przy u¿yciu regu³y %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "akceptowanie" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$domy¶lnie" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "stan %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Symbole terminalne i regu³y, w których wystêpuj±" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Symbole nieterminalne i regu³y, w których wystêpuj±" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " po lewej:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " po prawej:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "Bezu¿yteczne regu³y w analizatorze z powodu konfliktów" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "wielokrotne deklaracje %s" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "niezgodno¶æ typów powrotu przy po³±czeniu funkcji `%s': <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "poprzednia deklaracja" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "regu³a dana dla symbolu leksykalnego %s" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "konflikt typu w domy¶lnej akcji: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "" +"pusta regu³a i brak akcji dla symbolu nieterminalnego z okre¶leniem typu" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "nieu¿ywana warto¶æ: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "nieustawiona warto¶æ: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "tylko jedno %s dozwolone na jedn± regu³ê" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s wp³ywa tylko na analizatory sk³adni GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "za %s musi byæ umieszczona liczba dodatnia" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "zbyt d³uga regu³a" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "brak regu³ w gramatyce wej¶ciowej" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "regu³a bezu¿yteczna w gramatyce" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "Symbol nieterminalny bezu¿yteczny w gramatyce: %s" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "Symbole nieterminalne bezu¿yteczne w gramatyce" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "Nieu¿ywane symbole terminalne w gramatyce" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "Bezu¿yteczne regu³y w gramatyce" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "%d bezu¿yteczny symbol nieterminalny w gramatyce" +msgstr[1] "%d bezu¿yteczne symbole nieterminalne w gramatyce" +msgstr[2] "%d bezu¿ytecznych symboli nieterminalnych w gramatyce" + +#: src/reduce.c:397 +#, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "%d bezu¿yteczna regu³a w gramatyce" +msgstr[1] "%d bezu¿yteczne regu³y w gramatyce" +msgstr[2] "%d bezu¿ytecznych regu³ w gramatyce" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "pocz±tkowy symbol %s nie dziedziczy ¿adnego zdania" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "zab³±kany `$'" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "zab³±kany `@'" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "jawny typ w gramatyce beztypowej" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "" +"$$ w pozycji $%d nale¿±cy do po¶redniej regu³y `%s' nie posiada " +"zadeklarowanego typu" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ nale¿±cy do `%s' nie posiada zadeklarowanego typu" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d nale¿±cy do `%s' nie posiada zadeklarowanego typu" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "liczba ca³kowita poza zakresem: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "zab³±kany znak `,' potraktowany jako bia³y znak" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "nieprawid³owa dyrektywa: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "nieprawid³owy znak: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "nieprawid³owy pusty znak" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "nieprawid³owa sekwencja ucieczki: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "nieprawid³owy pusty znak: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "nierozpoznana sekwencja ucieczki: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "brakuj±cy `%s' na koñcu pliku" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "brakuj±cy `%s' na koñcu linii" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "nieprawid³owa warto¶æ $: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "zbyt du¿o symboli w gramatyce wej¶ciowej (limit wynosi %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s redeklaracja dla %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s redeklaracja dla <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "zredefiniowany symbol %s" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "zredefiniowany symbol %s" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "przedefiniowanie numeru symbolu leksykalnego %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"u¿yty symbol %s nie jest zdefiniowany jako symbol leksykalny i nie posiada " +"regu³" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "symbol `%s' u¿yty wiêcej ni¿ jeden raz jako ³añcuch literalny" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "symbol `%s' podany wiêcej ni¿ jeden ³añcuch literalny" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "oba symbole leksykalne %s i %s maj± przypisan± warto¶æ %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "symbol pocz±tkowy %s jest niezdefiniowany" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "symbol pocz±tkowy %s jest symbolem leksykalnym" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "domy¶lny oznaczony %%destructor deklarowany ponownie" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "domy¶lny nieoznaczony %%destructor deklarowany ponownie" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "domy¶lny oznaczony %%printer deklarowany ponownie" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "domy¶lny nieoznaczony %%printer deklarowany ponownie" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "nieprawid³owy argument %s dla %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "niejednoznaczny argument %s dla %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Prawid³owe argumenty to:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u zwolnione (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u zapamiêtane (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u zapamiêtane (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u zapamiêtane (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "histogram rejestru zliczeñ\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "histogram rejestru wielko¶ci\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "histogram gêsto¶ci\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Statystyki bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Zakumulowane przebiegi = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Nie mo¿na odczytaæ pliku statystyk." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Z³y rozmiar pliku statystyk.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Nie mo¿na zapisaæ pliku statystyk." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Nie mo¿na otworzyæ pliku statystyk do zapisu." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Nieznany b³±d systemu" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opcja `%s' jest niejednoznaczna\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opcja `--%s' nie mo¿e mieæ argumentów\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opcja `%c%s' nie mo¿e mieæ argumentów\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opcja `%s' musi mieæ argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: nieznana opcja `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: nieznana opcja `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: niew³a¶ciwa opcja -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: b³êdna opcja -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opcja musi mieæ argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opcja `-W %s' jest niejednoznaczna\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opcja `-W %s' nie mo¿e mieæ argumentów\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "pamiêæ wyczerpana" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "dodatkowy program `%s' nie móg³ byæ wywo³any" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Czas wykonania (w sekundach)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " CA£KOWITY :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "czas w %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "%d nonterminal" +#~ msgid_plural "%d nonterminals" +#~ msgstr[0] "%d nieterminal" +#~ msgstr[1] "%d nieterminale" +#~ msgstr[2] "%d nieterminali" + +#~ msgid " and " +#~ msgstr " i " + +#~ msgid "%d rule" +#~ msgid_plural "%d rules" +#~ msgstr[0] "%d regu³a" +#~ msgstr[1] "%d regu³y" +#~ msgstr[2] "%d regu³" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Je¶li d³uga opcja posiada obowi±zkowy argument, to wtedy obowi±zkowy " +#~ "jest\n" +#~ "on tak¿e dla równowa¿nej jej opcji krótkiej. Podobnie jest dla " +#~ "argumentów\n" +#~ "opcjonalnych.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "Regu³y nieredukowalne" + +#~ msgid "useless rule" +#~ msgstr "bezu¿yteczna regu³a" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "bezu¿yteczny symbol nieterminalny: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Bezu¿yteczne symbole nieterminalne" + +#~ msgid "Terminals which are not used" +#~ msgstr "Symbole terminalne, które nie s± u¿yte" + +#~ msgid "Useless rules" +#~ msgstr "Bezu¿yteczne regu³y" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d nieredukowalna regu³a\n" +#~ msgstr[1] "%d nieredukowalne regu³y\n" +#~ msgstr[2] "%d nieredukowalnych regu³\n" + +#~ msgid "warning: " +#~ msgstr "ostrze¿enie: " + +#~ msgid "missing `{' in %s" +#~ msgstr "brakuje `{' w %s" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "dodatkowy program `%s' nie znaleziony" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "dodatkowy program `%s' nie powiód³ siê" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "dodatkowy program `%s' nie powiód³ siê (kod wyj¶cia %d)" + +#~ msgid "syntax error: cannot back up" +#~ msgstr "b³±d sk³adni: nie mo¿na cofn±æ przesuniêcia symbolu leksykalnego" + +#~ msgid "Stack now" +#~ msgstr "Stos obecnie" + +#~ msgid "Reducing stack by rule %d (line %u), " +#~ msgstr "Redukcja stosu poprzez regu³ê %d (linia %u), " + +#~ msgid "parser stack overflow" +#~ msgstr "przepe³nienie stosu analizatora" + +#~ msgid "Stack size increased to %lu\n" +#~ msgstr "Rozmiar stosu zwiêkszony do %lu\n" + +#~ msgid "Entering state %d\n" +#~ msgstr "Wej¶cie w stan %d\n" + +#~ msgid "Reading a token: " +#~ msgstr "Odczyt symbolu leksykalnego: " + +#~ msgid "Now at end of input.\n" +#~ msgstr "Teraz na koñcu wej¶cia.\n" + +#~ msgid "Next token is" +#~ msgstr "Nastêpny symbol leksykalny to" + +#~ msgid "Shifting" +#~ msgstr "Przesuniêcie" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX zabrania deklaracji w gramatyce" + +#~ msgid "syntax error, unexpected %s" +#~ msgstr "b³±d sk³adni, niespodziewany symbol %s" + +#~ msgid "syntax error, unexpected %s, expecting %s" +#~ msgstr "b³±d sk³adni, niespodziewany symbol %s, oczekiwano %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s" +#~ msgstr "b³±d sk³adni, niespodziewany symbol %s, oczekiwano %s lub %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s" +#~ msgstr "b³±d sk³adni, niespodziewany %s, oczekiwano %s lub %s lub %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +#~ msgstr "" +#~ "b³±d sk³adni, niespodziewany symbol %s, oczekiwano %s lub %s lub %s lub %s" + +#~ msgid "syntax error; also memory exhausted" +#~ msgstr "b³±d sk³adni; ponadto wyczerpana pamiêæ" + +#~ msgid "syntax error" +#~ msgstr "b³±d sk³adni" + +#~ msgid "Error: discarding" +#~ msgstr "B³±d: odrzucenie" + +#~ msgid "Error: popping" +#~ msgstr "B³±d: zdejmowanie" + +#~ msgid "Error: discarding lookahead" +#~ msgstr "B³±d: odrzucenie symbolu-nastêpcy" + +#~ msgid "invalid $ value" +#~ msgstr "nieprawid³owa warto¶æ $" + +#~ msgid "type redeclaration for %s" +#~ msgstr "redeklaracja typu dla %s" + +#~ msgid "redefining precedence of %s" +#~ msgstr "redefiniowanie pierwszeñstwa %s" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "konflikt pierwszeñstw dla %s i %s" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "konflikt ³±czno¶ci operatorów dla %s (%s) i %s (%s)" diff --git a/po/pt_BR.gmo b/po/pt_BR.gmo new file mode 100644 index 0000000..b579bbb Binary files /dev/null and b/po/pt_BR.gmo differ diff --git a/po/pt_BR.po b/po/pt_BR.po new file mode 100644 index 0000000..a0d9491 --- /dev/null +++ b/po/pt_BR.po @@ -0,0 +1,931 @@ +# bison: translation to Brazilian Portuguese (pt_BR) +# Copyright (C) 2002 Free Software Foundation, Inc. +# Alexandre Folle de Menezes , 2002, 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 1.875\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2003-01-06 02:30-0300\n" +"Last-Translator: Alexandre Folle de Menezes \n" +"Language-Team: Brazilian Portuguese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "aviso" + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "erro fatal: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Conflito entre a regra %d e a token %s resolvido como `shift`." + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Conflito entre a regra %d e a token %s resolvido como `reduce`." + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Conflito entre a regra %d e a token %s resolvido como um erro." + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "conflitos: %d de deslocamento/redução, %d de redução/redução\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "conflitos: %d de deslocamento/redução\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "conflitos: %d de redução/redução\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Estado %d" + +#: src/conflicts.c:582 +#, fuzzy, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%s afeta apenas analisadores GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "esperado: %d conflito de deslocamento/redução" +msgstr[1] "esperados: %d conflitos de deslocamento/redução" + +#: src/conflicts.c:612 +#, fuzzy, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "esperados 0 conflitos de redução/redução" +msgstr[1] "esperados 0 conflitos de redução/redução" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "impossível abrir o arquivo `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "Erro de E/S" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "impossível fechar o arquivo" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "saídas conflitantes para o arquivo %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "tente `%s --help' para mais informações.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Uso: %s [OPCAO]... ARQUIVO\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Analizador:\n" +" -S, --skeleton=arquivo especifica o skeleto a ser usado\n" +" -t, --debug instrumenta o analisador para depuração\n" +" --locations habilita a computação de localizações\n" +" -p, --name-prefix=PREFIXO adiciona PREFIXO aos símbolos externos\n" +" -l, --no-lines não gera diretivas `#line'\n" +" -n, --no-parser apenas gera as tabelas\n" +" --k, --token-table inclui uma tabela de nomes de tokens\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Saída:\n" +" -d, --defines também produz um arquivo de cabeçalho\n" +" -r, --report=ITENS também produz detalhes do autômato\n" +" -v, --verbose o mesmo que `--report=state'\n" +" -b, --file-prefix=PREFIXO especifica o PREFIXO para os arquivos de saída\n" +" -o, --output=ARQUIVO armazena a saída em ARQUIVO\n" +" -g, --graph também produz uma descrição em VCG do autômato\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +#, fuzzy +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"ITENS é uma lista separada por vírgulas, que pode incluir:\n" +" `state' descreve os estados\n" +" `itemset' completa os conjuntos de ítens básicos com seus " +"fechamentos\n" +" `lookahead' associa explicitamente as previsões com os ítens\n" +" `solved' descreve a solução de conflitos de deslocamento/redução\n" +" `all' inclui todas as informações acima\n" +" `none' desabilita o relatório\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Informe os erros para .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Escrito por Robert Corbett e Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright © %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Este é um software livre; veja o código fonte para condições de copyright. " +"Não\n" +"existe NENHUMA garantia; nem mesmo a garantia implícita de COMERCIABILIDADE " +"ou\n" +"ADEQUAÇÃO À QUALQUER FINALIDADE PARTICULAR.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "declarações de %s múltiplas" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "valor inválido: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "declarações de %s múltiplas" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "falta operando depois de `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "operando `%s' sobrando" + +#: src/gram.c:112 +msgid "empty" +msgstr "vazio" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Gramática" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "regra não reduzida por causa de conflitos" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "identificador faltando na declaração do parâmetro" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " tipo %d é %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "deslocar, e ir ao estado %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "ir ao estado %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "erro (não associativo)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "reduzir usando a regra %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "aceitar" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$padrão" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "estado %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminais, com as regras onde eles aparecem" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Não-terminais com as regras onde eles aparecem" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " à esquerda:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " à direita:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "regra não reduzida por causa de conflitos" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "declarações de %s múltiplas" + +#: src/reader.c:131 +#, fuzzy, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "tipo de resultado conflita na fução de mescla %s: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "declarações de %s múltiplas" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "regra fornecida para %s, que é um token" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "conflito de tipos na ação padrão: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "regra vazia para um não-terminal com tipo, e não há ações" + +#: src/reader.c:290 +#, fuzzy, c-format +msgid "unused value: $%d" +msgstr "valor inválido: %s" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "apenas um %s é permitido por regra" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s afeta apenas analisadores GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s deve ser seguido por um número positivo" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "não há regras na gramática de entrada" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "não há regras na gramática de entrada" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Não-terminais com as regras onde eles aparecem" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "não há regras na gramática de entrada" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "não há regras na gramática de entrada" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "não há regras na gramática de entrada" +msgstr[1] "não há regras na gramática de entrada" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "símbolo de início %s não deriva nenhuma sentença" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d de `%s' não tem tipo declarado" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ de `%s' não tem tipo declarado" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d de `%s' não tem tipo declarado" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "inteiro fora de faixa: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "`,' perdida tratada como branco" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "diretiva inválida: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "caractere inválido: %s" + +#: src/scan-gram.l:390 +#, fuzzy, c-format +msgid "invalid null character" +msgstr "caractere inválido: %s" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "seqüência de escape inválida: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, fuzzy, c-format +msgid "invalid null character: %s" +msgstr "caractere inválido: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "seqüência de escape não reconhecida: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "`%s' faltando no final do arquivo" + +#: src/scan-gram.l:774 +#, fuzzy, c-format +msgid "missing `%s' at end of line" +msgstr "`%s' faltando no final do arquivo" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "valor inválido: %s" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "redeclaração de %s para %s" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "redeclaração de %s para %s" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "símbolo %s redefinido" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "símbolo %s redefinido" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "redefinindo número de token de usuário de %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "símbolo %s usado, mas não definido como uma token e não tem regras" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "símbolo `%s' usado mais the uma vez como uma string literal" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "símbolo `%s' associado a mais de uma string literal" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "tokens %s e %s associadas ao mesmo número %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "o símbolo de início %s não está definido" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "o símbolo de início %s é um terminal" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "argumento %s inválido para %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "argumento %s ambíguo para %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Argumentos válidos são:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u liberados (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u em cache (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u em cache (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u em cache (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "histograma de log de contagens\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "histograma de log de tamanhos\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "histograma de densidades\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Estatísticas de bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Execuções acumuladas = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Impossível ler o arquivo de estatísticas." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Tamanho do arquivo de estatísticas com erro.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Impossível de escrever no arquivo de estatísticas." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Impossível abrir arquivo de estatísticas para escrita." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Erro de sistema desconhecido" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: a opção `%s' é ambígua\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: a opção `--%s' no admite nenhum argumento\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: a opção `%c%s' não admite nenhum argumento\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: a opção `%s' exige um argumento\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opção `--%s' não reconhecida\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opção `%c%s' não reconhecida\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opção -- %c ilegal\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opção -- %c inválida\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: a opção -- %c exige um argumento\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: a opção `-W %s' é ambígua\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: a opção `-W %s' não admite nenhum argumento\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "memória esgotada" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "programa subsidiário `%s' não pôde ser invocado" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Tempos de execução (segundos)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTAL :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "tempo em %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "warning: " +#~ msgstr "aviso: " + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison gera analisadores para gramáticas LALR(1).\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Se uma opção longa mostra um argumento como obrigatório, então ele é\n" +#~ "obrigatório para a opção curta equivalente também. Igualmente para os\n" +#~ "argumentos opcionais.\n" + +#~ msgid "" +#~ "Operation modes:\n" +#~ " -h, --help display this help and exit\n" +#~ " -V, --version output version information and exit\n" +#~ " -y, --yacc emulate POSIX yacc\n" +#~ msgstr "" +#~ "Modos de operação:\n" +#~ " -h, --help exibe esta ajuda e sai\n" +#~ " -V, --version mostra informações de versão e sai\n" +#~ " -y, --yacc emula o yacc POSIX\n" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "o POSIX proíbe declarações na gramática" + +#~ msgid "Rules never reduced" +#~ msgstr "Regras nunca reduzidas" + +#~ msgid "useless rule" +#~ msgstr "regra inútil" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "não-terminal inútil: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Não-terminais inúteis" + +#~ msgid "Terminals which are not used" +#~ msgstr "Terminais que não foram usados" + +#~ msgid "Useless rules" +#~ msgstr "Regras inúteis" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d regra que nunca foi reduzida\n" +#~ msgstr[1] "%d regras que nunca foram reduzidas\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d não-terminal inútil" +#~ msgstr[1] "%d não-terminal inútil" + +#~ msgid " and " +#~ msgstr " e " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d regra inútil" +#~ msgstr[1] "%d regras inúteis" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "falta `{' em `%s'" + +#~ msgid "invalid $ value" +#~ msgstr "valor $ inválido" + +#~ msgid "type redeclaration for %s" +#~ msgstr "redeclaração de tipo para %s" + +#~ msgid "redefining precedence of %s" +#~ msgstr "redefinindo precedência de %s" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "precedências conflitantes para %s e %s" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "valores associativos conflitantes para %s (%s) e %s (%s)" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "programa subsidiário `%s' não foi encontrado" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "programa subsidiário `%s' falhou" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "programa subsidiário `%s' falhou (estado de saída %d)" diff --git a/po/quot.sed b/po/quot.sed new file mode 100644 index 0000000..0122c46 --- /dev/null +++ b/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin new file mode 100644 index 0000000..2436c49 --- /dev/null +++ b/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/ro.gmo b/po/ro.gmo new file mode 100644 index 0000000..76d6c87 Binary files /dev/null and b/po/ro.gmo differ diff --git a/po/ro.po b/po/ro.po new file mode 100644 index 0000000..0c20350 --- /dev/null +++ b/po/ro.po @@ -0,0 +1,987 @@ +# Mesajele în limba românã pentru GNU Bison. +# Copyright (C) 2004 Free Software Foundation, Inc. +# Acest fiºier este distribuit sub aceeaºi licenþã ca ºi pachetul bison. +# Laurentiu Buzdugan , 2003,2004,2005. +# +# +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.0a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-06-03 12:00-0500\n" +"Last-Translator: Laurentiu Buzdugan \n" +"Language-Team: Romanian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "avertisment" + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "eroare fatalã: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Conflict între regula %d ºi elementul (token) %s rezolvat ca shift" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" +" Conflict între regula %d ºi elementul (token) %s rezolvat ca reduce" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" +" Conflict între regula %d ºi elementul (token) %s rezolvat ca eroare" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "conflicte: %d shift/reduce, %d reduce/reduce\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "conflicte: %d shift/reduce\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "conflicte: %d reduce/reduce\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Stare %d" + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%% expect-rr poate fi folosit numai pentru parsere GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "am aºteptat %d conflict shift/reduce" +msgstr[1] "am aºteptat %d conflicte shift/reduce" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "am aºteptat %d conflict reduce/reduce" +msgstr[1] "am aºteptat %d conflicte reduce/reduce" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "nu am putut deschide fiºierul `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "Eroare I/O" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "nu pot închide fiºierul" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "ieºiri în conflict în fiºierul %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Încercaþi `%s --help' pentru informaþii suplimentare.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Folosire: %s [OPÞIUNE]... FIªIER\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Parser:\n" +" -S, --skeleton=FIªIER specificã scheletul de folosit\n" +" -t, --debug instrumenteazã parserul pentru depanare\n" +" --locations activeazã calculul locaþiilor\n" +" -p, --name-prefix=PREFIX pune prefix PREFIX la simbolurile externe\n" +" -l, --no-lines nu genera directive `#line'\n" +" -n, --no-parser genereazã numai tabelele\n" +" -k, --token-table include un tabel cu nume de elemente\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Ieºire:\n" +" -d, --defines creazã ºi un fiºier header\n" +" -r, --report=LUCRURI creazã ºi detalii despre automaton\n" +" -v, --verbose la fel ca `--report=state'\n" +" -b, --file-prefix=PREFIX specificã un PREFIX pentru fiºierele ieºire\n" +" -o, --output=FIªIER creazã ieºire în FIªIER\n" +" -g, --graph creazã ºi o descriere VCG a automaton-ului\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +#, fuzzy +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"LUCRURI este o listã de cuvinte separate de virgulã ce pot fi:\n" +" `state' descrie stãrile\n" +" `itemset' completeazã seturile de elemente nucleu cu închiderea lor\n" +" `look-ahead' asociazã explicit lookaheads la elemente\n" +" `solved' descrie rezolvarea conflictelor shift/reduce\n" +" `all' include toatã informaþia de mai sus\n" +" `none' deactiveazã raportarea\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Raportaþi bug-uri la .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Scris de Robert Corbett ºi Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Acesta este software liber; vedeþi codul sursã pentru condiþii despre " +"copiere.\n" +"Nu existã nici o garanþie; nici chiar pentru COMERCIALIZARE sau de " +"POTRIVIRE\n" +"PENTRU UN SCOP ANUME.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "declaraþii %s multiple" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "valoare invalidã: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "declaraþii %s multiple" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "operator lipsã dupã `%s'" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "extra operator `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "goleºte" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Gramaticã" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "regula nu este redusã niciodatã din cauza conflictelor" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "identificator lipsã în declaraþia parametrului" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " tipul %d este %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "shift, ºi mergi în starea %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "mergi în starea %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "eroare (ne-asociativitate)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "reduce folosind regula %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "accept" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$implicit" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "stare %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminale, cu reguli acolo unde acestea apar" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Non-terminale, cu reguli acolo unde acestea apar" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " pe stânga:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " pe dreapta:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "regula nu este redusã niciodatã din cauza conflictelor" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "declaraþii %s multiple" + +#: src/reader.c:131 +#, fuzzy, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "" +"tipul rezultatului în conflict cu funcþia de combinare %s: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "prima declaraþie" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "regula datã pentru %s, care este un element (token)" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "conflict de tip pentru acþiunea implicitã: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "regulã vidã pentru nonterminal cu tip, ºi nici o acþiune" + +#: src/reader.c:290 +#, fuzzy, c-format +msgid "unused value: $%d" +msgstr "valoare invalidã: %s" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "un singur %s permis pe fiecare regulã" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s afecteazã numai parsere GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s trebuie sã fie urmat de numere pozitive" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "nici o regulã în gramatica furnizatã" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "nici o regulã în gramatica furnizatã" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Non-terminale, cu reguli acolo unde acestea apar" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "nici o regulã în gramatica furnizatã" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "nici o regulã în gramatica furnizatã" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "nici o regulã în gramatica furnizatã" +msgstr[1] "nici o regulã în gramatica furnizatã" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "simbol de start %s nu deriveazã nici o propoziþie" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d a lui `%s' nu are nici un tip declarat" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ a lui `%s' nu are nici un tip declarat" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d a lui `%s' nu are nici un tip declarat" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "întreg în afara domeniului: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "Virgulã `,' rãtãcitã tratatã ca spaþiu gol" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "directivã invalidã: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "caracter invalid: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "caracter null invalid" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "secvenþã escape invalidã: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "caracter null invalid: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "secvenþã escape nerecunoscutã: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "`%s' lipsã la sfârºitul fiºierului" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "`%s' lipsã la sfârºitul liniei" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "valoare invalidã: %s" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "prea multe simboluri în gramatica de intrare (limita este %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "redeclarare %s pentru %s" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "redeclarare %s pentru %s" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "simbol %s redefinit" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "simbol %s redefinit" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "numãrul elementului (token) definit de utilizator redefinit pentru %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"simbolul %s e folosit, dar nu este definit ca element (token) ºi nu are nici " +"o regulã" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "simbolul `%s' este folosit de mai multe ori ca ºir literar" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "simbolului `%s' îi este dat mai mult de un singur ºir literar" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "ambelor elementele (tokens) %s ºi %s le sunt alocate acelaºi numãr %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "simbolul de start %s nu este definit" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "simbolul de start %s este un element (token)" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "argument invalid %s pentru %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "argument ambiguu %s pentru %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Argumente valide sunt:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u eliberate (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u stocate (cached) (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u stocate (cached) (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u stocate (cached) (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "numãrã histograma jurnal\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "dimensiune histogramã jurnal\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "densitate histogramã\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Statistici bitset:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Rulãri acumulate = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Nu am putut citi fiºierul de statistici." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Dimensiune fiºier cu statistici incorectã.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Nu am putut scrie fiºier statistici." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Nu am putut deschide fiºierul de statistici pentru scriere." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Eroare de sistem necunoscutã" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opþiunea `%s' este ambiguã\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opþiunea `--%s' nu permite un argument\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opþiunea `%c%s' nu permite un argument\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opþiunea `%s' necesitã un argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opþiune nerecunoscutã `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opþiune nerecunoscutã `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opþiune ilegalã -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opþiune ilegalã -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opþiunea necesitã un argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opþiunea `-W %s' este ambiguã\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opþiunea `-W %s' nu permite un argument\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "memorie epuizatã" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "programul auxiliar `%s' nu poate fi invocat" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Timp de execuþie (secunde)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTAL :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "timp în %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "warning: " +#~ msgstr "avertisment: " + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison genereazã parsere pentru gramatici LALR(1).\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Dacã o opþiune lungã aratã un argument ca necesar, atunci el este " +#~ "necesar\n" +#~ "ºi pentru opþiunea scurtã echivalentã. Similar pentru argumentele " +#~ "opþionale.\n" + +#~ msgid "" +#~ "Operation modes:\n" +#~ " -h, --help display this help and exit\n" +#~ " -V, --version output version information and exit\n" +#~ " -y, --yacc emulate POSIX yacc\n" +#~ msgstr "" +#~ "Moduri de operare:\n" +#~ " -h, --help afiºeazã acest mesaj ºi terminã\n" +#~ " -V, --version afiºeazã informaþii despre versiune ºi terminã\n" +#~ " -y, --yacc emuleazã POSIX yacc\n" + +#~ msgid "syntax error: cannot back up" +#~ msgstr "eroare de sintaxã: nu pot da înapoi" + +#~ msgid "Stack now" +#~ msgstr "Stiva curentã" + +#~ msgid "Reducing stack by rule %d (line %u), " +#~ msgstr "Stivã redusã folosind regula %d (linia %u), " + +#~ msgid "parser stack overflow" +#~ msgstr "depãsire de stivã pentru parser" + +#~ msgid "Stack size increased to %lu\n" +#~ msgstr "Dimensiune stivei crescutã la %lu\n" + +#~ msgid "Entering state %d\n" +#~ msgstr "Intru în starea %d\n" + +#~ msgid "Reading a token: " +#~ msgstr "Citesc un element (token): " + +#~ msgid "Now at end of input.\n" +#~ msgstr "Acum la sfârºitul intrãrii.\n" + +#~ msgid "Next token is" +#~ msgstr "Urmãtorul element (token) este" + +#~ msgid "Shifting" +#~ msgstr "Shift-ez" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX interzice declaraþii în gramaticã" + +#~ msgid "syntax error, unexpected %s" +#~ msgstr "eroare de sintaxã, %s neaºteptat" + +#~ msgid "syntax error, unexpected %s, expecting %s" +#~ msgstr "eroare de sintaxã, %s neaºteptat, aºtept %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s" +#~ msgstr "eroare de sintaxã, %s neaºteptat, aºtept %s sau %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s" +#~ msgstr "eroare de sintaxã, %s neaºteptat, aºtept %s sau %s sau %s" + +#~ msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +#~ msgstr "eroare de sintaxã, %s neaºteptat, aºtept %s sau %s sau %s sau %s" + +#~ msgid "syntax error; also memory exhausted" +#~ msgstr "eroare de sintaxã ºi memorie epuizatã" + +#~ msgid "syntax error" +#~ msgstr "eroare de sintaxã" + +#~ msgid "Error: discarding" +#~ msgstr "Eroare: elimin" + +#~ msgid "Error: popping" +#~ msgstr "Eroare: scot (popping)" + +#~ msgid "Error: discarding lookahead" +#~ msgstr "Eroare: elimin lookahead" + +#~ msgid "Rules never reduced" +#~ msgstr "Regulile nu au fost reduse" + +#~ msgid "useless rule" +#~ msgstr "regulã fãrã rost" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "nonterminal fãrã rost: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Nonterminale fãrã rost" + +#~ msgid "Terminals which are not used" +#~ msgstr "Terminale care nu sunt folosite" + +#~ msgid "Useless rules" +#~ msgstr "Reguli fãrã rost" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d regulã niciodatã redusã\n" +#~ msgstr[1] "%d reguli niciodatã reduse\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d nonterminal fãrã rost" +#~ msgstr[1] "%d nonterminale fãrã rost" + +#~ msgid " and " +#~ msgstr " ºi " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d regulã fãrã rost" +#~ msgstr[1] "%d reguli fãrã rost" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "`{' lipsã în `%s'" + +#~ msgid "invalid $ value" +#~ msgstr "valoare $ invalidã" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "programul auxiliar `%s' nu a fost gãsit" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "programul auxiliar `%s' a eºuat" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "programul auxiliar `%s' a eºuat (stare de terminare %d)" diff --git a/po/ru.gmo b/po/ru.gmo new file mode 100644 index 0000000..7e16fad Binary files /dev/null and b/po/ru.gmo differ diff --git a/po/ru.po b/po/ru.po new file mode 100644 index 0000000..42c5fc2 --- /dev/null +++ b/po/ru.po @@ -0,0 +1,1180 @@ +# ðÅÒÅ×ÏÄ ÓÏÏÂÝÅÎÉÊ bison. +# Copyright (C) 1999 Free Software Foundation, Inc. +# Dmitry S. Sivachenko , 1999,2000,2001,2002. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 1.875\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2003-01-01 20:35+0300\n" +"Last-Translator: Dmitry S. Sivachenko \n" +"Language-Team: Russian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=koi8-r\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ" + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "ÆÁÔÁÌØÎÁÑ ÏÛÉÂËÁ: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " ëÏÎÆÌÉËÔ ÍÅÖÄÕ ÐÒÁ×ÉÌÏÍ %d É ÌÅËÓÅÍÏÊ %s ÒÁÚÒÅÛÅÎ ÓÄ×ÉÇÏÍ" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " ëÏÎÆÌÉËÔ ÍÅÖÄÕ ÐÒÁ×ÉÌÏÍ %d É ÌÅËÓÅÍÏÊ %s ÒÁÚÒÅÛÅÎ ×Ù×ÏÄÏÍ" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " ëÏÎÆÌÉËÔ ÍÅÖÄÕ ÐÒÁ×ÉÌÏÍ %d É ÌÅËÓÅÍÏÊ %s ÒÁÚÒÅÛÅÎ ËÁË ÏÛÉÂËÁ" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "ËÏÎÆÌÉËÔÙ: %d ÓÄ×ÉÇÁ/×Ù×ÏÄÁ, %d ×Ù×ÏÄÁ/×Ù×ÏÄÁ\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "ËÏÎÆÌÉËÔÙ: %d ÓÄ×ÉÇÁ/×Ù×ÏÄÁ\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "ËÏÎÆÌÉËÔÙ: %d ×Ù×ÏÄÁ/×Ù×ÏÄÁ\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "óÏÓÔÏÑÎÉÅ %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "ÏÖÉÄÁÌÓÑ %d ËÏÎÆÌÉËÔ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" +msgstr[1] "ÏÖÉÄÁÌÏÓØ %d ËÏÎÆÌÉËÔÁ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" +msgstr[2] "ÏÖÉÄÁÌÏÓØ %d ËÏÎÆÌÉËÔÏ× ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" + +#: src/conflicts.c:612 +#, fuzzy, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "ÏÖÉÄÁÌÏÓØ 0 ËÏÎÆÌÉËÔÏ× ×Ù×ÏÄÁ/×Ù×ÏÄÁ" +msgstr[1] "ÏÖÉÄÁÌÏÓØ 0 ËÏÎÆÌÉËÔÏ× ×Ù×ÏÄÁ/×Ù×ÏÄÁ" +msgstr[2] "ÏÖÉÄÁÌÏÓØ 0 ËÏÎÆÌÉËÔÏ× ×Ù×ÏÄÁ/×Ù×ÏÄÁ" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "ÎÅ ÕÄÁÅÔÓÑ ÏÔËÒÙÔØ ÆÁÊÌ `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "ÏÛÉÂËÁ ××ÏÄÁ-×Ù×ÏÄÁ" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "ÎÅ ÕÄÁÅÔÓÑ ÚÁËÒÙÔØ ÆÁÊÌ" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, fuzzy, c-format +msgid "conflicting outputs to file %s" +msgstr "ÐÒÏÔÉ×ÏÒÅÞÉ×ÙÅ ÚÎÁÞÅÎÉÑ ÁÓÓÏÃÉÁÔÉ×ÎÏÓÔÉ ÄÌÑ %s É %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "éÓÐÏÌØÚÕÊÔÅ `%s --help' ÄÌÑ ÄÏÐÏÌÎÉÔÅÌØÎÏÊ ÉÎÆÏÒÍÁÃÉÉ.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ëìàþé]... æáêì\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"áÎÁÌÉÚÁÔÏÒ:\n" +" -S, --skeleton=æáêì ÕËÁÚÁÔØ ÆÁÊÌ ÛÁÂÌÏÎÁ\n" +" -t, --debug ÎÁÓÔÒÏÉÔØ ÁÎÁÌÉÚÁÔÏÒ ÄÌÑ ÏÔÌÁÄËÉ\n" +" --locations ×ËÌÀÞÉÔØ ×ÙÞÉÓÌÅÎÉÅ ÍÅÓÔÏÐÏÌÏÖÅÎÉÊ\n" +" -p, --name-prefix=ðòåæéëó ÐÏÄÓÔÁ×ÉÔØ ðòåæéëó ÄÌÑ ×ÎÅÛÎÉÈ ÓÉÍ×ÏÌÏ×\n" +" -l, --no-lines ÎÅ ÇÅÎÅÒÉÒÏ×ÁÔØ ÄÉÒÅËÔÉ×Ù `#line'\n" +" -n, --no-parser ÇÅÎÅÒÉÒÏ×ÁÔØ ÔÏÌØËÏ ÔÁÂÌÉÃÙ\n" +" -k, --token-table ×ËÌÀÞÉÔØ ÔÁÂÌÉÃÕ ÉÍÅÎ ÌÅËÓÅÍ\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"÷Ù×ÏÄ:\n" +" -d, --defines ÓÏÚÄÁÔØ ÔÁËÖÅ ÆÁÊÌ ÚÁÇÏÌÏ×ËÏ×\n" +" -r, --report=THINGS ÓÏÚÄÁÔØ ÔÁËÖÅ ÐÏÑÓÎÅÎÉÑ × Á×ÔÏÍÁÔÕ\n" +" -v, --verbose ÔÏ ÖÅ, ÞÔÏ É `--report=state'\n" +" -b, --file-prefix=ðòåæéëó ÕËÁÚÁÔØ ðòåæéëó ÄÌÑ ×ÙÈÏÄÎÙÈ ÆÁÊÌÏ×\n" +" -o, --output=æáêì ÐÏÍÅÓÔÉÔØ ÒÅÚÕÌØÔÁÔ × æáêì\n" +" -g, --graph ÓÏÚÄÁÔØ ÔÁËÖÅ ÐÏÑÓÎÅÎÉÑ Ë Á×ÔÏÍÁÔÕ × ×ÉÄÅ \n" +" VCG-ÇÒÁÆÁ\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "ïÛÉÂËÉ ÓÏÏÂÝÁÊÔÅ ÐÏ ÁÄÒÅÓÕ .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "á×ÔÏÒÙ: òÏÂÅÒÔ ëÏÒÂÅÔ É òÉÞÁÒÄ óÔÏÌÍÅÎ.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"üÔÏ Ó×ÏÂÏÄÎÁÑ ÐÒÏÇÒÁÍÍÁ; ÕÓÌÏ×ÉÑ ÒÁÓÐÒÏÓÔÒÁÎÅÎÉÑ ÓÍÏÔÒÉÔÅ × ÉÓÈÏÄÎÙÈ " +"ÔÅËÓÔÁÈ.\n" +"îéëáëéè ÇÁÒÁÎÔÉÊ ÎÅ ÐÒÅÄÏÓÔÁ×ÌÑÅÔÓÑ, ÄÁÖÅ ÇÁÒÁÎÔÉÉ ðïìåúîïóôé ÉÌÉ " +"ðòéçïäîïóôé\n" +"äìñ ïðòåäåìåîîïê ãåìé.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "ÍÎÏÖÅÓÔ×ÅÎÎÏÅ ÏÐÉÓÁÎÉÅ %s" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "ÎÅÄÏÐÕÓÔÉÍÏÅ ÚÎÁÞÅÎÉÅ: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "ÍÎÏÖÅÓÔ×ÅÎÎÏÅ ÏÐÉÓÁÎÉÅ %s" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "ÐÏÓÌÅ `%s' ÐÒÏÐÕÝÅÎ ÏÐÅÒÁÎÄ" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "ÌÉÛÎÉÊ ÏÐÅÒÁÎÄ `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "ÐÕÓÔÏ" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "çÒÁÍÍÁÔÉËÁ" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "ÐÒÁ×ÉÌÏ ÎÅ Ó×ÅÄÅÎÏ ÉÚ-ÚÁ ËÏÎÆÌÉËÔÏ×" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "× ÏÐÉÓÁÎÉÉ ÐÁÒÁÍÅÔÒÁ ÏÔÓÕÔÓÔ×ÕÅÔ ÉÄÅÎÔÉÆÉËÁÔÏÒ" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " ÔÉÐ %d Ñ×ÌÑÅÔÓÑ %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "ÓÄ×ÉÇ, É ÐÅÒÅÈÏÄ × ÓÏÓÔÏÑÎÉÅ %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "ÐÅÒÅÈÏÄ × ÓÏÓÔÏÑÎÉÅ %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "ÏÛÉÂËÁ (ÎÅÁÓÓÏÃÉÁÔÉ×ÎÁÑ)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "ÓÏÓÔÏÑÎÉÅ %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "ôÅÒÍÉÎÁÌØÎÙÅ ÓÉÍ×ÏÌÙ Ó ÐÒÁ×ÉÌÁÍÉ, × ËÏÔÏÒÙÈ ÏÎÉ ÐÏÑ×ÌÑÀÔÓÑ" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "îÅÔÅÒÍÉÎÁÌØÎÙÅ ÓÉÍ×ÏÌÙ Ó ÐÒÁ×ÉÌÁÍÉ, × ËÏÔÏÒÙÈ ÏÎÉ ÐÏÑ×ÌÑÀÔÓÑ" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " ÎÁÌÅ×Ï:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " ÎÁÐÒÁ×Ï:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "ÐÒÁ×ÉÌÏ ÎÅ Ó×ÅÄÅÎÏ ÉÚ-ÚÁ ËÏÎÆÌÉËÔÏ×" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "ÍÎÏÖÅÓÔ×ÅÎÎÏÅ ÏÐÉÓÁÎÉÅ %s" + +#: src/reader.c:131 +#, fuzzy, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "ËÏÎÆÌÉËÔ ÔÉÐÏ× ÎÁ ÄÅÊÓÔ×ÉÉ ÐÏ ÕÍÏÌÞÁÎÉÀ: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "ÎÅ×ÅÒÎÏÅ ÏÐÉÓÁÎÉÅ %s" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "ÐÒÁ×ÉÌÏ ÚÁÄÁÎÏ ÄÌÑ %s, ËÏÔÏÒÙÊ Ñ×ÌÑÅÔÓÑ ÌÅËÓÅÍÏÊ" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "ËÏÎÆÌÉËÔ ÔÉÐÏ× ÎÁ ÄÅÊÓÔ×ÉÉ ÐÏ ÕÍÏÌÞÁÎÉÀ: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "" +"ÐÕÓÔÏÅ ÐÒÁ×ÉÌÏ ÄÌÑ ÔÉÐÉÚÉÒÏ×ÁÎÎÏÇÏ ÎÅÔÅÒÍÉÎÁÌØÎÏÇÏ ÓÉÍ×ÏÌÁ, É ÎÅÔ ÄÅÊÓÔ×ÉÑ" + +#: src/reader.c:290 +#, fuzzy, c-format +msgid "unused value: $%d" +msgstr "ÎÅÄÏÐÕÓÔÉÍÏÅ ÚÎÁÞÅÎÉÅ: %s" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "ÚÁ %s ÄÏÌÖÎÏ ÓÌÅÄÏ×ÁÔØ ÐÏÌÏÖÉÔÅÌØÎÏÅ ÞÉÓÌÏ" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "îÅÔÅÒÍÉÎÁÌØÎÙÅ ÓÉÍ×ÏÌÙ Ó ÐÒÁ×ÉÌÁÍÉ, × ËÏÔÏÒÙÈ ÏÎÉ ÐÏÑ×ÌÑÀÔÓÑ" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ" +msgstr[1] "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ" +msgstr[2] "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "ÎÁÞÁÌØÎÙÊ ÓÉÍ×ÏÌ %s ÎÅ ×Ù×ÏÄÉÔ ÎÉ ÏÄÎÏÇÏ ÐÒÅÄÌÏÖÅÎÉÑ" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$%d ÉÚ `%s' ÎÅ ÉÍÅÅÔ ÏÐÉÓÁÎÎÏÇÏ ÔÉÐÁ" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ × `%s' ÎÅ ÉÍÅÅÔ ÏÐÉÓÁÎÎÏÇÏ ÔÉÐÁ" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d ÉÚ `%s' ÎÅ ÉÍÅÅÔ ÏÐÉÓÁÎÎÏÇÏ ÔÉÐÁ" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "×ÙÈÏÄ ÚÁ ÇÒÁÎÉÃÙ ÄÉÁÐÁÚÏÎÁ ÃÅÌÏÇÏ: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "ÌÉÛÎÑÑ `,', ÓÞÉÔÁÅÔÓÑ ÐÒÏÂÅÌÏÍ" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "ÎÅ×ÅÒÎÁÑ ÄÉÒÅËÔÉ×Á: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "ÎÅÄÏÐÕÓÔÉÍÙÊ ÓÉÍ×ÏÌ: %s" + +#: src/scan-gram.l:390 +#, fuzzy, c-format +msgid "invalid null character" +msgstr "ÎÅÄÏÐÕÓÔÉÍÙÊ ÓÉÍ×ÏÌ: %s" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "ÎÅÄÏÐÕÓÔÉÍÁÑ ÜËÒÁÎÉÒÕÀÝÁÑ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, fuzzy, c-format +msgid "invalid null character: %s" +msgstr "ÎÅÄÏÐÕÓÔÉÍÙÊ ÓÉÍ×ÏÌ: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÁÑ ÜËÒÁÎÉÒÕÀÝÁÑ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "ÏÔÓÕÔÓÔ×ÕÅÔ `%s' × ËÏÎÃÅ ÆÁÊÌÁ" + +#: src/scan-gram.l:774 +#, fuzzy, c-format +msgid "missing `%s' at end of line" +msgstr "ÏÔÓÕÔÓÔ×ÕÅÔ `%s' × ËÏÎÃÅ ÆÁÊÌÁ" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "ÎÅÄÏÐÕÓÔÉÍÏÅ ÚÎÁÞÅÎÉÅ: %s" + +#: src/symtab.c:78 +#, fuzzy, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "ÓÌÉÛËÏÍ ÍÎÏÇÏ ÓÉÍ×ÏÌÏ× (ÌÅËÓÅÍÙ ÐÌÀÓ ÎÅÔÅÒÍÉÎÁÌÙ); ÍÁËÓÉÍÁÌØÎÏ %d" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "ÐÏ×ÔÏÒÎÏÅ ÏÐÉÓÁÎÉÅ %s ÄÌÑ %s" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "ÐÏ×ÔÏÒÎÏÅ ÏÐÉÓÁÎÉÅ %s ÄÌÑ %s" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "ÐÏ×ÔÏÒÎÏÅ ÏÐÒÅÄÅÌÅÎÉÅ ÓÉÍ×ÏÌÁ %s" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "ÐÏ×ÔÏÒÎÏÅ ÏÐÒÅÄÅÌÅÎÉÅ ÓÉÍ×ÏÌÁ %s" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "ÐÅÒÅÏÐÒÅÄÅÌÅÎÉÅ ÎÏÍÅÒÁ ÌÅËÓÅÍÙ ÐÏÌØÚÏ×ÁÔÅÌÑ ÄÌÑ %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "ÓÉÍ×ÏÌ %s ÉÓÐÏÌØÚÕÅÔÓÑ, ÎÏ ÎÅ ÏÐÒÅÄÅÌÅÎ ËÁË ÌÅËÓÅÍÁ É ÎÅ ÉÍÅÅÔ ÐÒÁ×ÉÌ" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "ÏÂÅÉÍ ÌÅËÓÅÍÁÍ %s É %s ÐÒÉÓ×ÏÅÎ ÎÏÍÅÒ %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "ÎÁÞÁÌØÎÙÊ ÓÉÍ×ÏÌ %s ÎÅÏÐÒÅÄÅÌÅÎ" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "ÎÁÞÁÌØÎÙÊ ÓÉÍ×ÏÌ %s Ñ×ÌÑÅÔÓÑ ÌÅËÓÅÍÏÊ" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "ÎÅÄÏÐÕÓÔÉÍÙÊ ÁÒÇÕÍÅÎÔ %s ÄÌÑ %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "ÎÅÏÄÎÏÚÎÁÞÎÙÊ ÁÒÇÕÍÅÎÔ %s ÄÌÑ %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "äÏÐÕÓÔÉÍÙÅ ÁÒÇÕÍÅÎÔÙ:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "îÅ ÕÄÁÅÔÓÑ ÐÒÏÞÉÔÁÔØ ÆÁÊÌ ÓÔÁÔÉÓÔÉËÉ." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "îÅ ÕÄÁÅÔÓÑ ÚÁÐÉÓÁÔØ × ÆÁÊÌ ÓÔÁÔÉÓÔÉËÉ." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "îÅ ÕÄÁÅÔÓÑ ÏÔËÒÙÔØ ÆÁÊÌ ÓÔÁÔÉÓÔÉËÉ ÄÌÑ ÚÁÐÉÓÉ." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "îÅÉÚ×ÅÓÔÎÁÑ ÓÉÓÔÅÍÎÁÑ ÏÛÉÂËÁ" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: ÎÅÏÄÎÏÚÎÁÞÎÙÊ ËÌÀÞ `%s'\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ËÌÀÞ `--%s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÂÅÚ ÁÒÇÕÍÅÎÔÁ\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ËÌÀÞ `%c%s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÂÅÚ ÁÒÇÕÍÅÎÔÁ\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ËÌÀÞ `%s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ Ó ÁÒÇÕÍÅÎÔÏÍ\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ÎÅÉÚ×ÅÓÔÎÙÊ ËÌÀÞ `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ÎÅÉÚ×ÅÓÔÎÙÊ ËÌÀÞ `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ÎÅÄÏÐÕÓÔÉÍÙÊ ËÌÀÞ -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ÎÅ×ÅÒÎÙÊ ËÌÀÞ -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ËÌÀÞ ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ Ó ÁÒÇÕÍÅÎÔÏÍ -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: ÎÅÏÄÎÏÚÎÁÞÎÙÊ ËÌÀÞ `-W %s'\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ËÌÀÞ `-W %s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÂÅÚ ÁÒÇÕÍÅÎÔÁ\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "ÐÁÍÑÔØ ÉÓÞÅÒÐÁÎÁ" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "ÎÅ ÕÄÁÅÔÓÑ ×ÙÐÏÌÎÉÔØ ×ÓÐÏÍÏÇÁÔÅÌØÎÕÀ ÐÒÏÇÒÁÍÍÕ `%s'" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr "" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "" + +#~ msgid "warning: " +#~ msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: " + +#~ msgid "GNU bison generates parsers for LALR(1) grammars.\n" +#~ msgstr "GNU bison ÇÅÎÅÒÉÒÕÅÔ ÁÎÁÌÉÚÁÔÏÒÙ ÄÌÑ ÇÒÁÍÍÁÔÉË LALR(1).\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "åÓÌÉ ÄÌÉÎÎÁÑ ÆÏÒÍÁ ËÌÀÞÁ ÏÐÒÅÄÅÌÑÅÔ ÁÒÇÕÍÅÎÔ ËÁË ÏÂÑÚÁÔÅÌØÎÙÊ, ÔÏ ÏÎ " +#~ "ÔÁËÖÅ\n" +#~ "Ñ×ÌÑÅÔÓÑ ÏÂÑÚÁÔÅÌØÎÙÍ ÄÌÑ ËÏÒÏÔËÏÊ ÆÏÒÍÙ. ôÏ ÖÅ ËÁÓÁÅÔÓÑ ÎÅÏÂÑÚÁÔÅÌØÎÙÈ\n" +#~ "ÁÒÇÕÍÅÎÔÏ×.\n" + +#~ msgid "" +#~ "Operation modes:\n" +#~ " -h, --help display this help and exit\n" +#~ " -V, --version output version information and exit\n" +#~ " -y, --yacc emulate POSIX yacc\n" +#~ msgstr "" +#~ "òÅÖÉÍÙ ÆÕÎËÃÉÏÎÉÒÏ×ÁÎÉÑ:\n" +#~ " -h, --help ×Ù×ÅÓÔÉ ÜÔÕ ÓÐÒÁ×ËÕ É ×ÙÊÔÉ\n" +#~ " -V, --version ×Ù×ÅÓÔÉ ÉÎÆÏÒÍÁÃÉÀ Ï ×ÅÒÓÉÉ É ×ÙÊÔÉ\n" +#~ " -y, --yacc ÜÍÕÌÉÒÏ×ÁÔØ POSIX yacc\n" + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "POSIX ÚÁÐÒÅÝÁÅÔ ÐÏÍÅÝÁÔØ ÏÐÉÓÁÎÉÑ × ÇÒÁÍÍÁÔÉËÅ" + +#~ msgid "Rules never reduced" +#~ msgstr "ðÒÁ×ÉÌÁ ÎÅ Ó×ÅÄÅÎÙ" + +#~ msgid "useless rule" +#~ msgstr "ÂÅÓÐÏÌÅÚÎÏÅ ÐÒÁ×ÉÌÏ" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "ÂÅÓÐÏÌÅÚÎÙÅ ÎÅÔÅÒÍÉÎÁÌ: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "âÅÓÐÏÌÅÚÎÙÅ ÎÅÔÅÒÍÉÎÁÌÙ" + +#~ msgid "Terminals which are not used" +#~ msgstr "îÅÉÓÐÏÌØÚÏ×ÁÎÎÙÅ ÔÅÒÍÉÎÁÌÙ" + +#~ msgid "Useless rules" +#~ msgstr "âÅÓÐÏÌÅÚÎÙÅ ÐÒÁ×ÉÌÁ" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d ÐÒÁ×ÉÌÏ ÎÅ Ó×ÅÄÅÎÏ\n" +#~ msgstr[1] "%d ÐÒÁ×ÉÌÁ ÎÅ Ó×ÅÄÅÎÏ\n" +#~ msgstr[2] "%d ÐÒÁ×ÉÌ ÎÅ Ó×ÅÄÅÎÏ\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d ÂÅÓÐÏÌÅÚÎÙÊ ÎÅÔÅÒÍÉÎÁÌ" +#~ msgstr[1] "%d ÂÅÓÐÏÌÅÚÎÙÈ ÎÅÔÅÒÍÉÎÁÌÁ" +#~ msgstr[2] "%d ÂÅÓÐÏÌÅÚÎÙÈ ÎÅÔÅÒÍÉÎÁÌÏ×" + +#~ msgid " and " +#~ msgstr " É " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d ÂÅÓÐÏÌÅÚÎÏÅ ÐÒÁ×ÉÌÏ" +#~ msgstr[1] "%d ÂÅÓÐÏÌÅÚÎÙÈ ÐÒÁ×ÉÌÁ" +#~ msgstr[2] "%d ÂÅÓÐÏÌÅÚÎÙÈ ÐÒÁ×ÉÌ" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "× `%s' ÏÔÓÕÔÓÔ×ÕÅÔ `{'" + +#~ msgid "invalid $ value" +#~ msgstr "ÎÅ×ÅÒÎÏÅ $ ÚÎÁÞÅÎÉÅ" + +#~ msgid "type redeclaration for %s" +#~ msgstr "ÐÏ×ÔÏÒÎÏÅ ÏÐÉÓÁÎÉÅ ÔÉÐÁ ÄÌÑ %s" + +#~ msgid "redefining precedence of %s" +#~ msgstr "ÐÅÒÅÏÐÒÅÄÅÌÅÎÉÅ ÐÒÉÏÒÉÔÅÔÁ ÄÌÑ %s" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "ÐÒÏÔÉ×ÏÒÅÞÉ×ÙÅ ÐÒÉÏÒÉÔÅÔÙ ÄÌÑ %s É %s" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "ÐÒÏÔÉ×ÏÒÅÞÉ×ÙÅ ÚÎÁÞÅÎÉÑ ÁÓÓÏÃÉÁÔÉ×ÎÏÓÔÉ ÄÌÑ %s (%s) É %s (%s)" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "×ÓÐÏÍÏÇÁÔÅÌØÎÁÑ ÐÒÏÇÒÁÍÍÁ `%s' ÎÅ ÎÁÊÄÅÎÁ" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "×ÓÐÏÍÏÇÁÔÅÌØÎÁÑ ÐÒÏÇÒÁÍÍÁ `%s' ÚÁ×ÅÒÛÉÌÁÓØ ÎÅÕÄÁÞÎÏ" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "" +#~ "×ÓÐÏÍÏÇÁÔÅÌØÎÁÑ ÐÒÏÇÒÁÍÍÁ `%s' ÚÁ×ÅÒÛÉÌÁÓØ ÎÅÕÄÁÞÎÏ (ËÏÄ ÚÁ×ÅÒÛÅÎÉÑ %d)" + +#~ msgid "too many states (max %d)" +#~ msgstr "ÓÌÉÛËÏÍ ÍÎÏÇÏ ÓÏÓÔÏÑÎÉÊ (ÍÁËÓÉÍÁÌØÎÏ %d)" + +#~ msgid "reduce" +#~ msgstr "×Ù×ÏÄ" + +#~ msgid "shift" +#~ msgstr "ÓÄ×ÉÇ" + +#~ msgid "%d shift/reduce conflict" +#~ msgid_plural "%d shift/reduce conflicts" +#~ msgstr[0] "%d ËÏÎÆÌÉËÔ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" +#~ msgstr[1] "%d ËÏÎÆÌÉËÔÁ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" +#~ msgstr[2] "%d ËÏÎÆÌÉËÔÏ× ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" + +#~ msgid "and" +#~ msgstr "É" + +#~ msgid "State %d contains " +#~ msgstr "óÏÓÔÏÑÎÉÅ %d ÓÏÄÅÒÖÉÔ " + +#~ msgid "conflicts: " +#~ msgstr "ËÏÎÆÌÉËÔÙ: " + +#~ msgid "%s contains " +#~ msgstr "%s ÓÏÄÅÒÖÉÔ " + +#~ msgid "`%s' is no longer supported" +#~ msgstr "`%s' ÂÏÌØÛÅ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ" + +#~ msgid "%s: no grammar file given\n" +#~ msgstr "%s: ÎÅ ÚÁÄÁÎ ÆÁÊÌ Ó ÇÒÁÍÍÁÔÉËÏÊ\n" + +#~ msgid "%s: extra arguments ignored after `%s'\n" +#~ msgstr "%s: ÌÉÛÎÉÅ ÁÒÇÕÍÅÎÔÙ ÐÏÓÌÅ `%s' ÉÇÎÏÒÉÒÏ×ÁÎÙ\n" + +#~ msgid "too many gotos (max %d)" +#~ msgstr "ÓÌÉÛËÏÍ ÍÎÏÇÏ goto (ÍÁËÓÉÍÁÌØÎÏ %d)" + +#~ msgid "unexpected `/' found and ignored" +#~ msgstr "×ÓÔÒÅÞÅÎ É ÐÒÏÉÇÎÏÒÉÒÏ×ÁÎ ÎÅÏÖÉÄÁÎÎÙÊ ÓÉÍ×ÏÌ `/'" + +#~ msgid "unterminated comment" +#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÙÊ ËÏÍÍÅÎÔÁÒÉÊ" + +#~ msgid "unexpected end of file" +#~ msgstr "ÎÅÏÖÉÄÁÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ" + +#~ msgid "unescaped newline in constant" +#~ msgstr "ÎÅÜËÒÁÎÉÒÏ×ÁÎÎÙÊ ÐÅÒÅ×ÏÄ ÓÔÒÏËÉ × ËÏÎÓÔÁÎÔÅ" + +#~ msgid "octal value outside range 0...255: `\\%o'" +#~ msgstr "×ÏÓØÍÅÒÉÞÎÁÑ ×ÅÌÉÞÉÎÁ ÚÁ ÐÒÅÄÅÌÁÍÉ ÄÉÁÐÁÚÏÎÁ 0...255: `\\%o'" + +#~ msgid "hexadecimal value above 255: `\\x%x'" +#~ msgstr "ÛÅÓÔÎÁÄÃÁÔÅÒÉÞÎÁÑ ×ÅÌÉÞÉÎÁ ÐÒÅ×ÙÛÁÅÔ 255: `\\x%x'" + +#~ msgid "unknown escape sequence: `\\' followed by `%s'" +#~ msgstr "ÎÅÉÚ×ÅÓÔÎÁÑ escape-ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ: `%s' ÐÏÓÌÅ `\\'" + +#~ msgid "unterminated type name at end of file" +#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÏÅ ÉÍÑ ÔÉÐÁ × ËÏÎÃÅ ÆÁÊÌÁ" + +#~ msgid "unterminated type name" +#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÏÅ ÉÍÑ ÔÉÐÁ" + +#~ msgid "use \"...\" for multi-character literal tokens" +#~ msgstr "ÉÓÐÏÌØÚÕÊÔÅ \"...\" ÄÌÑ ÍÎÏÇÏÓÉÍ×ÏÌØÎÙÈ ÌÉÔÅÒÁÌØÎÙÈ ÌÅËÓÅÍ" + +#~ msgid "`%s' supports no argument: %s" +#~ msgstr "`%s' ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔ ÁÒÇÕÍÅÎÔÁ %s" + +#~ msgid "`%s' requires an argument" +#~ msgstr "ËÌÀÞ `%s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ Ó ÁÒÇÕÍÅÎÔÏÍ" + +#~ msgid " (rule %d)" +#~ msgstr " (ÐÒÁ×ÉÌÏ %d)" + +#~ msgid " %-4s\terror (nonassociative)\n" +#~ msgstr " %-4s\tÏÛÉÂËÁ (ÎÅÁÓÓÏÃÉÁÔÉ×ÎÁÑ)\n" + +#~ msgid "" +#~ " $default\treduce using rule %d (%s)\n" +#~ "\n" +#~ msgstr "" +#~ " $default\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" +#~ "\n" + +#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" +#~ msgstr " %-4s\t[×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)]\n" + +#~ msgid " %-4s\treduce using rule %d (%s)\n" +#~ msgstr " %-4s\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" + +#~ msgid " $default\treduce using rule %d (%s)\n" +#~ msgstr " $default\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" + +#~ msgid " $default\taccept\n" +#~ msgstr " $default\tÐÒÉÎÑÔÉÅ\n" + +#~ msgid " NO ACTIONS\n" +#~ msgstr " îåô äåêóô÷éê\n" + +#~ msgid "Number, Line, Rule" +#~ msgstr "îÏÍÅÒ, óÔÒÏËÁ, ðÒÁ×ÉÌÏ" + +#~ msgid " %3d %3d %s ->" +#~ msgstr " %3d %3d %s ->" + +#~ msgid " Skipping to next \\n" +#~ msgstr " ðÒÏÐÕÓË ÄÏ ÓÌÅÄÕÀÝÅÇÏ \\n" + +#~ msgid " Skipping to next %c" +#~ msgstr " ðÒÏÐÕÓË ÄÏ ÓÌÅÄÕÀÝÅÇÏ %c" + +#~ msgid "unterminated string" +#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÁÑ ÓÔÒÏËÁ" + +#~ msgid "%s is invalid" +#~ msgstr "ÎÅ×ÅÒÎÙÊ ÚÎÁË %s" + +#~ msgid "unterminated `%{' definition" +#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÏÅ ÏÐÒÅÄÅÌÅÎÉÅ `%{'" + +#~ msgid "Premature EOF after %s" +#~ msgstr "ðÒÅÖÄÅ×ÒÅÍÅÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ ÐÏÓÌÅ %s" + +#~ msgid "`%s' is invalid in %s" +#~ msgstr "`%s' ÎÅ×ÅÒÎÏ × %s" + +#~ msgid "%type declaration has no " +#~ msgstr "ÏÐÉÓÁÎÉÅ %type ÎÅ ÉÍÅÅÔ <ÉÍÑ_ÔÉÐÁ>" + +#~ msgid "invalid %%type declaration due to item: %s" +#~ msgstr "ÎÅ×ÅÒÎÏÅ ÏÐÉÓÁÎÉÅ %%type ÉÚ-ÚÁ ÜÌÅÍÅÎÔÁ: %s" + +#~ msgid "invalid text (%s) - number should be after identifier" +#~ msgstr "ÎÅ×ÅÒÎÙÊ ÔÅËÓÔ (%s) - ÞÉÓÌÏ ÄÏÌÖÎÏ ÓÌÅÄÏ×ÁÔØ ÚÁ ÉÄÅÎÔÉÆÉËÁÔÏÒÏÍ" + +#~ msgid "unexpected item: %s" +#~ msgstr "ÎÅÏÖÉÄÁÎÎÙÊ ÜÌÅÍÅÎÔ: %s" + +#~ msgid "unmatched %s" +#~ msgstr "ÎÅÐÁÒÎÁÑ %s" + +#~ msgid "argument of %%expect is not an integer" +#~ msgstr "ÁÒÇÕÍÅÎÔ %%expect ÎÅ Ñ×ÌÑÅÔÓÑ ÃÅÌÙÍ ÞÉÓÌÏÍ" + +#~ msgid "unrecognized item %s, expected an identifier" +#~ msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ ÜÌÅÍÅÎÔ %s, ÏÖÉÄÁÌÓÑ ÉÄÅÎÔÉÆÉËÁÔÏÒ" + +#~ msgid "expected string constant instead of %s" +#~ msgstr "×ÍÅÓÔÏ %s ÏÖÉÄÁÌÁÓØ ÓÔÒÏËÏ×ÁÑ ÐÏÓÔÏÑÎÎÁÑ" + +#~ msgid "no input grammar" +#~ msgstr "ÎÅÔ ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÉ" + +#~ msgid "ill-formed rule: initial symbol not followed by colon" +#~ msgstr "ÎÅ×ÅÒÎÏÅ ÐÒÁ×ÉÌÏ: Ä×ÏÅÔÏÞÉÅ ÎÅ ÓÌÅÄÕÅÔ ÚÁ ÎÁÞÁÌØÎÙÍ ÓÉÍ×ÏÌÏÍ" + +#~ msgid "grammar starts with vertical bar" +#~ msgstr "ÇÒÁÍÍÁÔÉËÁ ÎÁÞÉÎÁÅÔÓÑ Ó ×ÅÒÔÉËÁÌØÎÏÊ ÞÅÒÔÙ" + +#~ msgid "previous rule lacks an ending `;'" +#~ msgstr "× ÐÒÅÄÙÄÕÝÅÍ ÐÒÁ×ÉÌÅ ÏÔÓÕÔÓÔ×ÕÅÔ ÚÁ×ÅÒÛÁÀÝÁÑ `;'" + +#~ msgid "two @prec's in a row" +#~ msgstr "Ä×Á @prec ÐÏÄÒÑÄ" + +#~ msgid "%%guard present but %%semantic_parser not specified" +#~ msgstr "%%guard ÐÒÉÓÕÔÓÔ×ÕÅÔ, Á %%semantic_parser ÎÅ ÚÁÄÁÎ" + +#~ msgid "two actions at end of one rule" +#~ msgstr "Ä×Á ÄÅÊÓÔ×ÉÑ × ËÏÎÃÅ ÏÄÎÏÇÏ ÐÒÁ×ÉÌÁ" + +#~ msgid "maximum table size (%d) exceeded" +#~ msgstr "ÐÒÅ×ÙÛÅÎ ÍÁËÓÉÍÁÌØÎÙÊ ÒÁÚÍÅÒ ÔÁÂÌÉÃÙ (%d)" + +#~ msgid " $ \tgo to state %d\n" +#~ msgstr " $ \tÐÅÒÅÈÏÄ × ÓÏÓÔÏÑÎÉÅ %d\n" + +#~ msgid "unterminated %guard clause" +#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÙÊ ÏÐÅÒÁÔÏÒ %guard" + +#~ msgid " 1 shift/reduce conflict" +#~ msgstr " 1 ËÏÎÆÌÉËÔ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" + +#~ msgid "%s contains" +#~ msgstr "%s ÓÏÄÅÒÖÉÔ" + +#~ msgid "DERIVES" +#~ msgstr "DERIVES" + +#~ msgid "%s derives" +#~ msgstr "%s ×Ù×ÏÄÉÔ" + +#~ msgid "%s: internal error: %s\n" +#~ msgstr "%s: ×ÎÕÔÒÅÎÎÑÑ ÏÛÉÂËÁ: %s\n" + +#~ msgid "Entering set_nullable" +#~ msgstr "÷ÈÏÄ × set_nullable" + +#~ msgid "\t\t/* empty */" +#~ msgstr "\t\t/* ÐÕÓÔÏ */" + +#~ msgid "multiple %%header_extension declarations" +#~ msgstr "ÍÎÏÖÅÓÔ×ÅÎÎÙÅ ÏÐÉÓÁÎÉÑ %%header_extension" + +#~ msgid "multiple %%source_extension declarations" +#~ msgstr "ÍÎÏÖÅÓÔ×ÅÎÎÙÅ ÏÐÉÓÁÎÉÑ %%source_extension" + +#~ msgid "" +#~ "Variables\n" +#~ "---------\n" +#~ "\n" +#~ msgstr "" +#~ "ðÅÒÅÍÅÎÎÙÅ\n" +#~ "----------\n" +#~ "\n" + +#~ msgid "Value Sprec Sassoc Tag\n" +#~ msgstr "úÎÁÞ ðÒÉÏÒ áÓÓÏà ôÅÇ\n" + +#~ msgid "" +#~ "Rules\n" +#~ "-----\n" +#~ "\n" +#~ msgstr "" +#~ "ðÒÁ×ÉÌÁ\n" +#~ "-------\n" +#~ "\n" + +#~ msgid "" +#~ "Rules interpreted\n" +#~ "-----------------\n" +#~ "\n" +#~ msgstr "" +#~ "éÎÔÅÒÐÒÅÔÉÒÏ×ÁÎÎÙÅ ÐÒÁ×ÉÌÁ\n" +#~ "--------------------------\n" +#~ "\n" + +#~ msgid "" +#~ "reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n" +#~ msgstr "" +#~ "×Ù×ÅÄÅÎÎÙÊ %s ÏÐÒÅÄÅÌÑÅÔ %d ÔÅÒÍÉÎÁÌÏ×%s, %d ÎÅÔÅÒÍÉÎÁÌÏ×%s, É %d ÐÒÁ×ÉÌ " +#~ "×Ù×ÏÄÁ%s.\n" + +#~ msgid "@%s is invalid" +#~ msgstr "ÎÅ×ÅÒÎÙÊ ÚÎÁË @%s" diff --git a/po/stamp-po b/po/stamp-po new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/po/sv.gmo b/po/sv.gmo new file mode 100644 index 0000000..d00a9e2 Binary files /dev/null and b/po/sv.gmo differ diff --git a/po/sv.po b/po/sv.po new file mode 100644 index 0000000..cbbc66d --- /dev/null +++ b/po/sv.po @@ -0,0 +1,868 @@ +# Swedish messages for bison. +# Copyright © 2001-2006, 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Göran Uddeborg , 2001-2006, 2008. +# +# $Revision: 1.62 $ +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.4\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-11-11 14:53+0100\n" +"Last-Translator: Göran Uddeborg \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "varning" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "ödesdigert fel" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Konflikt mellan regel %d och element %s löstes som skift" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Konflikt mellan regel %d och element %s löstes som reducera" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Konflikt mellan regel %d och element %s löstes som ett fel" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "konflikter: %d skifta/reducera, %d reducera/reducera\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "konflikter: %d skifta/reducera\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "konflikter: %d reducera/reducera\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Tillstånd %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr gäller endast GLR-parsrar" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "förväntade %d skifta/reducerakonflikt" +msgstr[1] "förväntade %d skifta/reducerakonflikter" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "förväntade %d reducera/reducerakonflikt" +msgstr[1] "förväntade %d reducera/reducerakonflikter" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "kan inte öppna filen \"%s\"" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "I/O-fel" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "kan inte stänga fil" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "vägrar att skriva över indatafilen %s" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "motstridiga utmatningar till filen %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Försök med \"%s --help\" för mer information.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Användning: %s [FLAGGA]... FIL\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "" +"Generera LALR(1)- och GLR-parsrar.\n" +"\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" +"Obligatoriska argument till långa flaggor är obligatoriska även för de " +"korta.\n" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "Detsamma gäller valfria argument.\n" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"\n" +"Arbetslägen:\n" +" -h, --help visa denna hjälptext och avsluta\n" +" -V, --version visa versionsinformation och avsluta\n" +" --print-localedir skriv katalogen som innehåller lokalberoende " +"data\n" +" --print-datadir skriv katalogen som innehåller skelett och " +"XSLT\n" +" -y, --yacc emulera POSIX-Yacc\n" +" -W, --warnings=[KATEGORI] rapportera varningarna som faller inom " +"KATEGORI\n" +"\n" + +#: src/getargs.c:272 +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Tolk:\n" +" -L, --language=SPRÅK ange programspråk för utmatning\n" +" (detta är en experimentell funktion)\n" +" -S, --skeleton=FIL ange skelettfilen som skall användas\n" +" -t, --debug instrumentera tolken för felsökning\n" +" --locations aktivera lägesberäkning\n" +" -p, --name-prefix=PREFIX lägg till PREFIX före externa symboler\n" +" -l, --no-lines generera inte \"#line\"-direktiv\n" +" -k, --token-table inkludera en tabell över elementnamn\n" +"\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Utdata:\n" +" --defines[=FIL] skapa också en huvudfil\n" +" -d detsamma, utan att kunna ange FIL (för POSIX-" +"Yacc)\n" +" -r, --report=SAKER skapa också detaljer om automaten\n" +" --report-file=FIL skriv en rapport till FIL\n" +" -v, --verbose samma som \"--report=state\"\n" +" -b, --file-prefix=PREFIX ange ett PREFIX för utdatafiler\n" +" -o, --output=FIL lägg utdata i FIL\n" +" -g, --graph[=FIL] skapa också en graf av automaten\n" +" -x, --xml[=FIL] skapa också en XML-rapport om automaten\n" +" (XML-schemat är experimentellt)\n" +"\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" +"Varningskategorier innefattar:\n" +" `midrule-values' ej satta eller oanvända värden mitt i regler\n" +" `yacc' inkompatibiliteter med POSIX YACC\n" +" `all' alla varningarna\n" +" `no-KATEGORI' slå av varningar i KATEGORI\n" +" `none' slå av alla varningarna\n" +" `error' behandla varningar som fel\n" +"\n" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"SAKER är en lista med kommaseparerade ord som kan innehålla:\n" +" \"state\" beskriv tillstånden\n" +" \"itemset\" komplettera kärnobjektmängderna med sina höljen\n" +" \"lookahead\" koppla uttryckligen framåtblickande element till objekt\n" +" \"solved\" beskriv lösningar av skifta/reducerakonflikter\n" +" \"all\" inkludera all ovanstående information\n" +" \"none\" avaktivera rapporten\n" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"\n" +"Rapportera fel till <%s>.\n" +"Rapportera synpunkter på översättningen till .\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Skriven av Robert Corbett och Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright © %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Detta är fri programvara, se källkoden för kopieringsvillkor. Det\n" +"finns INGEN garanti, inte ens för SÄLJBARHET eller LÄMPLIGHET FÖR ETT\n" +"SPECIELLT ÄNDAMÅL.\n" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "flera skelettdeklarationer är inte tillåtet" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "ogiltigt språk \"%s\"" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "flera språkdeklarationer är inte tillåtet" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "saknad operand efter \"%s\"" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "extra operand \"%s\"" + +#: src/gram.c:112 +msgid "empty" +msgstr "tom" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Grammatik" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "radnummerspill" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "kolumnnummerspill" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "oanvändbar regel i parsern på grund av konflikter" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "identiferare saknas i parameterdeklaration" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " typ %d är %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "skifta, och gå till tillstånd %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "gå till tillstånd %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "fel (ickeassociativ)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "reducera med regel %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "acceptera" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$standard" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "tillstånd %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Terminaler, med regler där de förekommer" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Icketerminaler, med regler där de förekommer" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " till vänster:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " till höger:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "Oanvändbara regler i parser på grund av konflikter" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "flera %s-deklarationer" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "resultattypskonflikt vid sammanslagningsfunktion \"%s\": <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "föregående deklaration" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "regel given för %s, som är ett element" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "typkonflikt för standardåtgärd: <%s> <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "tom regel för typad icketerminal, och ingen åtgärd" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "oanvänt värde: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "ej satt värde: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "endast en %s tillåts per regel" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s påverkar endast GLR-parsrar" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s måste följas av ett positivt tal" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "regeln är för lång" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "inga regler i ingrammatiken" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "oanvändbar regel i grammatiken" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "oanvändbar icketerminal i grammatiken: %s" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "Oanvändbara icketerminaler i grammatiken" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "Oanvända terminaler i grammatiken" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "Oanvändbara regler i grammatiken" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "%d oanvändbar icketerminal i grammatiken" +msgstr[1] "%d oanvändbara icketerminaler i grammatiken" + +#: src/reduce.c:397 +#, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "%d oanvändbar regel i grammatiken" +msgstr[1] "%d oanvändbara regler i grammatiken" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "startsymbolen %s genererar inga meningar" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "vilsekommet \"$\"" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "vilsekommet \"@\"" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "explicit typ given i otypad grammatik" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$$ för mitt-i-regeln vid $%d av \"%s\" har ingen deklarerad typ" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ för \"%s\" har ingen deklarerad typ" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d för \"%s\" har ingen deklarerad typ" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "heltal utanför intervall: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "vilsekommet \",\" hanterat som blank" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "ogiltigt direktiv: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "ogiltigt tecken: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "ogiltigt nolltecken" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "ogiltig specialsekvens: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "ogiltigt nolltecken: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "okänd specialsekvens: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "saknat \"%s\" vid filslut" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "saknat \"%s\" vid radslut" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "felaktigt $-värde: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "för många symboler i ingrammatiken (gränsen är %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s-omdeklaration för %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s-omdeklaration för <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "symbolen %s omdefinierad" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "symbolen %s omdeklarerad" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "omdefinition av elementnummer för %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"symbolen %s används, men är inte definierad som ett element och har inga " +"regler" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "symbolen \"%s\" används mer än en gång som en bokstavlig sträng" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "symbolen \"%s\" har fått mer än en bokstavlig sträng" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "elementen %s och %s har båda fått nummer %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "startsymbolen %s är odefinierad" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "startsymbolen %s är ett element" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "omdeklaration av standard-%%destructor med tagg" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "omdeklaration av standard-%%destructor utan tagg" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "omdeklaration av standard-%%printer med tagg" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "omdeklaration av standard-%%printer utan tagg" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "ogiltigt argument %s till %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "tvetydigt argument %s till %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Giltiga argument är:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitmängdallokeringar, %u frianden (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitmängdmängder, %u cachade (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitmängdåterställanden, %u cachade (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitmängdtester, %u cachade (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitmängdlistor\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "anropslogghistogram\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "storlekslogghistogram\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "densitetshistogram\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Bitmängdsstatistik:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Ackumulerade körningar = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Kunde inte läsa statistikfil." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Dålig statistikfilstorlek.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Kunde inte skriva statistikfil." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Kunde inte öppna statistikfil för skrivning." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Okänt systemfel" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: flaggan \"%s\" är tvetydig\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: flaggan \"--%s\" tar inget argument\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: flaggan \"%c%s\" tar inget argument\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: flaggan \"%s\" behöver ett argument\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: okänd flagga \"--%s\"\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: okänd flagga \"%c%s\"\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: otillåten flagga -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ogiltig flagga --%c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: flaggan behöver ett argument -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: flaggan \"-W %s\" är tvetydig\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: flaggan \"-W %s\" tar inget argument\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "minnet slut" + +# När vi går över till Unicode mer allmänt kanske vi bör översätta båda dessa +# med U+201D (RIGHT DOUBLE QUOTATION MARK) på svenska. Eller? +# +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "\"" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "underprogram \"%s\" kunde inte köras" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Exekveringstider (sekunder)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOTALT :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "tid i %s: %ld.%06ld (%ld%%)\n" diff --git a/po/tr.gmo b/po/tr.gmo new file mode 100644 index 0000000..17e87fe Binary files /dev/null and b/po/tr.gmo differ diff --git a/po/tr.po b/po/tr.po new file mode 100644 index 0000000..526ebda --- /dev/null +++ b/po/tr.po @@ -0,0 +1,1102 @@ +# Turkish translations for GNU Bison messages. +# Copyright (C) 2001 Free Software Foundation, Inc. +# Altuð Bayram , 2001. +# Çaðrý Çöltekin , 2003 - 2005 +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bison 2.0\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-03-20 22:03+0100\n" +"Last-Translator: Çaðrý Çöltekin \n" +"Language-Team: Turkish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-9\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "uyarý" + +#: src/complain.c:130 src/complain.c:137 +#, fuzzy +msgid "fatal error" +msgstr "ölümcül hata: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " %d durumu %s andacý arasýndaki çeliþki kaydýrýlarak çözümlendi" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " %d durumu %s andacý arasýndaki çeliþki indirgenerek çözümlendi" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " %d durumu %s andacý arasýndaki çeliþki hata olarak çözümlendi" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "çeliþkiler: %d öteleme/indirgeme, %d indirgeme/indirgeme\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "çeliþkiler: %d öteleme/indirgeme\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "çeliþkiler: %d indirgeme/indirgeme\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Durum %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr sadece GLR ayrýþtýrýcýlarý için geçerlidir" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "%d öteleme/indirgeme çeliþkisi bekleniyor" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "%d indirgeme/indirgeme çeliþkisi bekleniyor" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "`%s' dosyasý açýlamýyor" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "G/Ç hatasý" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "dosya kapatýlamýyor" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "%s dosyasýna çeliþen çýktýlar" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Daha fazla bilgi için `%s --help' yazýn.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Kullaným: %s [SEÇENEK]... DOSYA\n" + +#: src/getargs.c:248 +#, fuzzy +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "GNU bison LALR(1) gramerler için ayrýþtýrýcýlar üretir.\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +#, fuzzy +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"Çalýþma kipleri:\n" +" -h, --help bu yardýmý göster ve çýk\n" +" -V, --version sürüm bilgisini ver ve çýk\n" +" -y, --yacc POSIX yacc öykünmesi\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Ayrýþtýrýcý:\n" +" -S, --skeleton=FILE kullanýlacak iskeleti belirt\n" +" -t, --debug ayrýþtýrýcýya hata ayýklayýcý ekle\n" +" --locations konum hesaplamalarýný etkinleþtir\n" +" -p, --name-prefix=ÖNEK dýþ simgelerin baþýna ÖNEK ekle\n" +" -l, --no-lines `#line' yönergelerini üretme\n" +" -n, --no-parser sadece tablolarý üret\n" +" -k, --token-table andaç isimlerinin bir tablosunu içer\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Çýktý:\n" +" -d, --defines bir baþlýk dosyasý da üret\n" +" -r, --report=SEÇENEKLER otomatta ayrýntýlý bilgi de göster\n" +" -v, --verbose otomatýn bir açýklamasýný da üret\n" +" -b, --file-prefix=ÖNEK çýktý dosyalarý için bir ÖNEK belir\n" +" -o, --output=DOSYA çýktýyý DOSYAya yaz\n" +" -g, --graph otomatýn bir VCG grafik açýklamasýný da üret\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +# DUZELT: cevrilmemis iki mesaj var +#: src/getargs.c:313 +#, fuzzy +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"SEÇENEKLER aþaðýdaki anhtar sözcüklerden virgülle ayýrarak oluþturulabilir:\n" +" `state' durumlarý açýkla\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookaheads to items\n" +" `solved' öteleme/indigerme çeliþkilerinin çözümünü açýkla\n" +" `all' yukarýdaki bilgilerini tümünü gosterir\n" +" `none' raporu üretme\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"Hatalarý 'a,\n" +"çeviri hatalarýný 'e bildirin.\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Yazanlar: Robert Corbett ve Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Telif Hakký (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Bu bir serbest yazýlýmdýr; kopyalama koþullarý için kaynak koduna bakýnýz.\n" +"Hiçbir garantisi yoktur; hatta SATILABÝLÝRLÝÐÝ veya ÞAHSÝ KULLANIMINIZA\n" +"UYGUNLUÐU için bile garanti verilmez.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "çoklu %s bildirimleri" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "geçersiz karakter: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "çoklu %s bildirimleri" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "`%s'ten sonra eksik iþleç" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "fazla iþleç: `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "boþ" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Gramer" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "çeliskiler yüzünden kural indirgenemedi" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "parametre bildiriminde eksik tanýtýcý" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " tip %d %s'dir\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "ötele, ve durum %d'ye git\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "durum %d'ye git\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "hata (birleþmeli deðil)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "kural %d (%s) ile indirgeme" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "onayla" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$öntanýmlý" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "durum %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Sabit simgeler, içinde geçtikleri kurallarla birlikte" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Deðiþken simgeler, içinde geçtikleri kurallarla birlikte" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " (sol tarafta):" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " (sað tarafta):" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "çeliskiler yüzünden kural indirgenemedi" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "çoklu %s bildirimleri" + +#: src/reader.c:131 +#, fuzzy, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "birleþtirme iþlevi `%s'de tip çatýþmasý: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, fuzzy, c-format +msgid "previous declaration" +msgstr "ilk bildirim" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "bir andaç olan %s için kural verilmiþ" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "öntanýmlý eylem üzerinde tip çatýþmasý: `%s' != `%s'" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "" +"Tipli deðiþken simge için boþ kural tanýmlanmýþ, ve eylem belirtilmemiþ" + +#: src/reader.c:290 +#, fuzzy, c-format +msgid "unused value: $%d" +msgstr "geçersiz deðer: %s" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "her kural icin sadece bir %s kullanýlabilir" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s sadece GLR ayrýþtýrýcýlarý etkiler" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s'i pozitif bir sayý izlemeli" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "girdi gramer içinde kural yok" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "girdi gramer içinde kural yok" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Deðiþken simgeler, içinde geçtikleri kurallarla birlikte" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "girdi gramer içinde kural yok" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "girdi gramer içinde kural yok" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "girdi gramer içinde kural yok" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "baþlangýç simgesi %s herhangi bir cümleden türemiyor" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, fuzzy, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "`%2$s''in %1$d'i için bildirilmiþ tip yok" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "`%s''in $$'ý için bildirilmiþ tip yok" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "`%2$s''in %1$d'i için bildirilmiþ tip yok" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "tam sayý kapsam dýþý: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "fazladan `,' boþluk olarak algýlandý" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "geçersiz yönerge: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "geçersiz karakter: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "geçersiz 'null' karakter" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "geçersiz önceleme dizgesi: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "geçersiz karakter: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "tanýnmayan önceleme dizgesi: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "dosyanýn sonunda eksik `%s'" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "satýr sonunda eksik `%s'" + +#: src/symlist.c:199 +#, fuzzy, c-format +msgid "invalid $ value: $%d" +msgstr "geçersiz deðer: %s" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "girdi gramerde çok fazla simge var (sýnýr: %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%2$s için tekrar %1$s bildirimi" + +#: src/symtab.c:148 +#, fuzzy, c-format +msgid "%s redeclaration for <%s>" +msgstr "%2$s için tekrar %1$s bildirimi" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "%s simgesi tekrar tanýmlanmýþ" + +#: src/symtab.c:346 +#, fuzzy, c-format +msgid "symbol %s redeclared" +msgstr "%s simgesi tekrar tanýmlanmýþ" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "kullanýcý andacý %s tekrar tanýmlanýyor" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"simge %s kullanýlmýþ, fakat andaç olarak tanýmlanmamýþ ve kurallarý yok" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "simge `%s', yalýn dizge olarak birden fazla kullanýlmýþ" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "simge `%s', birden fazla yalýn dizgeye atanmýþ" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "%s ve %s andaçlarýnýn her ikisi %d sayýsýna atandmýþ" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "baþlangýç simgesi %s tanýmlanmamýþ" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "baþlangýç simgesi %s bir andaç" + +#: src/symtab.c:908 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "%2$s için tekrar %1$s bildirimi" + +#: src/symtab.c:921 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "%2$s için tekrar %1$s bildirimi" + +#: src/symtab.c:934 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "%2$s için tekrar %1$s bildirimi" + +#: src/symtab.c:947 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "%2$s için tekrar %1$s bildirimi" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "geçersiz argüman: %2$s için %1$s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "%s argümaný, %s için belirsiz" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Geçerli argümanlar:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u serbest býrakýlan (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u önbellek kullanýmý (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u önbellek kullanýmý (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u önbellek kullanýmý (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "sayý histogramý\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "büyükük histogramý\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "yogunluk histogramý\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Bitset istatistikleri:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Toplam çalýþtýrýlan = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Ýstatistik dosyasý okunamadý." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Ýstatistik dosyasý büyüklüðü yanlýþ.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Ýstatistik dosyasýna yazýlamadý." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Ýstatistik dosyasý yazmak için açýlamadý." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Bilinmeyen sistem hatasý" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: `%s' seçeneði belirsiz\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: `--%s' seçeneði argümansýz kullanýlýr\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: seçenek `%c%s' argümansýz kullanýlýr\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: `%s' seçeneði bir argümanla kullanýlýr\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: `--%s' seçeneði bilinmiyor\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: `%c%s' seçeneði bilinmiyor\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: kural dýþý seçenek -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: geçersiz seçenek -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: seçenek bir argümanla kullanýlýr -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: `-W %s' seçeneði belirsiz\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: `-W %s' seçeneði argümansýz kullanýlýr\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "bellek tükendi" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "alt program `%s' çalýþtýrýlamadý" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Çalýþma süresi (saniye)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TOPLAM : " + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "%s'te geçen zaman: %ld.%06ld (%ld%%)\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Eðer bir uzun seçenek bir argümaný gerektirirse, bu gereklilik, denk olan " +#~ "kýsa\n" +#~ "seçenek için de geçerlidir. Bu durum, seçimli argümanlar için de " +#~ "geçerlidir.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "Hiç indirgenmeyen kurallar" + +#~ msgid "useless rule" +#~ msgstr "gereksiz kural" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "gereksiz deðiþken simge: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "Gereksiz deðiþken simgeler" + +#~ msgid "Terminals which are not used" +#~ msgstr "Kullanýlmayan sabit simgeler" + +#~ msgid "Useless rules" +#~ msgstr "Gereksiz kurallar" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d kural hiç indirgenmedi\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d gereksiz deðiþken simge" + +#~ msgid " and " +#~ msgstr " ve " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d gereksiz kural" + +#~ msgid "warning: " +#~ msgstr "uyarý: " + +#~ msgid "POSIX forbids declarations in the grammar" +#~ msgstr "Gramer içindeki bildirimler POSIX'e uygun deðildir" + +#~ msgid "missing `{' in `%s'" +#~ msgstr "`%s' içinde eksik `{'" + +#~ msgid "invalid $ value" +#~ msgstr "geçersiz $ deðeri" + +#~ msgid "subsidiary program `%s' not found" +#~ msgstr "alt program `%s' bulunamadý" + +#~ msgid "subsidiary program `%s' failed" +#~ msgstr "alt program `%s' baþarýsýz" + +#~ msgid "subsidiary program `%s' failed (exit status %d)" +#~ msgstr "alt program `%s' baþarýsýz (hata kodu: %d)" + +#~ msgid "type redeclaration for %s" +#~ msgstr "%s için tekrar tip bildirimi" + +#~ msgid "redefining precedence of %s" +#~ msgstr "%s'in önceliði tekrar tanýmlanýyor" + +#~ msgid "conflicting precedences for %s and %s" +#~ msgstr "%s ve %s için çeliþen öncelikler" + +#~ msgid "conflicting associativities for %s (%s) and %s (%s)" +#~ msgstr "%s (%s) ve %s (%s) için çeliþen birleþmeli deðerler" + +#~ msgid "too many states (max %d)" +#~ msgstr "çok fazla durum (en fazla %d)" + +#~ msgid "reduce" +#~ msgstr "indirgeme" + +#~ msgid "shift" +#~ msgstr "shift" + +#~ msgid "%d shift/reduce conflict" +#~ msgid_plural "%d shift/reduce conflicts" +#~ msgstr[0] "%d öteleme/indirgeme çeliþkisi" + +#~ msgid "and" +#~ msgstr "ve" + +#~ msgid "State %d contains " +#~ msgstr "%d durumu içerir" + +#~ msgid "conflicts: " +#~ msgstr "çeliþkiler: " + +#~ msgid "%s contains " +#~ msgstr "%s içerir" + +#~ msgid "`%s' is no longer supported" +#~ msgstr "`%s' artýk desteklenmeyecek" + +#~ msgid "%s: no grammar file given\n" +#~ msgstr "%s: gramer dosyasý verilmemiþ\n" + +#~ msgid "%s: extra arguments ignored after `%s'\n" +#~ msgstr "%s: '%s' den sonraki argümanlar yoksayýldý\n" + +#~ msgid "too many gotos (max %d)" +#~ msgstr "gotos çok fazla (en fazla %d)" + +#~ msgid "unexpected `/' found and ignored" +#~ msgstr "beklenmeyen `/' bulundu ve yoksayýldý" + +#~ msgid "unterminated comment" +#~ msgstr "sonlandýrýlmamýþ açýklama" + +#~ msgid "unexpected end of file" +#~ msgstr "beklenmeyen dosya sonu" + +#~ msgid "unescaped newline in constant" +#~ msgstr "sabit içinde kaçamayan yeni satýr" + +#~ msgid "octal value outside range 0...255: `\\%o'" +#~ msgstr "sekizli deðer 0...255'in dýþýnda: `\\%o'" + +#~ msgid "hexadecimal value above 255: `\\x%x'" +#~ msgstr "onaltýlýk deðer 255'in üstünde: `\\x%x'" + +#~ msgid "unknown escape sequence: `\\' followed by `%s'" +#~ msgstr "bilinmeyen kaçýþ sýrasý: `\\' `%s' tarafýndan takip edildi" + +#~ msgid "unterminated type name at end of file" +#~ msgstr "dosya sonunda sonlandýrýlmamýþ tip adý" + +#~ msgid "unterminated type name" +#~ msgstr "sonlandýrýlmamýþ tip ismi" + +#~ msgid "use \"...\" for multi-character literal tokens" +#~ msgstr "çok-karakterli yazýn andaçlarý için \"...\" kullan" + +#~ msgid "`%s' supports no argument: %s" +#~ msgstr "`%s' argüman %s'i desteklemez" + +#~ msgid "`%s' requires an argument" +#~ msgstr "`%s' bir argüman gerektirir" + +#~ msgid " (rule %d)" +#~ msgstr " (kural %d)" + +#~ msgid " %-4s\terror (nonassociative)\n" +#~ msgstr " %-4s\thata (birleþmeli deðil)\n" + +#~ msgid "" +#~ " $default\treduce using rule %d (%s)\n" +#~ "\n" +#~ msgstr "" +#~ " $default\tindirgeme kural %d (%s)'i kullanýyor\n" +#~ "\n" + +#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" +#~ msgstr " %-4s\t[indirgeme kural %d (%s)'i kullanýyor]\n" + +#~ msgid " %-4s\treduce using rule %d (%s)\n" +#~ msgstr " %-4s\tindirgeme kural %d (%s)'i kullanýyor\n" + +#~ msgid " $default\treduce using rule %d (%s)\n" +#~ msgstr " $default\tindirgeme kural %d (%s)'i kullanýyor\n" + +#~ msgid " $default\taccept\n" +#~ msgstr " $default\tonayla\n" + +#~ msgid " NO ACTIONS\n" +#~ msgstr " EYLEM YOK\n" + +#~ msgid "Number, Line, Rule" +#~ msgstr "Sayý, Satýr, Kural" + +#~ msgid " %3d %3d %s ->" +#~ msgstr " %3d %3d %s ->" + +#~ msgid " Skipping to next \\n" +#~ msgstr " Sonrakine atlanýyor \\n" + +#~ msgid " Skipping to next %c" +#~ msgstr " Sonraki %c'ye atlanýyor" + +#~ msgid "unterminated string" +#~ msgstr "sonlandýrýlmamýþ dizge" + +#~ msgid "%s is invalid" +#~ msgstr "%s geçersizdir" + +#~ msgid "unterminated `%{' definition" +#~ msgstr "`%{' tanýmlamasý sonlandýrýlmamýþ" + +#~ msgid "Premature EOF after %s" +#~ msgstr "%s'den sonra erken EOF" + +#~ msgid "`%s' is invalid in %s" +#~ msgstr "`%s' %s içinde geçersizdir" + +#~ msgid "%type declaration has no " +#~ msgstr "%type bildirimi 'na sahip deðil" + +#~ msgid "invalid %%type declaration due to item: %s" +#~ msgstr "geçersiz %%type bildirimine neden olan öðe: `%s'" + +#~ msgid "invalid text (%s) - number should be after identifier" +#~ msgstr "geçersiz metin (%s) - sayý tanýtýcýdan sonra olmalýdýr" + +#~ msgid "unexpected item: %s" +#~ msgstr "beklenmeyen öðe: %s" + +#~ msgid "unmatched %s" +#~ msgstr "eþlenemeyen %s" + +#~ msgid "argument of %%expect is not an integer" +#~ msgstr "%%expect'in argümaný bir tamsayý deðildir" + +#~ msgid "unrecognized item %s, expected an identifier" +#~ msgstr "%s öðesi tanýnmadý, beklenen bir tanýtýcýdýr" + +#~ msgid "expected string constant instead of %s" +#~ msgstr "%s'in yerine sabit dizge beklendi" + +#~ msgid "no input grammar" +#~ msgstr "girdi grameri yok" + +#~ msgid "ill-formed rule: initial symbol not followed by colon" +#~ msgstr "kötü-biçemli kural: baþlangýç simgesini takip eden \":\" yok" + +#~ msgid "grammar starts with vertical bar" +#~ msgstr "gramer düþey çubuk ile baþlýyor" + +#~ msgid "previous rule lacks an ending `;'" +#~ msgstr "önceki kuralda bir bitiþ `;' eksik" + +#~ msgid "two @prec's in a row" +#~ msgstr "bir satýrda iki @prec" + +#~ msgid "%%guard present but %%semantic_parser not specified" +#~ msgstr "%%guard sunulmuþ fakat %%semantic_parser belirlenmemiþ" + +#~ msgid "two actions at end of one rule" +#~ msgstr "bir kuralýn sonunda iki eylem" + +#~ msgid "maximum table size (%d) exceeded" +#~ msgstr "en büyük tablo uzunluðu (%d) aþýldý" + +#~ msgid " $ \tgo to state %d\n" +#~ msgstr " $ \tdurum %d'ye git\n" + +#~ msgid "unterminated %guard clause" +#~ msgstr "sonlandýrýlmamýþ %guard yantümcesi" diff --git a/po/uk.gmo b/po/uk.gmo new file mode 100644 index 0000000..b41d6f3 Binary files /dev/null and b/po/uk.gmo differ diff --git a/po/uk.po b/po/uk.po new file mode 100644 index 0000000..6928f80 --- /dev/null +++ b/po/uk.po @@ -0,0 +1,897 @@ +# Ukrainian translation of bison. +# Copyright (C) 2007 Free Software Foundation, Inc. +# Maxim V. Dziumanenko , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2007-07-13 20:35+0300\n" +"Last-Translator: Maxim V. Dziumanenko \n" +"Language-Team: Ukrainian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "попередження" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "критична помилка: " + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " Конфлікт між правилом %d та лексемою %s розв'язаний зсувом" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " Конфлікт між правилом %d та лексемою %s розв'язаний виводу" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " Конфлікт між правилом %d та лексемою %s розв'язаний як помилка" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "конфлікти: %d зсуву/виводу, %d виводу/виводу\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "конфлікти: %d зсуву/виводу\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "конфлікти: %d виводу/виводу\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Стан %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr застосовується лише до аналізатору GLR" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "очікувався %d конфлікт зсуву/виводу" +msgstr[1] "очікувалось %d конфлікти зсуву/виводу" +msgstr[2] "очікувалось %d конфліктів зсуву/виводу" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "очікувалось %d конфлікт виводу/виводу" +msgstr[1] "очікувалось %d конфлікти виводу/виводу" +msgstr[2] "очікувалось %d конфліктів виводу/виводу" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "не вдається відкрити файл `%s'" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "помилка вводу-виводу" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "не вдається закрити файл" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "суперечливий вивід у файл %s" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Використовуйте `%s --help' для додаткової інформації.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Використання: %s [КЛЮЧІ]... ФАЙЛ\n" + +#: src/getargs.c:248 +#, fuzzy +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "GNU bison генерує аналізатори для граматик LALR(1) та GLR.\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +#, fuzzy +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"Режими роботи:\n" +" -h, --help вивести цю довідку та завершити роботу\n" +" -V, --version вивести інформацію про версію та завершити роботу\n" +" -y, --yacc імітувати POSIX yacc\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"Аналізатор:\n" +" -S, --skeleton=ФАЙЛ вказати файл шаблона\n" +" -t, --debug налаштувати аналізатор для налагодження\n" +" --locations увімкнути обчислення розташування\n" +" -p, --name-prefix=ПРЕФІКС підставити ПРЕФІКС для зовнішніх символів\n" +" -l, --no-lines не генерувати директиви `#line'\n" +" -n, --no-parser генерувати лише таблиці\n" +" -k, --token-table включить таблицю назв лексем\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Вывод:\n" +" -d, --defines створити також файл заголовків\n" +" -r, --report=THINGS створити також пояснення до автомату\n" +" -v, --verbose те ж, що й `--report=state'\n" +" -b, --file-prefix=ПРЕФІКС вказати ПРЕФІКС для файлів виводу\n" +" -o, --output=ФАЙЛ помістити результат у ФАЙЛ\n" +" -g, --graph створити також пояснення до автомату у " +"вигляді \n" +" VCG-графа\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"THINGS - список розділених комою слів, які можуть включати:\n" +" `state' описує стани\n" +" `itemset' завершити набір елементів ядра та закрити їх\n" +" `lookahead' явна прив'язати ознаки lookahead до елементів\n" +" `solved' описати вирішення конфліктів зсуву/виводу\n" +" `all' включати всю наведену вище інформацію\n" +" `none' вимкнути звіт\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "Про помилки повідомляйте за адресою <" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Автори: Роберт Корбет та Річард Столмен.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Це - вільна програма; умови розповсюдження дивіться у первинних текстах.\n" +"не надається ЖОДНИХ гарантій, навіть гарантії КОРИСНОСТІ або ПРИДАТНОСТІ\n" +"ДЛЯ ПЕВНОЇ МЕТИ.\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "багатократні описи %s" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "неприпустимий символ: %s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "багатократні описи %s" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "після `%s' пропущено операнд" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "зайвий операнд `%s'" + +#: src/gram.c:112 +msgid "empty" +msgstr "порожній" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Граматика" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "переповнення номеру рядка" + +#: src/location.c:94 +#, fuzzy, c-format +msgid "column number overflow" +msgstr "переповнення номеру рядка" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "правило не зведено через конфлікти" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "у описі параметра відсутній ідентифікатор" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " тип %d є %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "зсув, та перехід у стан %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "перехід у стан %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "помилка (не асоціативна)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "вивід з використанням правила %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "прийняти" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "стан %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Термінальні символи з правилами, у яких вони з'являються" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Нетермінальні символи з правилами, у яких вони з'являються" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " ліворуч:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " правируч:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "правило не зведено через конфлікти" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "багатократні описи %s" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "конфлікт типів у функції злиття `%s': <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "попереднє оголошення" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "правило задано для %s, який є лексемою" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "конфлікт типів на типовій дії: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "" +"порожнє правило для типізованого нетермінального символу, та відсутня дія" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "не використане значення: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "не встановлене значення: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "у правилі допускається лише один %s" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s впливає лише на аналізатори GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "за %s повинно слідувати додатне число" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "правило надто довге" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "відсутні правила у вхідній граматиці" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "відсутні правила у вхідній граматиці" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "Нетермінальні символи з правилами, у яких вони з'являються" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "відсутні правила у вхідній граматиці" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "відсутні правила у вхідній граматиці" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "відсутні правила у вхідній граматиці" +msgstr[1] "відсутні правила у вхідній граматиці" +msgstr[2] "відсутні правила у вхідній граматиці" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "початковий символ %s не виводить жодного речення" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "вихід за межі діапазону цілого числа: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "зайва `,', вважається пробілом" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "некоректна директива: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "неприпустимий символ: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "неприпустимий null-символ" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "неприпустима екрануюча послідовність: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "неприпустимий null-символ: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "нерозпізнана екрануюча послідовність: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "відсутня `%s' наприкінці файлу" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "відсутня `%s' наприкінці рядка" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "некоректне $ значення: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "надто багато символів (лексеми плюс нетермінали); максимально %d" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "повторний опис %s для %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "повторний опис %s для <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "повторне визначення символу %s" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "символ %s визначений повторно" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "перевизначення номера лексеми користувача для %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"символ %s використовується, але не визначений як лексема та не має правил" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "символ `%s' використовується більш ніж один раз як символьний рядокю" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "символ `%s' вказаний більш ніж один раз як символьний рядок" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "обом лексемам %s та %s призначений номер %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "початковий символ %s невизначений" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "початковий символ %s є лексемою" + +#: src/symtab.c:908 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "повторний опис типового %%destructor" + +#: src/symtab.c:921 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "повторний опис типового %%destructor" + +#: src/symtab.c:934 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "повторний опис типового %%printer" + +#: src/symtab.c:947 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "повторний опис типового %%printer" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "неприпустимий аргумент %s для %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "неоднозначний аргумент %s для %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Допустимі аргументи:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs, %u звільнено (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets, %u кешовано (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets, %u кешовано (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests, %u кешовано (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "гістограма журналу лічильників\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "гістограма журналу розміру\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "гістограма щільності\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Статистика бітових полів:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Акумульовані запуски = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Не вдається прочитати файл статистики." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Некоректний файл статистики.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Не вдається записати у файл статистики." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Не вдається відкрити файл статистики для запису." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Невідома системна помилка" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: неоднозначний ключ `%s'\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ключ `--%s' повинен використовуватись без аргументу\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ключ `%c%s' повинен використовуватись без аргументу\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ключ `%s' повинен використовуватись з аргументом\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: невідомий ключ `--%s'\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: невідомий ключ `%c%s'\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: неприпустимий ключ -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: некоректний ключ -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ключ повинен використовуватись з аргументом -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: неоднозначний ключ `-W %s'\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ключ `-W %s' повинен використовуватись без аргументу\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "пам'ять вичерпано" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "'" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "не вдається виконати допоміжну програму `%s'" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Час виконання (у секунда)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " ЗАГАЛОМ :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "час у %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "Якщо довга форма ключа визначає аргумент як обов'язковий, він також\n" +#~ "є обов'язковим і для короткої форми. Те ж стосується необов'язкових\n" +#~ "аргументів.\n" + +#~ msgid "Rules never reduced" +#~ msgstr "Правила не зведені" + +#~ msgid "useless rule" +#~ msgstr "марне правило" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "марний нетермінал: %s" + +#~ msgid "Useless nonterminals" +#~ msgstr "марні нетермінали" + +#~ msgid "Terminals which are not used" +#~ msgstr "Невикористані термінали" + +#~ msgid "Useless rules" +#~ msgstr "Марні правила" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d правило не зведене\n" +#~ msgstr[1] "%d правила не зведене\n" +#~ msgstr[2] "%d правил не зведене\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d марний нетермінал" +#~ msgstr[1] "%d марні нетермінали" +#~ msgstr[2] "%d марних нетерміналів" + +#~ msgid " and " +#~ msgstr " та " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d марне правило" +#~ msgstr[1] "%d марні правила" +#~ msgstr[2] "%d марних правил" diff --git a/po/vi.gmo b/po/vi.gmo new file mode 100644 index 0000000..d41ee57 Binary files /dev/null and b/po/vi.gmo differ diff --git a/po/vi.po b/po/vi.po new file mode 100644 index 0000000..b3fbee8 --- /dev/null +++ b/po/vi.po @@ -0,0 +1,871 @@ +# Vietnamese Translation for Bison. +# Copyright © 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Clytie Siddall , 2005-2008. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.3b\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-05-30 18:55+0930\n" +"Last-Translator: Clytie Siddall \n" +"Language-Team: Vietnamese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: LocFactoryEditor 1.7b3\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "cảnh báo" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "lỗi nghiêm trọng" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr "" +" Xung đột giữa quy tắc %d và hiệu bài %s được quyết định là dời (shift)" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr "" +" Xung đột giữa quy tắc %d và hiệu bài %s được quyết định là giảm (reduce)." + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr "" +" Xung đột giữa quy tắc %d và hiệu bài %s được quyết định là một lỗi " +"(error)." + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "xung đột: %d dời/giảm, %d giảm/giảm\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "xung đột: %d dời/giảm\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "xung đột: %d giảm/giảm\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "Tình trạng %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr chỉ áp dụng cho bộ phân tích kiểu GLR." + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "mong đợi %d lần xung đột dời/giảm" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "mong đợi %d lần xung đột giảm/giảm" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "không thể mở tập tin « %s »" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "Lỗi V/R" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "không thể đóng tập tin" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "tập tin « %s » có nhiều kết xuất xung đột với nhau" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Hãy chạy câu lệnh « %s --help » (trợ giúp) để xem thêm thông tin.\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "Sá»­ dụng: %s [TÙY_CHỌN]... TẬP_TIN\n" + +#: src/getargs.c:248 +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "Tạo cÆ¡ chế phân tích kiểu LALR(1) và GLR.\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" +"Mọi đối số bắt buộc phải sá»­ dụng với tùy chọn dài cÅ©ng bắt buộc với tùy chọn " +"ngắn.\n" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "CÅ©ng vậy với đối số còn tùy chọn.\n" + +#: src/getargs.c:260 +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"\n" +"Chế độ thao tác:\n" +" -h, --help \thiển thị trợ giúp này rồì thoát\n" +" -V, --version \txuất thông tin phiên bản rồi thoát\n" +" --print-localedir \tin ra thÆ° mục chứa dữ liệu phụ thuộc vào\n" +" --print-datadir thÆ° mục kết xuất chứa khung sườn và XSLT\n" +" -y, --yacc mô phỏng POSIX Yacc\n" +" -W, --warnings=[LOẠI] thông báo các cảnh báo thuộc về phân loại này\n" +"\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"CÆ¡ chế phân tích cú pháp:\n" +" -L, --language=NGÔN_NGá»® ghi rõ ngôn ngữ lập trình kết xuất\n" +" -S, --skeleton=TẬP_TIN xác định khung sườn cần dùng\n" +" -t, --debug thiết lập cÆ¡ chế phân tích để gỡ lỗi\n" +" --locations hiệu lá»±c phép tính về vị trí\n" +" -p, --name-prefix=TIỀN_TỐ đặt tiền tố nào vào trước ký hiệu ngoài\n" +" -l, --no-lines đừng tạo chỉ thị kiểu « #line »\n" +" -k, --token-table thêm một bảng các tên hiệu bài\n" + +#: src/getargs.c:287 +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"Kết xuất:\n" +" --defines[=TẬP_TIN] cÅ©ng tạo một tập tin phần đầu\n" +" -d cÅ©ng vậy nhÆ°ng không thể đặt TẬP_TIN (cho POSIX " +"Yacc)\n" +" -r, --report=CÁI cÅ©ng hiện chi tiết về hàm tá»± động\n" +" --report-file=TẬP_TIN ghi báo cáo vào tập tin này\n" +" -v, --verbose tÆ°Æ¡ng đương với « --report=state »\n" +" -b, --file-prefix=TIỀN_TỐ xác định một tiền tố cho các tập tin kết xuất\n" +" -o, --output=TẬP_TIN xuất vào tập tin này\n" +" -g, --graph[=TẬP_TIN] cÅ©ng xuất một đồ thị về hàm tá»± động\n" +" -x, --xml[=TẬP_TIN] cÅ©ng xuất một báo cáo XML về hàm tá»± động\n" +"\t\t\t\t\t\t(giản đồ XML vẫn còn thá»±c nghiệm)\n" +"\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" +"Các phân loại cảnh báo bao gồm:\n" +" • midrule-values\tgiá trị ở giữa quy tắc mà chÆ°a dùng hay đặt\n" +" • yacc \tsá»± không tÆ°Æ¡ng thích với POSIX YACC\n" +" • all \t\ttất cả các cảnh báo\n" +" • no-LOẠI \t\ttắt cảnh báo trong loại này\n" +" • none \ttắt mọi cảnh báo\n" +" • error \txá»­ lý cảnh báo dưới dạng lỗi\n" +"\n" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"CÁI là danh sách những từ định giới bằng dấu phẩy có thể bao gồm:\n" +" • state\t\tdiễn tả các tình trạng\n" +" • itemset\tđiền nốt mỗi tập hợp mục lõi với kết thúc nó\n" +" • look-ahead\t\tliên quan dứt khoát mỗi hiệu bài nhìn trước đến mục\n" +" • solved \tdiễn tả tiến trình giải sá»± xung đột kiểu dời/giảm\n" +" • all \tbao gồm tất cả thông tin trên\n" +" • none\t\ttắt báo cáo\n" + +#: src/getargs.c:323 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"\n" +"Hãy thông báo lỗi cho <%s>.\n" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "Tác giả: Robert Corbett và Richard Stallman.\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "Bản quyền © %d Tổ chức Phần mềm Tá»± do.\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"ChÆ°Æ¡ng trình này là phần mềm tá»± do; xem mã nguồn để tìm điều kiện sao chép.\n" +"KHÔNG CÓ BẢO HÀNH GÌ CẢ, THẬM CHÍ KHÔNG CÓ BẢO ĐẢM ĐƯỢC NGỤ Ý\n" +"KHẢ NĂNG BÁN HAY KHẢ NĂNG LÀM ĐƯỢC VIỆC DỨT KHOÁT.\n" + +#: src/getargs.c:371 +msgid "multiple skeleton declarations are invalid" +msgstr "chỉ cho phép một khai báo khung sườn" + +#: src/getargs.c:394 +#, c-format +msgid "invalid language `%s'" +msgstr "ngôn ngữ không hợp lệ « %s »" + +#: src/getargs.c:397 +msgid "multiple language declarations are invalid" +msgstr "chỉ cho phép một khai báo ngôn ngữ" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "thiếu tác tá»­ phía sau « %s »" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "tác tá»­ thừa « %s »" + +#: src/gram.c:112 +msgid "empty" +msgstr "rỗng" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "Ngữ pháp" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "tràn số thứ tá»± dòng" + +#: src/location.c:94 +#, c-format +msgid "column number overflow" +msgstr "tràn số thứ tá»± cột" + +#: src/main.c:136 +msgid "rule useless in parser due to conflicts" +msgstr "quy vô ích trong cÆ¡ chế phân tích do xung đột" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "thiếu dấu nhận diện trong khai báo tham số" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr " kiểu %d là %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "dời, và chuyển sang tình trạng %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "chuyển sang tình trạng %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "lỗi (không kết hợp)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "giảm dùng quy tắc %d (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "chấp nhận" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$default" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "tình trạng %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "Đồ kết thúc, với quy tắc nÆ¡i mà có" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "Đồ không kết thúc, với quy tắc nÆ¡i mà có" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr " bên trái:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr " bên phải:" + +#: src/print.c:495 +msgid "Rules useless in parser due to conflicts" +msgstr "Quy tắc vô ích trong cÆ¡ chế phân tích do xung đột" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "nhiều khai báo %s" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "kiểu kết quả xung đột ở hàm gộp lại « %s »: <%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "khai báo trước" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "đưa ra quy tắc cho %s, mà là hiệu bài" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "kiểu xung đột ở hành động mặc định: <%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "quy tắc rỗng cho đồ không kết thúc có kiểu, cÅ©ng không có hành động" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "giá trị chÆ°a dùng: $%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "giá trị chÆ°a đặt: $$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "chỉ cho phép một %s cho mỗi quy tắc" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s chỉ ảnh hưởng đến cÆ¡ chế phân tích kiểu GLR" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s phải có con số dÆ°Æ¡ng theo sau" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "quy tắc quá dài" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "không có quy tắc trong ngữ pháp nhập vào" + +#: src/reduce.c:242 +msgid "rule useless in grammar" +msgstr "quy tắc vô ích trong ngữ pháp" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "đồ không kết thúc vô ích trong ngữ pháp: %s" + +#: src/reduce.c:351 +msgid "Nonterminals useless in grammar" +msgstr "Đồ không kết thúc vô ích trong ngữ pháp" + +#: src/reduce.c:364 +msgid "Terminals unused in grammar" +msgstr "Đồ kết thúc chÆ°a dùng trong ngữ pháp" + +#: src/reduce.c:373 +msgid "Rules useless in grammar" +msgstr "Quy tắc vô ích trong ngữ pháp" + +#: src/reduce.c:388 +#, fuzzy, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "Đồ không kết thúc vô ích trong ngữ pháp" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "quy tắc vô ích trong ngữ pháp" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "ký hiệu bắt đầu %s không nhận được câu" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "ký hiệu « $ » lạc" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "ký hiệu « @ » lạc" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "đưa ra kiểu dứt khoát theo ngữ cảnh không đặt kiểu" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "$$ cho quy tắc giữa ở $%d của « %s » không có kiểu được khai báo" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "$$ của « %s » không có kiểu được khai báo" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "$%d của « %s » không có kiểu được khai báo" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "số nguyên ở ngoại phạm vi: %s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "dấu phẩy « , » lạc được xá»­ lý dưới dạng khoảng trắng" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "chi thị không hợp lệ: %s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "ký tá»± không hợp lệ: %s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "ký tá»± vô giá trị không hợp lệ" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "dãy thoát không hợp lệ: %s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "ký tá»± vô giá trị không hợp lệ: %s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "không nhận ra dãy thoát: %s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "thiếu « %s » tại kết thúc tập tin" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "thiếu « %s » tại kết thúc dòng" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "giá trị $ không hợp lệ: $%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "quá nhiều ký hiệu trong ngữ pháp nhập vào (giới hạn %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s khai báo lại cho %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s khai báo lại cho <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "ký hiệu %s đã được định nghÄ©a lại" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "ký hiệu %s đã được khai báo lại" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "đang định nghÄ©a lại số thứ tá»± hiệu bài người dùng của %s" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "" +"ký hiệu %s được dùng, nhÆ°ng chÆ°a được định nghÄ©a nhÆ° là hiệu bài, cÅ©ng không " +"có quy tắc" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "ký hiệu « %s » được dùng nhiều lần dưới dạng một chuỗi nghÄ©a chữ" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "ký hiệu « %s » nhận nhiều chuỗi nghÄ©a chữ" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "cả hiệu bài %s lẫn %s đều được gán số %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "chÆ°a định nghÄ©a ký hiệu bắt đầu %s" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "ký hiệu bắt đầu %s là một hiệụ bài" + +#: src/symtab.c:908 +#, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "khai báo lại cho %%destructor có thẻ mặc định" + +#: src/symtab.c:921 +#, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "khai báo lại cho %%destructor không có thẻ mặc định" + +#: src/symtab.c:934 +#, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "khai báo lại cho %%printer có thẻ mặc định" + +#: src/symtab.c:947 +#, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "khai báo lại cho %%printer không có thẻ mặc định" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "đối sô không hợp lệ %s cho %s" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "đối số mÆ¡ hồ %s cho %s" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "Đối số hợp lệ:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs (cấp bộ bit), %u đã giải phóng (%.2f%%).\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets (bộ bộ bit), %u đã lÆ°u tạm (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets (lập lại bộ bit), %u đã lÆ°u tạm (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests (thá»­ bộ bit), %u đã lÆ°u tạm (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists (danh sách bộ bit)\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "biểu đồ tần xuất ghi lÆ°u số đếm\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "biểu đồ tần xuất ghi lÆ°u kích cỡ\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "biểu đồ tần xuất mật độ\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Thống kê bộ bit:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "Lần chạy tích lÅ©y = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "Không thể đọc tập tin thống kê." + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "Kích cỡ tập tin thống kê sai.\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "Không thể ghi tập tin thống kê." + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "Không thể mở tập tin thống kê để ghi." + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "Lỗi hệ thống không rõ" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: tùy chọn « %s » là mÆ¡ hồ\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: tùy chọn « --%s » không cho phép đối số\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: tùy chọn « %c%s » không cho phép đối số\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: tùy chọn « %s » cần đến đối số\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: không nhận ra tùy chọn « --%s »\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: không nhận ra tùy chọn « %c%s »\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: tùy chọn cấm -- %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: tùy chọn không hợp lệ -- %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: tùy chọn cần đến đối số -- %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: tùy chọn « -W %s » là mÆ¡ hồ\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: tùy chọn « -W %s » không cho phép đối số\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "cạn bộ nhớ" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "« " + +#: lib/quotearg.c:267 +msgid "'" +msgstr " »" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "không thể gọi chÆ°Æ¡ng trình phụ « %s »" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"Thời gian thá»±c hiện (giây)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " TỔNG :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "thời gian theo %s: %ld.%06ld (%ld%%)\n" + +#~ msgid "%d nonterminal" +#~ msgid_plural "%d nonterminals" +#~ msgstr[0] "%d đồ không kết thúc" + +#~ msgid " and " +#~ msgstr " và " + +#~ msgid "%d rule" +#~ msgid_plural "%d rules" +#~ msgstr[0] "%d quy tắc" + +#~ msgid " useless in grammar" +#~ msgstr " vô ích trong ngữ pháp" diff --git a/po/zh_TW.gmo b/po/zh_TW.gmo new file mode 100644 index 0000000..9c01484 Binary files /dev/null and b/po/zh_TW.gmo differ diff --git a/po/zh_TW.po b/po/zh_TW.po new file mode 100644 index 0000000..b6a7b9c --- /dev/null +++ b/po/zh_TW.po @@ -0,0 +1,878 @@ +# Traditional Chinese Messages for bison. +# Copyright (C) 2006, 07 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Wei-Lun Chao , 2006, 07. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2007-07-23 22:36+0800\n" +"Last-Translator: Wei-Lun Chao \n" +"Language-Team: Chinese (traditional) \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: src/complain.c:93 src/complain.c:100 src/gram.c:311 src/reduce.c:387 +#: src/reduce.c:396 +msgid "warning" +msgstr "警告" + +#: src/complain.c:130 src/complain.c:137 +msgid "fatal error" +msgstr "嚴重錯誤" + +#: src/conflicts.c:77 +#, c-format +msgid " Conflict between rule %d and token %s resolved as shift" +msgstr " 在規則 %d 與記號 %s 之間的衝突以偏移來解決" + +#: src/conflicts.c:86 +#, c-format +msgid " Conflict between rule %d and token %s resolved as reduce" +msgstr " 在規則 %d 與記號 %s 之間的衝突以縮減來解決" + +#: src/conflicts.c:94 +#, c-format +msgid " Conflict between rule %d and token %s resolved as an error" +msgstr " 在規則 %d 與記號 %s 之間的衝突以視為錯誤來解決" + +#: src/conflicts.c:492 +#, c-format +msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" +msgstr "衝突:%d 項偏移/縮減,%d 項縮減/縮減\n" + +#: src/conflicts.c:495 +#, c-format +msgid "conflicts: %d shift/reduce\n" +msgstr "衝突:%d 項偏移/縮減\n" + +#: src/conflicts.c:497 +#, c-format +msgid "conflicts: %d reduce/reduce\n" +msgstr "衝突:%d 項縮減/縮減\n" + +#: src/conflicts.c:515 +#, c-format +msgid "State %d " +msgstr "狀態 %d " + +#: src/conflicts.c:582 +#, c-format +msgid "%%expect-rr applies only to GLR parsers" +msgstr "%%expect-rr 只套用到 GLR 剖析器" + +#: src/conflicts.c:607 +#, c-format +msgid "expected %d shift/reduce conflict" +msgid_plural "expected %d shift/reduce conflicts" +msgstr[0] "預期有 %d 項偏移/縮減衝突" + +#: src/conflicts.c:612 +#, c-format +msgid "expected %d reduce/reduce conflict" +msgid_plural "expected %d reduce/reduce conflicts" +msgstr[0] "預期有 %d 項縮減/縮減衝突" + +#: src/files.c:112 +#, c-format +msgid "cannot open file `%s'" +msgstr "無法開啟檔案「%s」" + +#: src/files.c:128 +#, c-format +msgid "I/O error" +msgstr "輸入/輸出錯誤" + +#: src/files.c:131 +#, c-format +msgid "cannot close file" +msgstr "無法關閉檔案" + +#: src/files.c:357 +#, c-format +msgid "refusing to overwrite the input file %s" +msgstr "" + +#: src/files.c:362 +#, c-format +msgid "conflicting outputs to file %s" +msgstr "輸出至檔案 %s 時發生衝突" + +#: src/getargs.c:243 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "請嘗試執行「%s --help」來獲取更多資訊。\n" + +#: src/getargs.c:247 +#, c-format +msgid "Usage: %s [OPTION]... FILE\n" +msgstr "用法:%s [選項]... 檔案\n" + +#: src/getargs.c:248 +#, fuzzy +msgid "" +"Generate LALR(1) and GLR parsers.\n" +"\n" +msgstr "GNU bison 產生 LALR(1) 與 GLR 剖析器。\n" + +#: src/getargs.c:253 +msgid "" +"Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/getargs.c:256 +msgid "The same is true for optional arguments.\n" +msgstr "" + +#: src/getargs.c:260 +#, fuzzy +msgid "" +"\n" +"Operation modes:\n" +" -h, --help display this help and exit\n" +" -V, --version output version information and exit\n" +" --print-localedir output directory containing locale-dependent " +"data\n" +" --print-datadir output directory containing skeletons and XSLT\n" +" -y, --yacc emulate POSIX Yacc\n" +" -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n" +"\n" +msgstr "" +"操作模式:\n" +" -h, --help 顯示此說明並離開\n" +" -V, --version 輸出版本資訊並離開\n" +" --print-localedir 輸出包含語區相依資料的目錄\n" +" -y, --yacc 模擬 POSIX yacc\n" + +#: src/getargs.c:272 +#, fuzzy +msgid "" +"Parser:\n" +" -L, --language=LANGUAGE specify the output programming language\n" +" (this is an experimental feature)\n" +" -S, --skeleton=FILE specify the skeleton to use\n" +" -t, --debug instrument the parser for debugging\n" +" --locations enable locations computation\n" +" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" +" -l, --no-lines don't generate `#line' directives\n" +" -k, --token-table include a table of token names\n" +"\n" +msgstr "" +"剖析器:\n" +" -S, --skeleton=FILE 指定所使用的架構\n" +" -t, --debug 提供用於偵錯的剖析器\n" +" --locations 啟用位置計算\n" +" -p, --name-prefix=PREFIX 前置 PREFIX 於外部符號\n" +" -l, --no-lines 不產生「#line」指令\n" +" -n, --no-parser 只產生表格\n" +" -k, --token-table 包含記號名稱表格\n" + +#: src/getargs.c:287 +#, fuzzy +msgid "" +"Output:\n" +" --defines[=FILE] also produce a header file\n" +" -d likewise but cannot specify FILE (for POSIX " +"Yacc)\n" +" -r, --report=THINGS also produce details on the automaton\n" +" --report-file=FILE write report to FILE\n" +" -v, --verbose same as `--report=state'\n" +" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" +" -o, --output=FILE leave output to FILE\n" +" -g, --graph[=FILE] also output a graph of the automaton\n" +" -x, --xml[=FILE] also output an XML report of the automaton\n" +" (the XML schema is experimental)\n" +"\n" +msgstr "" +"輸出:\n" +" -d, --defines 同時產生標頭檔案\n" +" -r, --report=THINGS 同時在自動裝置上產生細節\n" +" -v, --verbose 如同「--report=state」\n" +" -b, --file-prefix=PREFIX 指定用於輸出檔案的 PREFIX\n" +" -o, --output=FILE 保留輸出到 FILE\n" +" -g, --graph 同時產生自動裝置 VCG 的描述\n" + +#: src/getargs.c:302 +msgid "" +"Warning categories include:\n" +" `midrule-values' unset or unused midrule values\n" +" `yacc' incompatibilities with POSIX YACC\n" +" `all' all the warnings\n" +" `no-CATEGORY' turn off warnings in CATEGORY\n" +" `none' turn off all the warnings\n" +" `error' treat warnings as errors\n" +"\n" +msgstr "" + +#: src/getargs.c:313 +msgid "" +"THINGS is a list of comma separated words that can include:\n" +" `state' describe the states\n" +" `itemset' complete the core item sets with their closure\n" +" `lookahead' explicitly associate lookahead tokens to items\n" +" `solved' describe shift/reduce conflicts solving\n" +" `all' include all the above information\n" +" `none' disable the report\n" +msgstr "" +"THINGS 是以逗號所分隔的字詞清單,其中可以包含:\n" +" `state' 描述狀態\n" +" `itemset' 完成核心項目集合並附有它們的結束\n" +" `lookahead' 明確地將預估記號關聯到項目\n" +" `solved' 描述正在解決的偏移/縮減衝突\n" +" `all' 包含所有以上的資訊\n" +" `none' 停用報告\n" + +#: src/getargs.c:323 +#, fuzzy, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "回報錯誤請寄 <" + +#: src/getargs.c:339 +#, c-format +msgid "bison (GNU Bison) %s" +msgstr "bison (GNU Bison) %s" + +#: src/getargs.c:341 +msgid "Written by Robert Corbett and Richard Stallman.\n" +msgstr "由 Robert Corbett 與 Richard Stallman 編寫。\n" + +#: src/getargs.c:345 +#, c-format +msgid "Copyright (C) %d Free Software Foundation, Inc.\n" +msgstr "版權所有 (C) %d 自由軟體基金會。\n" + +#: src/getargs.c:348 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"這是自由軟體;請參考原始碼的版權聲明。本軟體不提供任何保證,甚至不會包括\n" +"可售性或適用於任何特定目的的保證。\n" + +#: src/getargs.c:371 +#, fuzzy +msgid "multiple skeleton declarations are invalid" +msgstr "多重 %s 宣告" + +#: src/getargs.c:394 +#, fuzzy, c-format +msgid "invalid language `%s'" +msgstr "無效的字元:%s" + +#: src/getargs.c:397 +#, fuzzy +msgid "multiple language declarations are invalid" +msgstr "多重 %s 宣告" + +#: src/getargs.c:619 +#, c-format +msgid "missing operand after `%s'" +msgstr "「%s」之後缺少了運算元" + +#: src/getargs.c:621 +#, c-format +msgid "extra operand `%s'" +msgstr "多餘的運算元「%s」" + +#: src/gram.c:112 +msgid "empty" +msgstr "空白" + +#: src/gram.c:201 +msgid "Grammar" +msgstr "文法" + +#: src/location.c:92 src/scan-gram.l:731 +#, c-format +msgid "line number overflow" +msgstr "列號溢位" + +#: src/location.c:94 +#, fuzzy, c-format +msgid "column number overflow" +msgstr "列號溢位" + +#: src/main.c:136 +#, fuzzy +msgid "rule useless in parser due to conflicts" +msgstr "由於發生衝突導致規則一直無法縮減" + +#: src/parse-gram.y:693 +#, c-format +msgid "missing identifier in parameter declaration" +msgstr "在參數宣告中缺少識別項" + +#: src/print.c:47 +#, c-format +msgid " type %d is %s\n" +msgstr "類型 %d 為 %s\n" + +#: src/print.c:164 +#, c-format +msgid "shift, and go to state %d\n" +msgstr "偏移,並進入狀態 %d\n" + +#: src/print.c:166 +#, c-format +msgid "go to state %d\n" +msgstr "進入狀態 %d\n" + +#: src/print.c:203 +msgid "error (nonassociative)\n" +msgstr "錯誤 (非相聯的)\n" + +#: src/print.c:226 +#, c-format +msgid "reduce using rule %d (%s)" +msgstr "使用規則 %d 以縮減 (%s)" + +#: src/print.c:228 +#, c-format +msgid "accept" +msgstr "接受" + +#: src/print.c:263 src/print.c:329 +msgid "$default" +msgstr "$預設" + +#: src/print.c:358 +#, c-format +msgid "state %d" +msgstr "狀態 %d" + +#: src/print.c:394 +msgid "Terminals, with rules where they appear" +msgstr "終結語詞,附有它們出現處的規則" + +#: src/print.c:421 +msgid "Nonterminals, with rules where they appear" +msgstr "非終結語詞,附有它們出現處的規則" + +#: src/print.c:450 +#, c-format +msgid " on left:" +msgstr "於左側:" + +#: src/print.c:467 +#, c-format +msgid " on right:" +msgstr "於右側:" + +#: src/print.c:495 +#, fuzzy +msgid "Rules useless in parser due to conflicts" +msgstr "由於發生衝突導致規則一直無法縮減" + +#: src/reader.c:61 +#, c-format +msgid "multiple %s declarations" +msgstr "多重 %s 宣告" + +#: src/reader.c:131 +#, c-format +msgid "result type clash on merge function `%s': <%s> != <%s>" +msgstr "結果類型與合併功能相抵觸「%s」:<%s> != <%s>" + +#: src/reader.c:134 src/symtab.c:141 src/symtab.c:149 src/symtab.c:910 +#: src/symtab.c:923 src/symtab.c:936 src/symtab.c:949 +#, c-format +msgid "previous declaration" +msgstr "前次宣告" + +#: src/reader.c:218 +#, c-format +msgid "rule given for %s, which is a token" +msgstr "用於 %s 這項記號的規則" + +#: src/reader.c:270 +#, c-format +msgid "type clash on default action: <%s> != <%s>" +msgstr "類型與預設動作相抵觸:<%s> != <%s>" + +#: src/reader.c:276 +#, c-format +msgid "empty rule for typed nonterminal, and no action" +msgstr "空白規則用於賦予類型的非終結語詞,以及沒有動作" + +#: src/reader.c:290 +#, c-format +msgid "unused value: $%d" +msgstr "未使用的值:$%d" + +#: src/reader.c:292 +#, c-format +msgid "unset value: $$" +msgstr "解除設定值:$$" + +#: src/reader.c:369 src/reader.c:383 src/reader.c:396 +#, c-format +msgid "only one %s allowed per rule" +msgstr "每個規則只允許一個 %s" + +#: src/reader.c:379 src/reader.c:394 +#, c-format +msgid "%s affects only GLR parsers" +msgstr "%s 只影響 GLR 剖析器" + +#: src/reader.c:381 +#, c-format +msgid "%s must be followed by positive number" +msgstr "%s 必須在正數之後" + +#: src/reader.c:487 +#, c-format +msgid "rule is too long" +msgstr "規則太長" + +#: src/reader.c:575 +#, c-format +msgid "no rules in the input grammar" +msgstr "在輸入文法中沒有規則" + +#: src/reduce.c:242 +#, fuzzy +msgid "rule useless in grammar" +msgstr "在輸入文法中沒有規則" + +#: src/reduce.c:303 +#, c-format +msgid "nonterminal useless in grammar: %s" +msgstr "" + +#: src/reduce.c:351 +#, fuzzy +msgid "Nonterminals useless in grammar" +msgstr "非終結語詞,附有它們出現處的規則" + +#: src/reduce.c:364 +#, fuzzy +msgid "Terminals unused in grammar" +msgstr "在輸入文法中沒有規則" + +#: src/reduce.c:373 +#, fuzzy +msgid "Rules useless in grammar" +msgstr "在輸入文法中沒有規則" + +#: src/reduce.c:388 +#, c-format +msgid "%d nonterminal useless in grammar" +msgid_plural "%d nonterminals useless in grammar" +msgstr[0] "" + +#: src/reduce.c:397 +#, fuzzy, c-format +msgid "%d rule useless in grammar" +msgid_plural "%d rules useless in grammar" +msgstr[0] "在輸入文法中沒有規則" + +#: src/reduce.c:428 +#, c-format +msgid "start symbol %s does not derive any sentence" +msgstr "啟始符號 %s 不衍生任何句子" + +#: src/scan-code.l:163 +#, c-format +msgid "stray `$'" +msgstr "" + +#: src/scan-code.l:167 +#, c-format +msgid "stray `@'" +msgstr "" + +#: src/scan-code.l:280 +#, c-format +msgid "explicit type given in untyped grammar" +msgstr "" + +#: src/scan-code.l:295 +#, c-format +msgid "$$ for the midrule at $%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:300 +#, c-format +msgid "$$ of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:328 +#, c-format +msgid "$%d of `%s' has no declared type" +msgstr "" + +#: src/scan-code.l:343 src/scan-code.l:378 src/scan-gram.l:653 +#, c-format +msgid "integer out of range: %s" +msgstr "整數超過範圍:%s" + +#: src/scan-gram.l:135 +#, c-format +msgid "stray `,' treated as white space" +msgstr "零星的「,」會被視為空白" + +#: src/scan-gram.l:201 +#, c-format +msgid "invalid directive: %s" +msgstr "無效的指令:%s" + +#: src/scan-gram.l:259 +#, c-format +msgid "invalid character: %s" +msgstr "無效的字元:%s" + +#: src/scan-gram.l:390 +#, c-format +msgid "invalid null character" +msgstr "無效的空字元" + +#: src/scan-gram.l:403 src/scan-gram.l:414 src/scan-gram.l:435 +#, c-format +msgid "invalid escape sequence: %s" +msgstr "無效的跳脫序列:%s" + +#: src/scan-gram.l:405 src/scan-gram.l:416 src/scan-gram.l:437 +#, c-format +msgid "invalid null character: %s" +msgstr "無效的空字元:%s" + +#: src/scan-gram.l:442 +#, c-format +msgid "unrecognized escape sequence: %s" +msgstr "無法辨識的跳脫序列:%s" + +#: src/scan-gram.l:763 +#, c-format +msgid "missing `%s' at end of file" +msgstr "檔案末端缺少「%s」" + +#: src/scan-gram.l:774 +#, c-format +msgid "missing `%s' at end of line" +msgstr "列尾缺少「%s」" + +#: src/symlist.c:199 +#, c-format +msgid "invalid $ value: $%d" +msgstr "無效的 $ 值:$%d" + +#: src/symtab.c:78 +#, c-format +msgid "too many symbols in input grammar (limit is %d)" +msgstr "在輸入文法中太多符號 (限制為 %d)" + +#: src/symtab.c:140 +#, c-format +msgid "%s redeclaration for %s" +msgstr "%s 重複宣告了 %s" + +#: src/symtab.c:148 +#, c-format +msgid "%s redeclaration for <%s>" +msgstr "%s 重複宣告了 <%s>" + +#: src/symtab.c:332 +#, c-format +msgid "symbol %s redefined" +msgstr "符號 %s 被重新定義" + +#: src/symtab.c:346 +#, c-format +msgid "symbol %s redeclared" +msgstr "符號 %s 被重新宣告" + +#: src/symtab.c:367 +#, c-format +msgid "redefining user token number of %s" +msgstr "重新定義 %s 的使用者記號數目" + +#: src/symtab.c:394 +#, c-format +msgid "symbol %s is used, but is not defined as a token and has no rules" +msgstr "符號 %s 已使用過,但是並未定義為記號也沒有規則" + +#: src/symtab.c:419 +#, c-format +msgid "symbol `%s' used more than once as a literal string" +msgstr "符號「%s」被超過一次做為常值字串使用" + +#: src/symtab.c:422 +#, c-format +msgid "symbol `%s' given more than one literal string" +msgstr "符號「%s」給予一個以上的原文字串" + +#: src/symtab.c:558 +#, c-format +msgid "tokens %s and %s both assigned number %d" +msgstr "記號 %s 與 %s 兩者都指派了數字 %d" + +#: src/symtab.c:889 +#, c-format +msgid "the start symbol %s is undefined" +msgstr "未定義起始符號 %s" + +#: src/symtab.c:893 +#, c-format +msgid "the start symbol %s is a token" +msgstr "起始符號 %s 是一項記號" + +#: src/symtab.c:908 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%destructor" +msgstr "重複宣告了預設的 %%destructor" + +#: src/symtab.c:921 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%destructor" +msgstr "重複宣告了預設的 %%destructor" + +#: src/symtab.c:934 +#, fuzzy, c-format +msgid "redeclaration for default tagged %%printer" +msgstr "重複宣告了預設的 %%printer" + +#: src/symtab.c:947 +#, fuzzy, c-format +msgid "redeclaration for default tagless %%printer" +msgstr "重複宣告了預設的 %%printer" + +#: lib/argmatch.c:133 +#, c-format +msgid "invalid argument %s for %s" +msgstr "%2$s 的引數 %1$s 無效" + +#: lib/argmatch.c:134 +#, c-format +msgid "ambiguous argument %s for %s" +msgstr "%2$s 的引數 %1$s 不明確" + +#: lib/argmatch.c:153 +#, c-format +msgid "Valid arguments are:" +msgstr "有效的引數為:" + +#: lib/bitset_stats.c:175 +#, c-format +msgid "%u bitset_allocs, %u freed (%.2f%%).\n" +msgstr "%u bitset_allocs,%u 已釋放 (%.2f%%)。\n" + +#: lib/bitset_stats.c:178 +#, c-format +msgid "%u bitset_sets, %u cached (%.2f%%)\n" +msgstr "%u bitset_sets,%u 已快取 (%.2f%%)\n" + +#: lib/bitset_stats.c:181 +#, c-format +msgid "%u bitset_resets, %u cached (%.2f%%)\n" +msgstr "%u bitset_resets,%u 已快取 (%.2f%%)\n" + +#: lib/bitset_stats.c:184 +#, c-format +msgid "%u bitset_tests, %u cached (%.2f%%)\n" +msgstr "%u bitset_tests,%u 已快取 (%.2f%%)\n" + +#: lib/bitset_stats.c:188 +#, c-format +msgid "%u bitset_lists\n" +msgstr "%u bitset_lists\n" + +#: lib/bitset_stats.c:190 +msgid "count log histogram\n" +msgstr "計算日誌長條圖\n" + +#: lib/bitset_stats.c:193 +msgid "size log histogram\n" +msgstr "調整日誌長條圖大小\n" + +#: lib/bitset_stats.c:196 +msgid "density histogram\n" +msgstr "密度長條圖\n" + +#: lib/bitset_stats.c:210 +#, c-format +msgid "" +"Bitset statistics:\n" +"\n" +msgstr "" +"Bitset 統計:\n" +"\n" + +#: lib/bitset_stats.c:213 +#, c-format +msgid "Accumulated runs = %u\n" +msgstr "累積的執行 = %u\n" + +#: lib/bitset_stats.c:257 lib/bitset_stats.c:262 +msgid "Could not read stats file." +msgstr "無法讀取統計檔。" + +#: lib/bitset_stats.c:259 +#, c-format +msgid "Bad stats file size.\n" +msgstr "不當的統計檔大小。\n" + +#: lib/bitset_stats.c:285 lib/bitset_stats.c:287 +msgid "Could not write stats file." +msgstr "無法寫入統計檔。" + +#: lib/bitset_stats.c:290 +msgid "Could not open stats file for writing." +msgstr "寫入時無法開啟統計檔。" + +#: lib/error.c:125 +msgid "Unknown system error" +msgstr "不明的系統錯誤" + +#: lib/getopt.c:526 lib/getopt.c:542 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s:選項「%s」不明確\n" + +#: lib/getopt.c:575 lib/getopt.c:579 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s:選項「--%s」不可配合引數使用\n" + +#: lib/getopt.c:588 lib/getopt.c:593 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s:選項「%c%s」不可配合引數使用\n" + +#: lib/getopt.c:636 lib/getopt.c:655 lib/getopt.c:971 lib/getopt.c:990 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s:選項「%s」需要引數\n" + +#: lib/getopt.c:693 lib/getopt.c:696 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s:無法識別的選項「--%s」\n" + +#: lib/getopt.c:704 lib/getopt.c:707 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s:無法識別的選項「%c%s」\n" + +#: lib/getopt.c:759 lib/getopt.c:762 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s:不合法的選項 ─ %c\n" + +#: lib/getopt.c:768 lib/getopt.c:771 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s:無效的選項 ─ %c\n" + +#: lib/getopt.c:823 lib/getopt.c:839 lib/getopt.c:1043 lib/getopt.c:1061 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s:選項需要引數 ─ %c\n" + +#: lib/getopt.c:892 lib/getopt.c:908 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s:選項「-W %s」不明確\n" + +#: lib/getopt.c:932 lib/getopt.c:950 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s:選項「-W %s」不可配合引數使用\n" + +#: lib/obstack.c:423 lib/obstack.c:425 lib/xalloc-die.c:34 +msgid "memory exhausted" +msgstr "記憶體耗盡" + +#. TRANSLATORS: +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. +#. If you don't know what to put here, please see +#. +#. and use glyphs suitable for your language. +#: lib/quotearg.c:266 +msgid "`" +msgstr "「" + +#: lib/quotearg.c:267 +msgid "'" +msgstr "」" + +#: lib/subpipe.c:161 +#, c-format +msgid "subsidiary program `%s' could not be invoked" +msgstr "無法執行輔助程式「%s」" + +#: lib/timevar.c:472 +msgid "" +"\n" +"Execution times (seconds)\n" +msgstr "" +"\n" +"執行時間 (秒)\n" + +#: lib/timevar.c:522 +msgid " TOTAL :" +msgstr " 總計 :" + +#: lib/timevar.c:558 +#, c-format +msgid "time in %s: %ld.%06ld (%ld%%)\n" +msgstr "%s 中的時間:%ld.%06ld (%ld%%)\n" + +#~ msgid "" +#~ "If a long option shows an argument as mandatory, then it is mandatory\n" +#~ "for the equivalent short option also. Similarly for optional arguments.\n" +#~ msgstr "" +#~ "如果某個長選項必須使用引數,在對等的短選項中這些引數也是必須的。\n" +#~ "選擇性的引數也有類似的規定。\n" + +#~ msgid "Rules never reduced" +#~ msgstr "永不縮減的規則" + +#~ msgid "useless rule" +#~ msgstr "沒用到的規則" + +#~ msgid "useless nonterminal: %s" +#~ msgstr "沒用到的非終結符號:%s" + +#~ msgid "Useless nonterminals" +#~ msgstr "沒用到的非終結符號" + +#~ msgid "Terminals which are not used" +#~ msgstr "沒用到的終結符號" + +#~ msgid "Useless rules" +#~ msgstr "沒用到的規則" + +#~ msgid "%d rule never reduced\n" +#~ msgid_plural "%d rules never reduced\n" +#~ msgstr[0] "%d 條規則永不縮減\n" + +#~ msgid "%d useless nonterminal" +#~ msgid_plural "%d useless nonterminals" +#~ msgstr[0] "%d 項沒用到的非終結符號" + +#~ msgid " and " +#~ msgstr " 和 " + +#~ msgid "%d useless rule" +#~ msgid_plural "%d useless rules" +#~ msgstr[0] "%d 條沒用到的規則" diff --git a/runtime-po/LINGUAS b/runtime-po/LINGUAS new file mode 100644 index 0000000..4739205 --- /dev/null +++ b/runtime-po/LINGUAS @@ -0,0 +1,29 @@ +da +de +el +es +et +fi +fr +ga +hr +id +it +ja +ky +lt +ms +nb +nl +pl +pt_BR +ro +ru +sl +sv +th +tr +uk +vi +zh_CN +zh_TW diff --git a/runtime-po/Makefile.in.in b/runtime-po/Makefile.in.in new file mode 100644 index 0000000..e7d1ab2 --- /dev/null +++ b/runtime-po/Makefile.in.in @@ -0,0 +1,395 @@ +# -*- buffer-read-only: t -*- vi: set ro: +# DO NOT EDIT! GENERATED AUTOMATICALLY! +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License but which still want to provide support for the GNU gettext +# functionality. +# Please note that the actual code of GNU gettext is covered by the GNU +# General Public License and is *not* in the public domain. +# +# Origin: gettext-0.15 + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +localedir = @localedir@ +gettextsrcdir = $(datadir)/gettext/po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +mkinstalldirs = $(SHELL) @install_sh@ -d +mkdir_p = @mkdir_p@ + +GMSGFMT_ = @GMSGFMT@ +GMSGFMT_no = @GMSGFMT@ +GMSGFMT_yes = @GMSGFMT_015@ +GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) +MSGFMT_ = @MSGFMT@ +MSGFMT_no = @MSGFMT@ +MSGFMT_yes = @MSGFMT_015@ +MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) +XGETTEXT_ = @XGETTEXT@ +XGETTEXT_no = @XGETTEXT@ +XGETTEXT_yes = @XGETTEXT_015@ +XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) +MSGMERGE = msgmerge +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter + +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) + +POTFILES = \ + +CATALOGS = @CATALOGS@ + +# Makevars gets inserted here. (Don't remove this line!) + +.SUFFIXES: +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update + +.po.mo: + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +.po.gmo: + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ + + +all: all-@USE_NLS@ + +all-yes: stamp-po +all-no: + +# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no +# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because +# we don't want to bother translators with empty POT files). We assume that +# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. +# In this case, stamp-po is a nop (i.e. a phony target). + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + test ! -f $(srcdir)/$(DOMAIN).pot || \ + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @test ! -f $(srcdir)/$(DOMAIN).pot || { \ + echo "touch stamp-po" && \ + echo timestamp > stamp-poT && \ + mv stamp-poT stamp-po; \ + } + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ + msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ + else \ + msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ + fi; \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address="$$msgid_bugs_address" + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(srcdir)/$(DOMAIN).pot + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + if test -f "$(srcdir)/$${lang}.po"; then \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +install-data-no: all +install-data-yes: all + $(mkdir_p) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + $(mkdir_p) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done + +check: all + +info dvi ps pdf html tags TAGS ctags CTAGS ID: + +mostlyclean: + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f stamp-po $(GMOFILES) + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: + $(MAKE) update-po + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: stamp-po $(DISTFILES) + dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + dists="$$dists $(DOMAIN).pot stamp-po"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ + for file in $$dists; do \ + if test -f $$file; then \ + cp -p $$file $(distdir) || exit 1; \ + else \ + cp -p $(srcdir)/$$file $(distdir) || exit 1; \ + fi; \ + done + +update-po: Makefile + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) + $(MAKE) update-gmo + +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + +update-gmo: Makefile $(GMOFILES) + @: + +Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ + cd $(top_builddir) \ + && $(SHELL) ./config.status $(subdir)/$@.in po-directories + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/runtime-po/Makevars b/runtime-po/Makevars new file mode 100644 index 0000000..50a0782 --- /dev/null +++ b/runtime-po/Makevars @@ -0,0 +1,57 @@ +# -*- buffer-read-only: t -*- vi: set ro: +# DO NOT EDIT! GENERATED AUTOMATICALLY! +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = bison-runtime + +# These two variables depend on the location of this directory. +subdir = runtime-po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ \ + \ + --flag=_:1:pass-c-format\ + --flag=N_:1:pass-c-format\ + --flag=error:3:c-format --flag=error_at_line:5:c-format\ +\ + --from-code=UTF-8\ + --flag=asprintf:2:c-format\ + --flag=complain:1:c-format --flag=complain_at:2:c-format\ + --flag=fatal:1:c-format --flag=fatal_at:2:c-format\ + --flag=warn:1:c-format --flag=warn_at:2:c-format\ + --flag=unexpected_end:2:c-format\ +\ + --keyword=YY_ \ + $${end_of_xgettext_options+} + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Free Software Foundation, Inc. + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = bug-bison@gnu.org + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = diff --git a/runtime-po/POTFILES.in b/runtime-po/POTFILES.in new file mode 100644 index 0000000..7e73063 --- /dev/null +++ b/runtime-po/POTFILES.in @@ -0,0 +1,3 @@ +data/glr.c +data/lalr1.cc +data/yacc.c diff --git a/runtime-po/Rules-quot b/runtime-po/Rules-quot new file mode 100644 index 0000000..9c2a995 --- /dev/null +++ b/runtime-po/Rules-quot @@ -0,0 +1,47 @@ +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/runtime-po/bison-runtime.pot b/runtime-po/bison-runtime.pot new file mode 100644 index 0000000..8f359a9 --- /dev/null +++ b/runtime-po/bison-runtime.pot @@ -0,0 +1,60 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" diff --git a/runtime-po/boldquot.sed b/runtime-po/boldquot.sed new file mode 100644 index 0000000..4b937aa --- /dev/null +++ b/runtime-po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g +s/“/“/g +s/”/”/g +s/‘/‘/g +s/’/’/g diff --git a/runtime-po/da.gmo b/runtime-po/da.gmo new file mode 100644 index 0000000..03bb961 Binary files /dev/null and b/runtime-po/da.gmo differ diff --git a/runtime-po/da.po b/runtime-po/da.po new file mode 100644 index 0000000..bf566cf --- /dev/null +++ b/runtime-po/da.po @@ -0,0 +1,63 @@ +# Danish messages for bison. +# Copyright (C) 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Keld Simonsen , 2002. +# Byrial Ole Jensen , 2002-2004. +# Joe Hansen , 2008. +# Keld Simonsen , 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime-2.3b\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-08-25 00:00+0000\n" +"Last-Translator: Keld Simonsen \n" +"Language-Team: Danish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "syntaksfejl: kan ikke lave sikkerhedskopi" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "syntaks er tvetydig" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "syntaksfejl" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "hukommelsen opbrugt" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "syntaksfejl, uventet %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "syntaksfejl, uventet %s, forventede %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "syntaksfejl, uventet %s, forventede %s eller %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "syntaksfejl, uventet %s, forventede %s eller %s eller %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "syntaksfejl, uventet %s, forventede %s eller %s eller %s eller %s" diff --git a/runtime-po/de.gmo b/runtime-po/de.gmo new file mode 100644 index 0000000..178fc68 Binary files /dev/null and b/runtime-po/de.gmo differ diff --git a/runtime-po/de.po b/runtime-po/de.po new file mode 100644 index 0000000..2b8db25 --- /dev/null +++ b/runtime-po/de.po @@ -0,0 +1,61 @@ +# German translation for messages of GNU bison (runtime module). +# Copyright (C) 2004 Free Software Foundation, Inc. +# Ulrich Drepper , 1996. +# Michael Piefel , 2002, 2003, 2004, 2005, 2006. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2006-12-12 09:38+0100\n" +"Last-Translator: Michael Piefel \n" +"Language-Team: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "Syntaxfehler: Kann nicht zurück gehen" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "Syntax ist mehrdeutig" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "Syntaxfehler" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "Speicher ausgeschöpft" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "Syntaxfehler, unerwartetes %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "Syntaxfehler, unerwartetes %s, hatte %s erwartet" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "Syntaxfehler, unerwartetes %s, hatte %s oder %s erwartet" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "Syntaxfehler, unerwartetes %s, hatte %s oder %s oder %s erwartet" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" +"Syntaxfehler, unerwartetes %s, hatte %s oder %s oder %s oder %s erwartet" diff --git a/runtime-po/el.gmo b/runtime-po/el.gmo new file mode 100644 index 0000000..912b59b Binary files /dev/null and b/runtime-po/el.gmo differ diff --git a/runtime-po/el.po b/runtime-po/el.po new file mode 100644 index 0000000..950c63a --- /dev/null +++ b/runtime-po/el.po @@ -0,0 +1,60 @@ +# translation of bison-runtime.2.3b.po to Greek +# Copyright (C) 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# +# Lefteris Dimitroulakis , 2008. +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime-2.3b\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-06-21 19:17+0300\n" +"Last-Translator: Lefteris Dimitroulakis \n" +"Language-Team: Greek \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "συντακτικό σφάλμα: δεν μπορώ να κάνω πίσω" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "ασαφής σύνταξη" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "συντακτικό σφάλμα" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "η μνήμη εξαντλήθηκε" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "συντακτικό σφάλμα, αναπάντεχο %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "συντακτικό σφάλμα, αναπάντεχο %s, αναμενόμενο %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "συντακτικό σφάλμα, αναπάντεχο %s, αναμενόμενο %s ή %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "συντακτικό σφάλμα, αναπάντεχο %s, αναμενόμενο %s ή %s ή %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "συντακτικό σφάλμα, αναπάντεχο %s, αναμενόμενο %s ή %s ή %s ή %s" diff --git a/runtime-po/en@boldquot.header b/runtime-po/en@boldquot.header new file mode 100644 index 0000000..fedb6a0 --- /dev/null +++ b/runtime-po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/runtime-po/en@quot.header b/runtime-po/en@quot.header new file mode 100644 index 0000000..a9647fc --- /dev/null +++ b/runtime-po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/runtime-po/es.gmo b/runtime-po/es.gmo new file mode 100644 index 0000000..5723878 Binary files /dev/null and b/runtime-po/es.gmo differ diff --git a/runtime-po/es.po b/runtime-po/es.po new file mode 100644 index 0000000..ee36559 --- /dev/null +++ b/runtime-po/es.po @@ -0,0 +1,83 @@ +# Mensajes en español para GNU Bison. +# Copyright (C) 1998 Free Software Foundation, Inc. +# Nicolás García-Pedrajas , 1998. +# +# Corregido por: +# +# cll - Carlos Linares López clinares@acm.org +# clinares@delicias.dia.fi.upm.es +# +# Notas: +# +# 1. Nicolás, en algunas ocasiones notarás que algunos `msgstr' no están +# indentados como los `msgid'. No te preocupes, eso es porque yo utilizo +# el `po-mode' de Emacs, ... Él es el responsable de esas indentaciones +# del `msgstr' :) +# +# 2. Todos los comentarios que contengan "Duda:" debieran revisarse. +# +# -------------------------------------------------------------------- +# En mi opinión has hecho un excelente trabajo y te animo a que sigas +# manteniendo esta traducción y a que lo intentes con otras. +# +# (¡te lo dice el tío que ha traducido el paquete más grande: 1406 +# mensajes en el clisp!) +# +# Carlos Linares +# -------------------------------------------------------------------- +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bison 1.875\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2003-01-02 12:47+0100\n" +"Last-Translator: Nicolás García-Pedrajas \n" +"Language-Team: Spanish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "memoria agotada" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" diff --git a/runtime-po/et.gmo b/runtime-po/et.gmo new file mode 100644 index 0000000..cb35876 Binary files /dev/null and b/runtime-po/et.gmo differ diff --git a/runtime-po/et.po b/runtime-po/et.po new file mode 100644 index 0000000..705e103 --- /dev/null +++ b/runtime-po/et.po @@ -0,0 +1,59 @@ +# Estonian translations for bison. +# Copyright (C) 2001 Free Software Foundation, Inc. +# Toomas Soome , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.0b\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-08-02 08:28+0300\n" +"Last-Translator: Toomas Soome \n" +"Language-Team: Estonian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "süntaksi viga: ei saa toetada" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "süntaks on segane" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "süntaksi viga" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "mälu on otsas" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "süntaksi viga, ootamatu %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "süntaksi viga, ootamatu %s, ootasin %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "süntaksi viga, ootamatu %s, ootasin %s või %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "süntaksi viga, ootamatu %s, ootasin %s või %s või %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "süntaksi viga, ootamatu %s, ootasin %s või %s või %s või %s" diff --git a/runtime-po/fi.gmo b/runtime-po/fi.gmo new file mode 100644 index 0000000..c5ea804 Binary files /dev/null and b/runtime-po/fi.gmo differ diff --git a/runtime-po/fi.po b/runtime-po/fi.po new file mode 100644 index 0000000..8a1ef0a --- /dev/null +++ b/runtime-po/fi.po @@ -0,0 +1,60 @@ +# translation of @grep@.po to @Finnish@ +# Copyright © 2007 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# +# Jorma Karvonen , 2007. +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2007-11-16 19:37+0200\n" +"Last-Translator: Jorma Karvonen \n" +"Language-Team: Finnish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.2\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "syntaksivirhe: ei voida tehdä varmuuskopiota" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "syntaksi on moniselitteinen" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "syntaksivirhe" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "muisti loppui" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "syntaksivirhe, odottamaton %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "syntaksivirhe, odottamaton %s, odotetaan %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "syntaksivirhe, odottamaton %s, odotetaan %s tai %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "syntaksivirhe, odottamaton %s, odotetaan %s tai %s tai %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "syntaksivirhe, odottamaton %s, odotetaan %s tai %s tai %s tai %s" diff --git a/runtime-po/fr.gmo b/runtime-po/fr.gmo new file mode 100644 index 0000000..11c009e Binary files /dev/null and b/runtime-po/fr.gmo differ diff --git a/runtime-po/fr.po b/runtime-po/fr.po new file mode 100644 index 0000000..6e9e317 --- /dev/null +++ b/runtime-po/fr.po @@ -0,0 +1,60 @@ +# Messages français pour Bison. +# Copyright © 2004 Free Software Foundation, Inc. +# Michel Robitaille , traducteur depuis/since 1996 +# Dominique Boucher a été le traducteur de 1996 à 2000 +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-09-21 08:00-0500\n" +"Last-Translator: Michel Robitaille \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "erreur de syntaxe: ne peut reculer" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "syntaxe ambiguë" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "erreur de syntaxe" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "mémoire épuisée" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "erreur de syntaxe, %s inattendu" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "erreur de syntaxe, %s inattendu, attendait %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "erreur de syntaxe, %s inattendu, attendait %s ou %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "erreur de syntaxe, %s inattendu, attendait %s ou %s ou %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "erreur de syntaxe, %s inattendu, attendait %s ou %s ou %s ou %s" diff --git a/runtime-po/ga.gmo b/runtime-po/ga.gmo new file mode 100644 index 0000000..6b4fec2 Binary files /dev/null and b/runtime-po/ga.gmo differ diff --git a/runtime-po/ga.po b/runtime-po/ga.po new file mode 100644 index 0000000..45c29d8 --- /dev/null +++ b/runtime-po/ga.po @@ -0,0 +1,60 @@ +# Irish translations for bison. +# Copyright (C) 2004 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Kevin Patrick Scannell , 2004, 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-09-18 23:14-0500\n" +"Last-Translator: Kevin Patrick Scannell \n" +"Language-Team: Irish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "earráid chomhréire: ní féidir cúlú" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "comhréir dhébhríoch" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "earráid chomhréire" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "cuimhne ídithe" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "earráid chomhréire, %s gan choinne" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "earráid chomhréire, %s gan choinne, bhíothas ag súil le %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "earráid chomhréire, %s gan choinne, bhíothas ag súil le %s nó %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "earráid chomhréire, %s gan choinne, bhíothas ag súil le %s nó %s nó %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" +"earráid chomhréire, %s gan choinne, bhíothas ag súil le %s nó %s nó %s nó %s" diff --git a/runtime-po/hr.gmo b/runtime-po/hr.gmo new file mode 100644 index 0000000..bf3cf01 Binary files /dev/null and b/runtime-po/hr.gmo differ diff --git a/runtime-po/hr.po b/runtime-po/hr.po new file mode 100644 index 0000000..636789d --- /dev/null +++ b/runtime-po/hr.po @@ -0,0 +1,61 @@ +# Translation of bision to Croatian +# Copyright (C) 2002 Free Software Foundation, Inc. +# Denis Lackovic , 2002. +# This file is distributed under the same license as the bison package. +# Denis Lackovic , 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 1.34a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2002-04-10 22:20+01\n" +"Last-Translator: Denis Lackovic \n" +"Language-Team: Croatian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n==1 ? 0 : 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "iscrpljeni memorijski resursi" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" diff --git a/runtime-po/id.gmo b/runtime-po/id.gmo new file mode 100644 index 0000000..649f2d9 Binary files /dev/null and b/runtime-po/id.gmo differ diff --git a/runtime-po/id.po b/runtime-po/id.po new file mode 100644 index 0000000..3f440d2 --- /dev/null +++ b/runtime-po/id.po @@ -0,0 +1,65 @@ +# translation of bison-runtime-2.0b.id.po to Indonesia +# bison-runtime-2.0b (Indonesian) +# Copyright (C) 2002, 2005 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison 1.50 package. +# Tedi Heriyanto , 2002, 2003, 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.0b.id\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-09-14 20:39+0700\n" +"Last-Translator: Tedi Heriyanto \n" +"Language-Team: Indonesian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: KBabel 1.10\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "kesalahan sintaks: tidak dapat membackup" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "sintaks rancu" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "kesalahan sintaks" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "memori habis" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "kesalahan sintaks, %s tidak diharapkan" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "kesalahan sintaks, %s tidak diharapkan, mengharapkan %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "kesalahan sintaks, %s tidak diharapkan, mengharapkan %s atau %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "" +"kesalahan sintaks, %s tidak diharapkan, mengharapkan %s atau %s atau %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" +"kesalahan sintaks, %s tidak diharapkan, mengharapkan %s atau %s atau %s atau " +"%s" diff --git a/runtime-po/insert-header.sin b/runtime-po/insert-header.sin new file mode 100644 index 0000000..b26de01 --- /dev/null +++ b/runtime-po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/runtime-po/it.gmo b/runtime-po/it.gmo new file mode 100644 index 0000000..463e291 Binary files /dev/null and b/runtime-po/it.gmo differ diff --git a/runtime-po/it.po b/runtime-po/it.po new file mode 100644 index 0000000..b64dd8a --- /dev/null +++ b/runtime-po/it.po @@ -0,0 +1,59 @@ +# Italian translation for message of GNU bison. +# Copyright (C) 2002 Free Software Foundation, Inc. +# Paolo Bonzini , 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 2.0\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-05-23 12:37+0100\n" +"Last-Translator: Paolo Bonzini \n" +"Language-Team: Italian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "errore di sintassi: impossibile tornare indietro" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "errore di sintassi" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "memoria esaurita" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "errore di sintassi, %s non atteso" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "errore di sintassi, atteso %2$s e non %1$s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "errore di sintassi, atteso %2$s o %3$s e non %1$s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "errore di sintassi, atteso %2$s o %3$s o %4$s e non %1$s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "errore di sintassi, atteso %2$s o %3$s o %4$s o %5$s e non %1$s" diff --git a/runtime-po/ja.gmo b/runtime-po/ja.gmo new file mode 100644 index 0000000..d11de40 Binary files /dev/null and b/runtime-po/ja.gmo differ diff --git a/runtime-po/ja.po b/runtime-po/ja.po new file mode 100644 index 0000000..7a2bc0b --- /dev/null +++ b/runtime-po/ja.po @@ -0,0 +1,59 @@ +# Japanese message for GNU bison 1.30f +# Copyright (C) 2001 Free Software Foundation, Inc. +# Daisuke Yamashita , 2001. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bison 1.30f\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2002-10-29 01:00-05:00\n" +"Last-Translator: Daisuke Yamashita \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=EUC-JP\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "¥á¥â¥ê¤ò»È¤¤²Ì¤¿¤·¤Þ¤·¤¿" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" diff --git a/runtime-po/ky.gmo b/runtime-po/ky.gmo new file mode 100644 index 0000000..4185d05 Binary files /dev/null and b/runtime-po/ky.gmo differ diff --git a/runtime-po/ky.po b/runtime-po/ky.po new file mode 100644 index 0000000..8878ad4 --- /dev/null +++ b/runtime-po/ky.po @@ -0,0 +1,61 @@ +# Translation of 'bison-runtime' messages to Kirghiz. +# Copyright (C) 1999 Free Software Foundation, Inc. +# This file is distributed under the same license as the PACKAGE package. +# Ilyas Bakirov , 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-01-29 11:47+0600\n" +"Last-Translator: Ilyas Bakirov \n" +"Language-Team: Kirghiz \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Kyrgyz\n" +"X-Poedit-Country: KYRGYZSTAN\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "синтаксис катасы: көчурмө алынган жок" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "синтаксис анык эмес" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "синтаксис катасы" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "эс колдонулуп бүттүү" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "синтаксис катасы, күтүлбөгөн %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "синтаксис катасы, күтүлбөгөн %s, %s күтүлүүдө" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "синтаксис катасы, күтүлбөгөн %s, %s же %s күтүлүүдө" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "синтаксис катасы, күтүлбөгөн %s, %s же %s же %s күтүлүүдө" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "синтаксис катасы, күтүлбөгөн %s, %s же %s же %s же %s күтүлүүдө" diff --git a/runtime-po/lt.gmo b/runtime-po/lt.gmo new file mode 100644 index 0000000..16ac4d1 Binary files /dev/null and b/runtime-po/lt.gmo differ diff --git a/runtime-po/lt.po b/runtime-po/lt.po new file mode 100644 index 0000000..eeaade2 --- /dev/null +++ b/runtime-po/lt.po @@ -0,0 +1,62 @@ +# translation of bison-runtime-2.3a to Lithuanian +# Copyright (C) 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# +# Gintautas Miliauskas , 2008. +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime-2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-05-14 02:10+0300\n" +"Last-Translator: Gintautas Miliauskas \n" +"Language-Team: Lithuanian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%" +"100<10 || n%100>=20) ? 1 : 2);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "sintaksės klaida: negalima grįžti" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "sintaksė dviprasmė" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "sintaksės klaida" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "baigėsi atmintis" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "sintaksės klaida, netikėtas %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "sintaksės klaida, netikėtas %s, tikėtasi %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "sintaksės klaida, netikėtas %s, tikėtasi %s arba %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "sintaksės klaida, netikėtas %s, tikėtasi %s arba %s arba %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "sintaksės klaida, netikėtas %s, tikėtasi %s arba %s arba %s arba %s" diff --git a/runtime-po/ms.gmo b/runtime-po/ms.gmo new file mode 100644 index 0000000..87905ba Binary files /dev/null and b/runtime-po/ms.gmo differ diff --git a/runtime-po/ms.po b/runtime-po/ms.po new file mode 100644 index 0000000..ceef3dc --- /dev/null +++ b/runtime-po/ms.po @@ -0,0 +1,62 @@ +# Bison-runtime Bahasa Melayu (Malay) (ms). +# Copyright (C) 2003 Free Software Foundation, Inc. +# This file is distributed under the same license as the Bison-runtime package. +# Sharuzzaman Ahmat Raslan , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-10-10 10:50+0800\n" +"Last-Translator: Sharuzzaman Ahmat Raslan \n" +"Language-Team: Malay \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: KBabel 0.9.5\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "ralat sintaks: tidak dapat mengundur" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "sintaks adalah kabur" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "ralat sintaks" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "kehabisan memori" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "ralat sintaks, tidak menjangka %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "ralat sintaks, tidak menjangka %s, menjangka %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "ralat sintaks, tidak menjangka %s, menjangka %s atau %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "ralat sintaks, tidak menjangka %s, menjangka %s atau %s atau %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" +"ralat sintaks, tidak menjangka %s, menjangka %s atau %s atau %s atau %s" diff --git a/runtime-po/nb.gmo b/runtime-po/nb.gmo new file mode 100644 index 0000000..cff7d77 Binary files /dev/null and b/runtime-po/nb.gmo differ diff --git a/runtime-po/nb.po b/runtime-po/nb.po new file mode 100644 index 0000000..ee7f47e --- /dev/null +++ b/runtime-po/nb.po @@ -0,0 +1,75 @@ +# Norwegian bokmål translation of GNU bison. +# Copyright (C) 2004 Free Software Foundation, Inc. +# This file is distributed under the same license as the PACKAGE package. +# Trond Endrestøl , 2004. +# +# Send this file as an gzipped attachment to: +# translation@iro.umontreal.ca +# with the subject: +# TP-Robot PACKAGE-VERSION.TEAM.po +# +# The subject for the Norwegian bokmål translation of GNU bison-runtime 2.1 +# would then be: +# TP-Robot bison-runtime-2.1.nb.po +# +# Here's the URL for the Norwegian bokmål translation team: +# http://www.iro.umontreal.ca/translation/registry.cgi?team=nb +# +# Here's the URL for the current translations of GNU bison-runtime: +# http://www.iro.umontreal.ca/translation/registry.cgi?domain=bison-runtime +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-09-21 09:35+0200\n" +"Last-Translator: Trond Endrestøl \n" +"Language-Team: Norwegian Bokmaal \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "syntaksfeil: kan ikke gå tilbake" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "syntaksen er flertydig" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "syntaksfeil" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "minne er uttømt" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "syntaksfeil, uforventet %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "syntaksfeil, uforventet %s, forventet %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "syntaksfeil, uforventet %s, forventet %s eller %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "syntaksfeil, uforventet %s, forventet %s eller %s eller %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "syntaksfeil, uforventet %s, forventet %s eller %s eller %s eller %s" diff --git a/runtime-po/nl.gmo b/runtime-po/nl.gmo new file mode 100644 index 0000000..7b2f24c Binary files /dev/null and b/runtime-po/nl.gmo differ diff --git a/runtime-po/nl.po b/runtime-po/nl.po new file mode 100644 index 0000000..c078153 --- /dev/null +++ b/runtime-po/nl.po @@ -0,0 +1,60 @@ +# Dutch messages for GNU bison. +# Copyright (C) 1996, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# Tim Van Holder , 2002, 2003, 2004, 2005. +# Erick Branderhorst , 1996. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-09-21 11:22+0200\n" +"Last-Translator: Tim Van Holder \n" +"Language-Team: Dutch \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "syntaxfout: kan niet terugkeren" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "syntax is niet eenduidig" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "syntaxfout" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "geen geheugen meer beschikbaar" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "syntaxfout, %s onverwacht" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "syntaxfout, %s onverwacht (%s verwacht)" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "syntaxfout, %s onverwacht (%s of %s verwacht)" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "syntaxfout, %s onverwacht (%s of %s of %s verwacht)" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "syntaxfout, %s onverwacht (%s of %s of %s of %s verwacht)" diff --git a/runtime-po/pl.gmo b/runtime-po/pl.gmo new file mode 100644 index 0000000..30822a5 Binary files /dev/null and b/runtime-po/pl.gmo differ diff --git a/runtime-po/pl.po b/runtime-po/pl.po new file mode 100644 index 0000000..b517dd0 --- /dev/null +++ b/runtime-po/pl.po @@ -0,0 +1,62 @@ +# Polish translations for GNU Bison package. +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# This file is distributed under the same license as the GNU Bison package. +# Wojciech Polak , 2004, 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-09-20 19:28+0200\n" +"Last-Translator: Wojciech Polak \n" +"Language-Team: Polish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "b³±d sk³adni: nie mo¿na cofn±æ przesuniêcia symbolu leksykalnego" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "sk³adnia jest niejednoznaczna" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "b³±d sk³adni" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "pamiêæ wyczerpana" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "b³±d sk³adni, niespodziewany symbol %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "b³±d sk³adni, niespodziewany symbol %s, oczekiwano %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "b³±d sk³adni, niespodziewany symbol %s, oczekiwano %s lub %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "b³±d sk³adni, niespodziewany %s, oczekiwano %s lub %s lub %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" +"b³±d sk³adni, niespodziewany symbol %s, oczekiwano %s lub %s lub %s lub %s" diff --git a/runtime-po/pt_BR.gmo b/runtime-po/pt_BR.gmo new file mode 100644 index 0000000..1e72485 Binary files /dev/null and b/runtime-po/pt_BR.gmo differ diff --git a/runtime-po/pt_BR.po b/runtime-po/pt_BR.po new file mode 100644 index 0000000..f417416 --- /dev/null +++ b/runtime-po/pt_BR.po @@ -0,0 +1,59 @@ +# Brazilian Portuguese Translation (pt_BR). +# Copyright © 2007 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison-runtime package. +# Leslie Harlley Watter , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2007-05-03 22:39-0300\n" +"Last-Translator: Leslie Harlley Watter \n" +"Language-Team: Brazilian Portuguese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "erro de sintaxe: não é possível voltar" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "a sintaxe é ambígua" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "erro de sintaxe" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "falta de memória" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "erro de sintaxe, %s não esperado" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "erro de sintaxe, %s não esperado, esperando %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "erro de sintaxe, %s não esperado, esperando %s ou %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "erro de sintaxe, %s não esperado, esperando %s ou %s ou %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "erro de sintaxe, %s não esperado, esperando %s ou %s ou %s ou %s" diff --git a/runtime-po/quot.sed b/runtime-po/quot.sed new file mode 100644 index 0000000..0122c46 --- /dev/null +++ b/runtime-po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g diff --git a/runtime-po/remove-potcdate.sin b/runtime-po/remove-potcdate.sin new file mode 100644 index 0000000..2436c49 --- /dev/null +++ b/runtime-po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/runtime-po/ro.gmo b/runtime-po/ro.gmo new file mode 100644 index 0000000..aaff454 Binary files /dev/null and b/runtime-po/ro.gmo differ diff --git a/runtime-po/ro.po b/runtime-po/ro.po new file mode 100644 index 0000000..a3aebbe --- /dev/null +++ b/runtime-po/ro.po @@ -0,0 +1,63 @@ +# Mesajele în limba românã pentru GNU Bison. +# Copyright (C) 2004 Free Software Foundation, Inc. +# Acest fiºier este distribuit sub aceeaºi licenþã ca ºi pachetul bison. +# Laurentiu Buzdugan , 2003,2004,2005. +# +# +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-09-20 12:00-0500\n" +"Last-Translator: Laurentiu Buzdugan \n" +"Language-Team: Romanian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : (n==0 || ((n%100) > 0 && (n%" +"100) < 20)) ? 1 : 2);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "eroare de sintaxã: nu pot da înapoi" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "sintaxa este ambiguã" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "eroare de sintaxã" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "memorie epuizatã" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "eroare de sintaxã, %s neaºteptat" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "eroare de sintaxã, %s neaºteptat, aºtept %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "eroare de sintaxã, %s neaºteptat, aºtept %s sau %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "eroare de sintaxã, %s neaºteptat, aºtept %s sau %s sau %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "eroare de sintaxã, %s neaºteptat, aºtept %s sau %s sau %s sau %s" diff --git a/runtime-po/ru.gmo b/runtime-po/ru.gmo new file mode 100644 index 0000000..189d7dd Binary files /dev/null and b/runtime-po/ru.gmo differ diff --git a/runtime-po/ru.po b/runtime-po/ru.po new file mode 100644 index 0000000..1188424 --- /dev/null +++ b/runtime-po/ru.po @@ -0,0 +1,60 @@ +# ðÅÒÅ×ÏÄ ÓÏÏÂÝÅÎÉÊ bison. +# Copyright (C) 1999 Free Software Foundation, Inc. +# Dmitry S. Sivachenko , 1999,2000,2001,2002. +# +msgid "" +msgstr "" +"Project-Id-Version: bison 1.875\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2003-01-01 20:35+0300\n" +"Last-Translator: Dmitry S. Sivachenko \n" +"Language-Team: Russian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=koi8-r\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "ÐÁÍÑÔØ ÉÓÞÅÒÐÁÎÁ" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" diff --git a/runtime-po/sl.gmo b/runtime-po/sl.gmo new file mode 100644 index 0000000..fd1b5d2 Binary files /dev/null and b/runtime-po/sl.gmo differ diff --git a/runtime-po/sl.po b/runtime-po/sl.po new file mode 100644 index 0000000..a761c1f --- /dev/null +++ b/runtime-po/sl.po @@ -0,0 +1,63 @@ +# -*- mode:po; coding:utf-8; -*- Slovenian message catalogue for bison-runtime-2.1. +# Copyright (C) 2005 Free Software Foundation, Inc. +# Matej Urbančič , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-10-06 14:58+0200\n" +"Last-Translator: Primož Peterlin \n" +"Language-Team: Slovenian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n" +"%100==4 ? 3 : 0);\n" +"X-Poedit-Language: Slovenian\n" +"X-Poedit-Country: SLOVENIA\n" +"X-Poedit-SourceCharset: utf-8\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "napačna skladnja: ni mogoče povrniti" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "dvoumna skladnja" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "skladenjska napaka" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "zmanjkalo pomnilnika" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "skladenjska napaka, nepričakovan %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "skladenjska napaka, nepričakovan %s, pričakuje se %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "skladenjska napaka, nepričakovan %s, pričakuje se %s ali %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "skladenjska napaka, nepričakovan %s, pričakuje se %s , %s ali %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "skladenjska napaka, nepričakovan %s, pričakuje se %s , %s , %s ali %s" diff --git a/runtime-po/stamp-po b/runtime-po/stamp-po new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/runtime-po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/runtime-po/sv.gmo b/runtime-po/sv.gmo new file mode 100644 index 0000000..51d4b15 Binary files /dev/null and b/runtime-po/sv.gmo differ diff --git a/runtime-po/sv.po b/runtime-po/sv.po new file mode 100644 index 0000000..d3739df --- /dev/null +++ b/runtime-po/sv.po @@ -0,0 +1,62 @@ +# Swedish messages for bison. +# Copyright © 2001-2006, 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Göran Uddeborg , 2001-2006, 2008. +# +# $Revision: 1.22 $ +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.4\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-11-11 14:39+0100\n" +"Last-Translator: Göran Uddeborg \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "syntaxfel: kan inte backa" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "tvetydig syntax" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "syntaxfel" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "minnet slut" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "syntaxfel, oväntad %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "syntaxfel, oväntad %s, förväntade %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "syntaxfel, oväntad %s, förväntade %s eller %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "syntaxfel, oväntad %s, förväntade %s eller %s eller %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "syntaxfel, oväntad %s, förväntade %s eller %s eller %s eller %s" diff --git a/runtime-po/th.gmo b/runtime-po/th.gmo new file mode 100644 index 0000000..537a09b Binary files /dev/null and b/runtime-po/th.gmo differ diff --git a/runtime-po/th.po b/runtime-po/th.po new file mode 100644 index 0000000..eb23574 --- /dev/null +++ b/runtime-po/th.po @@ -0,0 +1,61 @@ +# Translation bison-runtime to Thai. +# Copyright (C) 2007 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Seksan Poltree , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2007-12-13 01:56+0700\n" +"Last-Translator: Seksan Poltree \n" +"Language-Team: Thai \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Thai\n" +"X-Poedit-Country: THAILAND\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "ผิดวากยสัมพันธ์: ไม่สามารถสำรองข้อมูล" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "วากยสัมพันธ์คลุมเครือไม่ชัดเจน" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "ผิดวากยสัมพันธ์" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "หน่วยความจำถูกใช้จนหมดสิ้น" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "ผิดวากยสัมพันธ์, ไม่คาดคิดกับ %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "ผิดวากยสัมพันธ์, ไม่คาดคิดกับ %s, คาดหวัง %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "ผิดวากยสัมพันธ์, ไม่คาดคิดกับ %s, คาดหวัง %s หรือ %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "ผิดวากยสัมพันธ์, ไม่คาดคิดกับ %s, คาดหวัง %s หรือ %s หรือ %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "ผิดวากยสัมพันธ์, ไม่คาดคิดกับ %s, คาดหวัง %s หรือ %s หรือ %s หรือ %s" diff --git a/runtime-po/tr.gmo b/runtime-po/tr.gmo new file mode 100644 index 0000000..e338912 Binary files /dev/null and b/runtime-po/tr.gmo differ diff --git a/runtime-po/tr.po b/runtime-po/tr.po new file mode 100644 index 0000000..da81461 --- /dev/null +++ b/runtime-po/tr.po @@ -0,0 +1,60 @@ +# Turkish translations for GNU Bison messages. +# Copyright (C) 2001 Free Software Foundation, Inc. +# Altuð Bayram , 2001. +# Çaðrý Çöltekin , 2003 - 2005 +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bison 2.0\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-03-20 22:03+0100\n" +"Last-Translator: Çaðrý Çöltekin \n" +"Language-Team: Turkish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-9\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "bellek tükendi" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" diff --git a/runtime-po/uk.gmo b/runtime-po/uk.gmo new file mode 100644 index 0000000..a0323a5 Binary files /dev/null and b/runtime-po/uk.gmo differ diff --git a/runtime-po/uk.po b/runtime-po/uk.po new file mode 100644 index 0000000..6e8e5d1 --- /dev/null +++ b/runtime-po/uk.po @@ -0,0 +1,61 @@ +# Ukrainian translation of bison-runtime. +# Copyright (C) 2007 Free Software Foundation, Inc. +# Maxim V. Dziumanenko , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2007-07-13 20:35+0300\n" +"Last-Translator: Maxim V. Dziumanenko \n" +"Language-Team: Ukrainian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "синтаксична помилка: не вдається зробити резервну копію" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "синтаксис неоднозначний" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "синтаксична помилка" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "пам'ять вичерпано'" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "синтаксична помилка, неочікуваний %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "синтаксична помилка, неочікуваний %s, очікувалось %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "синтаксична помилка, неочікуваний %s, очікувалось %s або %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "синтаксична помилка, неочікуваний %s, очікувалось %s, або %s, або %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "" +"синтаксична помилка, неочікуваний %s, очікувалось %s, або %s, або %s, або %s" diff --git a/runtime-po/vi.gmo b/runtime-po/vi.gmo new file mode 100644 index 0000000..7e650d7 Binary files /dev/null and b/runtime-po/vi.gmo differ diff --git a/runtime-po/vi.po b/runtime-po/vi.po new file mode 100644 index 0000000..25f888d --- /dev/null +++ b/runtime-po/vi.po @@ -0,0 +1,61 @@ +# Vietnamese Translation for Bison-runtime. +# Copyright © 2008 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# Clytie Siddall , 2005-2008. +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.3b\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2008-05-29 22:19+0930\n" +"Last-Translator: Clytie Siddall \n" +"Language-Team: Vietnamese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: LocFactoryEditor 1.7b3\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "lỗi cú pháp: không thể sao lÆ°u" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "cú pháp là mÆ¡ hồ" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "lỗi cú pháp" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "cạn bộ nhớ" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "lỗi cú pháp, gặp %s bất thường" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "lỗi cú pháp, gặp %s bất thường, còn mong đợi %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "lỗi cú pháp, gặp %s bất thường, còn mong đợi đợi %s hay %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "lỗi cú pháp, gặp %s bất thường, còn mong đợi %s hay %s hay %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "lỗi cú pháp, gặp %s bất thường, còn mong đợi %s hay %s hay %s hay %s " diff --git a/runtime-po/zh_CN.gmo b/runtime-po/zh_CN.gmo new file mode 100644 index 0000000..b099838 Binary files /dev/null and b/runtime-po/zh_CN.gmo differ diff --git a/runtime-po/zh_CN.po b/runtime-po/zh_CN.po new file mode 100644 index 0000000..0c7969c --- /dev/null +++ b/runtime-po/zh_CN.po @@ -0,0 +1,60 @@ +# Simplified Chinese translation for bison-runtime. +# Copyright (C) 2005 Free Software Foundation, Inc. +# This file is distributed under the same license as the bison package. +# +# Meng Jie , 2005, 2007. +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.3a\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2007-08-13 23:19+0800\n" +"Last-Translator: Meng Jie \n" +"Language-Team: Chinese (simplified) \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "语法错误:不能备份" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "语法有歧义" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "语法错误" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "内存耗尽" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "语法错误,非预期的 %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "语法错误,非预期的 %s,需要 %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "语法错误,非预期的 %s,需要 %s 或 %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "语法错误,非预期的 %s,需要 %s,%s 或 %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "语法错误,非预期的 %s,需要 %s,%s,%s 或 %s" diff --git a/runtime-po/zh_TW.gmo b/runtime-po/zh_TW.gmo new file mode 100644 index 0000000..243f5aa Binary files /dev/null and b/runtime-po/zh_TW.gmo differ diff --git a/runtime-po/zh_TW.po b/runtime-po/zh_TW.po new file mode 100644 index 0000000..91507ae --- /dev/null +++ b/runtime-po/zh_TW.po @@ -0,0 +1,59 @@ +# Traditional Chinese Messages for bison-runtime +# Copyright (C) 2005 Free Software Foundation, Inc. +# Wei-Lun Chao , 2005 +# +msgid "" +msgstr "" +"Project-Id-Version: bison-runtime 2.1\n" +"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" +"POT-Creation-Date: 2008-12-11 17:06-0500\n" +"PO-Revision-Date: 2005-09-27 10:31+0800\n" +"Last-Translator: Wei-Lun Chao \n" +"Language-Team: Chinese (traditional) \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: data/glr.c:923 data/yacc.c:630 +msgid "syntax error: cannot back up" +msgstr "語法錯誤:無法備份" + +#: data/glr.c:1806 +msgid "syntax is ambiguous" +msgstr "語法不明確" + +#: data/glr.c:2181 data/glr.c:2187 data/glr.c:2455 data/lalr1.cc:878 +#: data/yacc.c:1491 data/yacc.c:1519 +msgid "syntax error" +msgstr "語法錯誤" + +#: data/glr.c:2515 data/yacc.c:1106 data/yacc.c:1108 data/yacc.c:1284 +#: data/yacc.c:1640 +msgid "memory exhausted" +msgstr "記憶體耗盡" + +#: data/yacc.c:918 +#, c-format +msgid "syntax error, unexpected %s" +msgstr "語法錯誤,預期之外的 %s" + +#: data/yacc.c:919 +#, c-format +msgid "syntax error, unexpected %s, expecting %s" +msgstr "語法錯誤,預期之外的 %s,預期為 %s" + +#: data/yacc.c:920 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s" +msgstr "語法錯誤,預期之外的 %s,預期為 %s 或 %s" + +#: data/yacc.c:921 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s" +msgstr "語法錯誤,預期之外的 %s,預期為 %s、%s 或 %s" + +#: data/yacc.c:922 +#, c-format +msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s" +msgstr "語法錯誤,預期之外的 %s,預期為 %s、%s、%s 或 %s" diff --git a/src/LR0.c b/src/LR0.c new file mode 100644 index 0000000..efda69f --- /dev/null +++ b/src/LR0.c @@ -0,0 +1,377 @@ +/* Generate the nondeterministic finite state machine for Bison. + + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + + +/* See comments in state.h for the data structures that represent it. + The entry point is generate_states. */ + +#include +#include "system.h" + +#include +#include + +#include "LR0.h" +#include "closure.h" +#include "complain.h" +#include "getargs.h" +#include "gram.h" +#include "gram.h" +#include "lalr.h" +#include "reader.h" +#include "reduce.h" +#include "state.h" +#include "symtab.h" + +typedef struct state_list +{ + struct state_list *next; + state *state; +} state_list; + +static state_list *first_state = NULL; +static state_list *last_state = NULL; + + +/*------------------------------------------------------------------. +| A state was just discovered from another state. Queue it for | +| later examination, in order to find its transitions. Return it. | +`------------------------------------------------------------------*/ + +static state * +state_list_append (symbol_number sym, size_t core_size, item_number *core) +{ + state_list *node = xmalloc (sizeof *node); + state *s = state_new (sym, core_size, core); + + if (trace_flag & trace_automaton) + fprintf (stderr, "state_list_append (state = %d, symbol = %d (%s))\n", + nstates, sym, symbols[sym]->tag); + + node->next = NULL; + node->state = s; + + if (!first_state) + first_state = node; + if (last_state) + last_state->next = node; + last_state = node; + + return s; +} + +static int nshifts; +static symbol_number *shift_symbol; + +static rule **redset; +static state **shiftset; + +static item_number **kernel_base; +static int *kernel_size; +static item_number *kernel_items; + + +static void +allocate_itemsets (void) +{ + symbol_number i; + rule_number r; + item_number *rhsp; + + /* Count the number of occurrences of all the symbols in RITEMS. + Note that useless productions (hence useless nonterminals) are + browsed too, hence we need to allocate room for _all_ the + symbols. */ + size_t count = 0; + size_t *symbol_count = xcalloc (nsyms + nuseless_nonterminals, + sizeof *symbol_count); + + for (r = 0; r < nrules; ++r) + for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp) + { + count++; + symbol_count[*rhsp]++; + } + + /* See comments before new_itemsets. All the vectors of items + live inside KERNEL_ITEMS. The number of active items after + some symbol S cannot be more than the number of times that S + appears as an item, which is SYMBOL_COUNT[S]. + We allocate that much space for each symbol. */ + + kernel_base = xnmalloc (nsyms, sizeof *kernel_base); + kernel_items = xnmalloc (count, sizeof *kernel_items); + + count = 0; + for (i = 0; i < nsyms; i++) + { + kernel_base[i] = kernel_items + count; + count += symbol_count[i]; + } + + free (symbol_count); + kernel_size = xnmalloc (nsyms, sizeof *kernel_size); +} + + +static void +allocate_storage (void) +{ + allocate_itemsets (); + + shiftset = xnmalloc (nsyms, sizeof *shiftset); + redset = xnmalloc (nrules, sizeof *redset); + state_hash_new (); + shift_symbol = xnmalloc (nsyms, sizeof *shift_symbol); +} + + +static void +free_storage (void) +{ + free (shift_symbol); + free (redset); + free (shiftset); + free (kernel_base); + free (kernel_size); + free (kernel_items); + state_hash_free (); +} + + + + +/*---------------------------------------------------------------. +| Find which symbols can be shifted in S, and for each one | +| record which items would be active after that shift. Uses the | +| contents of itemset. | +| | +| shift_symbol is set to a vector of the symbols that can be | +| shifted. For each symbol in the grammar, kernel_base[symbol] | +| points to a vector of item numbers activated if that symbol is | +| shifted, and kernel_size[symbol] is their numbers. | +| | +| itemset is sorted on item index in ritem, which is sorted on | +| rule number. Compute each kernel_base[symbol] with the same | +| sort. | +`---------------------------------------------------------------*/ + +static void +new_itemsets (state *s) +{ + size_t i; + + if (trace_flag & trace_automaton) + fprintf (stderr, "Entering new_itemsets, state = %d\n", s->number); + + memset (kernel_size, 0, nsyms * sizeof *kernel_size); + + nshifts = 0; + + for (i = 0; i < nitemset; ++i) + if (item_number_is_symbol_number (ritem[itemset[i]])) + { + symbol_number sym = item_number_as_symbol_number (ritem[itemset[i]]); + if (!kernel_size[sym]) + { + shift_symbol[nshifts] = sym; + nshifts++; + } + + kernel_base[sym][kernel_size[sym]] = itemset[i] + 1; + kernel_size[sym]++; + } +} + + + +/*--------------------------------------------------------------. +| Find the state we would get to (from the current state) by | +| shifting SYM. Create a new state if no equivalent one exists | +| already. Used by append_states. | +`--------------------------------------------------------------*/ + +static state * +get_state (symbol_number sym, size_t core_size, item_number *core) +{ + state *s; + + if (trace_flag & trace_automaton) + fprintf (stderr, "Entering get_state, symbol = %d (%s)\n", + sym, symbols[sym]->tag); + + s = state_hash_lookup (core_size, core); + if (!s) + s = state_list_append (sym, core_size, core); + + if (trace_flag & trace_automaton) + fprintf (stderr, "Exiting get_state => %d\n", s->number); + + return s; +} + +/*---------------------------------------------------------------. +| Use the information computed by new_itemsets to find the state | +| numbers reached by each shift transition from S. | +| | +| SHIFTSET is set up as a vector of those states. | +`---------------------------------------------------------------*/ + +static void +append_states (state *s) +{ + int i; + + if (trace_flag & trace_automaton) + fprintf (stderr, "Entering append_states, state = %d\n", s->number); + + /* First sort shift_symbol into increasing order. */ + + for (i = 1; i < nshifts; i++) + { + symbol_number sym = shift_symbol[i]; + int j; + for (j = i; 0 < j && sym < shift_symbol[j - 1]; j--) + shift_symbol[j] = shift_symbol[j - 1]; + shift_symbol[j] = sym; + } + + for (i = 0; i < nshifts; i++) + { + symbol_number sym = shift_symbol[i]; + shiftset[i] = get_state (sym, kernel_size[sym], kernel_base[sym]); + } +} + + +/*----------------------------------------------------------------. +| Find which rules can be used for reduction transitions from the | +| current state and make a reductions structure for the state to | +| record their rule numbers. | +`----------------------------------------------------------------*/ + +static void +save_reductions (state *s) +{ + int count = 0; + size_t i; + + /* Find and count the active items that represent ends of rules. */ + for (i = 0; i < nitemset; ++i) + { + item_number item = ritem[itemset[i]]; + if (item_number_is_rule_number (item)) + { + rule_number r = item_number_as_rule_number (item); + redset[count++] = &rules[r]; + if (r == 0) + { + /* This is "reduce 0", i.e., accept. */ + aver (!final_state); + final_state = s; + } + } + } + + /* Make a reductions structure and copy the data into it. */ + state_reductions_set (s, count, redset); +} + + +/*---------------. +| Build STATES. | +`---------------*/ + +static void +set_states (void) +{ + states = xcalloc (nstates, sizeof *states); + + while (first_state) + { + state_list *this = first_state; + + /* Pessimization, but simplification of the code: make sure all + the states have valid transitions and reductions members, + even if reduced to 0. It is too soon for errs, which are + computed later, but set_conflicts. */ + state *s = this->state; + if (!s->transitions) + state_transitions_set (s, 0, 0); + if (!s->reductions) + state_reductions_set (s, 0, 0); + + states[s->number] = s; + + first_state = this->next; + free (this); + } + first_state = NULL; + last_state = NULL; +} + + +/*-------------------------------------------------------------------. +| Compute the nondeterministic finite state machine (see state.h for | +| details) from the grammar. | +`-------------------------------------------------------------------*/ + +void +generate_states (void) +{ + item_number initial_core = 0; + state_list *list = NULL; + allocate_storage (); + new_closure (nritems); + + /* Create the initial state. The 0 at the lhs is the index of the + item of this initial rule. */ + state_list_append (0, 1, &initial_core); + + /* States are queued when they are created; process them all. */ + for (list = first_state; list; list = list->next) + { + state *s = list->state; + if (trace_flag & trace_automaton) + fprintf (stderr, "Processing state %d (reached by %s)\n", + s->number, + symbols[s->accessing_symbol]->tag); + /* Set up itemset for the transitions out of this state. itemset gets a + vector of all the items that could be accepted next. */ + closure (s->items, s->nitems); + /* Record the reductions allowed out of this state. */ + save_reductions (s); + /* Find the itemsets of the states that shifts can reach. */ + new_itemsets (s); + /* Find or create the core structures for those states. */ + append_states (s); + + /* Create the shifts structures for the shifts to those states, + now that the state numbers transitioning to are known. */ + state_transitions_set (s, nshifts, shiftset); + } + + /* discard various storage */ + free_closure (); + free_storage (); + + /* Set up STATES. */ + set_states (); +} diff --git a/src/LR0.h b/src/LR0.h new file mode 100644 index 0000000..7865e48 --- /dev/null +++ b/src/LR0.h @@ -0,0 +1,26 @@ +/* Generate the nondeterministic finite state machine for bison, + Copyright 1984, 1986, 1989, 2000, 2001, 2002 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef LR0_H_ +# define LR0_H_ + +# include "state.h" + +void generate_states (void); + +#endif /* !LR0_H_ */ diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..afe6d08 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,115 @@ +# Make bison/src. + +# 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 +# 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 . + +AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/lib +AM_YFLAGS = "-dv" + +LDADD = ../lib/libbison.a $(LIBINTL) + +# Use our own Bison to build the parser. Of course, you ought to +# keep a sane version of Bison nearby... +YACC = ../tests/bison -y --warnings=all,error + +bin_PROGRAMS = bison +bin_SCRIPTS = $(YACC_SCRIPT) +EXTRA_SCRIPTS = yacc + +bison_SOURCES = \ + LR0.c LR0.h \ + assoc.c assoc.h \ + closure.c closure.h \ + complain.c complain.h \ + conflicts.c conflicts.h \ + derives.c derives.h \ + files.c files.h \ + flex-scanner.h \ + getargs.c getargs.h \ + gram.c gram.h \ + lalr.h lalr.c \ + location.c location.h \ + main.c \ + muscle_tab.c muscle_tab.h \ + nullable.c nullable.h \ + output.c output.h \ + parse-gram.h parse-gram.y \ + print.c print.h \ + print_graph.c print_graph.h \ + print-xml.c print-xml.h \ + reader.c reader.h \ + reduce.c reduce.h \ + relation.c relation.h \ + scan-code.h scan-code-c.c \ + scan-gram.h scan-gram-c.c \ + scan-skel.h scan-skel-c.c \ + state.c state.h \ + symlist.c symlist.h \ + symtab.c symtab.h \ + system.h \ + tables.h tables.c \ + uniqstr.c uniqstr.h \ + graphviz.c graphviz.h + +EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l + +BUILT_SOURCES = \ +parse-gram.c parse-gram.h \ +scan-code.c \ +scan-skel.c \ +scan-gram.c + +MOSTLYCLEANFILES = yacc + +yacc: + echo '#! /bin/sh' >$@ + echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@ + chmod a+x $@ + +echo: + echo $(bison_SOURCES) $(noinst_HEADERS) + +# The following rule is not designed to be portable, +# and relies on tools that not everyone has. + +# Most functions in src/*.c should have static scope. +# Any that don't must be marked with `extern', but `main' +# and `usage' are exceptions. They're always extern, but +# don't need to be marked. +# +# The second nm|grep checks for file-scope variables with `extern' scope. +sc_tight_scope: $(all_programs) + @t=exceptions-$$$$; \ + trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \ + ( printf '^main$$\n^usage$$\n'; \ + grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \ + | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \ + if nm -e *.$(OBJEXT) \ + | sed -n 's/.* T //p' \ + | grep -Ev -f $$t; then \ + echo 'the above functions should have static scope' 1>&2; \ + exit 1; \ + fi; \ + ( printf '^program_name$$\n'; \ + sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \ + $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \ + if nm -e *.$(OBJEXT) \ + | sed -n 's/.* [BD] //p' \ + | grep -Ev -f $$t; then \ + echo 'the above variables should have static scope' 1>&2; \ + exit 1; \ + fi diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..82a7daf --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,956 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Make bison/src. + +# 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 +# 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 . + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = bison$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in parse-gram.c \ + scan-code.c scan-gram.c scan-skel.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_bison_OBJECTS = LR0.$(OBJEXT) assoc.$(OBJEXT) closure.$(OBJEXT) \ + complain.$(OBJEXT) conflicts.$(OBJEXT) derives.$(OBJEXT) \ + files.$(OBJEXT) getargs.$(OBJEXT) gram.$(OBJEXT) \ + lalr.$(OBJEXT) location.$(OBJEXT) main.$(OBJEXT) \ + muscle_tab.$(OBJEXT) nullable.$(OBJEXT) output.$(OBJEXT) \ + parse-gram.$(OBJEXT) print.$(OBJEXT) print_graph.$(OBJEXT) \ + print-xml.$(OBJEXT) reader.$(OBJEXT) reduce.$(OBJEXT) \ + relation.$(OBJEXT) scan-code-c.$(OBJEXT) scan-gram-c.$(OBJEXT) \ + scan-skel-c.$(OBJEXT) state.$(OBJEXT) symlist.$(OBJEXT) \ + symtab.$(OBJEXT) tables.$(OBJEXT) uniqstr.$(OBJEXT) \ + graphviz.$(OBJEXT) +bison_OBJECTS = $(am_bison_OBJECTS) +bison_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +bison_DEPENDENCIES = ../lib/libbison.a $(am__DEPENDENCIES_1) +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/lib +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) +YLWRAP = $(top_srcdir)/build-aux/ylwrap +YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +SOURCES = $(bison_SOURCES) $(EXTRA_bison_SOURCES) +DIST_SOURCES = $(bison_SOURCES) $(EXTRA_bison_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ + +# Use our own Bison to build the parser. Of course, you ought to +# keep a sane version of Bison nearby... +YACC = ../tests/bison -y --warnings=all,error +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/lib +AM_YFLAGS = "-dv" +LDADD = ../lib/libbison.a $(LIBINTL) +bin_SCRIPTS = $(YACC_SCRIPT) +EXTRA_SCRIPTS = yacc +bison_SOURCES = \ + LR0.c LR0.h \ + assoc.c assoc.h \ + closure.c closure.h \ + complain.c complain.h \ + conflicts.c conflicts.h \ + derives.c derives.h \ + files.c files.h \ + flex-scanner.h \ + getargs.c getargs.h \ + gram.c gram.h \ + lalr.h lalr.c \ + location.c location.h \ + main.c \ + muscle_tab.c muscle_tab.h \ + nullable.c nullable.h \ + output.c output.h \ + parse-gram.h parse-gram.y \ + print.c print.h \ + print_graph.c print_graph.h \ + print-xml.c print-xml.h \ + reader.c reader.h \ + reduce.c reduce.h \ + relation.c relation.h \ + scan-code.h scan-code-c.c \ + scan-gram.h scan-gram-c.c \ + scan-skel.h scan-skel-c.c \ + state.c state.h \ + symlist.c symlist.h \ + symtab.c symtab.h \ + system.h \ + tables.h tables.c \ + uniqstr.c uniqstr.h \ + graphviz.c graphviz.h + +EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l +BUILT_SOURCES = \ +parse-gram.c parse-gram.h \ +scan-code.c \ +scan-skel.c \ +scan-gram.c + +MOSTLYCLEANFILES = yacc +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .l .o .obj .y +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +installcheck-binPROGRAMS: $(bin_PROGRAMS) + bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ + case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ + *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ + esac; \ + f=`echo "$$p" | \ + sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + for opt in --help --version; do \ + if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ + 2>c$${pid}_.err &2; bad=1; fi; \ + done; \ + done; rm -f c$${pid}_.???; exit $$bad +bison$(EXEEXT): $(bison_OBJECTS) $(bison_DEPENDENCIES) + @rm -f bison$(EXEEXT) + $(LINK) $(bison_OBJECTS) $(bison_LDADD) $(LIBS) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +installcheck-binSCRIPTS: $(bin_SCRIPTS) + bad=0; pid=$$$$; list="$(bin_SCRIPTS)"; for p in $$list; do \ + case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ + *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ + esac; \ + f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \ + for opt in --help --version; do \ + if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ + 2>c$${pid}_.err &2; bad=1; fi; \ + done; \ + done; rm -f c$${pid}_.???; exit $$bad + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LR0.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assoc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closure.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complain.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conflicts.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/derives.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/files.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getargs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gram.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphviz.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lalr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/location.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/muscle_tab.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nullable.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse-gram.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-xml.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_graph.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reduce.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relation.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-code-c.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-code.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-gram-c.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-gram.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-skel-c.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-skel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtab.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniqstr.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.l.c: + $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) + +.y.c: + $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) $(SCRIPTS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -rm -f parse-gram.c + -rm -f scan-code.c + -rm -f scan-gram.c + -rm -f scan-skel.c + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS install-binSCRIPTS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: installcheck-binPROGRAMS installcheck-binSCRIPTS + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-binSCRIPTS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am \ + installcheck-binPROGRAMS installcheck-binSCRIPTS installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-binSCRIPTS + + +yacc: + echo '#! /bin/sh' >$@ + echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@ + chmod a+x $@ + +echo: + echo $(bison_SOURCES) $(noinst_HEADERS) + +# The following rule is not designed to be portable, +# and relies on tools that not everyone has. + +# Most functions in src/*.c should have static scope. +# Any that don't must be marked with `extern', but `main' +# and `usage' are exceptions. They're always extern, but +# don't need to be marked. +# +# The second nm|grep checks for file-scope variables with `extern' scope. +sc_tight_scope: $(all_programs) + @t=exceptions-$$$$; \ + trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \ + ( printf '^main$$\n^usage$$\n'; \ + grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \ + | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \ + if nm -e *.$(OBJEXT) \ + | sed -n 's/.* T //p' \ + | grep -Ev -f $$t; then \ + echo 'the above functions should have static scope' 1>&2; \ + exit 1; \ + fi; \ + ( printf '^program_name$$\n'; \ + sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \ + $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \ + if nm -e *.$(OBJEXT) \ + | sed -n 's/.* [BD] //p' \ + | grep -Ev -f $$t; then \ + echo 'the above variables should have static scope' 1>&2; \ + exit 1; \ + fi +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/assoc.c b/src/assoc.c new file mode 100644 index 0000000..2ce16f0 --- /dev/null +++ b/src/assoc.c @@ -0,0 +1,45 @@ +/* Associativity information. + Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include "assoc.h" + + +const char * +assoc_to_string (assoc a) +{ + switch (a) + { + default: + abort (); + + case undef_assoc: + return "undefined associativity"; + + case right_assoc: + return "%right"; + + case left_assoc: + return "%left"; + + case non_assoc: + return "%nonassoc"; + } +} diff --git a/src/assoc.h b/src/assoc.h new file mode 100644 index 0000000..d900caf --- /dev/null +++ b/src/assoc.h @@ -0,0 +1,33 @@ +/* Associativity information. + Copyright (C) 2002, 2006 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef ASSOC_H_ +# define ASSOC_H_ + +/* Associativity values for tokens and rules. */ +typedef enum +{ + undef_assoc, + right_assoc, + left_assoc, + non_assoc +} assoc; + +char const *assoc_to_string (assoc a); + +#endif /* !ASSOC_H_ */ diff --git a/src/closure.c b/src/closure.c new file mode 100644 index 0000000..ff3109c --- /dev/null +++ b/src/closure.c @@ -0,0 +1,249 @@ +/* Closures for Bison + + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005, 2007 Free + Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include +#include +#include + +#include "closure.h" +#include "derives.h" +#include "getargs.h" +#include "gram.h" +#include "reader.h" +#include "symtab.h" + +/* NITEMSET is the size of the array ITEMSET. */ +item_number *itemset; +size_t nitemset; + +static bitset ruleset; + +/* internal data. See comments before set_fderives and set_firsts. */ +static bitsetv fderives = NULL; +static bitsetv firsts = NULL; + +/* Retrieve the FDERIVES/FIRSTS sets of the nonterminals numbered Var. */ +#define FDERIVES(Var) fderives[(Var) - ntokens] +#define FIRSTS(Var) firsts[(Var) - ntokens] + + +/*-----------------. +| Debugging code. | +`-----------------*/ + +static void +print_closure (char const *title, item_number *array, size_t size) +{ + size_t i; + fprintf (stderr, "Closure: %s\n", title); + for (i = 0; i < size; ++i) + { + item_number *rp; + fprintf (stderr, " %2d: .", array[i]); + for (rp = &ritem[array[i]]; *rp >= 0; ++rp) + fprintf (stderr, " %s", symbols[*rp]->tag); + fprintf (stderr, " (rule %d)\n", -*rp - 1); + } + fputs ("\n\n", stderr); +} + + +static void +print_firsts (void) +{ + symbol_number i, j; + + fprintf (stderr, "FIRSTS\n"); + for (i = ntokens; i < nsyms; i++) + { + bitset_iterator iter; + fprintf (stderr, "\t%s firsts\n", symbols[i]->tag); + BITSET_FOR_EACH (iter, FIRSTS (i), j, 0) + { + fprintf (stderr, "\t\t%s\n", + symbols[j + ntokens]->tag); + } + } + fprintf (stderr, "\n\n"); +} + + +static void +print_fderives (void) +{ + int i; + rule_number r; + + fprintf (stderr, "FDERIVES\n"); + for (i = ntokens; i < nsyms; i++) + { + bitset_iterator iter; + fprintf (stderr, "\t%s derives\n", symbols[i]->tag); + BITSET_FOR_EACH (iter, FDERIVES (i), r, 0) + { + fprintf (stderr, "\t\t%3d ", r); + rule_rhs_print (&rules[r], stderr); + } + } + fprintf (stderr, "\n\n"); +} + +/*------------------------------------------------------------------. +| Set FIRSTS to be an NVARS array of NVARS bitsets indicating which | +| items can represent the beginning of the input corresponding to | +| which other items. | +| | +| For example, if some rule expands symbol 5 into the sequence of | +| symbols 8 3 20, the symbol 8 can be the beginning of the data for | +| symbol 5, so the bit [8 - ntokens] in first[5 - ntokens] (= FIRST | +| (5)) is set. | +`------------------------------------------------------------------*/ + +static void +set_firsts (void) +{ + symbol_number i, j; + + firsts = bitsetv_create (nvars, nvars, BITSET_FIXED); + + for (i = ntokens; i < nsyms; i++) + for (j = 0; derives[i - ntokens][j]; ++j) + { + item_number sym = derives[i - ntokens][j]->rhs[0]; + if (ISVAR (sym)) + bitset_set (FIRSTS (i), sym - ntokens); + } + + if (trace_flag & trace_sets) + bitsetv_matrix_dump (stderr, "RTC: Firsts Input", firsts); + bitsetv_reflexive_transitive_closure (firsts); + if (trace_flag & trace_sets) + bitsetv_matrix_dump (stderr, "RTC: Firsts Output", firsts); + + if (trace_flag & trace_sets) + print_firsts (); +} + +/*-------------------------------------------------------------------. +| Set FDERIVES to an NVARS by NRULES matrix of bits indicating which | +| rules can help derive the beginning of the data for each | +| nonterminal. | +| | +| For example, if symbol 5 can be derived as the sequence of symbols | +| 8 3 20, and one of the rules for deriving symbol 8 is rule 4, then | +| the [5 - NTOKENS, 4] bit in FDERIVES is set. | +`-------------------------------------------------------------------*/ + +static void +set_fderives (void) +{ + symbol_number i, j; + rule_number k; + + fderives = bitsetv_create (nvars, nrules, BITSET_FIXED); + + set_firsts (); + + for (i = ntokens; i < nsyms; ++i) + for (j = ntokens; j < nsyms; ++j) + if (bitset_test (FIRSTS (i), j - ntokens)) + for (k = 0; derives[j - ntokens][k]; ++k) + bitset_set (FDERIVES (i), derives[j - ntokens][k]->number); + + if (trace_flag & trace_sets) + print_fderives (); + + bitsetv_free (firsts); +} + + + +void +new_closure (unsigned int n) +{ + itemset = xnmalloc (n, sizeof *itemset); + + ruleset = bitset_create (nrules, BITSET_FIXED); + + set_fderives (); +} + + + +void +closure (item_number *core, size_t n) +{ + /* Index over CORE. */ + size_t c; + + /* A bit index over RULESET. */ + rule_number ruleno; + + bitset_iterator iter; + + if (trace_flag & trace_sets) + print_closure ("input", core, n); + + bitset_zero (ruleset); + + for (c = 0; c < n; ++c) + if (ISVAR (ritem[core[c]])) + bitset_or (ruleset, ruleset, FDERIVES (ritem[core[c]])); + + /* core is sorted on item index in ritem, which is sorted on rule number. + Compute itemset with the same sort. */ + nitemset = 0; + c = 0; + BITSET_FOR_EACH (iter, ruleset, ruleno, 0) + { + item_number itemno = rules[ruleno].rhs - ritem; + while (c < n && core[c] < itemno) + { + itemset[nitemset] = core[c]; + nitemset++; + c++; + } + itemset[nitemset] = itemno; + nitemset++; + }; + + while (c < n) + { + itemset[nitemset] = core[c]; + nitemset++; + c++; + } + + if (trace_flag & trace_sets) + print_closure ("output", itemset, nitemset); +} + + +void +free_closure (void) +{ + free (itemset); + bitset_free (ruleset); + bitsetv_free (fderives); +} diff --git a/src/closure.h b/src/closure.h new file mode 100644 index 0000000..045daa9 --- /dev/null +++ b/src/closure.h @@ -0,0 +1,57 @@ +/* Subroutines for bison + + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef CLOSURE_H_ +# define CLOSURE_H_ + +# include "gram.h" + +/* Allocates the itemset and ruleset vectors, and precomputes useful + data so that closure can be called. n is the number of elements to + allocate for itemset. */ + +void new_closure (unsigned int n); + + +/* Given the kernel (aka core) of a state (a sorted vector of item numbers + ITEMS, of length N), set up RULESET and ITEMSET to indicate what + rules could be run and which items could be accepted when those + items are the active ones. + + RULESET contains a bit for each rule. CLOSURE sets the bits for + all rules which could potentially describe the next input to be + read. + + ITEMSET is a sorted vector of item numbers; NITEMSET is its size + (actually, points to just beyond the end of the part of it that is + significant). CLOSURE places there the indices of all items which + represent units of input that could arrive next. */ + +void closure (item_number *items, size_t n); + + +/* Frees ITEMSET, RULESET and internal data. */ + +void free_closure (void); + +extern item_number *itemset; +extern size_t nitemset; + +#endif /* !CLOSURE_H_ */ diff --git a/src/complain.c b/src/complain.c new file mode 100644 index 0000000..2c26c4e --- /dev/null +++ b/src/complain.c @@ -0,0 +1,139 @@ +/* Declaration for error-reporting function for Bison. + + Copyright (C) 2000, 2001, 2002, 2004, 2005, 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 . */ + +/* Based on error.c and error.h, + written by David MacKenzie . */ + +#include +#include "system.h" + +#include + +#include "complain.h" +#include "files.h" +#include "getargs.h" + +bool complaint_issued; + + + +/** Report an error message. + * + * \param loc the location, defaulting to the current file, + * or the program name. + * \param prefix put before the message (e.g., "warning"). + * \param message the error message, a printf format string. + * \param args the arguments of the format string. + */ +static +void +error_message (location *loc, + const char *prefix, + const char *message, va_list args) +{ + if (loc) + location_print (stderr, *loc); + else + fputs (current_file ? current_file : program_name, stderr); + fputs (": ", stderr); + + if (prefix) + fprintf (stderr, "%s: ", prefix); + + vfprintf (stderr, message, args); + va_end (args); + putc ('\n', stderr); + fflush (stderr); +} + +/** Wrap error_message() with varargs handling. */ +#define ERROR_MESSAGE(Loc, Prefix, Message) \ +{ \ + va_list args; \ + va_start (args, Message); \ + error_message (Loc, Prefix, Message, args); \ +} + + +/*--------------------------------. +| Report a warning, and proceed. | +`--------------------------------*/ + +static void +set_warning_issued (void) +{ + static bool warning_issued = false; + if (!warning_issued && (warnings_flag & warnings_error)) + { + fprintf (stderr, "%s: warnings being treated as errors\n", program_name); + complaint_issued = true; + } + warning_issued = true; +} + +void +warn_at (location loc, const char *message, ...) +{ + set_warning_issued (); + ERROR_MESSAGE (&loc, _("warning"), message); +} + +void +warn (const char *message, ...) +{ + set_warning_issued (); + ERROR_MESSAGE (NULL, _("warning"), message); +} + + +/*-----------------------------------------------------------. +| An error has occurred, but we can proceed, and die later. | +`-----------------------------------------------------------*/ + +void +complain_at (location loc, const char *message, ...) +{ + ERROR_MESSAGE (&loc, NULL, message); + complaint_issued = true; +} + +void +complain (const char *message, ...) +{ + ERROR_MESSAGE (NULL, NULL, message); + complaint_issued = true; +} + + +/*-------------------------------------------------. +| A severe error has occurred, we cannot proceed. | +`-------------------------------------------------*/ + +void +fatal_at (location loc, const char *message, ...) +{ + ERROR_MESSAGE (&loc, _("fatal error"), message); + exit (EXIT_FAILURE); +} + +void +fatal (const char *message, ...) +{ + ERROR_MESSAGE (NULL, _("fatal error"), message); + exit (EXIT_FAILURE); +} diff --git a/src/complain.h b/src/complain.h new file mode 100644 index 0000000..a633613 --- /dev/null +++ b/src/complain.h @@ -0,0 +1,57 @@ +/* Declaration for error-reporting function for Bison. + Copyright (C) 2000, 2001, 2002, 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 . */ + +#ifndef COMPLAIN_H_ +# define COMPLAIN_H_ 1 + +# include "location.h" + +# ifdef __cplusplus +extern "C" { +# endif + +/** Informative messages, but we proceed. */ + +void warn (char const *format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); + +void warn_at (location loc, char const *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + +/** An error, but we continue and die later. */ + +void complain (char const *format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); + +void complain_at (location loc, char const *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + +/** A fatal error, causing immediate exit. */ + +void fatal (char const *format, ...) + __attribute__ ((__noreturn__, __format__ (__printf__, 1, 2))); + +void fatal_at (location loc, char const *format, ...) + __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); + +/** Whether an error was reported. */ +extern bool complaint_issued; + +# ifdef __cplusplus +} +# endif + +#endif /* !COMPLAIN_H_ */ diff --git a/src/conflicts.c b/src/conflicts.c new file mode 100644 index 0000000..7a9f3c2 --- /dev/null +++ b/src/conflicts.c @@ -0,0 +1,628 @@ +/* Find and resolve or report lookahead conflicts for bison, + + Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include + +#include "LR0.h" +#include "complain.h" +#include "conflicts.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "lalr.h" +#include "print-xml.h" +#include "reader.h" +#include "state.h" +#include "symtab.h" + +/* -1 stands for not specified. */ +int expected_sr_conflicts = -1; +int expected_rr_conflicts = -1; +static char *conflicts; +static struct obstack solved_conflicts_obstack; +static struct obstack solved_conflicts_xml_obstack; + +static bitset shift_set; +static bitset lookahead_set; + + + +enum conflict_resolution + { + shift_resolution, + reduce_resolution, + left_resolution, + right_resolution, + nonassoc_resolution + }; + + +/*----------------------------------------------------------------. +| Explain how an SR conflict between TOKEN and RULE was resolved: | +| RESOLUTION. | +`----------------------------------------------------------------*/ + +static inline void +log_resolution (rule *r, symbol_number token, + enum conflict_resolution resolution) +{ + if (report_flag & report_solved_conflicts) + { + /* The description of the resolution. */ + switch (resolution) + { + case shift_resolution: + case right_resolution: + obstack_fgrow2 (&solved_conflicts_obstack, + _(" Conflict between rule %d and token %s" + " resolved as shift"), + r->number, + symbols[token]->tag); + break; + + case reduce_resolution: + case left_resolution: + obstack_fgrow2 (&solved_conflicts_obstack, + _(" Conflict between rule %d and token %s" + " resolved as reduce"), + r->number, + symbols[token]->tag); + break; + + case nonassoc_resolution: + obstack_fgrow2 (&solved_conflicts_obstack, + _(" Conflict between rule %d and token %s" + " resolved as an error"), + r->number, + symbols[token]->tag); + break; + } + + /* The reason. */ + switch (resolution) + { + case shift_resolution: + obstack_fgrow2 (&solved_conflicts_obstack, + " (%s < %s)", + r->prec->tag, + symbols[token]->tag); + break; + + case reduce_resolution: + obstack_fgrow2 (&solved_conflicts_obstack, + " (%s < %s)", + symbols[token]->tag, + r->prec->tag); + break; + + case left_resolution: + obstack_fgrow1 (&solved_conflicts_obstack, + " (%%left %s)", + symbols[token]->tag); + break; + + case right_resolution: + obstack_fgrow1 (&solved_conflicts_obstack, + " (%%right %s)", + symbols[token]->tag); + break; + + case nonassoc_resolution: + obstack_fgrow1 (&solved_conflicts_obstack, + " (%%nonassoc %s)", + symbols[token]->tag); + break; + } + + obstack_sgrow (&solved_conflicts_obstack, ".\n"); + } + + /* XML report */ + if (xml_flag) + { + /* The description of the resolution. */ + switch (resolution) + { + case shift_resolution: + case right_resolution: + obstack_fgrow2 (&solved_conflicts_xml_obstack, + " ", + r->number, + xml_escape (symbols[token]->tag)); + break; + + case reduce_resolution: + case left_resolution: + obstack_fgrow2 (&solved_conflicts_xml_obstack, + " ", + r->number, + xml_escape (symbols[token]->tag)); + break; + + case nonassoc_resolution: + obstack_fgrow2 (&solved_conflicts_xml_obstack, + " ", + r->number, + xml_escape (symbols[token]->tag)); + break; + } + + /* The reason. */ + switch (resolution) + { + case shift_resolution: + obstack_fgrow2 (&solved_conflicts_xml_obstack, + "%s < %s", + xml_escape_n (0, r->prec->tag), + xml_escape_n (1, symbols[token]->tag)); + break; + + case reduce_resolution: + obstack_fgrow2 (&solved_conflicts_xml_obstack, + "%s < %s", + xml_escape_n (0, symbols[token]->tag), + xml_escape_n (1, r->prec->tag)); + break; + + case left_resolution: + obstack_fgrow1 (&solved_conflicts_xml_obstack, + "%%left %s", + xml_escape (symbols[token]->tag)); + break; + + case right_resolution: + obstack_fgrow1 (&solved_conflicts_xml_obstack, + "%%right %s", + xml_escape (symbols[token]->tag)); + break; + + case nonassoc_resolution: + obstack_fgrow1 (&solved_conflicts_xml_obstack, + "%%nonassoc %s", + xml_escape (symbols[token]->tag)); + break; + } + + obstack_sgrow (&solved_conflicts_xml_obstack, "\n"); + } +} + + +/*------------------------------------------------------------------. +| Turn off the shift recorded for the specified token in the | +| specified state. Used when we resolve a shift-reduce conflict in | +| favor of the reduction or as an error (%nonassoc). | +`------------------------------------------------------------------*/ + +static void +flush_shift (state *s, int token) +{ + transitions *trans = s->transitions; + int i; + + bitset_reset (lookahead_set, token); + for (i = 0; i < trans->num; i++) + if (!TRANSITION_IS_DISABLED (trans, i) + && TRANSITION_SYMBOL (trans, i) == token) + TRANSITION_DISABLE (trans, i); +} + + +/*--------------------------------------------------------------------. +| Turn off the reduce recorded for the specified token in the | +| specified lookahead set. Used when we resolve a shift-reduce | +| conflict in favor of the shift or as an error (%nonassoc). | +`--------------------------------------------------------------------*/ + +static void +flush_reduce (bitset lookahead_tokens, int token) +{ + bitset_reset (lookahead_tokens, token); +} + + +/*------------------------------------------------------------------. +| Attempt to resolve shift-reduce conflict for one rule by means of | +| precedence declarations. It has already been checked that the | +| rule has a precedence. A conflict is resolved by modifying the | +| shift or reduce tables so that there is no longer a conflict. | +| | +| RULENO is the number of the lookahead bitset to consider. | +| | +| ERRORS and NERRS can be used to store discovered explicit | +| errors. | +`------------------------------------------------------------------*/ + +static void +resolve_sr_conflict (state *s, int ruleno, symbol **errors, int *nerrs) +{ + symbol_number i; + reductions *reds = s->reductions; + /* Find the rule to reduce by to get precedence of reduction. */ + rule *redrule = reds->rules[ruleno]; + int redprec = redrule->prec->prec; + bitset lookahead_tokens = reds->lookahead_tokens[ruleno]; + + for (i = 0; i < ntokens; i++) + if (bitset_test (lookahead_tokens, i) + && bitset_test (lookahead_set, i) + && symbols[i]->prec) + { + /* Shift-reduce conflict occurs for token number i + and it has a precedence. + The precedence of shifting is that of token i. */ + if (symbols[i]->prec < redprec) + { + log_resolution (redrule, i, reduce_resolution); + flush_shift (s, i); + } + else if (symbols[i]->prec > redprec) + { + log_resolution (redrule, i, shift_resolution); + flush_reduce (lookahead_tokens, i); + } + else + /* Matching precedence levels. + For left association, keep only the reduction. + For right association, keep only the shift. + For nonassociation, keep neither. */ + + switch (symbols[i]->assoc) + { + default: + abort (); + + case right_assoc: + log_resolution (redrule, i, right_resolution); + flush_reduce (lookahead_tokens, i); + break; + + case left_assoc: + log_resolution (redrule, i, left_resolution); + flush_shift (s, i); + break; + + case non_assoc: + log_resolution (redrule, i, nonassoc_resolution); + flush_shift (s, i); + flush_reduce (lookahead_tokens, i); + /* Record an explicit error for this token. */ + errors[(*nerrs)++] = symbols[i]; + break; + } + } +} + + +/*-------------------------------------------------------------------. +| Solve the S/R conflicts of state S using the | +| precedence/associativity, and flag it inconsistent if it still has | +| conflicts. ERRORS can be used as storage to compute the list of | +| lookahead tokens on which S raises a syntax error (%nonassoc). | +`-------------------------------------------------------------------*/ + +static void +set_conflicts (state *s, symbol **errors) +{ + int i; + transitions *trans = s->transitions; + reductions *reds = s->reductions; + int nerrs = 0; + + if (s->consistent) + return; + + bitset_zero (lookahead_set); + + FOR_EACH_SHIFT (trans, i) + bitset_set (lookahead_set, TRANSITION_SYMBOL (trans, i)); + + /* Loop over all rules which require lookahead in this state. First + check for shift-reduce conflict, and try to resolve using + precedence. */ + for (i = 0; i < reds->num; ++i) + if (reds->rules[i]->prec && reds->rules[i]->prec->prec + && !bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set)) + resolve_sr_conflict (s, i, errors, &nerrs); + + if (nerrs) + { + /* Some tokens have been explicitly made errors. Allocate a + permanent errs structure for this state, to record them. */ + state_errs_set (s, nerrs, errors); + } + if (obstack_object_size (&solved_conflicts_obstack)) + { + obstack_1grow (&solved_conflicts_obstack, '\0'); + s->solved_conflicts = obstack_finish (&solved_conflicts_obstack); + } + if (obstack_object_size (&solved_conflicts_xml_obstack)) + { + obstack_1grow (&solved_conflicts_xml_obstack, '\0'); + s->solved_conflicts_xml = obstack_finish (&solved_conflicts_xml_obstack); + } + + /* Loop over all rules which require lookahead in this state. Check + for conflicts not resolved above. */ + for (i = 0; i < reds->num; ++i) + { + if (!bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set)) + conflicts[s->number] = 1; + bitset_or (lookahead_set, lookahead_set, reds->lookahead_tokens[i]); + } +} + + +/*----------------------------------------------------------------. +| Solve all the S/R conflicts using the precedence/associativity, | +| and flag as inconsistent the states that still have conflicts. | +`----------------------------------------------------------------*/ + +void +conflicts_solve (void) +{ + state_number i; + /* List of lookahead tokens on which we explicitly raise a syntax error. */ + symbol **errors = xnmalloc (ntokens + 1, sizeof *errors); + + conflicts = xcalloc (nstates, sizeof *conflicts); + shift_set = bitset_create (ntokens, BITSET_FIXED); + lookahead_set = bitset_create (ntokens, BITSET_FIXED); + obstack_init (&solved_conflicts_obstack); + obstack_init (&solved_conflicts_xml_obstack); + + for (i = 0; i < nstates; i++) + { + set_conflicts (states[i], errors); + + /* For uniformity of the code, make sure all the states have a valid + `errs' member. */ + if (!states[i]->errs) + states[i]->errs = errs_new (0, 0); + } + + free (errors); +} + + +void +conflicts_update_state_numbers (state_number old_to_new[], + state_number nstates_old) +{ + state_number i; + for (i = 0; i < nstates_old; ++i) + if (old_to_new[i] != nstates_old) + conflicts[old_to_new[i]] = conflicts[i]; +} + + +/*---------------------------------------------. +| Count the number of shift/reduce conflicts. | +`---------------------------------------------*/ + +static int +count_sr_conflicts (state *s) +{ + int i; + int src_count = 0; + transitions *trans = s->transitions; + reductions *reds = s->reductions; + + if (!trans) + return 0; + + bitset_zero (lookahead_set); + bitset_zero (shift_set); + + FOR_EACH_SHIFT (trans, i) + bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); + + for (i = 0; i < reds->num; ++i) + bitset_or (lookahead_set, lookahead_set, reds->lookahead_tokens[i]); + + bitset_and (lookahead_set, lookahead_set, shift_set); + + src_count = bitset_count (lookahead_set); + + return src_count; +} + + +/*----------------------------------------------------------------. +| Count the number of reduce/reduce conflicts. If ONE_PER_TOKEN, | +| count one conflict for each token that has any reduce/reduce | +| conflicts. Otherwise, count one conflict for each pair of | +| conflicting reductions. | ++`----------------------------------------------------------------*/ + +static int +count_rr_conflicts (state *s, bool one_per_token) +{ + int i; + reductions *reds = s->reductions; + int rrc_count = 0; + + for (i = 0; i < ntokens; i++) + { + int count = 0; + int j; + for (j = 0; j < reds->num; ++j) + if (bitset_test (reds->lookahead_tokens[j], i)) + count++; + + if (count >= 2) + rrc_count += one_per_token ? 1 : count-1; + } + + return rrc_count; +} + + +/*--------------------------------------------------------. +| Report the number of conflicts, using the Yacc format. | +`--------------------------------------------------------*/ + +static void +conflict_report (FILE *out, int src_num, int rrc_num) +{ + if (src_num && rrc_num) + fprintf (out, _("conflicts: %d shift/reduce, %d reduce/reduce\n"), + src_num, rrc_num); + else if (src_num) + fprintf (out, _("conflicts: %d shift/reduce\n"), src_num); + else if (rrc_num) + fprintf (out, _("conflicts: %d reduce/reduce\n"), rrc_num); +} + + +/*-----------------------------------------------------------. +| Output the detailed description of states with conflicts. | +`-----------------------------------------------------------*/ + +void +conflicts_output (FILE *out) +{ + bool printed_sth = false; + state_number i; + for (i = 0; i < nstates; i++) + { + state *s = states[i]; + if (conflicts[i]) + { + fprintf (out, _("State %d "), i); + conflict_report (out, count_sr_conflicts (s), + count_rr_conflicts (s, true)); + printed_sth = true; + } + } + if (printed_sth) + fputs ("\n\n", out); +} + +/*--------------------------------------------------------. +| Total the number of S/R and R/R conflicts. Unlike the | +| code in conflicts_output, however, count EACH pair of | +| reductions for the same state and lookahead as one | +| conflict. | +`--------------------------------------------------------*/ + +int +conflicts_total_count (void) +{ + state_number i; + int count; + + /* Conflicts by state. */ + count = 0; + for (i = 0; i < nstates; i++) + if (conflicts[i]) + { + count += count_sr_conflicts (states[i]); + count += count_rr_conflicts (states[i], false); + } + return count; +} + + +/*------------------------------------------. +| Reporting the total number of conflicts. | +`------------------------------------------*/ + +void +conflicts_print (void) +{ + /* Is the number of SR conflicts OK? Either EXPECTED_CONFLICTS is + not set, and then we want 0 SR, or else it is specified, in which + case we want equality. */ + bool src_ok; + bool rrc_ok; + + int src_total = 0; + int rrc_total = 0; + int src_expected; + int rrc_expected; + + /* Conflicts by state. */ + { + state_number i; + + for (i = 0; i < nstates; i++) + if (conflicts[i]) + { + src_total += count_sr_conflicts (states[i]); + rrc_total += count_rr_conflicts (states[i], true); + } + } + + if (! glr_parser && rrc_total > 0 && expected_rr_conflicts != -1) + { + warn (_("%%expect-rr applies only to GLR parsers")); + expected_rr_conflicts = -1; + } + + src_expected = expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts; + rrc_expected = expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts; + src_ok = src_total == src_expected; + rrc_ok = rrc_total == rrc_expected; + + /* If there are as many RR conflicts and SR conflicts as + expected, then there is nothing to report. */ + if (rrc_ok & src_ok) + return; + + /* Report the total number of conflicts on STDERR. */ + if (src_total | rrc_total) + { + if (! yacc_flag) + fprintf (stderr, "%s: ", current_file); + conflict_report (stderr, src_total, rrc_total); + } + + if (expected_sr_conflicts != -1 || expected_rr_conflicts != -1) + { + if (! src_ok) + complain (ngettext ("expected %d shift/reduce conflict", + "expected %d shift/reduce conflicts", + src_expected), + src_expected); + if (! rrc_ok) + complain (ngettext ("expected %d reduce/reduce conflict", + "expected %d reduce/reduce conflicts", + rrc_expected), + rrc_expected); + } +} + + +void +conflicts_free (void) +{ + free (conflicts); + bitset_free (shift_set); + bitset_free (lookahead_set); + obstack_free (&solved_conflicts_obstack, NULL); + obstack_free (&solved_conflicts_xml_obstack, NULL); +} diff --git a/src/conflicts.h b/src/conflicts.h new file mode 100644 index 0000000..d8264cc --- /dev/null +++ b/src/conflicts.h @@ -0,0 +1,45 @@ +/* Find and resolve or report lookahead conflicts for bison, + Copyright (C) 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef CONFLICTS_H_ +# define CONFLICTS_H_ +# include "state.h" + +void conflicts_solve (void); + +/** + * Update state numbers recorded in internal arrays such that: + * - \c nstates_old is the old number of states. + * - Where \c i is the old state number, old_to_new[i] is either: + * - \c nstates_old if state \c i is removed because it is unreachable. + * - The new state number. + * - The highest new state number is the number of remaining states - 1. + * - The numerical order of the remaining states has not changed. + */ +void conflicts_update_state_numbers (state_number old_to_new[], + state_number nstates_old); + +void conflicts_print (void); +int conflicts_total_count (void); +void conflicts_output (FILE *out); +void conflicts_free (void); + +/* Were there conflicts? */ +extern int expected_sr_conflicts; +extern int expected_rr_conflicts; +#endif /* !CONFLICTS_H_ */ diff --git a/src/derives.c b/src/derives.c new file mode 100644 index 0000000..dc6049c --- /dev/null +++ b/src/derives.c @@ -0,0 +1,119 @@ +/* Match rules with nonterminals for bison, + + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2005 Free + Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include "getargs.h" + +#include "derives.h" +#include "gram.h" +#include "reader.h" +#include "symtab.h" + +/* Linked list of rule numbers. */ +typedef struct rule_list +{ + struct rule_list *next; + rule *value; +} rule_list; + +rule ***derives; + +static void +print_derives (void) +{ + int i; + + fputs ("DERIVES\n", stderr); + + for (i = ntokens; i < nsyms; i++) + { + rule **rp; + fprintf (stderr, "\t%s derives\n", symbols[i]->tag); + for (rp = derives[i - ntokens]; *rp; ++rp) + { + fprintf (stderr, "\t\t%3d ", (*rp)->user_number); + rule_rhs_print (*rp, stderr); + } + } + + fputs ("\n\n", stderr); +} + + +void +derives_compute (void) +{ + symbol_number i; + rule_number r; + rule **q; + + /* DSET[NTERM - NTOKENS] -- A linked list of the numbers of the rules + whose LHS is NTERM. */ + rule_list **dset = xcalloc (nvars, sizeof *dset); + + /* DELTS[RULE] -- There are NRULES rule number to attach to nterms. + Instead of performing NRULES allocations for each, have an array + indexed by rule numbers. */ + rule_list *delts = xnmalloc (nrules, sizeof *delts); + + for (r = nrules - 1; r >= 0; --r) + { + symbol_number lhs = rules[r].lhs->number; + rule_list *p = &delts[r]; + /* A new LHS is found. */ + p->next = dset[lhs - ntokens]; + p->value = &rules[r]; + dset[lhs - ntokens] = p; + } + + /* DSET contains what we need under the form of a linked list. Make + it a single array. */ + + derives = xnmalloc (nvars, sizeof *derives); + q = xnmalloc (nvars + nrules, sizeof *q); + + for (i = ntokens; i < nsyms; i++) + { + rule_list *p = dset[i - ntokens]; + derives[i - ntokens] = q; + while (p) + { + *q++ = p->value; + p = p->next; + } + *q++ = NULL; + } + + if (trace_flag & trace_sets) + print_derives (); + + free (dset); + free (delts); +} + + +void +derives_free (void) +{ + free (derives[0]); + free (derives); +} diff --git a/src/derives.h b/src/derives.h new file mode 100644 index 0000000..d4ba116 --- /dev/null +++ b/src/derives.h @@ -0,0 +1,35 @@ +/* Match rules with nonterminals for bison, + + Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef DERIVES_H_ +# define DERIVES_H_ + +# include "gram.h" + +/* DERIVES[SYMBOL - NTOKENS] points to a vector of the rules that + SYMBOL derives, terminated with NULL. */ +extern rule ***derives; + +/* Compute DERIVES. */ + +void derives_compute (void); +void derives_free (void); + +#endif /* !DERIVES_H_ */ diff --git a/src/files.c b/src/files.c new file mode 100644 index 0000000..07f761b --- /dev/null +++ b/src/files.c @@ -0,0 +1,384 @@ +/* Open and close files for Bison. + + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include +#include +#include +#include +#include + +#include "complain.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" + +/* Initializing some values below (such SPEC_NAME_PREFIX to `yy') is + tempting, but don't do that: for the time being our handling of the + %directive vs --option leaves precedence to the options by deciding + that if a %directive sets a variable which is really set (i.e., not + NULL), then the %directive is ignored. As a result, %name-prefix, + for instance, will not be honored. */ + +char const *spec_outfile = NULL; /* for -o. */ +char const *spec_file_prefix = NULL; /* for -b. */ +char const *spec_name_prefix = NULL; /* for -p. */ +char *spec_verbose_file = NULL; /* for --verbose. */ +char *spec_graph_file = NULL; /* for -g. */ +char *spec_xml_file = NULL; /* for -x. */ +char *spec_defines_file = NULL; /* for --defines. */ +char *parser_file_name; + +/* All computed output file names. */ +static char **file_names = NULL; +static int file_names_count = 0; + +uniqstr grammar_file = NULL; +uniqstr current_file = NULL; + +/* If --output=dir/foo.c was specified, + DIR_PREFIX is `dir/' and ALL_BUT_EXT and ALL_BUT_TAB_EXT are `dir/foo'. + + If --output=dir/foo.tab.c was specified, DIR_PREFIX is `dir/', + ALL_BUT_EXT is `dir/foo.tab', and ALL_BUT_TAB_EXT is `dir/foo'. + + If --output was not specified but --file-prefix=dir/foo was specified, + ALL_BUT_EXT = `foo.tab' and ALL_BUT_TAB_EXT = `foo'. + + If neither --output nor --file was specified but the input grammar + is name dir/foo.y, ALL_BUT_EXT and ALL_BUT_TAB_EXT are `foo'. + + If neither --output nor --file was specified, DIR_PREFIX is the + empty string (meaning the current directory); otherwise it is + `dir/'. */ + +char *all_but_ext; +static char *all_but_tab_ext; +char *dir_prefix; + +/* C source file extension (the parser source). */ +static char *src_extension = NULL; +/* Header file extension (if option ``-d'' is specified). */ +static char *header_extension = NULL; + +/*-----------------------------------------------------------------. +| Return a newly allocated string composed of the concatenation of | +| STR1, and STR2. | +`-----------------------------------------------------------------*/ + +static char * +concat2 (char const *str1, char const *str2) +{ + size_t len = strlen (str1) + strlen (str2); + char *res = xmalloc (len + 1); + char *cp; + cp = stpcpy (res, str1); + cp = stpcpy (cp, str2); + return res; +} + +/*-----------------------------------------------------------------. +| Try to open file NAME with mode MODE, and print an error message | +| if fails. | +`-----------------------------------------------------------------*/ + +FILE * +xfopen (const char *name, const char *mode) +{ + FILE *ptr; + + ptr = fopen_safer (name, mode); + if (!ptr) + error (EXIT_FAILURE, get_errno (), _("cannot open file `%s'"), name); + + return ptr; +} + +/*-------------------------------------------------------------. +| Try to close file PTR, and print an error message if fails. | +`-------------------------------------------------------------*/ + +void +xfclose (FILE *ptr) +{ + if (ptr == NULL) + return; + + if (ferror (ptr)) + error (EXIT_FAILURE, 0, _("I/O error")); + + if (fclose (ptr) != 0) + error (EXIT_FAILURE, get_errno (), _("cannot close file")); +} + + +/*------------------------------------------------------------------. +| Compute ALL_BUT_EXT, ALL_BUT_TAB_EXT and output files extensions. | +`------------------------------------------------------------------*/ + +/* In the string S, replace all characters FROM by TO. */ +static void +tr (char *s, char from, char to) +{ + for (; *s; s++) + if (*s == from) + *s = to; +} + +/* Compute extensions from the grammar file extension. */ +static void +compute_exts_from_gf (const char *ext) +{ + if (strcmp (ext, ".y") == 0) + { + src_extension = xstrdup (language->src_extension); + header_extension = xstrdup (language->header_extension); + } + else + { + src_extension = xstrdup (ext); + header_extension = xstrdup (ext); + tr (src_extension, 'y', 'c'); + tr (src_extension, 'Y', 'C'); + tr (header_extension, 'y', 'h'); + tr (header_extension, 'Y', 'H'); + } +} + +/* Compute extensions from the given c source file extension. */ +static void +compute_exts_from_src (const char *ext) +{ + /* We use this function when the user specifies `-o' or `--output', + so the extenions must be computed unconditionally from the file name + given by this option. */ + src_extension = xstrdup (ext); + header_extension = xstrdup (ext); + tr (header_extension, 'c', 'h'); + tr (header_extension, 'C', 'H'); +} + + +/* Decompose FILE_NAME in four parts: *BASE, *TAB, and *EXT, the fourth + part, (the directory) is ranging from FILE_NAME to the char before + *BASE, so we don't need an additional parameter. + + *EXT points to the last period in the basename, or NULL if none. + + If there is no *EXT, *TAB is NULL. Otherwise, *TAB points to + `.tab' or `_tab' if present right before *EXT, or is NULL. *TAB + cannot be equal to *BASE. + + None are allocated, they are simply pointers to parts of FILE_NAME. + Examples: + + '/tmp/foo.tab.c' -> *BASE = 'foo.tab.c', *TAB = '.tab.c', *EXT = + '.c' + + 'foo.c' -> *BASE = 'foo.c', *TAB = NULL, *EXT = '.c' + + 'tab.c' -> *BASE = 'tab.c', *TAB = NULL, *EXT = '.c' + + '.tab.c' -> *BASE = '.tab.c', *TAB = NULL, *EXT = '.c' + + 'foo.tab' -> *BASE = 'foo.tab', *TAB = NULL, *EXT = '.tab' + + 'foo_tab' -> *BASE = 'foo_tab', *TAB = NULL, *EXT = NULL + + 'foo' -> *BASE = 'foo', *TAB = NULL, *EXT = NULL. */ + +static void +file_name_split (const char *file_name, + const char **base, const char **tab, const char **ext) +{ + *base = last_component (file_name); + + /* Look for the extension, i.e., look for the last dot. */ + *ext = strrchr (*base, '.'); + *tab = NULL; + + /* If there is an extension, check if there is a `.tab' part right + before. */ + if (*ext) + { + size_t baselen = *ext - *base; + size_t dottablen = 4; + if (dottablen < baselen + && (strncmp (*ext - dottablen, ".tab", dottablen) == 0 + || strncmp (*ext - dottablen, "_tab", dottablen) == 0)) + *tab = *ext - dottablen; + } +} + + +static void +compute_file_name_parts (void) +{ + const char *base, *tab, *ext; + + /* Compute ALL_BUT_EXT and ALL_BUT_TAB_EXT from SPEC_OUTFILE + or GRAMMAR_FILE. + + The precise -o name will be used for FTABLE. For other output + files, remove the ".c" or ".tab.c" suffix. */ + if (spec_outfile) + { + file_name_split (spec_outfile, &base, &tab, &ext); + dir_prefix = xstrndup (spec_outfile, base - spec_outfile); + + /* ALL_BUT_EXT goes up the EXT, excluding it. */ + all_but_ext = + xstrndup (spec_outfile, + (strlen (spec_outfile) - (ext ? strlen (ext) : 0))); + + /* ALL_BUT_TAB_EXT goes up to TAB, excluding it. */ + all_but_tab_ext = + xstrndup (spec_outfile, + (strlen (spec_outfile) + - (tab ? strlen (tab) : (ext ? strlen (ext) : 0)))); + + if (ext) + compute_exts_from_src (ext); + } + else + { + file_name_split (grammar_file, &base, &tab, &ext); + + if (spec_file_prefix) + { + /* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT = `foo'. */ + dir_prefix = + xstrndup (spec_file_prefix, + last_component (spec_file_prefix) - spec_file_prefix); + all_but_tab_ext = xstrdup (spec_file_prefix); + } + else if (yacc_flag) + { + /* If --yacc, then the output is `y.tab.c'. */ + dir_prefix = xstrdup (""); + all_but_tab_ext = xstrdup ("y"); + } + else + { + /* Otherwise, ALL_BUT_TAB_EXT is computed from the input + grammar: `foo/bar.yy' => `bar'. */ + dir_prefix = xstrdup (""); + all_but_tab_ext = + xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0))); + } + + if (language->add_tab) + all_but_ext = concat2 (all_but_tab_ext, TAB_EXT); + else + all_but_ext = xstrdup (all_but_tab_ext); + + /* Compute the extensions from the grammar file name. */ + if (ext && !yacc_flag) + compute_exts_from_gf (ext); + } +} + + +/* Compute the output file names. Warn if we detect conflicting + outputs to the same file. */ + +void +compute_output_file_names (void) +{ + compute_file_name_parts (); + + /* If not yet done. */ + if (!src_extension) + src_extension = xstrdup (".c"); + if (!header_extension) + header_extension = xstrdup (".h"); + + parser_file_name = + (spec_outfile + ? xstrdup (spec_outfile) + : concat2 (all_but_ext, src_extension)); + + if (defines_flag) + { + if (! spec_defines_file) + spec_defines_file = concat2 (all_but_ext, header_extension); + } + + if (graph_flag) + { + if (! spec_graph_file) + spec_graph_file = concat2 (all_but_tab_ext, ".dot"); + output_file_name_check (spec_graph_file); + } + + if (xml_flag) + { + if (! spec_xml_file) + spec_xml_file = concat2 (all_but_tab_ext, ".xml"); + output_file_name_check (spec_xml_file); + } + + if (report_flag) + { + if (!spec_verbose_file) + spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT); + output_file_name_check (spec_verbose_file); + } + + free (all_but_tab_ext); + free (src_extension); + free (header_extension); +} + +void +output_file_name_check (char const *file_name) +{ + if (0 == strcmp (file_name, grammar_file)) + fatal (_("refusing to overwrite the input file %s"), quote (file_name)); + { + int i; + for (i = 0; i < file_names_count; i++) + if (0 == strcmp (file_names[i], file_name)) + warn (_("conflicting outputs to file %s"), quote (file_name)); + } + file_names = xnrealloc (file_names, ++file_names_count, sizeof *file_names); + file_names[file_names_count-1] = xstrdup (file_name); +} + +void +output_file_names_free (void) +{ + free (all_but_ext); + free (spec_verbose_file); + free (spec_graph_file); + free (spec_xml_file); + free (spec_defines_file); + free (parser_file_name); + free (dir_prefix); + { + int i; + for (i = 0; i < file_names_count; i++) + free (file_names[i]); + } + free (file_names); +} diff --git a/src/files.h b/src/files.h new file mode 100644 index 0000000..3a72193 --- /dev/null +++ b/src/files.h @@ -0,0 +1,71 @@ +/* File names and variables for bison, + + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2006, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef FILES_H_ +# define FILES_H_ + +# include "uniqstr.h" + +/* File name specified with -o for the output file, or 0 if no -o. */ +extern char const *spec_outfile; + +/* File name for the parser (i.e., the one above, or its default.) */ +extern char *parser_file_name; + +/* Symbol prefix specified with -p, or 0 if no -p. */ +extern const char *spec_name_prefix; + +/* File name prefix specified with -b, or 0 if no -b. */ +extern char const *spec_file_prefix; + +/* --verbose. */ +extern char *spec_verbose_file; + +/* File name specified for the output graph. */ +extern char *spec_graph_file; + +/* File name specified for the xml output. */ +extern char *spec_xml_file; + +/* File name specified with --defines. */ +extern char *spec_defines_file; + +/* Directory prefix of output file names. */ +extern char *dir_prefix; + +/* The file name as given on the command line. + Not named "input_file" because Flex uses this name for an argument, + and therefore GCC warns about a name clash. */ +extern uniqstr grammar_file; + +/* The current file name. Might change with %include, or with #line. */ +extern uniqstr current_file; + +/* The computed base for output file names. */ +extern char *all_but_ext; + +void compute_output_file_names (void); +void output_file_names_free (void); +void output_file_name_check (char const *file_name); + +FILE *xfopen (const char *name, const char *mode); +void xfclose (FILE *ptr); + +#endif /* !FILES_H_ */ diff --git a/src/flex-scanner.h b/src/flex-scanner.h new file mode 100644 index 0000000..ffa5191 --- /dev/null +++ b/src/flex-scanner.h @@ -0,0 +1,88 @@ +/* Common parts between scan-code.l, scan-gram.l, and scan-skel.l. + + Copyright (C) 2006 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef FLEX_PREFIX +# error "FLEX_PREFIX not defined" +#endif + +/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ +int FLEX_PREFIX (get_lineno) (void); +FILE *FLEX_PREFIX (get_in) (void); +FILE *FLEX_PREFIX (get_out) (void); +int FLEX_PREFIX (get_leng) (void); +char *FLEX_PREFIX (get_text) (void); +void FLEX_PREFIX (set_lineno) (int); +void FLEX_PREFIX (set_in) (FILE *); +void FLEX_PREFIX (set_out) (FILE *); +int FLEX_PREFIX (get_debug) (void); +void FLEX_PREFIX (set_debug) (int); +int FLEX_PREFIX (lex_destroy) (void); + +#define last_string FLEX_PREFIX (last_string) + +/* It seems to be a nice "feature" of Flex that one cannot use yytext, + yyleng etc. when a prefix is given, since there is no longer a + #define, but rather the token is actually changed in the output. + However, this is not true for Flex 2.5.4. */ +#ifndef yyleng +# define yyleng FLEX_PREFIX (leng) +#endif +#ifndef yytext +# define yytext FLEX_PREFIX (text) +#endif + +/* Non-reentrant scanners generated by Flex 2.5.9 and later (and some earlier + versions according to the Flex manual) leak memory if yylex_destroy is not + invoked. However, yylex_destroy is not defined before Flex 2.5.9, so give + an implementation here that at least appears to work with Flex 2.5.4. */ +#if !defined(YY_FLEX_MAJOR_VERSION) || YY_FLEX_MAJOR_VERSION < 2 \ + || (YY_FLEX_MAJOR_VERSION == 2 \ + && (!defined(YY_FLEX_MINOR_VERSION) || YY_FLEX_MINOR_VERSION < 5 \ + || (YY_FLEX_MINOR_VERSION == 5 \ + && (!defined(YY_FLEX_SUBMINOR_VERSION) \ + || YY_FLEX_SUBMINOR_VERSION < 9)))) +# define yylex_destroy() yy_delete_buffer (YY_CURRENT_BUFFER) +#endif + +/* OBSTACK_FOR_STRING -- Used to store all the characters that we need to + keep (to construct ID, STRINGS etc.). Use the following macros to + use it. + + Use STRING_GROW to append what has just been matched, and + STRING_FINISH to end the string (it puts the ending 0). + STRING_FINISH also stores this string in LAST_STRING, which can be + used, and which is used by STRING_FREE to free the last string. */ + +#ifndef FLEX_NO_OBSTACK + +static struct obstack obstack_for_string; + +#define STRING_GROW \ + obstack_grow (&obstack_for_string, yytext, yyleng) + +#define STRING_FINISH \ + do { \ + obstack_1grow (&obstack_for_string, '\0'); \ + last_string = obstack_finish (&obstack_for_string); \ + } while (0) + +#define STRING_FREE \ + obstack_free (&obstack_for_string, last_string) + +#endif diff --git a/src/getargs.c b/src/getargs.c new file mode 100644 index 0000000..f36f25b --- /dev/null +++ b/src/getargs.c @@ -0,0 +1,626 @@ +/* Parse command line arguments for Bison. + + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" +#include "output.h" + +#include +#include +#include +#include + +/* Hack to get to declare getopt with a prototype. */ +#if lint && ! defined __GNU_LIBRARY__ +# define __GNU_LIBRARY__ +# define HACK_FOR___GNU_LIBRARY___PROTOTYPE 1 +#endif + +#include + +#ifdef HACK_FOR___GNU_LIBRARY___PROTOTYPE +# undef __GNU_LIBRARY__ +# undef HACK_FOR___GNU_LIBRARY___PROTOTYPE +#endif + +#include "complain.h" +#include "files.h" +#include "getargs.h" +#include "uniqstr.h" + +bool debug_flag; +bool defines_flag; +bool graph_flag; +bool xml_flag; +bool locations_flag; +bool no_lines_flag; +bool token_table_flag; +bool yacc_flag; /* for -y */ + +bool error_verbose = false; + +bool nondeterministic_parser = false; +bool glr_parser = false; + +int report_flag = report_none; +int trace_flag = trace_none; +int warnings_flag = warnings_none; + +static struct bison_language const valid_languages[] = { + { "c", "c-skel.m4", ".c", ".h", true }, + { "c++", "c++-skel.m4", ".cc", ".hh", true }, + { "java", "java-skel.m4", ".java", ".java", false }, + { "", "", "", "", false } +}; + +int skeleton_prio = default_prio; +const char *skeleton = NULL; +int language_prio = default_prio; +struct bison_language const *language = &valid_languages[0]; +const char *include = NULL; + +char *program_name; + + +/** Decode an option's set of keys. + * + * \param option option being decoded. + * \param keys array of valid subarguments. + * \param values array of corresponding (int) values. + * \param flags the flags to update + * \param args colon separated list of effective subarguments to decode. + * If 0, then activate all the flags. + * + * The special value 0 resets the flags to 0. + */ +static void +flags_argmatch (const char *option, + const char * const keys[], const int values[], + int *flags, char *args) +{ + if (args) + { + args = strtok (args, ","); + while (args) + { + int value = XARGMATCH (option, args, keys, values); + if (value == 0) + *flags = 0; + else + *flags |= value; + args = strtok (NULL, ","); + } + } + else + *flags = ~0; +} + +/** Decode a set of sub arguments. + * + * \param FlagName the flag familly to update. + * \param Args the effective sub arguments to decode. + * + * \arg FlagName_args the list of keys. + * \arg FlagName_types the list of values. + * \arg FlagName_flag the flag to update. + */ +#define FLAGS_ARGMATCH(FlagName, Args) \ + flags_argmatch ("--" #FlagName, FlagName ## _args, FlagName ## _types, \ + &FlagName ## _flag, Args) + + +/*----------------------. +| --report's handling. | +`----------------------*/ + +static const char * const report_args[] = +{ + /* In a series of synonyms, present the most meaningful first, so + that argmatch_valid be more readable. */ + "none", + "state", "states", + "itemset", "itemsets", + "lookahead", "lookaheads", "look-ahead", + "solved", + "all", + 0 +}; + +static const int report_types[] = +{ + report_none, + report_states, report_states, + report_states | report_itemsets, report_states | report_itemsets, + report_states | report_lookahead_tokens, + report_states | report_lookahead_tokens, + report_states | report_lookahead_tokens, + report_states | report_solved_conflicts, + report_all +}; + +ARGMATCH_VERIFY (report_args, report_types); + + +/*---------------------. +| --trace's handling. | +`---------------------*/ + +static const char * const trace_args[] = +{ + /* In a series of synonyms, present the most meaningful first, so + that argmatch_valid be more readable. */ + "none - no traces", + "scan - grammar scanner traces", + "parse - grammar parser traces", + "automaton - construction of the automaton", + "bitsets - use of bitsets", + "grammar - reading, reducing the grammar", + "resource - memory consumption (where available)", + "sets - grammar sets: firsts, nullable etc.", + "tools - m4 invocation", + "m4 - m4 traces", + "skeleton - skeleton postprocessing", + "time - time consumption", + "all - all of the above", + 0 +}; + +static const int trace_types[] = +{ + trace_none, + trace_scan, + trace_parse, + trace_automaton, + trace_bitsets, + trace_grammar, + trace_resource, + trace_sets, + trace_tools, + trace_m4, + trace_skeleton, + trace_time, + trace_all +}; + +ARGMATCH_VERIFY (trace_args, trace_types); + + +/*------------------------. +| --warnings's handling. | +`------------------------*/ + +static const char * const warnings_args[] = +{ + /* In a series of synonyms, present the most meaningful first, so + that argmatch_valid be more readable. */ + "none - no warnings", + "midrule-values - unset or unused midrule values", + "yacc - incompatibilities with POSIX YACC", + "all - all of the above", + "error - warnings are errors", + 0 +}; + +static const int warnings_types[] = +{ + warnings_none, + warnings_midrule_values, + warnings_yacc, + warnings_all, + warnings_error +}; + +ARGMATCH_VERIFY (warnings_args, warnings_types); + + +/*-------------------------------------------. +| Display the help message and exit STATUS. | +`-------------------------------------------*/ + +static void usage (int) ATTRIBUTE_NORETURN; + +static void +usage (int status) +{ + if (status != 0) + fprintf (stderr, _("Try `%s --help' for more information.\n"), + program_name); + else + { + printf (_("Usage: %s [OPTION]... FILE\n"), program_name); + fputs (_("\ +Generate LALR(1) and GLR parsers.\n\ +\n\ +"), stdout); + + fputs (_("\ +Mandatory arguments to long options are mandatory for short options too.\n\ +"), stdout); + fputs (_("\ +The same is true for optional arguments.\n\ +"), stdout); + + fputs (_("\ +\n\ +Operation modes:\n\ + -h, --help display this help and exit\n\ + -V, --version output version information and exit\n\ + --print-localedir output directory containing locale-dependent data\n\ + --print-datadir output directory containing skeletons and XSLT\n\ + -y, --yacc emulate POSIX Yacc\n\ + -W, --warnings=[CATEGORY] report the warnings falling in CATEGORY\n\ +\n\ +"), stdout); + + fputs (_("\ +Parser:\n\ + -L, --language=LANGUAGE specify the output programming language\n\ + (this is an experimental feature)\n\ + -S, --skeleton=FILE specify the skeleton to use\n\ + -t, --debug instrument the parser for debugging\n\ + --locations enable locations computation\n\ + -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\ + -l, --no-lines don't generate `#line' directives\n\ + -k, --token-table include a table of token names\n\ +\n\ +"), stdout); + + /* Keep -d and --defines separate so that ../build-aux/cross-options.pl + * won't assume that -d also takes an argument. */ + fputs (_("\ +Output:\n\ + --defines[=FILE] also produce a header file\n\ + -d likewise but cannot specify FILE (for POSIX Yacc)\n\ + -r, --report=THINGS also produce details on the automaton\n\ + --report-file=FILE write report to FILE\n\ + -v, --verbose same as `--report=state'\n\ + -b, --file-prefix=PREFIX specify a PREFIX for output files\n\ + -o, --output=FILE leave output to FILE\n\ + -g, --graph[=FILE] also output a graph of the automaton\n\ + -x, --xml[=FILE] also output an XML report of the automaton\n\ + (the XML schema is experimental)\n\ +\n\ +"), stdout); + + fputs (_("\ +Warning categories include:\n\ + `midrule-values' unset or unused midrule values\n\ + `yacc' incompatibilities with POSIX YACC\n\ + `all' all the warnings\n\ + `no-CATEGORY' turn off warnings in CATEGORY\n\ + `none' turn off all the warnings\n\ + `error' treat warnings as errors\n\ +\n\ +"), stdout); + + fputs (_("\ +THINGS is a list of comma separated words that can include:\n\ + `state' describe the states\n\ + `itemset' complete the core item sets with their closure\n\ + `lookahead' explicitly associate lookahead tokens to items\n\ + `solved' describe shift/reduce conflicts solving\n\ + `all' include all the above information\n\ + `none' disable the report\n\ +"), stdout); + + printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT); + } + + exit (status); +} + + +/*------------------------------. +| Display the version message. | +`------------------------------*/ + +static void +version (void) +{ + /* Some efforts were made to ease the translators' task, please + continue. */ + printf (_("bison (GNU Bison) %s"), VERSION); + putc ('\n', stdout); + fputs (_("Written by Robert Corbett and Richard Stallman.\n"), stdout); + putc ('\n', stdout); + + fprintf (stdout, + _("Copyright (C) %d Free Software Foundation, Inc.\n"), + PACKAGE_COPYRIGHT_YEAR); + + fputs (_("\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), + stdout); +} + + +/*-------------------------------------. +| --skeleton and --language handling. | +`--------------------------------------*/ + +void +skeleton_arg (char const *arg, int prio, location const *loc) +{ + if (prio < skeleton_prio) + { + skeleton_prio = prio; + skeleton = arg; + } + else if (prio == skeleton_prio) + { + char const *msg = + _("multiple skeleton declarations are invalid"); + if (loc) + complain_at (*loc, msg); + else + complain (msg); + } +} + +void +language_argmatch (char const *arg, int prio, location const *loc) +{ + char const *msg; + + if (prio < language_prio) + { + int i; + for (i = 0; valid_languages[i].language[0]; i++) + if (c_strcasecmp (arg, valid_languages[i].language) == 0) + { + language_prio = prio; + language = &valid_languages[i]; + return; + } + msg = _("invalid language `%s'"); + } + else if (language_prio == prio) + msg = _("multiple language declarations are invalid"); + else + return; + + if (loc) + complain_at (*loc, msg, arg); + else + complain (msg, arg); +} + +/*----------------------. +| Process the options. | +`----------------------*/ + +/* Shorts options. + Should be computed from long_options. */ +static char const short_options[] = + "L:" + "S:" + "T::" + "V" + "W::" + "b:" + "d" + "e" + "g::" + "h" + "k" + "l" + "n" + "o:" + "p:" + "r:" + "t" + "v" + "x::" + "y" + ; + +/* Values for long options that do not have single-letter equivalents. */ +enum +{ + LOCATIONS_OPTION = CHAR_MAX + 1, + PRINT_LOCALEDIR_OPTION, + PRINT_DATADIR_OPTION, + REPORT_FILE_OPTION +}; + +static struct option const long_options[] = +{ + /* Operation modes. */ + { "help", no_argument, 0, 'h' }, + { "version", no_argument, 0, 'V' }, + { "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION }, + { "print-datadir", no_argument, 0, PRINT_DATADIR_OPTION }, + { "warnings", optional_argument, 0, 'W' }, + + /* Parser. */ + { "name-prefix", required_argument, 0, 'p' }, + { "include", required_argument, 0, 'I' }, + + /* Output. */ + { "file-prefix", required_argument, 0, 'b' }, + { "output", required_argument, 0, 'o' }, + { "output-file", required_argument, 0, 'o' }, + { "graph", optional_argument, 0, 'g' }, + { "xml", optional_argument, 0, 'x' }, + { "report", required_argument, 0, 'r' }, + { "report-file", required_argument, 0, REPORT_FILE_OPTION }, + { "verbose", no_argument, 0, 'v' }, + + /* Hidden. */ + { "trace", optional_argument, 0, 'T' }, + + /* Output. */ + { "defines", optional_argument, 0, 'd' }, + + /* Operation modes. */ + { "fixed-output-files", no_argument, 0, 'y' }, + { "yacc", no_argument, 0, 'y' }, + + /* Parser. */ + { "debug", no_argument, 0, 't' }, + { "locations", no_argument, 0, LOCATIONS_OPTION }, + { "no-lines", no_argument, 0, 'l' }, + { "raw", no_argument, 0, 0 }, + { "skeleton", required_argument, 0, 'S' }, + { "language", required_argument, 0, 'L' }, + { "token-table", no_argument, 0, 'k' }, + + {0, 0, 0, 0} +}; + +/* Under DOS, there is no difference on the case. This can be + troublesome when looking for `.tab' etc. */ +#ifdef MSDOS +# define AS_FILE_NAME(File) (strlwr (File), (File)) +#else +# define AS_FILE_NAME(File) (File) +#endif + +void +getargs (int argc, char *argv[]) +{ + int c; + + while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) + != -1) + switch (c) + { + case 0: + /* Certain long options cause getopt_long to return 0. */ + break; + + case 'd': + /* Here, the -d and --defines options are differentiated. */ + defines_flag = true; + if (optarg) + spec_defines_file = xstrdup (AS_FILE_NAME (optarg)); + break; + + case 'I': + include = AS_FILE_NAME (optarg); + break; + + case 'L': + language_argmatch (optarg, command_line_prio, NULL); + break; + + case 'S': + skeleton_arg (AS_FILE_NAME (optarg), command_line_prio, NULL); + break; + + case 'T': + FLAGS_ARGMATCH (trace, optarg); + break; + + case 'V': + version (); + exit (EXIT_SUCCESS); + + case 'W': + if (optarg) + FLAGS_ARGMATCH (warnings, optarg); + else + warnings_flag |= warnings_all; + break; + + case 'b': + spec_file_prefix = AS_FILE_NAME (optarg); + break; + + case 'g': + graph_flag = true; + if (optarg) + spec_graph_file = xstrdup (AS_FILE_NAME (optarg)); + break; + + case 'h': + usage (EXIT_SUCCESS); + + case 'k': + token_table_flag = true; + break; + + case 'l': + no_lines_flag = true; + break; + + case 'o': + spec_outfile = AS_FILE_NAME (optarg); + break; + + case 'p': + spec_name_prefix = optarg; + break; + + case 'r': + FLAGS_ARGMATCH (report, optarg); + break; + + case 't': + debug_flag = true; + break; + + case 'v': + report_flag |= report_states; + break; + + case 'x': + xml_flag = true; + if (optarg) + spec_xml_file = xstrdup (AS_FILE_NAME (optarg)); + break; + + case 'y': + yacc_flag = true; + break; + + case LOCATIONS_OPTION: + locations_flag = true; + break; + + case PRINT_LOCALEDIR_OPTION: + printf ("%s\n", LOCALEDIR); + exit (EXIT_SUCCESS); + + case PRINT_DATADIR_OPTION: + printf ("%s\n", compute_pkgdatadir ()); + exit (EXIT_SUCCESS); + + case REPORT_FILE_OPTION: + spec_verbose_file = xstrdup (AS_FILE_NAME (optarg)); + break; + + default: + usage (EXIT_FAILURE); + } + + if (argc - optind != 1) + { + if (argc - optind < 1) + error (0, 0, _("missing operand after `%s'"), argv[argc - 1]); + else + error (0, 0, _("extra operand `%s'"), argv[optind + 1]); + usage (EXIT_FAILURE); + } + + current_file = grammar_file = uniqstr_new (argv[optind]); +} diff --git a/src/getargs.h b/src/getargs.h new file mode 100644 index 0000000..eb7f448 --- /dev/null +++ b/src/getargs.h @@ -0,0 +1,141 @@ +/* Parse command line arguments for bison. + + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef GETARGS_H_ +# define GETARGS_H_ + +#include "location.h" + +extern char *program_name; +enum { command_line_prio, grammar_prio, default_prio }; + +/* flags set by % directives */ + +/* for -S */ +extern char const *skeleton; +extern int skeleton_prio; + +/* for -I */ +extern char const *include; + +extern bool debug_flag; /* for -t */ +extern bool defines_flag; /* for -d */ +extern bool graph_flag; /* for -g */ +extern bool xml_flag; /* for -x */ +extern bool locations_flag; +extern bool no_lines_flag; /* for -l */ +extern bool token_table_flag; /* for -k */ +extern bool yacc_flag; /* for -y */ + +extern bool error_verbose; + + +/* GLR_PARSER is true if the input file says to use the GLR + (Generalized LR) parser, and to output some additional information + used by the GLR algorithm. */ + +extern bool glr_parser; + +/* NONDETERMINISTIC_PARSER is true iff conflicts are accepted. This + is used by the GLR parser, and might be used in BackTracking + parsers too. */ + +extern bool nondeterministic_parser; + + +/* --language. */ +struct bison_language +{ + char language[sizeof "Java"]; + char skeleton[sizeof "java-skel.m4"]; + char src_extension[sizeof ".java"]; + char header_extension[sizeof ".java"]; + bool add_tab; +}; + +extern int language_prio; +extern struct bison_language const *language; + +/*-----------. +| --report. | +`-----------*/ + +enum report + { + report_none = 0, + report_states = 1 << 0, + report_itemsets = 1 << 1, + report_lookahead_tokens = 1 << 2, + report_solved_conflicts = 1 << 3, + report_all = ~0 + }; +/** What appears in the *.output file. */ +extern int report_flag; + +/*----------. +| --trace. | +`----------*/ +enum trace + { + trace_none = 0, /**< No traces. */ + trace_scan = 1 << 0, /**< Grammar scanner traces. */ + trace_parse = 1 << 1, /**< Grammar parser traces. */ + trace_resource = 1 << 2, /**< Memory allocation. */ + trace_sets = 1 << 3, /**< Grammar sets: firsts, nullable etc. */ + trace_bitsets = 1 << 4, /**< Use of bitsets. */ + trace_tools = 1 << 5, /**< m4 invocation. */ + trace_automaton = 1 << 6, /**< Construction of the automaton. */ + trace_grammar = 1 << 7, /**< Reading, reducing the grammar. */ + trace_time = 1 << 8, /**< Time consumption. */ + trace_skeleton = 1 << 9, /**< Skeleton postprocessing. */ + trace_m4 = 1 << 10, /**< M4 traces. */ + trace_all = ~0 /**< All of the above. */ + }; +/** What debug items bison displays during its run. */ +extern int trace_flag; + +/*-------------. +| --warnings. | +`-------------*/ + +enum warnings + { + warnings_none = 0, /**< Issue no warnings. */ + warnings_error = 1 << 0, /**< Warnings are treated as errors. */ + warnings_midrule_values = 1 << 1, /**< Unset or unused midrule values. */ + warnings_yacc = 1 << 2, /**< POSIXME. */ + warnings_all = ~warnings_error /**< All above warnings. */ + }; +/** What warnings are issued. */ +extern int warnings_flag; + + +/** Process the command line arguments. + * + * \param argc size of \a argv + * \param argv list of arguments. + */ +void getargs (int argc, char *argv[]); + +/* Used by parse-gram.y. */ +void language_argmatch (char const *arg, int prio, location const *loc); +void skeleton_arg (const char *arg, int prio, location const *loc); + +#endif /* !GETARGS_H_ */ diff --git a/src/gram.c b/src/gram.c new file mode 100644 index 0000000..6b9eda1 --- /dev/null +++ b/src/gram.c @@ -0,0 +1,326 @@ +/* Allocate input grammar variables for Bison. + + Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003, 2005, 2006 + 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include + +#include "gram.h" +#include "reader.h" +#include "reduce.h" +#include "symtab.h" +#include "print-xml.h" + +/* Comments for these variables are in gram.h. */ + +item_number *ritem = NULL; +unsigned int nritems = 0; + +rule *rules = NULL; +rule_number nrules = 0; + +symbol **symbols = NULL; +int nsyms = 0; +int ntokens = 1; +int nvars = 0; + +symbol_number *token_translations = NULL; + +int max_user_token_number = 256; + +bool +rule_useful_in_grammar_p (rule *r) +{ + return r->number < nrules; +} + +bool +rule_useless_in_grammar_p (rule *r) +{ + return !rule_useful_in_grammar_p (r); +} + +bool +rule_useless_in_parser_p (rule *r) +{ + return !r->useful && rule_useful_in_grammar_p (r); +} + +void +rule_lhs_print (rule *r, symbol *previous_lhs, FILE *out) +{ + fprintf (out, " %3d ", r->number); + if (previous_lhs != r->lhs) + { + fprintf (out, "%s:", r->lhs->tag); + } + else + { + int n; + for (n = strlen (previous_lhs->tag); n > 0; --n) + fputc (' ', out); + fputc ('|', out); + } +} + +void +rule_lhs_print_xml (rule *r, FILE *out, int level) +{ + xml_printf (out, level, "%s", r->lhs->tag); +} + +int +rule_rhs_length (rule *r) +{ + int res = 0; + item_number *rhsp; + for (rhsp = r->rhs; *rhsp >= 0; ++rhsp) + ++res; + return res; +} + +void +rule_rhs_print (rule *r, FILE *out) +{ + if (*r->rhs >= 0) + { + item_number *rp; + for (rp = r->rhs; *rp >= 0; rp++) + fprintf (out, " %s", symbols[*rp]->tag); + fputc ('\n', out); + } + else + { + fprintf (out, " /* %s */\n", _("empty")); + } +} + +static void +rule_rhs_print_xml (rule *r, FILE *out, int level) +{ + if (*r->rhs >= 0) + { + item_number *rp; + xml_puts (out, level, ""); + for (rp = r->rhs; *rp >= 0; rp++) + xml_printf (out, level + 1, "%s", + xml_escape (symbols[*rp]->tag)); + xml_puts (out, level, ""); + } + else + { + xml_puts (out, level, ""); + xml_puts (out, level + 1, ""); + xml_puts (out, level, ""); + } +} + +void +rule_print (rule *r, FILE *out) +{ + fprintf (out, "%s:", r->lhs->tag); + rule_rhs_print (r, out); +} + +void +ritem_print (FILE *out) +{ + unsigned int i; + fputs ("RITEM\n", out); + for (i = 0; i < nritems; ++i) + if (ritem[i] >= 0) + fprintf (out, " %s", symbols[ritem[i]]->tag); + else + fprintf (out, " (rule %d)\n", item_number_as_rule_number (ritem[i])); + fputs ("\n\n", out); +} + +size_t +ritem_longest_rhs (void) +{ + int max = 0; + rule_number r; + + for (r = 0; r < nrules; ++r) + { + int length = rule_rhs_length (&rules[r]); + if (length > max) + max = length; + } + + return max; +} + +void +grammar_rules_partial_print (FILE *out, const char *title, + rule_filter filter) +{ + rule_number r; + bool first = true; + symbol *previous_lhs = NULL; + + /* rule # : LHS -> RHS */ + for (r = 0; r < nrules + nuseless_productions; r++) + { + if (filter && !filter (&rules[r])) + continue; + if (first) + fprintf (out, "%s\n\n", title); + else if (previous_lhs && previous_lhs != rules[r].lhs) + fputc ('\n', out); + first = false; + rule_lhs_print (&rules[r], previous_lhs, out); + rule_rhs_print (&rules[r], out); + previous_lhs = rules[r].lhs; + } + if (!first) + fputs ("\n\n", out); +} + +void +grammar_rules_print (FILE *out) +{ + grammar_rules_partial_print (out, _("Grammar"), rule_useful_in_grammar_p); +} + +void +grammar_rules_print_xml (FILE *out, int level) +{ + rule_number r; + bool first = true; + + for (r = 0; r < nrules + nuseless_productions; r++) + { + if (first) + xml_puts (out, level + 1, ""); + first = false; + { + char const *usefulness; + if (rule_useless_in_grammar_p (&rules[r])) + usefulness = "useless-in-grammar"; + else if (rule_useless_in_parser_p (&rules[r])) + usefulness = "useless-in-parser"; + else + usefulness = "useful"; + xml_indent (out, level + 2); + fprintf (out, "tag); + fputs (">\n", out); + } + rule_lhs_print_xml (&rules[r], out, level + 3); + rule_rhs_print_xml (&rules[r], out, level + 3); + xml_puts (out, level + 2, ""); + } + if (!first) + xml_puts (out, level + 1, ""); + else + xml_puts (out, level + 1, ""); +} + +void +grammar_dump (FILE *out, const char *title) +{ + fprintf (out, "%s\n\n", title); + fprintf (out, + "ntokens = %d, nvars = %d, nsyms = %d, nrules = %d, nritems = %d\n\n", + ntokens, nvars, nsyms, nrules, nritems); + + + fprintf (out, "Variables\n---------\n\n"); + { + symbol_number i; + fprintf (out, "Value Sprec Sassoc Tag\n"); + + for (i = ntokens; i < nsyms; i++) + fprintf (out, "%5d %5d %5d %s\n", + i, + symbols[i]->prec, symbols[i]->assoc, + symbols[i]->tag); + fprintf (out, "\n\n"); + } + + fprintf (out, "Rules\n-----\n\n"); + { + rule_number i; + fprintf (out, "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n"); + for (i = 0; i < nrules + nuseless_productions; i++) + { + rule *rule_i = &rules[i]; + item_number *rp = NULL; + unsigned int rhs_itemno = rule_i->rhs - ritem; + unsigned int rhs_count = 0; + /* Find the last RHS index in ritems. */ + for (rp = rule_i->rhs; *rp >= 0; ++rp) + ++rhs_count; + fprintf (out, "%3d (%2d, %2d, %2d, %2u-%2u) %2d ->", + i, + rule_i->prec ? rule_i->prec->prec : 0, + rule_i->prec ? rule_i->prec->assoc : 0, + rule_i->useful, + rhs_itemno, + rhs_itemno + rhs_count - 1, + rule_i->lhs->number); + /* Dumped the RHS. */ + for (rp = rule_i->rhs; *rp >= 0; rp++) + fprintf (out, " %3d", *rp); + fprintf (out, " [%d]\n", item_number_as_rule_number (*rp)); + } + } + fprintf (out, "\n\n"); + + fprintf (out, "Rules interpreted\n-----------------\n\n"); + { + rule_number r; + for (r = 0; r < nrules + nuseless_productions; r++) + { + fprintf (out, "%-5d ", r); + rule_print (&rules[r], out); + } + } + fprintf (out, "\n\n"); +} + +void +grammar_rules_useless_report (const char *message) +{ + rule_number r; + for (r = 0; r < nrules ; ++r) + if (!rules[r].useful) + { + location_print (stderr, rules[r].location); + fprintf (stderr, ": %s: %s: ", _("warning"), message); + rule_print (&rules[r], stderr); + } +} + +void +grammar_free (void) +{ + if (ritem) + free (ritem - 1); + free (rules); + free (token_translations); + /* Free the symbol table data structure. */ + symbols_free (); + free_merger_functions (); +} diff --git a/src/gram.h b/src/gram.h new file mode 100644 index 0000000..8e997ec --- /dev/null +++ b/src/gram.h @@ -0,0 +1,275 @@ +/* Data definitions for internal representation of Bison's input. + + Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002, 2003, 2004, 2005, 2006 + 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef GRAM_H_ +# define GRAM_H_ + +/* Representation of the grammar rules: + + NTOKENS is the number of tokens, and NVARS is the number of + variables (nonterminals). NSYMS is the total number, ntokens + + nvars. + + Each symbol (either token or variable) receives a symbol number. + Numbers 0 to NTOKENS - 1 are for tokens, and NTOKENS to NSYMS - 1 + are for variables. Symbol number zero is the end-of-input token. + This token is counted in ntokens. The true number of token values + assigned is NTOKENS reduced by one for each alias declaration. + + The rules receive rule numbers 1 to NRULES in the order they are + written. More precisely Bison augments the grammar with the + initial rule, `$accept: START-SYMBOL $end', which is numbered 1, + all the user rules are 2, 3 etc. Each time a rule number is + presented to the user, we subtract 1, so *displayed* rule numbers + are 0, 1, 2... + + Internally, we cannot use the number 0 for a rule because for + instance RITEM stores both symbol (the RHS) and rule numbers: the + symbols are shorts >= 0, and rule number are stored negative. + Therefore 0 cannot be used, since it would be both the rule number + 0, and the token $end). + + Actions are accessed via the rule number. + + The rules themselves are described by several arrays: amongst which + RITEM, and RULES. + + RULES is an array of rules, whose members are: + + RULES[R].lhs -- the symbol of the left hand side of rule R. + + RULES[R].rhs -- the index in RITEM of the beginning of the portion + for rule R. + + RULES[R].prec -- the symbol providing the precedence level of R. + + RULES[R].precsym -- the symbol attached (via %prec) to give its + precedence to R. Of course, if set, it is equal to `prec', but we + need to distinguish one from the other when reducing: a symbol used + in a %prec is not useless. + + RULES[R].assoc -- the associativity of R. + + RULES[R].dprec -- the dynamic precedence level of R (for GLR + parsing). + + RULES[R].merger -- index of merging function for R (for GLR + parsing). + + RULES[R].line -- the line where R was defined. + + RULES[R].useful -- true iff the rule is used (i.e., false if thrown + away by reduce). + + The right hand side is stored as symbol numbers in a portion of + RITEM. + + The length of the portion is one greater than the number of symbols + in the rule's right hand side. The last element in the portion + contains minus R, which identifies it as the end of a portion and + says which rule it is for. + + The portions of RITEM come in order of increasing rule number. + NRITEMS is the total length of RITEM. Each element of RITEM is + called an "item" and its index in RITEM is an item number. + + Item numbers are used in the finite state machine to represent + places that parsing can get to. + + SYMBOLS[I]->prec records the precedence level of each symbol. + + Precedence levels are assigned in increasing order starting with 1 + so that numerically higher precedence values mean tighter binding + as they ought to. Zero as a symbol or rule's precedence means none + is assigned. + + Associativities are recorded similarly in SYMBOLS[I]->assoc. */ + +# include "location.h" +# include "symtab.h" + +# define ISTOKEN(i) ((i) < ntokens) +# define ISVAR(i) ((i) >= ntokens) + +extern int nsyms; +extern int ntokens; +extern int nvars; + +typedef int item_number; +#define ITEM_NUMBER_MAX INT_MAX +extern item_number *ritem; +extern unsigned int nritems; + +/* There is weird relationship between OT1H item_number and OTOH + symbol_number and rule_number: we store the latter in + item_number. symbol_number values are stored as-is, while + the negation of (rule_number + 1) is stored. + + Therefore, a symbol_number must be a valid item_number, and we + sometimes have to perform the converse transformation. */ + +static inline item_number +symbol_number_as_item_number (symbol_number sym) +{ + return sym; +} + +static inline symbol_number +item_number_as_symbol_number (item_number i) +{ + return i; +} + +static inline bool +item_number_is_symbol_number (item_number i) +{ + return i >= 0; +} + +/* Rule numbers. */ +typedef int rule_number; +#define RULE_NUMBER_MAX INT_MAX +extern rule_number nrules; + +static inline item_number +rule_number_as_item_number (rule_number r) +{ + return -1 - r; +} + +static inline rule_number +item_number_as_rule_number (item_number i) +{ + return -1 - i; +} + +static inline bool +item_number_is_rule_number (item_number i) +{ + return i < 0; +} + +/*--------. +| Rules. | +`--------*/ + +typedef struct +{ + /* The number of the rule in the source. It is usually the index in + RULES too, except if there are useless rules. */ + rule_number user_number; + + /* The index in RULES. Usually the rule number in the source, + except if some rules are useless. */ + rule_number number; + + symbol *lhs; + item_number *rhs; + + /* This symbol provides both the associativity, and the precedence. */ + symbol *prec; + + int dprec; + int merger; + + /* This symbol was attached to the rule via %prec. */ + symbol *precsym; + + location location; + bool useful; + + const char *action; + location action_location; +} rule; + +extern rule *rules; + +/* A function that selects a rule. */ +typedef bool (*rule_filter) (rule *); + +/* Return true IFF the rule has a `number' smaller than NRULES. That is, it is + useful in the grammar. */ +bool rule_useful_in_grammar_p (rule *r); + +/* Return true IFF the rule has a `number' higher than NRULES. That is, it is + useless in the grammar. */ +bool rule_useless_in_grammar_p (rule *r); + +/* Return true IFF the rule is not flagged as useful but is useful in the + grammar. In other words, it was discarded because of conflicts. */ +bool rule_useless_in_parser_p (rule *r); + +/* Print this rule's number and lhs on OUT. If a PREVIOUS_LHS was + already displayed (by a previous call for another rule), avoid + useless repetitions. */ +void rule_lhs_print (rule *r, symbol *previous_lhs, FILE *out); +void rule_lhs_print_xml (rule *r, FILE *out, int level); + +/* Return the length of the RHS. */ +int rule_rhs_length (rule *r); + +/* Print this rule's RHS on OUT. */ +void rule_rhs_print (rule *r, FILE *out); + +/* Print this rule on OUT. */ +void rule_print (rule *r, FILE *out); + + + + +/* Table of the symbols, indexed by the symbol number. */ +extern symbol **symbols; + +/* TOKEN_TRANSLATION -- a table indexed by a token number as returned + by the user's yylex routine, it yields the internal token number + used by the parser and throughout bison. */ +extern symbol_number *token_translations; +extern int max_user_token_number; + + + +/* Dump RITEM for traces. */ +void ritem_print (FILE *out); + +/* Return the size of the longest rule RHS. */ +size_t ritem_longest_rhs (void); + +/* Print the grammar's rules that match FILTER on OUT under TITLE. */ +void grammar_rules_partial_print (FILE *out, const char *title, + rule_filter filter); + +/* Print the grammar's useful rules on OUT. */ +void grammar_rules_print (FILE *out); +/* Print all of the grammar's rules with a "usefulness" attribute. */ +void grammar_rules_print_xml (FILE *out, int level); + +/* Dump the grammar. */ +void grammar_dump (FILE *out, const char *title); + +/* Report on STDERR the rules that are not flagged USEFUL, using the + MESSAGE (which can be `rule useless in grammar' when invoked after grammar + reduction, or `rule useless in parser due to conflicts' after conflicts + were taken into account). */ +void grammar_rules_useless_report (const char *message); + +/* Free the packed grammar. */ +void grammar_free (void); + +#endif /* !GRAM_H_ */ diff --git a/src/graphviz.c b/src/graphviz.c new file mode 100644 index 0000000..6454dc4 --- /dev/null +++ b/src/graphviz.c @@ -0,0 +1,64 @@ +/* Output Graphviz specification of a state machine generated by Bison. + + Copyright (C) 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +/* Written by Paul Eggert and Satya Kiran Popuri. */ + +#include +#include "system.h" + +#include + +#include "graphviz.h" + +/* Return an unambiguous printable representation for NAME, suitable + for C strings. Use slot 2 since the user may use slots 0 and 1. */ + +static char const * +quote (char const *name) +{ + return quotearg_n_style (2, c_quoting_style, name); +} + +void +start_graph (FILE *fout) +{ + fputs ("digraph Automaton {\n", fout); +} + +void +output_node (int id, char const *label, FILE *fout) +{ + fprintf (fout, " %d [label=%s]\n", id, quote (label)); +} + +void +output_edge (int source, int destination, char const *label, + char const *style, FILE *fout) +{ + fprintf (fout, " %d -> %d [style=%s", source, destination, style); + if (label) + fprintf (fout, " label=%s", quote (label)); + fputs ("]\n", fout); +} + +void +finish_graph (FILE *fout) +{ + fputs ("}\n", fout); +} diff --git a/src/graphviz.h b/src/graphviz.h new file mode 100644 index 0000000..1cf9422 --- /dev/null +++ b/src/graphviz.h @@ -0,0 +1,7 @@ +#include + +void start_graph (FILE *fout); +void output_node (int id, char const *label, FILE *fout); +void output_edge (int source, int destination, char const *label, + char const *style, FILE *fout); +void finish_graph (FILE *fout); diff --git a/src/lalr.c b/src/lalr.c new file mode 100644 index 0000000..a214dc5 --- /dev/null +++ b/src/lalr.c @@ -0,0 +1,490 @@ +/* Compute lookahead criteria for Bison. + + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + + +/* Compute how to make the finite state machine deterministic; find + which rules need lookahead in each state, and which lookahead + tokens they accept. */ + +#include +#include "system.h" + +#include +#include +#include + +#include "LR0.h" +#include "complain.h" +#include "derives.h" +#include "getargs.h" +#include "gram.h" +#include "lalr.h" +#include "nullable.h" +#include "reader.h" +#include "relation.h" +#include "symtab.h" + +goto_number *goto_map; +static goto_number ngotos; +state_number *from_state; +state_number *to_state; + +/* Linked list of goto numbers. */ +typedef struct goto_list +{ + struct goto_list *next; + goto_number value; +} goto_list; + + +/* LA is an NLA by NTOKENS matrix of bits. LA[l, i] is 1 if the rule + LArule[l] is applicable in the appropriate state when the next + token is symbol i. If LA[l, i] and LA[l, j] are both 1 for i != j, + it is a conflict. */ + +static bitsetv LA = NULL; +size_t nLA; + + +/* And for the famous F variable, which name is so descriptive that a + comment is hardly needed. . */ +static bitsetv F = NULL; + +static goto_number **includes; +static goto_list **lookback; + + + + +static void +set_goto_map (void) +{ + state_number s; + goto_number *temp_map; + + goto_map = xcalloc (nvars + 1, sizeof *goto_map); + temp_map = xnmalloc (nvars + 1, sizeof *temp_map); + + ngotos = 0; + for (s = 0; s < nstates; ++s) + { + transitions *sp = states[s]->transitions; + int i; + for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i) + { + ngotos++; + + /* Abort if (ngotos + 1) would overflow. */ + aver (ngotos != GOTO_NUMBER_MAXIMUM); + + goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++; + } + } + + { + goto_number k = 0; + int i; + for (i = ntokens; i < nsyms; i++) + { + temp_map[i - ntokens] = k; + k += goto_map[i - ntokens]; + } + + for (i = ntokens; i < nsyms; i++) + goto_map[i - ntokens] = temp_map[i - ntokens]; + + goto_map[nsyms - ntokens] = ngotos; + temp_map[nsyms - ntokens] = ngotos; + } + + from_state = xcalloc (ngotos, sizeof *from_state); + to_state = xcalloc (ngotos, sizeof *to_state); + + for (s = 0; s < nstates; ++s) + { + transitions *sp = states[s]->transitions; + int i; + for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i) + { + goto_number k = temp_map[TRANSITION_SYMBOL (sp, i) - ntokens]++; + from_state[k] = s; + to_state[k] = sp->states[i]->number; + } + } + + free (temp_map); +} + + + +/*----------------------------------------------------------. +| Map a state/symbol pair into its numeric representation. | +`----------------------------------------------------------*/ + +static goto_number +map_goto (state_number s0, symbol_number sym) +{ + goto_number high; + goto_number low; + goto_number middle; + state_number s; + + low = goto_map[sym - ntokens]; + high = goto_map[sym - ntokens + 1] - 1; + + for (;;) + { + aver (low <= high); + middle = (low + high) / 2; + s = from_state[middle]; + if (s == s0) + return middle; + else if (s < s0) + low = middle + 1; + else + high = middle - 1; + } +} + + +static void +initialize_F (void) +{ + goto_number **reads = xnmalloc (ngotos, sizeof *reads); + goto_number *edge = xnmalloc (ngotos + 1, sizeof *edge); + goto_number nedges = 0; + + goto_number i; + + F = bitsetv_create (ngotos, ntokens, BITSET_FIXED); + + for (i = 0; i < ngotos; i++) + { + state_number stateno = to_state[i]; + transitions *sp = states[stateno]->transitions; + + int j; + FOR_EACH_SHIFT (sp, j) + bitset_set (F[i], TRANSITION_SYMBOL (sp, j)); + + for (; j < sp->num; j++) + { + symbol_number sym = TRANSITION_SYMBOL (sp, j); + if (nullable[sym - ntokens]) + edge[nedges++] = map_goto (stateno, sym); + } + + if (nedges == 0) + reads[i] = NULL; + else + { + reads[i] = xnmalloc (nedges + 1, sizeof reads[i][0]); + memcpy (reads[i], edge, nedges * sizeof edge[0]); + reads[i][nedges] = END_NODE; + nedges = 0; + } + } + + relation_digraph (reads, ngotos, &F); + + for (i = 0; i < ngotos; i++) + free (reads[i]); + + free (reads); + free (edge); +} + + +static void +add_lookback_edge (state *s, rule *r, goto_number gotono) +{ + int ri = state_reduction_find (s, r); + goto_list *sp = xmalloc (sizeof *sp); + sp->next = lookback[(s->reductions->lookahead_tokens - LA) + ri]; + sp->value = gotono; + lookback[(s->reductions->lookahead_tokens - LA) + ri] = sp; +} + + + +static void +build_relations (void) +{ + goto_number *edge = xnmalloc (ngotos + 1, sizeof *edge); + state_number *states1 = xnmalloc (ritem_longest_rhs () + 1, sizeof *states1); + goto_number i; + + includes = xnmalloc (ngotos, sizeof *includes); + + for (i = 0; i < ngotos; i++) + { + int nedges = 0; + symbol_number symbol1 = states[to_state[i]]->accessing_symbol; + rule **rulep; + + for (rulep = derives[symbol1 - ntokens]; *rulep; rulep++) + { + bool done; + int length = 1; + item_number const *rp; + state *s = states[from_state[i]]; + states1[0] = s->number; + + for (rp = (*rulep)->rhs; ! item_number_is_rule_number (*rp); rp++) + { + s = transitions_to (s->transitions, + item_number_as_symbol_number (*rp)); + states1[length++] = s->number; + } + + if (!s->consistent) + add_lookback_edge (s, *rulep, i); + + length--; + done = false; + while (!done) + { + done = true; + /* Each rhs ends in a rule number, and there is a + sentinel before the first rhs, so it is safe to + decrement RP here. */ + rp--; + if (ISVAR (*rp)) + { + /* Downcasting from item_number to symbol_number. */ + edge[nedges++] = map_goto (states1[--length], + item_number_as_symbol_number (*rp)); + if (nullable[*rp - ntokens]) + done = false; + } + } + } + + if (nedges == 0) + includes[i] = NULL; + else + { + int j; + includes[i] = xnmalloc (nedges + 1, sizeof includes[i][0]); + for (j = 0; j < nedges; j++) + includes[i][j] = edge[j]; + includes[i][nedges] = END_NODE; + } + } + + free (edge); + free (states1); + + relation_transpose (&includes, ngotos); +} + + + +static void +compute_FOLLOWS (void) +{ + goto_number i; + + relation_digraph (includes, ngotos, &F); + + for (i = 0; i < ngotos; i++) + free (includes[i]); + + free (includes); +} + + +static void +compute_lookahead_tokens (void) +{ + size_t i; + goto_list *sp; + + for (i = 0; i < nLA; i++) + for (sp = lookback[i]; sp; sp = sp->next) + bitset_or (LA[i], LA[i], F[sp->value]); + + /* Free LOOKBACK. */ + for (i = 0; i < nLA; i++) + LIST_FREE (goto_list, lookback[i]); + + free (lookback); + bitsetv_free (F); +} + + +/*----------------------------------------------------. +| Count the number of lookahead tokens required for S | +| (N_LOOKAHEAD_TOKENS member). | +`----------------------------------------------------*/ + +static int +state_lookahead_tokens_count (state *s) +{ + int n_lookahead_tokens = 0; + reductions *rp = s->reductions; + transitions *sp = s->transitions; + + /* We need a lookahead either to distinguish different + reductions (i.e., there are two or more), or to distinguish a + reduction from a shift. Otherwise, it is straightforward, + and the state is `consistent'. There is no need to check that + transition 0 hasn't been disabled before checking if it is a + shift since transitions are only disabled during conflict + resolution, and that hasn't happened yet. */ + aver (sp->num == 0 || !TRANSITION_IS_DISABLED (sp, 0)); + if (rp->num > 1 + || (rp->num == 1 && sp->num && TRANSITION_IS_SHIFT (sp, 0))) + n_lookahead_tokens += rp->num; + else + s->consistent = 1; + + return n_lookahead_tokens; +} + + +/*----------------------------------------------------. +| Compute LA, NLA, and the lookahead_tokens members. | +`----------------------------------------------------*/ + +static void +initialize_LA (void) +{ + state_number i; + bitsetv pLA; + + /* Compute the total number of reductions requiring a lookahead. */ + nLA = 0; + for (i = 0; i < nstates; i++) + nLA += state_lookahead_tokens_count (states[i]); + /* Avoid having to special case 0. */ + if (!nLA) + nLA = 1; + + pLA = LA = bitsetv_create (nLA, ntokens, BITSET_FIXED); + lookback = xcalloc (nLA, sizeof *lookback); + + /* Initialize the members LOOKAHEAD_TOKENS for each state whose reductions + require lookahead tokens. */ + for (i = 0; i < nstates; i++) + { + int count = state_lookahead_tokens_count (states[i]); + if (count) + { + states[i]->reductions->lookahead_tokens = pLA; + pLA += count; + } + } +} + + +/*---------------------------------------------. +| Output the lookahead tokens for each state. | +`---------------------------------------------*/ + +static void +lookahead_tokens_print (FILE *out) +{ + state_number i; + int j, k; + fprintf (out, "Lookahead tokens: BEGIN\n"); + for (i = 0; i < nstates; ++i) + { + reductions *reds = states[i]->reductions; + bitset_iterator iter; + int n_lookahead_tokens = 0; + + if (reds->lookahead_tokens) + for (k = 0; k < reds->num; ++k) + if (reds->lookahead_tokens[k]) + ++n_lookahead_tokens; + + fprintf (out, "State %d: %d lookahead tokens\n", + i, n_lookahead_tokens); + + if (reds->lookahead_tokens) + for (j = 0; j < reds->num; ++j) + BITSET_FOR_EACH (iter, reds->lookahead_tokens[j], k, 0) + { + fprintf (out, " on %d (%s) -> rule %d\n", + k, symbols[k]->tag, + reds->rules[j]->number); + }; + } + fprintf (out, "Lookahead tokens: END\n"); +} + +void +lalr (void) +{ + initialize_LA (); + set_goto_map (); + initialize_F (); + build_relations (); + compute_FOLLOWS (); + compute_lookahead_tokens (); + + if (trace_flag & trace_sets) + lookahead_tokens_print (stderr); +} + + +void +lalr_update_state_numbers (state_number old_to_new[], state_number nstates_old) +{ + goto_number ngotos_reachable = 0; + symbol_number nonterminal = 0; + aver (nsyms == nvars + ntokens); + { + goto_number i; + for (i = 0; i < ngotos; ++i) + { + while (i == goto_map[nonterminal]) + goto_map[nonterminal++] = ngotos_reachable; + /* If old_to_new[from_state[i]] = nstates_old, remove this goto + entry. */ + if (old_to_new[from_state[i]] != nstates_old) + { + /* from_state[i] is not removed, so it and thus to_state[i] are + reachable, so to_state[i] != nstates_old. */ + aver (old_to_new[to_state[i]] != nstates_old); + from_state[ngotos_reachable] = old_to_new[from_state[i]]; + to_state[ngotos_reachable] = old_to_new[to_state[i]]; + ++ngotos_reachable; + } + } + } + while (nonterminal <= nvars) + { + aver (ngotos == goto_map[nonterminal]); + goto_map[nonterminal++] = ngotos_reachable; + } + ngotos = ngotos_reachable; +} + + +void +lalr_free (void) +{ + state_number s; + for (s = 0; s < nstates; ++s) + states[s]->reductions->lookahead_tokens = NULL; + bitsetv_free (LA); +} diff --git a/src/lalr.h b/src/lalr.h new file mode 100644 index 0000000..c65c9b4 --- /dev/null +++ b/src/lalr.h @@ -0,0 +1,83 @@ +/* Compute lookahead criteria for bison, + + Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004, 2006, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef LALR_H_ +# define LALR_H_ + +# include +# include + +/* Import the definition of RULE_T. */ +# include "gram.h" + +/* Import the definition of CORE, TRANSITIONS and REDUCTIONS. */ +# include "state.h" + + +/** Build the LALR(1) automaton. + + Compute how to make the finite state machine deterministic; find + which rules need lookahead in each state, and which lookahead + tokens they accept. + + Builds: + - #goto_map + - #from_state + - #to_state +*/ +void lalr (void); + +/** + * Update state numbers recorded in #goto_map, #from_state, and #to_state such + * that: + * - \c nstates_old is the old number of states. + * - Where \c i is the old state number, old_to_new[i] is either: + * - \c nstates_old if state \c i is removed because it is unreachable. + * Thus, remove all goto entries involving this state. + * - The new state number. + */ +void lalr_update_state_numbers (state_number old_to_new[], + state_number nstates_old); + + +/** Release the information related to lookahead tokens. + + Can be performed once the action tables are computed. */ +void lalr_free (void); + + +typedef size_t goto_number; +# define GOTO_NUMBER_MAXIMUM ((goto_number) -1) + +/** Index into #from_state and #to_state. + + All the transitions that accept a particular variable are grouped + together and GOTO_MAP[I - NTOKENS] is the index in FROM_STATE and + TO_STATE of the first of them. */ +extern goto_number *goto_map; + +/** State number which a transition leads from. */ +extern state_number *from_state; + +/** State number it leads to. */ +extern state_number *to_state; + + +#endif /* !LALR_H_ */ diff --git a/src/location.c b/src/location.c new file mode 100644 index 0000000..57adf18 --- /dev/null +++ b/src/location.c @@ -0,0 +1,132 @@ +/* Locations for Bison + Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include + +#include "complain.h" +#include "location.h" + +location const empty_location = EMPTY_LOCATION_INIT; + +/* If BUF is null, add BUFSIZE (which in this case must be less than + INT_MAX) to COLUMN; otherwise, add mbsnwidth (BUF, BUFSIZE, 0) to + COLUMN. If an overflow occurs, or might occur but is undetectable, + return INT_MAX. Assume COLUMN is nonnegative. */ + +static inline int +add_column_width (int column, char const *buf, size_t bufsize) +{ + size_t width; + unsigned int remaining_columns = INT_MAX - column; + + if (buf) + { + if (INT_MAX / 2 <= bufsize) + return INT_MAX; + width = mbsnwidth (buf, bufsize, 0); + } + else + width = bufsize; + + return width <= remaining_columns ? column + width : INT_MAX; +} + +/* Set *LOC and adjust scanner cursor to account for token TOKEN of + size SIZE. */ + +void +location_compute (location *loc, boundary *cur, char const *token, size_t size) +{ + int line = cur->line; + int column = cur->column; + char const *p0 = token; + char const *p = token; + char const *lim = token + size; + + loc->start = *cur; + + for (p = token; p < lim; p++) + switch (*p) + { + case '\n': + line += line < INT_MAX; + column = 1; + p0 = p + 1; + break; + + case '\t': + column = add_column_width (column, p0, p - p0); + column = add_column_width (column, NULL, 8 - ((column - 1) & 7)); + p0 = p + 1; + break; + + default: + break; + } + + cur->line = line; + cur->column = column = add_column_width (column, p0, p - p0); + + loc->end = *cur; + + if (line == INT_MAX && loc->start.line != INT_MAX) + warn_at (*loc, _("line number overflow")); + if (column == INT_MAX && loc->start.column != INT_MAX) + warn_at (*loc, _("column number overflow")); +} + + +/* Output to OUT the location LOC. + Warning: it uses quotearg's slot 3. */ +void +location_print (FILE *out, location loc) +{ + int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; + fprintf (out, "%s:%d.%d", + quotearg_n_style (3, escape_quoting_style, loc.start.file), + loc.start.line, loc.start.column); + + if (loc.start.file != loc.end.file) + fprintf (out, "-%s:%d.%d", + quotearg_n_style (3, escape_quoting_style, loc.end.file), + loc.end.line, end_col); + else if (loc.start.line < loc.end.line) + fprintf (out, "-%d.%d", loc.end.line, end_col); + else if (loc.start.column < end_col) + fprintf (out, "-%d", end_col); +} + +void +boundary_set_from_string (boundary *bound, char *loc_str) +{ + /* Must search in reverse since the file name field may + * contain `.' or `:'. */ + char *delim = strrchr (loc_str, '.'); + aver (delim); + *delim = '\0'; + bound->column = atoi (delim+1); + delim = strrchr (loc_str, ':'); + aver (delim); + *delim = '\0'; + bound->line = atoi (delim+1); + bound->file = uniqstr_new (loc_str); +} diff --git a/src/location.h b/src/location.h new file mode 100644 index 0000000..785947e --- /dev/null +++ b/src/location.h @@ -0,0 +1,85 @@ +/* Locations for Bison + Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef LOCATION_H_ +# define LOCATION_H_ + +# include "uniqstr.h" + +/* A boundary between two characters. */ +typedef struct +{ + /* The name of the file that contains the boundary. */ + uniqstr file; + + /* The (origin-1) line that contains the boundary. + If this is INT_MAX, the line number has overflowed. */ + int line; + + /* The (origin-1) column just after the boundary. This is neither a + byte count, nor a character count; it is a column count. + If this is INT_MAX, the column number has overflowed. */ + int column; + +} boundary; + +/* Set the position of \a a. */ +static inline void +boundary_set (boundary *b, const char *f, int l, int c) +{ + b->file = f; + b->line = l; + b->column = c; +} + +/* Return nonzero if A and B are equal boundaries. */ +static inline bool +equal_boundaries (boundary a, boundary b) +{ + return (a.column == b.column + && a.line == b.line + && UNIQSTR_EQ (a.file, b.file)); +} + +/* A location, that is, a region of source code. */ +typedef struct +{ + /* Boundary just before the location starts. */ + boundary start; + + /* Boundary just after the location ends. */ + boundary end; + +} location; + +#define YYLTYPE location + +#define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}} +extern location const empty_location; + +/* Set *LOC and adjust scanner cursor to account for token TOKEN of + size SIZE. */ +void location_compute (location *loc, + boundary *cur, char const *token, size_t size); + +void location_print (FILE *out, location loc); + +/* LOC_STR must be formatted as `file:line.column', it will be modified. */ +void boundary_set_from_string (boundary *bound, char *loc_str); + +#endif /* ! defined LOCATION_H_ */ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..9b472f1 --- /dev/null +++ b/src/main.c @@ -0,0 +1,210 @@ +/* Top level entry point of Bison. + + Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002, 2004, + 2005, 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include +#include +#include +#include + +#include "LR0.h" +#include "complain.h" +#include "conflicts.h" +#include "derives.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "lalr.h" +#include "muscle_tab.h" +#include "nullable.h" +#include "output.h" +#include "print.h" +#include "print_graph.h" +#include "print-xml.h" +#include "reader.h" +#include "reduce.h" +#include "scan-code.h" +#include "scan-gram.h" +#include "scan-skel.h" +#include "symtab.h" +#include "tables.h" +#include "uniqstr.h" + + + +int +main (int argc, char *argv[]) +{ + program_name = argv[0]; + setlocale (LC_ALL, ""); + (void) bindtextdomain (PACKAGE, LOCALEDIR); + (void) bindtextdomain ("bison-runtime", LOCALEDIR); + (void) textdomain (PACKAGE); + + uniqstrs_new (); + + getargs (argc, argv); + + timevar_report = trace_flag & trace_time; + init_timevar (); + timevar_start (TV_TOTAL); + + if (trace_flag & trace_bitsets) + bitset_stats_enable (); + + muscle_init (); + + /* Read the input. Copy some parts of it to FGUARD, FACTION, FTABLE + and FATTRS. In file reader.c. The other parts are recorded in + the grammar; see gram.h. */ + + timevar_push (TV_READER); + reader (); + timevar_pop (TV_READER); + + if (complaint_issued) + goto finish; + + /* Find useless nonterminals and productions and reduce the grammar. */ + timevar_push (TV_REDUCE); + reduce_grammar (); + timevar_pop (TV_REDUCE); + + /* Record other info about the grammar. In files derives and + nullable. */ + timevar_push (TV_SETS); + derives_compute (); + nullable_compute (); + timevar_pop (TV_SETS); + + /* Convert to nondeterministic finite state machine. In file LR0. + See state.h for more info. */ + timevar_push (TV_LR0); + generate_states (); + timevar_pop (TV_LR0); + + /* make it deterministic. In file lalr. */ + timevar_push (TV_LALR); + lalr (); + timevar_pop (TV_LALR); + + /* Find and record any conflicts: places where one token of + lookahead is not enough to disambiguate the parsing. In file + conflicts. Also resolve s/r conflicts based on precedence + declarations. */ + timevar_push (TV_CONFLICTS); + conflicts_solve (); + muscle_percent_define_default ("lr.keep_unreachable_states", "false"); + if (!muscle_percent_define_flag_if ("lr.keep_unreachable_states")) + { + state_number *old_to_new = xnmalloc (nstates, sizeof *old_to_new); + state_number nstates_old = nstates; + state_remove_unreachable_states (old_to_new); + lalr_update_state_numbers (old_to_new, nstates_old); + conflicts_update_state_numbers (old_to_new, nstates_old); + free (old_to_new); + } + conflicts_print (); + timevar_pop (TV_CONFLICTS); + + /* Compute the parser tables. */ + timevar_push (TV_ACTIONS); + tables_generate (); + timevar_pop (TV_ACTIONS); + + grammar_rules_useless_report + (_("rule useless in parser due to conflicts")); + + /* Output file names. */ + compute_output_file_names (); + + /* Output the detailed report on the grammar. */ + if (report_flag) + { + timevar_push (TV_REPORT); + print_results (); + timevar_pop (TV_REPORT); + } + + /* Output the graph. */ + if (graph_flag) + { + timevar_push (TV_GRAPH); + print_graph (); + timevar_pop (TV_GRAPH); + } + + /* Output xml. */ + if (xml_flag) + { + timevar_push (TV_XML); + print_xml (); + timevar_pop (TV_XML); + } + + /* Stop if there were errors, to avoid trashing previous output + files. */ + if (complaint_issued) + goto finish; + + /* Lookahead tokens are no longer needed. */ + timevar_push (TV_FREE); + lalr_free (); + timevar_pop (TV_FREE); + + /* Output the tables and the parser to ftable. In file output. */ + timevar_push (TV_PARSER); + output (); + timevar_pop (TV_PARSER); + + timevar_push (TV_FREE); + nullable_free (); + derives_free (); + tables_free (); + states_free (); + reduce_free (); + conflicts_free (); + grammar_free (); + output_file_names_free (); + + /* The scanner memory cannot be released right after parsing, as it + contains things such as user actions, prologue, epilogue etc. */ + gram_scanner_free (); + muscle_free (); + uniqstrs_free (); + code_scanner_free (); + skel_scanner_free (); + quotearg_free (); + timevar_pop (TV_FREE); + + if (trace_flag & trace_bitsets) + bitset_stats_dump (stderr); + + finish: + + /* Stop timing and print the times. */ + timevar_stop (TV_TOTAL); + timevar_print (stderr); + + return complaint_issued ? EXIT_FAILURE : EXIT_SUCCESS; +} diff --git a/src/muscle_tab.c b/src/muscle_tab.c new file mode 100644 index 0000000..afe59be --- /dev/null +++ b/src/muscle_tab.c @@ -0,0 +1,630 @@ +/* Muscle table manager for Bison. + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include + +#include "complain.h" +#include "files.h" +#include "muscle_tab.h" +#include "getargs.h" + +/* A key-value pair, along with storage that can be reclaimed when + this pair is no longer needed. */ +typedef struct +{ + char const *key; + char const *value; + char *storage; +} muscle_entry; + +/* An obstack used to create some entries. */ +struct obstack muscle_obstack; + +/* Initial capacity of muscles hash table. */ +#define HT_INITIAL_CAPACITY 257 + +static struct hash_table *muscle_table = NULL; + +static bool +hash_compare_muscles (void const *x, void const *y) +{ + muscle_entry const *m1 = x; + muscle_entry const *m2 = y; + return strcmp (m1->key, m2->key) == 0; +} + +static size_t +hash_muscle (const void *x, size_t tablesize) +{ + muscle_entry const *m = x; + return hash_string (m->key, tablesize); +} + +/*-----------------------------------------------------------------. +| Create the MUSCLE_TABLE, and initialize it with default values. | +| Also set up the MUSCLE_OBSTACK. | +`-----------------------------------------------------------------*/ + +static void +muscle_entry_free (void *entry) +{ + muscle_entry *mentry = entry; + free (mentry->storage); + free (mentry); +} + +void +muscle_init (void) +{ + /* Initialize the muscle obstack. */ + obstack_init (&muscle_obstack); + + muscle_table = hash_initialize (HT_INITIAL_CAPACITY, NULL, hash_muscle, + hash_compare_muscles, muscle_entry_free); + + /* Version and input file. */ + MUSCLE_INSERT_STRING ("version", VERSION); + MUSCLE_INSERT_C_STRING ("file_name", grammar_file); +} + + +/*------------------------------------------------------------. +| Free all the memory consumed by the muscle machinery only. | +`------------------------------------------------------------*/ + +void +muscle_free (void) +{ + hash_free (muscle_table); + obstack_free (&muscle_obstack, NULL); +} + + + +/*------------------------------------------------------------. +| Insert (KEY, VALUE). If KEY already existed, overwrite the | +| previous value. | +`------------------------------------------------------------*/ + +void +muscle_insert (char const *key, char const *value) +{ + muscle_entry probe; + muscle_entry *entry; + + probe.key = key; + entry = hash_lookup (muscle_table, &probe); + + if (!entry) + { + /* First insertion in the hash. */ + entry = xmalloc (sizeof *entry); + entry->key = key; + hash_insert (muscle_table, entry); + } + else + free (entry->storage); + entry->value = value; + entry->storage = NULL; +} + + +/*-------------------------------------------------------------------. +| Append VALUE to the current value of KEY. If KEY did not already | +| exist, create it. Use MUSCLE_OBSTACK. De-allocate the previously | +| associated value. Copy VALUE and SEPARATOR. | +`-------------------------------------------------------------------*/ + +void +muscle_grow (const char *key, const char *val, const char *separator) +{ + muscle_entry probe; + muscle_entry *entry = NULL; + + probe.key = key; + entry = hash_lookup (muscle_table, &probe); + + if (!entry) + { + /* First insertion in the hash. */ + entry = xmalloc (sizeof *entry); + entry->key = key; + hash_insert (muscle_table, entry); + entry->value = entry->storage = xstrdup (val); + } + else + { + /* Grow the current value. */ + char *new_val; + obstack_sgrow (&muscle_obstack, entry->value); + free (entry->storage); + obstack_sgrow (&muscle_obstack, separator); + obstack_sgrow (&muscle_obstack, val); + obstack_1grow (&muscle_obstack, 0); + new_val = obstack_finish (&muscle_obstack); + entry->value = entry->storage = xstrdup (new_val); + obstack_free (&muscle_obstack, new_val); + } +} + +/*------------------------------------------------------------------. +| Using muscle_grow, append a synchronization line for the location | +| LOC to the current value of KEY. | +`------------------------------------------------------------------*/ + +static void +muscle_syncline_grow (char const *key, location loc) +{ + char *extension = NULL; + obstack_fgrow1 (&muscle_obstack, "]b4_syncline(%d, [[", loc.start.line); + MUSCLE_OBSTACK_SGROW (&muscle_obstack, + quotearg_style (c_quoting_style, loc.start.file)); + obstack_sgrow (&muscle_obstack, "]])["); + obstack_1grow (&muscle_obstack, 0); + extension = obstack_finish (&muscle_obstack); + muscle_grow (key, extension, ""); + obstack_free (&muscle_obstack, extension); +} + +/*------------------------------------------------------------------. +| Append VALUE to the current value of KEY, using muscle_grow. But | +| in addition, issue a synchronization line for the location LOC | +| using muscle_syncline_grow. | +`------------------------------------------------------------------*/ + +void +muscle_code_grow (const char *key, const char *val, location loc) +{ + muscle_syncline_grow (key, loc); + muscle_grow (key, val, "\n"); +} + + +void muscle_pair_list_grow (const char *muscle, + const char *a1, const char *a2) +{ + char *pair; + obstack_sgrow (&muscle_obstack, "[[["); + MUSCLE_OBSTACK_SGROW (&muscle_obstack, a1); + obstack_sgrow (&muscle_obstack, "]], [["); + MUSCLE_OBSTACK_SGROW (&muscle_obstack, a2); + obstack_sgrow (&muscle_obstack, "]]]"); + obstack_1grow (&muscle_obstack, 0); + pair = obstack_finish (&muscle_obstack); + muscle_grow (muscle, pair, ",\n"); + obstack_free (&muscle_obstack, pair); +} + + +/*----------------------------------------------------------------------------. +| Find the value of muscle KEY. Unlike MUSCLE_FIND, this is always reliable | +| to determine whether KEY has a value. | +`----------------------------------------------------------------------------*/ + +char const * +muscle_find_const (char const *key) +{ + muscle_entry probe; + muscle_entry *result = NULL; + + probe.key = key; + result = hash_lookup (muscle_table, &probe); + if (result) + return result->value; + return NULL; +} + + +/*----------------------------------------------------------------------------. +| Find the value of muscle KEY. Abort if muscle_insert was invoked more | +| recently than muscle_grow for KEY since muscle_find can't return a | +| char const *. | +`----------------------------------------------------------------------------*/ + +char * +muscle_find (char const *key) +{ + muscle_entry probe; + muscle_entry *result = NULL; + + probe.key = key; + result = hash_lookup (muscle_table, &probe); + if (result) + { + aver (result->value == result->storage); + return result->storage; + } + return NULL; +} + + +void +muscle_boundary_grow (char const *key, boundary bound) +{ + char *extension; + MUSCLE_OBSTACK_SGROW (&muscle_obstack, bound.file); + obstack_1grow (&muscle_obstack, ':'); + obstack_fgrow1 (&muscle_obstack, "%d", bound.line); + obstack_1grow (&muscle_obstack, '.'); + obstack_fgrow1 (&muscle_obstack, "%d", bound.column); + obstack_1grow (&muscle_obstack, '\0'); + extension = obstack_finish (&muscle_obstack); + muscle_grow (key, extension, ""); + obstack_free (&muscle_obstack, extension); +} + +void +muscle_location_grow (char const *key, location loc) +{ + muscle_grow (key, "[[", ""); + muscle_boundary_grow (key, loc.start); + muscle_grow (key, "]], [[", ""); + muscle_boundary_grow (key, loc.end); + muscle_grow (key, "]]", ""); +} + +#define MUSCLE_COMMON_DECODE(Value) \ + case '$': \ + aver (*++(Value) == ']'); \ + aver (*++(Value) == '['); \ + obstack_sgrow (&muscle_obstack, "$"); \ + break; \ + case '@': \ + switch (*++(Value)) \ + { \ + case '@': obstack_sgrow (&muscle_obstack, "@" ); break; \ + case '{': obstack_sgrow (&muscle_obstack, "[" ); break; \ + case '}': obstack_sgrow (&muscle_obstack, "]" ); break; \ + default: aver (false); break; \ + } \ + break; \ + default: \ + obstack_1grow (&muscle_obstack, *(Value)); \ + break; + +/* Reverse of MUSCLE_OBSTACK_SGROW. */ +static char * +muscle_string_decode (char const *key) +{ + char const *value; + char *value_decoded; + char *result; + + value = muscle_find_const (key); + if (!value) + return NULL; + do { + switch (*value) + { + MUSCLE_COMMON_DECODE (value) + case '[': + case ']': + aver (false); + break; + } + } while (*value++); + value_decoded = obstack_finish (&muscle_obstack); + result = xstrdup (value_decoded); + obstack_free (&muscle_obstack, value_decoded); + return result; +} + +/* Reverse of muscle_location_grow. */ +static location +muscle_location_decode (char const *key) +{ + location loc; + char const *value = muscle_find_const (key); + aver (value); + aver (*value == '['); + aver (*++value == '['); + while (*++value) + switch (*value) + { + MUSCLE_COMMON_DECODE (value) + case '[': + aver (false); + break; + case ']': + { + char *boundary_str; + aver (*++value == ']'); + obstack_1grow (&muscle_obstack, '\0'); + boundary_str = obstack_finish (&muscle_obstack); + switch (*++value) + { + case ',': + boundary_set_from_string (&loc.start, boundary_str); + obstack_free (&muscle_obstack, boundary_str); + aver (*++value == ' '); + aver (*++value == '['); + aver (*++value == '['); + break; + case '\0': + boundary_set_from_string (&loc.end, boundary_str); + obstack_free (&muscle_obstack, boundary_str); + return loc; + break; + default: + aver (false); + break; + } + } + break; + } + aver (false); + return loc; +} + +void +muscle_user_name_list_grow (char const *key, char const *user_name, + location loc) +{ + muscle_grow (key, "[[[[", ","); + muscle_grow (key, user_name, ""); + muscle_grow (key, "]], ", ""); + muscle_location_grow (key, loc); + muscle_grow (key, "]]", ""); +} + +#define MUSCLE_USER_NAME_CONVERT(NAME, PREFIX, USER_NAME, SUFFIX) \ +do { \ + char *tmp; \ + size_t length = strlen ((USER_NAME)); \ + tmp = xmalloc (sizeof (PREFIX) - 1 + length + sizeof (SUFFIX)); \ + strcpy (tmp, (PREFIX)); \ + strcpy (tmp + sizeof (PREFIX) - 1, (USER_NAME)); \ + strcpy (tmp + sizeof (PREFIX) - 1 + length, (SUFFIX)); \ + (NAME) = uniqstr_new (tmp); \ + free (tmp); \ +} while (0) + +void +muscle_percent_define_insert (char const *variable, location variable_loc, + char const *value) +{ + char const *name; + char const *loc_name; + char const *syncline_name; + + MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")"); + MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")"); + MUSCLE_USER_NAME_CONVERT (syncline_name, + "percent_define_syncline(", variable, ")"); + + if (muscle_find_const (name)) + { + warn_at (variable_loc, _("%s `%s' redefined"), + "%define variable", variable); + warn_at (muscle_percent_define_get_loc (variable), + _("previous definition")); + } + MUSCLE_INSERT_STRING (name, value); + + muscle_insert (loc_name, ""); + muscle_location_grow (loc_name, variable_loc); + muscle_insert (syncline_name, ""); + muscle_syncline_grow (syncline_name, variable_loc); + muscle_user_name_list_grow ("percent_define_user_variables", variable, + variable_loc); +} + +char * +muscle_percent_define_get (char const *variable) +{ + char const *name; + char const *usage_name; + char *value; + + MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")"); + MUSCLE_USER_NAME_CONVERT (usage_name, "percent_define_bison_variables(", + variable, ")"); + + muscle_insert (usage_name, ""); + value = muscle_string_decode (name); + if (!value) + value = xstrdup (""); + return value; +} + +location +muscle_percent_define_get_loc (char const *variable) +{ + char const *loc_name; + MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")"); + if (!muscle_find_const (loc_name)) + fatal(_("undefined %%define variable `%s' passed to muscle_percent_define_get_loc"), + variable); + return muscle_location_decode (loc_name); +} + +char const * +muscle_percent_define_get_syncline (char const *variable) +{ + char const *syncline_name; + char const *syncline; + MUSCLE_USER_NAME_CONVERT (syncline_name, + "percent_define_syncline(", variable, ")"); + syncline = muscle_find_const (syncline_name); + if (!syncline) + fatal(_("undefined %%define variable `%s' passed to muscle_percent_define_get_syncline"), + variable); + return syncline; +} + +bool +muscle_percent_define_ifdef (char const *variable) +{ + char const *name; + char const *usage_name; + char const *value; + + MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")"); + MUSCLE_USER_NAME_CONVERT (usage_name, "percent_define_bison_variables(", + variable, ")"); + + value = muscle_find_const (name); + if (value) + { + muscle_insert (usage_name, ""); + return true; + } + + return false; +} + +bool +muscle_percent_define_flag_if (char const *variable) +{ + char const *invalid_boolean_name; + bool result = false; + + MUSCLE_USER_NAME_CONVERT (invalid_boolean_name, + "percent_define_invalid_boolean(", variable, ")"); + + if (muscle_percent_define_ifdef (variable)) + { + char *value = muscle_percent_define_get (variable); + if (value[0] == '\0' || 0 == strcmp (value, "true")) + result = true; + else if (0 == strcmp (value, "false")) + result = false; + else if (!muscle_find_const (invalid_boolean_name)) + { + muscle_insert (invalid_boolean_name, ""); + complain_at(muscle_percent_define_get_loc (variable), + _("invalid value for %%define Boolean variable `%s'"), + variable); + } + free (value); + } + else + fatal(_("undefined %%define variable `%s' passed to muscle_percent_define_flag_if"), + variable); + + return result; +} + +void +muscle_percent_define_default (char const *variable, char const *value) +{ + char const *name; + char const *loc_name; + char const *syncline_name; + MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")"); + MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")"); + MUSCLE_USER_NAME_CONVERT (syncline_name, + "percent_define_syncline(", variable, ")"); + if (!muscle_find_const (name)) + { + location loc; + MUSCLE_INSERT_STRING (name, value); + loc.start.file = loc.end.file = "[Bison:muscle_percent_define_default]"; + loc.start.line = loc.end.line = 1; + loc.start.column = loc.end.column = 0; + muscle_insert (loc_name, ""); + muscle_location_grow (loc_name, loc); + muscle_insert (syncline_name, ""); + muscle_syncline_grow (syncline_name, loc); + } +} + +void +muscle_percent_define_check_values (char const * const *values) +{ + for (; *values; ++values) + { + char const *variable = *values; + char const *name; + char *value; + + MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")"); + + value = muscle_string_decode (name); + if (value) + { + bool valid = false; + for (++values; *values; ++values) + { + if (0 == strcmp (value, *values)) + { + valid = true; + while (*values) + ++values; + break; + } + } + if (!valid) + complain_at(muscle_percent_define_get_loc (variable), + _("invalid value for %%define variable `%s': `%s'"), + variable, value); + free (value); + } + else + fatal(_("undefined %%define variable `%s' passed to muscle_percent_define_check_values"), + variable); + } +} + +void +muscle_percent_code_grow (char const *qualifier, location qualifier_loc, + char const *code, location code_loc) +{ + char const *name; + MUSCLE_USER_NAME_CONVERT (name, "percent_code(", qualifier, ")"); + muscle_code_grow (name, code, code_loc); + muscle_user_name_list_grow ("percent_code_user_qualifiers", qualifier, + qualifier_loc); +} + + +/*------------------------------------------------. +| Output the definition of ENTRY as a m4_define. | +`------------------------------------------------*/ + +static inline bool +muscle_m4_output (muscle_entry *entry, FILE *out) +{ + fprintf (out, "m4_define([b4_%s],\n", entry->key); + fprintf (out, "[[%s]])\n\n\n", entry->value); + return true; +} + +static bool +muscle_m4_output_processor (void *entry, void *out) +{ + return muscle_m4_output (entry, out); +} + + +/*----------------------------------------------------------------. +| Output the definition of all the current muscles into a list of | +| m4_defines. | +`----------------------------------------------------------------*/ + +void +muscles_m4_output (FILE *out) +{ + hash_do_for_each (muscle_table, muscle_m4_output_processor, out); +} diff --git a/src/muscle_tab.h b/src/muscle_tab.h new file mode 100644 index 0000000..19fba8b --- /dev/null +++ b/src/muscle_tab.h @@ -0,0 +1,196 @@ +/* Muscle table manager for Bison, + Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef MUSCLE_TAB_H_ +# define MUSCLE_TAB_H_ + +# include "location.h" + +void muscle_init (void); +void muscle_insert (char const *key, char const *value); +char const *muscle_find_const (char const *key); +char *muscle_find (char const *key); +void muscle_free (void); + + +/* An obstack dedicated to receive muscle keys and values. */ +extern struct obstack muscle_obstack; + +#define MUSCLE_INSERT_BOOL(Key, Value) \ +do { \ + int v = Value; \ + MUSCLE_INSERT_INT (Key, v); \ +} while(0) + +#define MUSCLE_INSERT_INT(Key, Value) \ +do { \ + obstack_fgrow1 (&muscle_obstack, "%d", Value); \ + obstack_1grow (&muscle_obstack, 0); \ + muscle_insert (Key, obstack_finish (&muscle_obstack)); \ +} while(0) + +#define MUSCLE_INSERT_LONG_INT(Key, Value) \ +do { \ + obstack_fgrow1 (&muscle_obstack, "%ld", Value); \ + obstack_1grow (&muscle_obstack, 0); \ + muscle_insert (Key, obstack_finish (&muscle_obstack)); \ +} while(0) + +#define MUSCLE_INSERT_STRING_RAW(Key, Value) \ +do { \ + obstack_sgrow (&muscle_obstack, Value); \ + obstack_1grow (&muscle_obstack, 0); \ + muscle_insert (Key, obstack_finish (&muscle_obstack)); \ +} while(0) + +#define MUSCLE_INSERT_STRING(Key, Value) \ +do { \ + MUSCLE_OBSTACK_SGROW (&muscle_obstack, Value); \ + obstack_1grow (&muscle_obstack, 0); \ + muscle_insert (Key, obstack_finish (&muscle_obstack)); \ +} while(0) + +#define MUSCLE_OBSTACK_SGROW(Obstack, Value) \ +do { \ + char const *p; \ + for (p = Value; *p; p++) \ + switch (*p) \ + { \ + case '$': obstack_sgrow (Obstack, "$]["); break; \ + case '@': obstack_sgrow (Obstack, "@@" ); break; \ + case '[': obstack_sgrow (Obstack, "@{" ); break; \ + case ']': obstack_sgrow (Obstack, "@}" ); break; \ + default: obstack_1grow (Obstack, *p); break; \ + } \ +} while(0) + +#define MUSCLE_INSERT_C_STRING(Key, Value) \ +do { \ + MUSCLE_OBSTACK_SGROW (&muscle_obstack, \ + quotearg_style (c_quoting_style, \ + Value)); \ + obstack_1grow (&muscle_obstack, 0); \ + muscle_insert (Key, obstack_finish (&muscle_obstack)); \ +} while(0) + +/* Append VALUE to the current value of KEY. If KEY did not already + exist, create it. Use MUSCLE_OBSTACK. De-allocate the previously + associated value. Copy VALUE and SEPARATOR. */ + +void muscle_grow (const char *key, const char *value, const char *separator); + + +/* Append VALUE to the current value of KEY, using muscle_grow. But + in addition, issue a synchronization line for the location LOC. */ + +void muscle_code_grow (const char *key, const char *value, location loc); + + +/* MUSCLE is an M4 list of pairs. Create or extend it with the pair + (A1, A2) after escaping both values with digraphs. Note that because the + muscle values are output *double* quoted, one needs to strip the first level + of quotes to reach the list itself. */ +void muscle_pair_list_grow (const char *muscle, + const char *a1, const char *a2); + +/* In the format `[[file_name:line.column]], [[file_name:line.column]]', append + LOC to MUSCLE. Use digraphs for special characters in each file name. */ +void muscle_location_grow (char const *key, location loc); + +/* In the format `file_name:line.column', append BOUND to MUSCLE. Use digraphs + for special characters in the file name. */ +void muscle_boundary_grow (char const *key, boundary bound); + +/* Grow KEY for the occurrence of the name USER_NAME at LOC appropriately for + use with b4_check_user_names in ../data/bison.m4. USER_NAME is not escaped + with digraphs, so it must not contain `[' or `]'. */ +void muscle_user_name_list_grow (char const *key, char const *user_name, + location loc); + +/* Define the muscle for the %define variable VARIABLE appearing at + VARIABLE_LOC in the grammar file with value VALUE. Warn if VARIABLE is + already defined. Record this as a grammar occurrence of VARIABLE by + invoking muscle_user_name_list_grow. */ +void muscle_percent_define_insert (char const *variable, location variable_loc, + char const *value); + +/* Mimic b4_percent_define_get in ../data/bison.m4 exactly. That is, if the + %define variable VARIABLE is defined, return its value. Otherwise, return + the empty string. Also, record Bison's usage of VARIABLE by defining + b4_percent_define_bison_variables(VARIABLE). The caller is responsible for + freeing the memory of the returned string. */ +char *muscle_percent_define_get (char const *variable); + +/* Mimic muscle_percent_define_get_loc in ../data/bison.m4 exactly. That is, + if the %define variable VARIABLE is undefined, complain fatally since that's + a Bison error. Otherwise, return its definition location in a form + approriate for the first argument of warn_at, complain_at, or fatal_at. + Don't record this as a Bison usage of VARIABLE as there's no reason to + suspect that the user-supplied value has yet influenced the output. */ +location muscle_percent_define_get_loc (char const *variable); + +/* Mimic muscle_percent_define_get_syncline in ../data/bison.m4 exactly. That + is, if the %define variable VARIABLE is undefined, complain fatally since + that's a Bison error. Otherwise, return its definition location as a + b4_syncline invocation. Don't record this as a Bison usage of VARIABLE as + there's no reason to suspect that the user-supplied value has yet influenced + the output. */ +char const *muscle_percent_define_get_syncline (char const *variable); + +/* Mimic b4_percent_define_ifdef in ../data/bison.m4 exactly. That is, if the + %define variable VARIABLE is defined, return true. Otherwise, return false. + Also, record Bison's usage of VARIABLE by defining + b4_percent_define_bison_variables(VARIABLE). */ +bool muscle_percent_define_ifdef (char const *variable); + +/* Mimic b4_percent_define_flag_if in ../data/bison.m4 exactly. That is, if + the %define variable VARIABLE is defined to "" or "true", return true. If + it is defined to "false", return false. Complain if it is undefined (a + Bison error since the default value should have been set already) or defined + to any other value (possibly a user error). Also, record Bison's usage of + VARIABLE by defining b4_percent_define_bison_variables(VARIABLE). */ +bool muscle_percent_define_flag_if (char const *variable); + +/* Mimic b4_percent_define_default in ../data/bison.m4 exactly. That is, if + the %define variable VARIABLE is undefined, set its value to VALUE. + 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. */ +void muscle_percent_define_default (char const *variable, char const *value); + +/* Mimic b4_percent_define_check_values in ../data/bison.m4 exactly except that + the VALUES structure is more appropriate for C. That is, VALUES points to a + list of strings that is partitioned into sublists by NULL's, one terminating + each sublist. The last sublist is followed by a second NULL. For each + sublist, the first string is the name of a %define variable, and all + remaining strings in that sublist are the valid values for that variable. + Complain if such a variable is undefined (a Bison error since the default + value should have been set already) or defined to any other value (possibly + a user error). Don't record this as a Bison usage of the variable as + there's no reason to suspect that the value has yet influenced the + output. */ +void muscle_percent_define_check_values (char const * const *values); + +/* Grow the muscle for the %code qualifier QUALIFIER appearing at QUALIFIER_LOC + in the grammar file with code CODE appearing at CODE_LOC. Record this as a + grammar occurrence of VARIABLE by invoking muscle_user_name_list_grow. */ +void muscle_percent_code_grow (char const *qualifier, location qualifier_loc, + char const *code, location code_loc); + +void muscles_m4_output (FILE *out); + +#endif /* not MUSCLE_TAB_H_ */ diff --git a/src/nullable.c b/src/nullable.c new file mode 100644 index 0000000..7ee6612 --- /dev/null +++ b/src/nullable.c @@ -0,0 +1,142 @@ +/* Calculate which nonterminals can expand into the null string for Bison. + + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + + +/* Set up NULLABLE, a vector saying which nonterminals can expand into + the null string. NULLABLE[I - NTOKENS] is nonzero if symbol I can + do so. */ + +#include +#include "system.h" + +#include "getargs.h" +#include "gram.h" +#include "nullable.h" +#include "reduce.h" +#include "symtab.h" + +/* Linked list of rules. */ +typedef struct rule_list +{ + struct rule_list *next; + rule *value; +} rule_list; + +bool *nullable = NULL; + +static void +nullable_print (FILE *out) +{ + int i; + fputs ("NULLABLE\n", out); + for (i = ntokens; i < nsyms; i++) + fprintf (out, "\t%s: %s\n", symbols[i]->tag, + nullable[i - ntokens] ? "yes" : "no"); + fputs ("\n\n", out); +} + +void +nullable_compute (void) +{ + rule_number ruleno; + symbol_number *s1; + symbol_number *s2; + rule_list *p; + + symbol_number *squeue = xnmalloc (nvars, sizeof *squeue); + size_t *rcount = xcalloc (nrules, sizeof *rcount); + /* RITEM contains all the rules, including useless productions. + Hence we must allocate room for useless nonterminals too. */ + rule_list **rsets = xcalloc (nvars, sizeof *rsets); + /* This is said to be more elements than we actually use. + Supposedly NRITEMS - NRULES is enough. But why take the risk? */ + rule_list *relts = xnmalloc (nritems + nvars + 1, sizeof *relts); + + nullable = xcalloc (nvars, sizeof *nullable); + + s1 = s2 = squeue; + p = relts; + + for (ruleno = 0; ruleno < nrules; ++ruleno) + if (rules[ruleno].useful) + { + rule *rules_ruleno = &rules[ruleno]; + if (rules_ruleno->rhs[0] >= 0) + { + /* This rule has a non empty RHS. */ + item_number *rp = NULL; + bool any_tokens = false; + for (rp = rules_ruleno->rhs; *rp >= 0; ++rp) + if (ISTOKEN (*rp)) + any_tokens = true; + + /* This rule has only nonterminals: schedule it for the second + pass. */ + if (!any_tokens) + for (rp = rules_ruleno->rhs; *rp >= 0; ++rp) + { + rcount[ruleno]++; + p->next = rsets[*rp - ntokens]; + p->value = rules_ruleno; + rsets[*rp - ntokens] = p; + p++; + } + } + else + { + /* This rule has an empty RHS. */ + aver (item_number_as_rule_number (rules_ruleno->rhs[0]) + == ruleno); + if (rules_ruleno->useful + && ! nullable[rules_ruleno->lhs->number - ntokens]) + { + nullable[rules_ruleno->lhs->number - ntokens] = true; + *s2++ = rules_ruleno->lhs->number; + } + } + } + + while (s1 < s2) + for (p = rsets[*s1++ - ntokens]; p; p = p->next) + { + rule *r = p->value; + if (--rcount[r->number] == 0) + if (r->useful && ! nullable[r->lhs->number - ntokens]) + { + nullable[r->lhs->number - ntokens] = true; + *s2++ = r->lhs->number; + } + } + + free (squeue); + free (rcount); + free (rsets); + free (relts); + + if (trace_flag & trace_sets) + nullable_print (stderr); +} + + +void +nullable_free (void) +{ + free (nullable); +} diff --git a/src/nullable.h b/src/nullable.h new file mode 100644 index 0000000..f8d8e23 --- /dev/null +++ b/src/nullable.h @@ -0,0 +1,31 @@ +/* Part of the bison parser generator, + Copyright (C) 2000, 2002 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef NULLABLE_H_ +# define NULLABLE_H_ + +/* A vector saying which nonterminals can expand into the null string. + NULLABLE[I - NTOKENS] is nonzero if symbol I can do so. */ +extern bool *nullable; + +/* Set up NULLABLE. */ +extern void nullable_compute (void); + +/* Free NULLABLE. */ +extern void nullable_free (void); +#endif /* !NULLABLE_H_ */ diff --git a/src/output.c b/src/output.c new file mode 100644 index 0000000..585b90e --- /dev/null +++ b/src/output.c @@ -0,0 +1,676 @@ +/* Output the generated parsing program for Bison. + + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include +#include +#include +#include +#include + +#include "complain.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "muscle_tab.h" +#include "output.h" +#include "reader.h" +#include "scan-code.h" /* max_left_semantic_context */ +#include "scan-skel.h" +#include "symtab.h" +#include "tables.h" + + +static struct obstack format_obstack; + + +/*-------------------------------------------------------------------. +| Create a function NAME which associates to the muscle NAME the | +| result of formatting the FIRST and then TABLE_DATA[BEGIN..END[ (of | +| TYPE), and to the muscle NAME_max, the max value of the | +| TABLE_DATA. | +`-------------------------------------------------------------------*/ + + +#define GENERATE_MUSCLE_INSERT_TABLE(Name, Type) \ + \ +static void \ +Name (char const *name, \ + Type *table_data, \ + Type first, \ + int begin, \ + int end) \ +{ \ + Type min = first; \ + Type max = first; \ + long int lmin; \ + long int lmax; \ + int i; \ + int j = 1; \ + \ + obstack_fgrow1 (&format_obstack, "%6d", first); \ + for (i = begin; i < end; ++i) \ + { \ + obstack_1grow (&format_obstack, ','); \ + if (j >= 10) \ + { \ + obstack_sgrow (&format_obstack, "\n "); \ + j = 1; \ + } \ + else \ + ++j; \ + obstack_fgrow1 (&format_obstack, "%6d", table_data[i]); \ + if (table_data[i] < min) \ + min = table_data[i]; \ + if (max < table_data[i]) \ + max = table_data[i]; \ + } \ + obstack_1grow (&format_obstack, 0); \ + muscle_insert (name, obstack_finish (&format_obstack)); \ + \ + lmin = min; \ + lmax = max; \ + /* Build `NAME_min' and `NAME_max' in the obstack. */ \ + obstack_fgrow1 (&format_obstack, "%s_min", name); \ + obstack_1grow (&format_obstack, 0); \ + MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), lmin); \ + obstack_fgrow1 (&format_obstack, "%s_max", name); \ + obstack_1grow (&format_obstack, 0); \ + MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), lmax); \ +} + +GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_unsigned_int_table, unsigned int) +GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_int_table, int) +GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_base_table, base_number) +GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_rule_number_table, rule_number) +GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_symbol_number_table, symbol_number) +GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_item_number_table, item_number) +GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number) + + +/*--------------------------------------------------------------------. +| Print to OUT a representation of STRING escaped both for C and M4. | +`--------------------------------------------------------------------*/ + +static void +escaped_output (FILE *out, char const *string) +{ + char const *p; + fprintf (out, "[["); + + for (p = quotearg_style (c_quoting_style, string); *p; p++) + switch (*p) + { + case '$': fputs ("$][", out); break; + case '@': fputs ("@@", out); break; + case '[': fputs ("@{", out); break; + case ']': fputs ("@}", out); break; + default: fputc (*p, out); break; + } + + fprintf (out, "]]"); +} + + +/*------------------------------------------------------------------. +| Prepare the muscles related to the symbols: translate, tname, and | +| toknum. | +`------------------------------------------------------------------*/ + +static void +prepare_symbols (void) +{ + MUSCLE_INSERT_BOOL ("token_table", token_table_flag); + MUSCLE_INSERT_INT ("tokens_number", ntokens); + MUSCLE_INSERT_INT ("nterms_number", nvars); + MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number); + MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number); + + muscle_insert_symbol_number_table ("translate", + token_translations, + token_translations[0], + 1, max_user_token_number + 1); + + /* tname -- token names. */ + { + int i; + /* We assume that the table will be output starting at column 2. */ + int j = 2; + struct quoting_options *qo = clone_quoting_options (0); + set_quoting_style (qo, c_quoting_style); + set_quoting_flags (qo, QA_SPLIT_TRIGRAPHS); + for (i = 0; i < nsyms; i++) + { + char *cp = quotearg_alloc (symbols[i]->tag, -1, qo); + /* Width of the next token, including the two quotes, the + comma and the space. */ + int width = strlen (cp) + 2; + + if (j + width > 75) + { + obstack_sgrow (&format_obstack, "\n "); + j = 1; + } + + if (i) + obstack_1grow (&format_obstack, ' '); + MUSCLE_OBSTACK_SGROW (&format_obstack, cp); + free (cp); + obstack_1grow (&format_obstack, ','); + j += width; + } + free (qo); + obstack_sgrow (&format_obstack, " ]b4_null["); + + /* Finish table and store. */ + obstack_1grow (&format_obstack, 0); + muscle_insert ("tname", obstack_finish (&format_obstack)); + } + + /* Output YYTOKNUM. */ + { + int i; + int *values = xnmalloc (ntokens, sizeof *values); + for (i = 0; i < ntokens; ++i) + values[i] = symbols[i]->user_token_number; + muscle_insert_int_table ("toknum", values, + values[0], 1, ntokens); + free (values); + } +} + + +/*-------------------------------------------------------------. +| Prepare the muscles related to the rules: rhs, prhs, r1, r2, | +| rline, dprec, merger. | +`-------------------------------------------------------------*/ + +static void +prepare_rules (void) +{ + rule_number r; + unsigned int i = 0; + item_number *rhs = xnmalloc (nritems, sizeof *rhs); + unsigned int *prhs = xnmalloc (nrules, sizeof *prhs); + unsigned int *rline = xnmalloc (nrules, sizeof *rline); + symbol_number *r1 = xnmalloc (nrules, sizeof *r1); + unsigned int *r2 = xnmalloc (nrules, sizeof *r2); + int *dprec = xnmalloc (nrules, sizeof *dprec); + int *merger = xnmalloc (nrules, sizeof *merger); + + for (r = 0; r < nrules; ++r) + { + item_number *rhsp = NULL; + /* Index of rule R in RHS. */ + prhs[r] = i; + /* RHS of the rule R. */ + for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp) + rhs[i++] = *rhsp; + /* LHS of the rule R. */ + r1[r] = rules[r].lhs->number; + /* Length of rule R's RHS. */ + r2[r] = i - prhs[r]; + /* Separator in RHS. */ + rhs[i++] = -1; + /* Line where rule was defined. */ + rline[r] = rules[r].location.start.line; + /* Dynamic precedence (GLR). */ + dprec[r] = rules[r].dprec; + /* Merger-function index (GLR). */ + merger[r] = rules[r].merger; + } + aver (i == nritems); + + muscle_insert_item_number_table ("rhs", rhs, ritem[0], 1, nritems); + muscle_insert_unsigned_int_table ("prhs", prhs, 0, 0, nrules); + muscle_insert_unsigned_int_table ("rline", rline, 0, 0, nrules); + muscle_insert_symbol_number_table ("r1", r1, 0, 0, nrules); + muscle_insert_unsigned_int_table ("r2", r2, 0, 0, nrules); + muscle_insert_int_table ("dprec", dprec, 0, 0, nrules); + muscle_insert_int_table ("merger", merger, 0, 0, nrules); + + MUSCLE_INSERT_INT ("rules_number", nrules); + MUSCLE_INSERT_INT ("max_left_semantic_context", max_left_semantic_context); + + free (rhs); + free (prhs); + free (rline); + free (r1); + free (r2); + free (dprec); + free (merger); +} + +/*--------------------------------------------. +| Prepare the muscles related to the states. | +`--------------------------------------------*/ + +static void +prepare_states (void) +{ + state_number i; + symbol_number *values = xnmalloc (nstates, sizeof *values); + for (i = 0; i < nstates; ++i) + values[i] = states[i]->accessing_symbol; + muscle_insert_symbol_number_table ("stos", values, + 0, 1, nstates); + free (values); + + MUSCLE_INSERT_INT ("last", high); + MUSCLE_INSERT_INT ("final_state_number", final_state->number); + MUSCLE_INSERT_INT ("states_number", nstates); +} + + + +/*---------------------------------. +| Output the user actions to OUT. | +`---------------------------------*/ + +static void +user_actions_output (FILE *out) +{ + rule_number r; + + fputs ("m4_define([b4_actions], \n[", out); + for (r = 0; r < nrules; ++r) + if (rules[r].action) + { + fprintf (out, "b4_case(%d, [b4_syncline(%d, ", r + 1, + rules[r].action_location.start.line); + escaped_output (out, rules[r].action_location.start.file); + fprintf (out, ")\n[ %s]])\n\n", rules[r].action); + } + fputs ("])\n\n", out); +} + +/*--------------------------------------. +| Output the merge functions to OUT. | +`--------------------------------------*/ + +static void +merger_output (FILE *out) +{ + int n; + merger_list* p; + + fputs ("m4_define([b4_mergers], \n[[", out); + for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next) + { + if (p->type[0] == '\0') + fprintf (out, " case %d: *yy0 = %s (*yy0, *yy1); break;\n", + n, p->name); + else + fprintf (out, " case %d: yy0->%s = %s (*yy0, *yy1); break;\n", + n, p->type, p->name); + } + fputs ("]])\n\n", out); +} + +/*--------------------------------------. +| Output the tokens definition to OUT. | +`--------------------------------------*/ + +static void +token_definitions_output (FILE *out) +{ + int i; + char const *sep = ""; + + fputs ("m4_define([b4_tokens], \n[", out); + for (i = 0; i < ntokens; ++i) + { + symbol *sym = symbols[i]; + int number = sym->user_token_number; + + /* At this stage, if there are literal aliases, they are part of + SYMBOLS, so we should not find symbols which are the aliases + here. */ + aver (number != USER_NUMBER_ALIAS); + + /* Skip error token. */ + if (sym == errtoken) + continue; + + /* If this string has an alias, then it is necessarily the alias + which is to be output. */ + if (sym->alias) + sym = sym->alias; + + /* Don't output literal chars or strings (when defined only as a + string). Note that must be done after the alias resolution: + think about `%token 'f' "f"'. */ + if (sym->tag[0] == '\'' || sym->tag[0] == '\"') + continue; + + /* Don't #define nonliteral tokens whose names contain periods + or '$' (as does the default value of the EOF token). */ + if (strchr (sym->tag, '.') || strchr (sym->tag, '$')) + continue; + + fprintf (out, "%s[[[%s]], %d]", + sep, sym->tag, number); + sep = ",\n"; + } + fputs ("])\n\n", out); +} + + +/*---------------------------------------------------. +| Output the symbol destructors or printers to OUT. | +`---------------------------------------------------*/ + +static void +symbol_code_props_output (FILE *out, char const *what, + code_props const *(*get)(symbol const *)) +{ + int i; + char const *sep = ""; + + fputs ("m4_define([b4_symbol_", out); + fputs (what, out); + fputs ("], \n[", out); + for (i = 0; i < nsyms; ++i) + { + symbol *sym = symbols[i]; + char const *code = (*get) (sym)->code; + if (code) + { + location loc = (*get) (sym)->location; + /* Filename, lineno, + Symbol-name, Symbol-number, + code, optional typename. */ + fprintf (out, "%s[", sep); + sep = ",\n"; + escaped_output (out, loc.start.file); + fprintf (out, ", %d, ", loc.start.line); + escaped_output (out, sym->tag); + fprintf (out, ", %d, [[%s]]", sym->number, code); + if (sym->type_name) + fprintf (out, ", [[%s]]", sym->type_name); + fputc (']', out); + } + } + fputs ("])\n\n", out); +} + + +static void +prepare_actions (void) +{ + /* Figure out the actions for the specified state, indexed by + lookahead token type. */ + + muscle_insert_rule_number_table ("defact", yydefact, + yydefact[0], 1, nstates); + + /* Figure out what to do after reducing with each rule, depending on + the saved state from before the beginning of parsing the data + that matched this rule. */ + muscle_insert_state_number_table ("defgoto", yydefgoto, + yydefgoto[0], 1, nsyms - ntokens); + + + /* Output PACT. */ + muscle_insert_base_table ("pact", base, + base[0], 1, nstates); + MUSCLE_INSERT_INT ("pact_ninf", base_ninf); + + /* Output PGOTO. */ + muscle_insert_base_table ("pgoto", base, + base[nstates], nstates + 1, nvectors); + + muscle_insert_base_table ("table", table, + table[0], 1, high + 1); + MUSCLE_INSERT_INT ("table_ninf", table_ninf); + + muscle_insert_base_table ("check", check, + check[0], 1, high + 1); + + /* GLR parsing slightly modifies YYTABLE and YYCHECK (and thus + YYPACT) so that in states with unresolved conflicts, the default + reduction is not used in the conflicted entries, so that there is + a place to put a conflict pointer. + + This means that YYCONFLP and YYCONFL are nonsense for a non-GLR + parser, so we could avoid accidents by not writing them out in + that case. Nevertheless, it seems even better to be able to use + the GLR skeletons even without the non-deterministic tables. */ + muscle_insert_unsigned_int_table ("conflict_list_heads", conflict_table, + conflict_table[0], 1, high + 1); + muscle_insert_unsigned_int_table ("conflicting_rules", conflict_list, + 0, 1, conflict_list_cnt); +} + + +/*---------------------------. +| Call the skeleton parser. | +`---------------------------*/ + +static void +output_skeleton (void) +{ + FILE *in; + FILE *out; + int filter_fd[2]; + char const *argv[9]; + pid_t pid; + + /* Compute the names of the package data dir and skeleton files. */ + char const m4sugar[] = "m4sugar/m4sugar.m4"; + char const m4bison[] = "bison.m4"; + char *full_m4sugar; + char *full_m4bison; + char *full_skeleton; + char const *p; + char const *m4 = (p = getenv ("M4")) ? p : M4; + char const *pkgdatadir = compute_pkgdatadir (); + size_t skeleton_size = strlen (skeleton) + 1; + size_t pkgdatadirlen = strlen (pkgdatadir); + while (pkgdatadirlen && pkgdatadir[pkgdatadirlen - 1] == '/') + pkgdatadirlen--; + full_skeleton = xmalloc (pkgdatadirlen + 1 + + (skeleton_size < sizeof m4sugar + ? sizeof m4sugar : skeleton_size)); + strncpy (full_skeleton, pkgdatadir, pkgdatadirlen); + full_skeleton[pkgdatadirlen] = '/'; + strcpy (full_skeleton + pkgdatadirlen + 1, m4sugar); + full_m4sugar = xstrdup (full_skeleton); + strcpy (full_skeleton + pkgdatadirlen + 1, m4bison); + full_m4bison = xstrdup (full_skeleton); + if (strchr (skeleton, '/')) + strcpy (full_skeleton, skeleton); + else + strcpy (full_skeleton + pkgdatadirlen + 1, skeleton); + + /* Test whether m4sugar.m4 is readable, to check for proper + installation. A faulty installation can cause deadlock, so a + cheap sanity check is worthwhile. */ + xfclose (xfopen (full_m4sugar, "r")); + + /* Create an m4 subprocess connected to us via two pipes. */ + + if (trace_flag & trace_tools) + fprintf (stderr, "running: %s %s - %s %s\n", + m4, full_m4sugar, full_m4bison, full_skeleton); + + /* Some future version of GNU M4 (most likely 1.6) may treat the -dV in a + position-dependent manner. Keep it as the first argument so that all + files are traced. + + See the thread starting at + + for details. */ + { + int i = 0; + argv[i++] = m4; + argv[i++] = "-I"; + argv[i++] = pkgdatadir; + if (trace_flag & trace_m4) + argv[i++] = "-dV"; + argv[i++] = full_m4sugar; + argv[i++] = "-"; + argv[i++] = full_m4bison; + argv[i++] = full_skeleton; + argv[i++] = NULL; + } + /* When POSIXLY_CORRECT is set, some future versions of GNU M4 (most likely + 2.0) may drop some of the GNU extensions that Bison's skeletons depend + upon. So that the next release of Bison is forward compatible with those + future versions of GNU M4, we unset POSIXLY_CORRECT here. + + FIXME: A user might set POSIXLY_CORRECT to affect processes run from + macros like m4_syscmd in a custom skeleton. For now, Bison makes no + promises about the behavior of custom skeletons, so this scenario is not a + concern. However, we eventually want to eliminate this shortcoming. The + next release of GNU M4 (1.4.12 or 1.6) will accept the -g command-line + option as a no-op, and later releases will accept it to indicate that + POSIXLY_CORRECT should be ignored. Once the GNU M4 versions that accept + -g are pervasive, Bison should use -g instead of unsetting + POSIXLY_CORRECT. + + See the thread starting at + + for details. */ + unsetenv ("POSIXLY_CORRECT"); + init_subpipe (); + pid = create_subpipe (argv, filter_fd); + free (full_m4sugar); + free (full_m4bison); + free (full_skeleton); + + out = fdopen (filter_fd[0], "w"); + if (! out) + error (EXIT_FAILURE, get_errno (), + "fdopen"); + + /* Output the definitions of all the muscles. */ + fputs ("m4_init()\n", out); + + user_actions_output (out); + merger_output (out); + token_definitions_output (out); + symbol_code_props_output (out, "destructors", &symbol_destructor_get); + symbol_code_props_output (out, "printers", &symbol_printer_get); + + muscles_m4_output (out); + xfclose (out); + + /* Read and process m4's output. */ + timevar_push (TV_M4); + end_of_output_subpipe (pid, filter_fd); + in = fdopen (filter_fd[1], "r"); + if (! in) + error (EXIT_FAILURE, get_errno (), + "fdopen"); + scan_skel (in); + xfclose (in); + reap_subpipe (pid, m4); + timevar_pop (TV_M4); +} + +static void +prepare (void) +{ + /* BISON_USE_PUSH_FOR_PULL is for the test suite and should not be documented + for the user. */ + char const *use_push_for_pull_env = getenv ("BISON_USE_PUSH_FOR_PULL"); + bool use_push_for_pull_flag = false; + if (use_push_for_pull_env != NULL + && use_push_for_pull_env[0] != '\0' + && 0 != strcmp (use_push_for_pull_env, "0")) + use_push_for_pull_flag = true; + + /* Flags. */ + MUSCLE_INSERT_BOOL ("debug_flag", debug_flag); + MUSCLE_INSERT_BOOL ("defines_flag", defines_flag); + MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose); + MUSCLE_INSERT_BOOL ("glr_flag", glr_parser); + MUSCLE_INSERT_BOOL ("locations_flag", locations_flag); + MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser); + MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag); + MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen); + MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag); + MUSCLE_INSERT_BOOL ("yacc_flag", yacc_flag); + + /* File names. */ + if (spec_name_prefix) + MUSCLE_INSERT_STRING ("prefix", spec_name_prefix); + + MUSCLE_INSERT_STRING ("file_name_all_but_ext", all_but_ext); + +#define DEFINE(Name) MUSCLE_INSERT_STRING (#Name, Name ? Name : "") + DEFINE (dir_prefix); + DEFINE (parser_file_name); + DEFINE (spec_defines_file); + DEFINE (spec_file_prefix); + DEFINE (spec_graph_file); + DEFINE (spec_name_prefix); + DEFINE (spec_outfile); + DEFINE (spec_verbose_file); +#undef DEFINE + + /* Find the right skeleton file, and add muscles about the skeletons. */ + if (skeleton) + MUSCLE_INSERT_C_STRING ("skeleton", skeleton); + else + skeleton = language->skeleton; + + /* About the skeletons. */ + { + /* b4_pkgdatadir is used inside m4_include in the skeletons, so digraphs + would never be expanded. Hopefully no one has M4-special characters in + his Bison installation path. */ + MUSCLE_INSERT_STRING_RAW ("pkgdatadir", compute_pkgdatadir ()); + } +} + + +/*----------------------------------------------------------. +| Output the parsing tables and the parser code to ftable. | +`----------------------------------------------------------*/ + +void +output (void) +{ + obstack_init (&format_obstack); + + prepare_symbols (); + prepare_rules (); + prepare_states (); + prepare_actions (); + + prepare (); + + /* Process the selected skeleton file. */ + output_skeleton (); + + obstack_free (&format_obstack, NULL); +} + +char const * +compute_pkgdatadir (void) +{ + char const *pkgdatadir = getenv ("BISON_PKGDATADIR"); + return pkgdatadir ? pkgdatadir : PKGDATADIR; +} diff --git a/src/output.h b/src/output.h new file mode 100644 index 0000000..abd88f5 --- /dev/null +++ b/src/output.h @@ -0,0 +1,27 @@ +/* Output the generated parsing program for bison, + Copyright (C) 2000, 2001, 2002, 2003, 2006, 2007 Free Software Foundation, + Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef OUTPUT_H_ +# define OUTPUT_H_ + +/* Output the parsing tables and the parser code to FTABLE. */ +void output (void); +char const *compute_pkgdatadir (void); + +#endif /* !OUTPUT_H_ */ diff --git a/src/parse-gram.c b/src/parse-gram.c new file mode 100644 index 0000000..b7938dc --- /dev/null +++ b/src/parse-gram.c @@ -0,0 +1,2967 @@ + +/* A Bison parser, made by GNU Bison 2.4.4-738cd. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 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 . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.4-738cd" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 1 + +/* Substitute the variable and function names. */ +#define yyparse gram_parse +#define yylex gram_lex +#define yyerror gram_error +#define yylval gram_lval +#define yychar gram_char +#define yydebug gram_debug +#define yynerrs gram_nerrs +#define yylloc gram_lloc + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "parse-gram.y" +/* Bison Grammar Parser -*- C -*- + + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include "complain.h" +#include "conflicts.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "muscle_tab.h" +#include "quotearg.h" +#include "reader.h" +#include "symlist.h" +#include "scan-gram.h" +#include "scan-code.h" + +#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) +static YYLTYPE lloc_default (YYLTYPE const *, int); + +#define YY_LOCATION_PRINT(File, Loc) \ + location_print (File, Loc) + +static void version_check (location const *loc, char const *version); + +/* Request detailed syntax error messages, and pass them to GRAM_ERROR. + FIXME: depends on the undocumented availability of YYLLOC. */ +#undef yyerror +#define yyerror(Msg) \ + gram_error (&yylloc, Msg) +static void gram_error (location const *, char const *); + +static char const *char_name (char); + +/** Add a lex-param or a parse-param. + * + * \param type \a lex_param or \a parse_param + * \param decl the formal argument + * \param loc the location in the source. + */ +static void add_param (char const *type, char *decl, location loc); + + +static symbol_class current_class = unknown_sym; +static uniqstr current_type = NULL; +static symbol *current_lhs; +static location current_lhs_location; +static int current_prec = 0; + +#define YYTYPE_INT16 int_fast16_t +#define YYTYPE_INT8 int_fast8_t +#define YYTYPE_UINT16 uint_fast16_t +#define YYTYPE_UINT8 uint_fast8_t + + +/* Line 189 of yacc.c */ +#line 155 "parse-gram.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + GRAM_EOF = 0, + STRING = 258, + INT = 259, + PERCENT_TOKEN = 260, + PERCENT_NTERM = 261, + PERCENT_TYPE = 262, + PERCENT_DESTRUCTOR = 263, + PERCENT_PRINTER = 264, + PERCENT_LEFT = 265, + PERCENT_RIGHT = 266, + PERCENT_NONASSOC = 267, + PERCENT_PREC = 268, + PERCENT_DPREC = 269, + PERCENT_MERGE = 270, + PERCENT_CODE = 271, + PERCENT_DEBUG = 272, + PERCENT_DEFAULT_PREC = 273, + PERCENT_DEFINE = 274, + PERCENT_DEFINES = 275, + PERCENT_ERROR_VERBOSE = 276, + PERCENT_EXPECT = 277, + PERCENT_EXPECT_RR = 278, + PERCENT_FILE_PREFIX = 279, + PERCENT_GLR_PARSER = 280, + PERCENT_INITIAL_ACTION = 281, + PERCENT_LANGUAGE = 282, + PERCENT_LEX_PARAM = 283, + PERCENT_LOCATIONS = 284, + PERCENT_NAME_PREFIX = 285, + PERCENT_NO_DEFAULT_PREC = 286, + PERCENT_NO_LINES = 287, + PERCENT_NONDETERMINISTIC_PARSER = 288, + PERCENT_OUTPUT = 289, + PERCENT_PARSE_PARAM = 290, + PERCENT_PURE_PARSER = 291, + PERCENT_REQUIRE = 292, + PERCENT_SKELETON = 293, + PERCENT_START = 294, + PERCENT_TOKEN_TABLE = 295, + PERCENT_VERBOSE = 296, + PERCENT_YACC = 297, + BRACED_CODE = 298, + CHAR = 299, + EPILOGUE = 300, + EQUAL = 301, + ID = 302, + ID_COLON = 303, + PERCENT_PERCENT = 304, + PIPE = 305, + PROLOGUE = 306, + SEMICOLON = 307, + TYPE = 308, + TYPE_TAG_ANY = 309, + TYPE_TAG_NONE = 310, + PERCENT_UNION = 311 + }; +#endif +/* Tokens. */ +#define GRAM_EOF 0 +#define STRING 258 +#define INT 259 +#define PERCENT_TOKEN 260 +#define PERCENT_NTERM 261 +#define PERCENT_TYPE 262 +#define PERCENT_DESTRUCTOR 263 +#define PERCENT_PRINTER 264 +#define PERCENT_LEFT 265 +#define PERCENT_RIGHT 266 +#define PERCENT_NONASSOC 267 +#define PERCENT_PREC 268 +#define PERCENT_DPREC 269 +#define PERCENT_MERGE 270 +#define PERCENT_CODE 271 +#define PERCENT_DEBUG 272 +#define PERCENT_DEFAULT_PREC 273 +#define PERCENT_DEFINE 274 +#define PERCENT_DEFINES 275 +#define PERCENT_ERROR_VERBOSE 276 +#define PERCENT_EXPECT 277 +#define PERCENT_EXPECT_RR 278 +#define PERCENT_FILE_PREFIX 279 +#define PERCENT_GLR_PARSER 280 +#define PERCENT_INITIAL_ACTION 281 +#define PERCENT_LANGUAGE 282 +#define PERCENT_LEX_PARAM 283 +#define PERCENT_LOCATIONS 284 +#define PERCENT_NAME_PREFIX 285 +#define PERCENT_NO_DEFAULT_PREC 286 +#define PERCENT_NO_LINES 287 +#define PERCENT_NONDETERMINISTIC_PARSER 288 +#define PERCENT_OUTPUT 289 +#define PERCENT_PARSE_PARAM 290 +#define PERCENT_PURE_PARSER 291 +#define PERCENT_REQUIRE 292 +#define PERCENT_SKELETON 293 +#define PERCENT_START 294 +#define PERCENT_TOKEN_TABLE 295 +#define PERCENT_VERBOSE 296 +#define PERCENT_YACC 297 +#define BRACED_CODE 298 +#define CHAR 299 +#define EPILOGUE 300 +#define EQUAL 301 +#define ID 302 +#define ID_COLON 303 +#define PERCENT_PERCENT 304 +#define PIPE 305 +#define PROLOGUE 306 +#define SEMICOLON 307 +#define TYPE 308 +#define TYPE_TAG_ANY 309 +#define TYPE_TAG_NONE 310 +#define PERCENT_UNION 311 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 222 of yacc.c */ +#line 92 "parse-gram.y" + + symbol *symbol; + symbol_list *list; + int integer; + char const *chars; + char *code; + assoc assoc; + uniqstr uniqstr; + unsigned char character; + + + +/* Line 222 of yacc.c */ +#line 318 "parse-gram.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 343 "parse-gram.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 156 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 57 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 33 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 105 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 143 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 311 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 8, 9, 12, 14, 16, 18, 22, + 24, 27, 29, 32, 35, 38, 42, 44, 47, 50, + 53, 55, 58, 62, 64, 66, 69, 73, 76, 78, + 81, 84, 86, 88, 90, 92, 94, 96, 99, 103, + 107, 109, 111, 114, 118, 119, 121, 125, 126, 130, + 131, 135, 139, 143, 145, 147, 149, 150, 152, 154, + 157, 159, 162, 164, 167, 169, 172, 174, 176, 178, + 180, 182, 184, 187, 190, 194, 196, 199, 201, 204, + 206, 209, 212, 213, 217, 219, 223, 226, 227, 230, + 233, 237, 241, 245, 247, 249, 250, 252, 254, 256, + 258, 260, 262, 264, 266, 267 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 58, 0, -1, 59, 49, 76, 89, -1, -1, 59, + 60, -1, 61, -1, 51, -1, 17, -1, 19, 82, + 83, -1, 20, -1, 20, 3, -1, 21, -1, 22, + 4, -1, 23, 4, -1, 24, 3, -1, 24, 46, + 3, -1, 25, -1, 26, 43, -1, 27, 3, -1, + 28, 43, -1, 29, -1, 30, 3, -1, 30, 46, + 3, -1, 32, -1, 33, -1, 34, 3, -1, 34, + 46, 3, -1, 35, 43, -1, 36, -1, 37, 3, + -1, 38, 3, -1, 40, -1, 41, -1, 42, -1, + 52, -1, 66, -1, 63, -1, 39, 87, -1, 8, + 43, 72, -1, 9, 43, 72, -1, 18, -1, 31, + -1, 16, 84, -1, 16, 47, 84, -1, -1, 47, + -1, 56, 62, 84, -1, -1, 6, 64, 75, -1, + -1, 5, 65, 75, -1, 7, 53, 71, -1, 67, + 68, 69, -1, 10, -1, 11, -1, 12, -1, -1, + 53, -1, 70, -1, 69, 70, -1, 87, -1, 87, + 4, -1, 87, -1, 71, 87, -1, 73, -1, 72, + 73, -1, 87, -1, 53, -1, 54, -1, 55, -1, + 53, -1, 85, -1, 85, 4, -1, 85, 88, -1, + 85, 4, 88, -1, 74, -1, 75, 74, -1, 77, + -1, 76, 77, -1, 78, -1, 61, 52, -1, 1, + 52, -1, -1, 86, 79, 80, -1, 81, -1, 80, + 50, 81, -1, 80, 52, -1, -1, 81, 87, -1, + 81, 43, -1, 81, 13, 87, -1, 81, 14, 4, + -1, 81, 15, 53, -1, 47, -1, 3, -1, -1, + 3, -1, 43, -1, 47, -1, 44, -1, 48, -1, + 85, -1, 88, -1, 3, -1, -1, 49, 45, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 202, 202, 210, 212, 216, 217, 227, 228, 232, + 233, 238, 239, 240, 241, 242, 243, 248, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 280, + 281, 305, 306, 307, 308, 312, 313, 314, 318, 325, + 332, 336, 340, 347, 362, 363, 367, 379, 379, 384, + 384, 389, 400, 415, 416, 417, 421, 422, 427, 429, + 434, 435, 440, 442, 447, 448, 452, 453, 454, 455, + 460, 465, 470, 476, 482, 493, 494, 503, 504, 510, + 511, 512, 519, 519, 523, 524, 525, 530, 531, 533, + 535, 537, 539, 549, 550, 556, 559, 568, 588, 590, + 599, 604, 605, 610, 617, 619 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"", + "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"", + "\"%printer\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%prec\"", + "\"%dprec\"", "\"%merge\"", "\"%code\"", "\"%debug\"", + "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"", + "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"", + "\"%initial-action\"", "\"%language\"", "\"%lex-param\"", + "\"%locations\"", "\"%name-prefix\"", "\"%no-default-prec\"", + "\"%no-lines\"", "\"%nondeterministic-parser\"", "\"%output\"", + "\"%parse-param\"", "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", + "\"%start\"", "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", + "\"{...}\"", "\"char\"", "\"epilogue\"", "\"=\"", "\"identifier\"", + "\"identifier:\"", "\"%%\"", "\"|\"", "\"%{...%}\"", "\";\"", "\"type\"", + "\"<*>\"", "\"<>\"", "\"%union\"", "$accept", "input", + "prologue_declarations", "prologue_declaration", "grammar_declaration", + "union_name", "symbol_declaration", "$@1", "$@2", + "precedence_declaration", "precedence_declarator", "type.opt", + "symbols.prec", "symbol.prec", "symbols.1", "generic_symlist", + "generic_symlist_item", "symbol_def", "symbol_defs.1", "grammar", + "rules_or_grammar_declaration", "rules", "$@3", "rhses.1", "rhs", + "variable", "content.opt", "braceless", "id", "id_colon", "symbol", + "string_as_id", "epilogue.opt", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 57, 58, 59, 59, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 62, 62, 61, 64, 63, 65, + 63, 63, 66, 67, 67, 67, 68, 68, 69, 69, + 70, 70, 71, 71, 72, 72, 73, 73, 73, 73, + 74, 74, 74, 74, 74, 75, 75, 76, 76, 77, + 77, 77, 79, 78, 80, 80, 80, 81, 81, 81, + 81, 81, 81, 82, 82, 83, 83, 84, 85, 85, + 86, 87, 87, 88, 89, 89 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 4, 0, 2, 1, 1, 1, 3, 1, + 2, 1, 2, 2, 2, 3, 1, 2, 2, 2, + 1, 2, 3, 1, 1, 2, 3, 2, 1, 2, + 2, 1, 1, 1, 1, 1, 1, 2, 3, 3, + 1, 1, 2, 3, 0, 1, 3, 0, 3, 0, + 3, 3, 3, 1, 1, 1, 0, 1, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, + 1, 1, 2, 2, 3, 1, 2, 1, 2, 1, + 2, 2, 0, 3, 1, 3, 2, 0, 2, 2, + 3, 3, 3, 1, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 0, 2 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 3, 0, 0, 1, 49, 47, 0, 0, 0, 53, + 54, 55, 0, 7, 40, 0, 9, 11, 0, 0, + 0, 16, 0, 0, 0, 20, 0, 41, 23, 24, + 0, 0, 28, 0, 0, 0, 31, 32, 33, 0, + 6, 34, 44, 4, 5, 36, 35, 56, 0, 0, + 0, 0, 0, 97, 0, 42, 94, 93, 95, 10, + 12, 13, 14, 0, 17, 18, 19, 21, 0, 25, + 0, 27, 29, 30, 103, 99, 98, 101, 37, 102, + 0, 100, 0, 0, 77, 79, 82, 45, 0, 57, + 0, 70, 75, 50, 71, 48, 51, 62, 67, 68, + 69, 38, 64, 66, 39, 43, 96, 8, 15, 22, + 26, 81, 80, 0, 78, 2, 87, 46, 52, 58, + 60, 76, 72, 73, 63, 65, 105, 83, 84, 59, + 61, 74, 87, 86, 0, 0, 0, 89, 88, 85, + 90, 91, 92 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 1, 2, 43, 82, 88, 45, 49, 48, 46, + 47, 90, 118, 119, 96, 101, 102, 92, 93, 83, + 84, 85, 116, 127, 128, 58, 107, 55, 77, 86, + 103, 79, 115 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -60 +static const yytype_int16 yypact[] = +{ + -60, 18, 100, -60, -60, -60, -16, 24, 27, -60, + -60, -60, -8, -60, -60, 11, 70, -60, 71, 80, + 2, -60, 46, 87, 48, -60, 31, -60, -60, -60, + 40, 49, -60, 91, 92, 0, -60, -60, -60, 15, + -60, -60, 50, -60, -60, -60, -60, 43, 12, 12, + 0, 25, 25, -60, 55, -60, -60, -60, 97, -60, + -60, -60, -60, 98, -60, -60, -60, -60, 99, -60, + 110, -60, -60, -60, -60, -60, -60, -60, -60, -60, + 51, -60, 62, 1, -60, -60, -60, -60, 55, -60, + 0, -60, -60, 12, 84, 12, 0, -60, -60, -60, + -60, 25, -60, -60, 25, -60, -60, -60, -60, -60, + -60, -60, -60, 101, -60, -60, -60, -60, 0, -60, + 111, -60, 140, -60, -60, -60, -60, 10, 38, -60, + -60, -60, -60, -60, 0, 141, 94, -60, -60, 38, + -60, -60, -60 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -60, -60, -60, -60, 142, -60, -60, -60, -60, -60, + -60, -60, -60, 30, -60, 102, -59, -27, 104, -60, + 67, -60, -60, -60, 23, -60, -60, -50, -19, -60, + -35, -58, -60 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -105 +static const yytype_int16 yytable[] = +{ + 78, -104, 80, 74, 105, 62, 4, 5, 6, 7, + 8, 9, 10, 11, 56, 97, 80, 12, 3, 14, + 4, 5, 6, 7, 8, 9, 10, 11, 74, 94, + 94, 12, 27, 14, 67, 53, 123, 50, 117, 54, + 35, 74, 125, 69, 75, 125, 27, 76, 63, 81, + 113, 134, 135, 136, 35, 120, 75, 42, 57, 76, + 132, 124, 133, 81, 131, 91, 121, 51, 121, 75, + 52, 42, 76, 59, 94, 60, 94, 68, 98, 99, + 100, 137, 75, 120, 61, 76, 70, 74, 122, 64, + 65, 66, 71, 138, 72, 73, 89, 87, 53, 140, + 106, 108, 109, 111, 138, 4, 5, 6, 7, 8, + 9, 10, 11, 110, 112, 130, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 74, 44, 141, 126, 142, 129, 39, + 114, 40, 41, 95, 104, 139, 42 +}; + +static const yytype_uint8 yycheck[] = +{ + 35, 0, 1, 3, 54, 3, 5, 6, 7, 8, + 9, 10, 11, 12, 3, 50, 1, 16, 0, 18, + 5, 6, 7, 8, 9, 10, 11, 12, 3, 48, + 49, 16, 31, 18, 3, 43, 94, 53, 88, 47, + 39, 3, 101, 3, 44, 104, 31, 47, 46, 48, + 49, 13, 14, 15, 39, 90, 44, 56, 47, 47, + 50, 96, 52, 48, 122, 53, 93, 43, 95, 44, + 43, 56, 47, 3, 93, 4, 95, 46, 53, 54, + 55, 43, 44, 118, 4, 47, 46, 3, 4, 43, + 3, 43, 43, 128, 3, 3, 53, 47, 43, 134, + 3, 3, 3, 52, 139, 5, 6, 7, 8, 9, + 10, 11, 12, 3, 52, 4, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 3, 2, 4, 45, 53, 118, 49, + 83, 51, 52, 49, 52, 132, 56 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 58, 59, 0, 5, 6, 7, 8, 9, 10, + 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 49, + 51, 52, 56, 60, 61, 63, 66, 67, 65, 64, + 53, 43, 43, 43, 47, 84, 3, 47, 82, 3, + 4, 4, 3, 46, 43, 3, 43, 3, 46, 3, + 46, 43, 3, 3, 3, 44, 47, 85, 87, 88, + 1, 48, 61, 76, 77, 78, 86, 47, 62, 53, + 68, 53, 74, 75, 85, 75, 71, 87, 53, 54, + 55, 72, 73, 87, 72, 84, 3, 83, 3, 3, + 3, 52, 52, 49, 77, 89, 79, 84, 69, 70, + 87, 74, 4, 88, 87, 73, 45, 80, 81, 70, + 4, 88, 50, 52, 13, 14, 15, 43, 87, 81, + 87, 4, 53 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* 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 (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval, &yylloc) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; +#endif +{ + if (!yyvaluep) + return; + YYUSE (yylocationp); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + case 3: /* "\"string\"" */ + +/* Line 715 of yacc.c */ +#line 180 "parse-gram.y" + { fputs (quotearg_style (c_quoting_style, (yyvaluep->chars)), stderr); }; + +/* Line 715 of yacc.c */ +#line 1038 "parse-gram.c" + break; + case 4: /* "\"integer\"" */ + +/* Line 715 of yacc.c */ +#line 191 "parse-gram.y" + { fprintf (stderr, "%d", (yyvaluep->integer)); }; + +/* Line 715 of yacc.c */ +#line 1047 "parse-gram.c" + break; + case 43: /* "\"{...}\"" */ + +/* Line 715 of yacc.c */ +#line 182 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->code)); }; + +/* Line 715 of yacc.c */ +#line 1056 "parse-gram.c" + break; + case 44: /* "\"char\"" */ + +/* Line 715 of yacc.c */ +#line 174 "parse-gram.y" + { fputs (char_name ((yyvaluep->character)), stderr); }; + +/* Line 715 of yacc.c */ +#line 1065 "parse-gram.c" + break; + case 45: /* "\"epilogue\"" */ + +/* Line 715 of yacc.c */ +#line 182 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; + +/* Line 715 of yacc.c */ +#line 1074 "parse-gram.c" + break; + case 47: /* "\"identifier\"" */ + +/* Line 715 of yacc.c */ +#line 187 "parse-gram.y" + { fputs ((yyvaluep->uniqstr), stderr); }; + +/* Line 715 of yacc.c */ +#line 1083 "parse-gram.c" + break; + case 48: /* "\"identifier:\"" */ + +/* Line 715 of yacc.c */ +#line 188 "parse-gram.y" + { fprintf (stderr, "%s:", (yyvaluep->uniqstr)); }; + +/* Line 715 of yacc.c */ +#line 1092 "parse-gram.c" + break; + case 51: /* "\"%{...%}\"" */ + +/* Line 715 of yacc.c */ +#line 182 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; + +/* Line 715 of yacc.c */ +#line 1101 "parse-gram.c" + break; + case 53: /* "\"type\"" */ + +/* Line 715 of yacc.c */ +#line 186 "parse-gram.y" + { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); }; + +/* Line 715 of yacc.c */ +#line 1110 "parse-gram.c" + break; + case 82: /* "variable" */ + +/* Line 715 of yacc.c */ +#line 187 "parse-gram.y" + { fputs ((yyvaluep->uniqstr), stderr); }; + +/* Line 715 of yacc.c */ +#line 1119 "parse-gram.c" + break; + case 83: /* "content.opt" */ + +/* Line 715 of yacc.c */ +#line 182 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; + +/* Line 715 of yacc.c */ +#line 1128 "parse-gram.c" + break; + case 84: /* "braceless" */ + +/* Line 715 of yacc.c */ +#line 182 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; + +/* Line 715 of yacc.c */ +#line 1137 "parse-gram.c" + break; + case 85: /* "id" */ + +/* Line 715 of yacc.c */ +#line 194 "parse-gram.y" + { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; + +/* Line 715 of yacc.c */ +#line 1146 "parse-gram.c" + break; + case 86: /* "id_colon" */ + +/* Line 715 of yacc.c */ +#line 195 "parse-gram.y" + { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); }; + +/* Line 715 of yacc.c */ +#line 1155 "parse-gram.c" + break; + case 87: /* "symbol" */ + +/* Line 715 of yacc.c */ +#line 194 "parse-gram.y" + { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; + +/* Line 715 of yacc.c */ +#line 1164 "parse-gram.c" + break; + case 88: /* "string_as_id" */ + +/* Line 715 of yacc.c */ +#line 194 "parse-gram.y" + { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; + +/* Line 715 of yacc.c */ +#line 1173 "parse-gram.c" + break; + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yylsp, yyrule) + YYSTYPE *yyvsp; + YYLTYPE *yylsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, yylsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + 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; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, yylocationp) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + YYLTYPE *yylocationp; +#endif +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + yylsp = yyls; + +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + +/* User initialization code. */ + +/* Line 1248 of yacc.c */ +#line 84 "parse-gram.y" +{ + /* Bison's grammar can initial empty locations, hence a default + location is needed. */ + boundary_set (&yylloc.start, current_file, 1, 1); + boundary_set (&yylloc.end, current_file, 1, 1); +} + +/* Line 1248 of yacc.c */ +#line 1702 "parse-gram.c" + yylsp[0] = yylloc; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 6: + +/* Line 1455 of yacc.c */ +#line 218 "parse-gram.y" + { + code_props plain_code; + code_props_plain_init (&plain_code, (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); + code_props_translate_code (&plain_code); + gram_scanner_last_string_free (); + muscle_code_grow (union_seen ? "post_prologue" : "pre_prologue", + plain_code.code, (yylsp[(1) - (1)])); + code_scanner_last_string_free (); + } + break; + + case 7: + +/* Line 1455 of yacc.c */ +#line 227 "parse-gram.y" + { debug_flag = true; } + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 229 "parse-gram.y" + { + muscle_percent_define_insert ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars)); + } + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 232 "parse-gram.y" + { defines_flag = true; } + break; + + case 10: + +/* Line 1455 of yacc.c */ +#line 234 "parse-gram.y" + { + defines_flag = true; + spec_defines_file = xstrdup ((yyvsp[(2) - (2)].chars)); + } + break; + + case 11: + +/* Line 1455 of yacc.c */ +#line 238 "parse-gram.y" + { error_verbose = true; } + break; + + case 12: + +/* Line 1455 of yacc.c */ +#line 239 "parse-gram.y" + { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); } + break; + + case 13: + +/* Line 1455 of yacc.c */ +#line 240 "parse-gram.y" + { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); } + break; + + case 14: + +/* Line 1455 of yacc.c */ +#line 241 "parse-gram.y" + { spec_file_prefix = (yyvsp[(2) - (2)].chars); } + break; + + case 15: + +/* Line 1455 of yacc.c */ +#line 242 "parse-gram.y" + { spec_file_prefix = (yyvsp[(3) - (3)].chars); } + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 244 "parse-gram.y" + { + nondeterministic_parser = true; + glr_parser = true; + } + break; + + case 17: + +/* Line 1455 of yacc.c */ +#line 249 "parse-gram.y" + { + code_props action; + code_props_symbol_action_init (&action, (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); + code_props_translate_code (&action); + gram_scanner_last_string_free (); + muscle_code_grow ("initial_action", action.code, (yylsp[(2) - (2)])); + code_scanner_last_string_free (); + } + break; + + case 18: + +/* Line 1455 of yacc.c */ +#line 257 "parse-gram.y" + { language_argmatch ((yyvsp[(2) - (2)].chars), grammar_prio, &(yylsp[(1) - (2)])); } + break; + + case 19: + +/* Line 1455 of yacc.c */ +#line 258 "parse-gram.y" + { add_param ("lex_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); } + break; + + case 20: + +/* Line 1455 of yacc.c */ +#line 259 "parse-gram.y" + { locations_flag = true; } + break; + + case 21: + +/* Line 1455 of yacc.c */ +#line 260 "parse-gram.y" + { spec_name_prefix = (yyvsp[(2) - (2)].chars); } + break; + + case 22: + +/* Line 1455 of yacc.c */ +#line 261 "parse-gram.y" + { spec_name_prefix = (yyvsp[(3) - (3)].chars); } + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 262 "parse-gram.y" + { no_lines_flag = true; } + break; + + case 24: + +/* Line 1455 of yacc.c */ +#line 263 "parse-gram.y" + { nondeterministic_parser = true; } + break; + + case 25: + +/* Line 1455 of yacc.c */ +#line 264 "parse-gram.y" + { spec_outfile = (yyvsp[(2) - (2)].chars); } + break; + + case 26: + +/* Line 1455 of yacc.c */ +#line 265 "parse-gram.y" + { spec_outfile = (yyvsp[(3) - (3)].chars); } + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 266 "parse-gram.y" + { add_param ("parse_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); } + break; + + case 28: + +/* Line 1455 of yacc.c */ +#line 268 "parse-gram.y" + { + /* %pure-parser is deprecated in favor of `%define api.pure', so use + `%define api.pure' in a backward-compatible manner here. First, don't + complain if %pure-parser is specified multiple times. */ + if (!muscle_find_const ("percent_define(api.pure)")) + muscle_percent_define_insert ("api.pure", (yylsp[(1) - (1)]), ""); + /* In all cases, use api.pure now so that the backend doesn't complain if + the skeleton ignores api.pure, but do warn now if there's a previous + conflicting definition from an actual %define. */ + if (!muscle_percent_define_flag_if ("api.pure")) + muscle_percent_define_insert ("api.pure", (yylsp[(1) - (1)]), ""); + } + break; + + case 29: + +/* Line 1455 of yacc.c */ +#line 280 "parse-gram.y" + { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); } + break; + + case 30: + +/* Line 1455 of yacc.c */ +#line 282 "parse-gram.y" + { + char const *skeleton_user = (yyvsp[(2) - (2)].chars); + if (strchr (skeleton_user, '/')) + { + size_t dir_length = strlen (current_file); + char *skeleton_build; + while (dir_length && current_file[dir_length - 1] != '/') + --dir_length; + while (dir_length && current_file[dir_length - 1] == '/') + --dir_length; + skeleton_build = + xmalloc (dir_length + 1 + strlen (skeleton_user) + 1); + if (dir_length > 0) + { + strncpy (skeleton_build, current_file, dir_length); + skeleton_build[dir_length++] = '/'; + } + strcpy (skeleton_build + dir_length, skeleton_user); + skeleton_user = uniqstr_new (skeleton_build); + free (skeleton_build); + } + skeleton_arg (skeleton_user, grammar_prio, &(yylsp[(1) - (2)])); + } + break; + + case 31: + +/* Line 1455 of yacc.c */ +#line 305 "parse-gram.y" + { token_table_flag = true; } + break; + + case 32: + +/* Line 1455 of yacc.c */ +#line 306 "parse-gram.y" + { report_flag |= report_states; } + break; + + case 33: + +/* Line 1455 of yacc.c */ +#line 307 "parse-gram.y" + { yacc_flag = true; } + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 315 "parse-gram.y" + { + grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); + } + break; + + case 38: + +/* Line 1455 of yacc.c */ +#line 319 "parse-gram.y" + { + symbol_list *list; + for (list = (yyvsp[(3) - (3)].list); list; list = list->next) + symbol_list_destructor_set (list, (yyvsp[(2) - (3)].code), (yylsp[(2) - (3)])); + symbol_list_free ((yyvsp[(3) - (3)].list)); + } + break; + + case 39: + +/* Line 1455 of yacc.c */ +#line 326 "parse-gram.y" + { + symbol_list *list; + for (list = (yyvsp[(3) - (3)].list); list; list = list->next) + symbol_list_printer_set (list, (yyvsp[(2) - (3)].code), (yylsp[(2) - (3)])); + symbol_list_free ((yyvsp[(3) - (3)].list)); + } + break; + + case 40: + +/* Line 1455 of yacc.c */ +#line 333 "parse-gram.y" + { + default_prec = true; + } + break; + + case 41: + +/* Line 1455 of yacc.c */ +#line 337 "parse-gram.y" + { + default_prec = false; + } + break; + + case 42: + +/* Line 1455 of yacc.c */ +#line 341 "parse-gram.y" + { + /* Do not invoke muscle_percent_code_grow here since it invokes + muscle_user_name_list_grow. */ + muscle_code_grow ("percent_code()", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); + code_scanner_last_string_free (); + } + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 348 "parse-gram.y" + { + muscle_percent_code_grow ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)])); + code_scanner_last_string_free (); + } + break; + + case 44: + +/* Line 1455 of yacc.c */ +#line 362 "parse-gram.y" + {} + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 363 "parse-gram.y" + { muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } + break; + + case 46: + +/* Line 1455 of yacc.c */ +#line 368 "parse-gram.y" + { + union_seen = true; + muscle_code_grow ("stype", (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)])); + code_scanner_last_string_free (); + } + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 379 "parse-gram.y" + { current_class = nterm_sym; } + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 380 "parse-gram.y" + { + current_class = unknown_sym; + current_type = NULL; + } + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 384 "parse-gram.y" + { current_class = token_sym; } + break; + + case 50: + +/* Line 1455 of yacc.c */ +#line 385 "parse-gram.y" + { + current_class = unknown_sym; + current_type = NULL; + } + break; + + case 51: + +/* Line 1455 of yacc.c */ +#line 390 "parse-gram.y" + { + symbol_list *list; + tag_seen = true; + for (list = (yyvsp[(3) - (3)].list); list; list = list->next) + symbol_type_set (list->content.sym, (yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)])); + symbol_list_free ((yyvsp[(3) - (3)].list)); + } + break; + + case 52: + +/* Line 1455 of yacc.c */ +#line 401 "parse-gram.y" + { + symbol_list *list; + ++current_prec; + for (list = (yyvsp[(3) - (3)].list); list; list = list->next) + { + symbol_type_set (list->content.sym, current_type, (yylsp[(2) - (3)])); + symbol_precedence_set (list->content.sym, current_prec, (yyvsp[(1) - (3)].assoc), (yylsp[(1) - (3)])); + } + symbol_list_free ((yyvsp[(3) - (3)].list)); + current_type = NULL; + } + break; + + case 53: + +/* Line 1455 of yacc.c */ +#line 415 "parse-gram.y" + { (yyval.assoc) = left_assoc; } + break; + + case 54: + +/* Line 1455 of yacc.c */ +#line 416 "parse-gram.y" + { (yyval.assoc) = right_assoc; } + break; + + case 55: + +/* Line 1455 of yacc.c */ +#line 417 "parse-gram.y" + { (yyval.assoc) = non_assoc; } + break; + + case 56: + +/* Line 1455 of yacc.c */ +#line 421 "parse-gram.y" + { current_type = NULL; } + break; + + case 57: + +/* Line 1455 of yacc.c */ +#line 422 "parse-gram.y" + { current_type = (yyvsp[(1) - (1)].uniqstr); tag_seen = true; } + break; + + case 58: + +/* Line 1455 of yacc.c */ +#line 428 "parse-gram.y" + { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } + break; + + case 59: + +/* Line 1455 of yacc.c */ +#line 430 "parse-gram.y" + { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); } + break; + + case 60: + +/* Line 1455 of yacc.c */ +#line 434 "parse-gram.y" + { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } + break; + + case 61: + +/* Line 1455 of yacc.c */ +#line 435 "parse-gram.y" + { (yyval.symbol) = (yyvsp[(1) - (2)].symbol); symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); } + break; + + case 62: + +/* Line 1455 of yacc.c */ +#line 441 "parse-gram.y" + { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } + break; + + case 63: + +/* Line 1455 of yacc.c */ +#line 443 "parse-gram.y" + { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); } + break; + + case 64: + +/* Line 1455 of yacc.c */ +#line 447 "parse-gram.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); } + break; + + case 65: + +/* Line 1455 of yacc.c */ +#line 448 "parse-gram.y" + { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].list)); } + break; + + case 66: + +/* Line 1455 of yacc.c */ +#line 452 "parse-gram.y" + { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } + break; + + case 67: + +/* Line 1455 of yacc.c */ +#line 453 "parse-gram.y" + { (yyval.list) = symbol_list_type_new ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } + break; + + case 68: + +/* Line 1455 of yacc.c */ +#line 454 "parse-gram.y" + { (yyval.list) = symbol_list_default_tagged_new ((yylsp[(1) - (1)])); } + break; + + case 69: + +/* Line 1455 of yacc.c */ +#line 455 "parse-gram.y" + { (yyval.list) = symbol_list_default_tagless_new ((yylsp[(1) - (1)])); } + break; + + case 70: + +/* Line 1455 of yacc.c */ +#line 461 "parse-gram.y" + { + current_type = (yyvsp[(1) - (1)].uniqstr); + tag_seen = true; + } + break; + + case 71: + +/* Line 1455 of yacc.c */ +#line 466 "parse-gram.y" + { + symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true); + symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)])); + } + break; + + case 72: + +/* Line 1455 of yacc.c */ +#line 471 "parse-gram.y" + { + symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); + symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); + symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); + } + break; + + case 73: + +/* Line 1455 of yacc.c */ +#line 477 "parse-gram.y" + { + symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); + symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); + symbol_make_alias ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].symbol), (yyloc)); + } + break; + + case 74: + +/* Line 1455 of yacc.c */ +#line 483 "parse-gram.y" + { + symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true); + symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)])); + symbol_user_token_number_set ((yyvsp[(1) - (3)].symbol), (yyvsp[(2) - (3)].integer), (yylsp[(2) - (3)])); + symbol_make_alias ((yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol), (yyloc)); + } + break; + + case 81: + +/* Line 1455 of yacc.c */ +#line 513 "parse-gram.y" + { + yyerrok; + } + break; + + case 82: + +/* Line 1455 of yacc.c */ +#line 519 "parse-gram.y" + { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); } + break; + + case 84: + +/* Line 1455 of yacc.c */ +#line 523 "parse-gram.y" + { grammar_current_rule_end ((yylsp[(1) - (1)])); } + break; + + case 85: + +/* Line 1455 of yacc.c */ +#line 524 "parse-gram.y" + { grammar_current_rule_end ((yylsp[(3) - (3)])); } + break; + + case 87: + +/* Line 1455 of yacc.c */ +#line 530 "parse-gram.y" + { grammar_current_rule_begin (current_lhs, current_lhs_location); } + break; + + case 88: + +/* Line 1455 of yacc.c */ +#line 532 "parse-gram.y" + { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } + break; + + case 89: + +/* Line 1455 of yacc.c */ +#line 534 "parse-gram.y" + { grammar_current_rule_action_append ((yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); } + break; + + case 90: + +/* Line 1455 of yacc.c */ +#line 536 "parse-gram.y" + { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); } + break; + + case 91: + +/* Line 1455 of yacc.c */ +#line 538 "parse-gram.y" + { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); } + break; + + case 92: + +/* Line 1455 of yacc.c */ +#line 540 "parse-gram.y" + { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); } + break; + + case 94: + +/* Line 1455 of yacc.c */ +#line 550 "parse-gram.y" + { (yyval.uniqstr) = uniqstr_new ((yyvsp[(1) - (1)].chars)); } + break; + + case 95: + +/* Line 1455 of yacc.c */ +#line 556 "parse-gram.y" + { + (yyval.chars) = ""; + } + break; + + case 97: + +/* Line 1455 of yacc.c */ +#line 569 "parse-gram.y" + { + code_props plain_code; + (yyvsp[(1) - (1)].code)[strlen ((yyvsp[(1) - (1)].code)) - 1] = '\n'; + code_props_plain_init (&plain_code, (yyvsp[(1) - (1)].code)+1, (yylsp[(1) - (1)])); + code_props_translate_code (&plain_code); + gram_scanner_last_string_free (); + (yyval.chars) = plain_code.code; + } + break; + + case 98: + +/* Line 1455 of yacc.c */ +#line 589 "parse-gram.y" + { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } + break; + + case 99: + +/* Line 1455 of yacc.c */ +#line 591 "parse-gram.y" + { + (yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)])); + symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); + symbol_user_token_number_set ((yyval.symbol), (yyvsp[(1) - (1)].character), (yylsp[(1) - (1)])); + } + break; + + case 100: + +/* Line 1455 of yacc.c */ +#line 599 "parse-gram.y" + { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } + break; + + case 103: + +/* Line 1455 of yacc.c */ +#line 611 "parse-gram.y" + { + (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)])); + symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); + } + break; + + case 105: + +/* Line 1455 of yacc.c */ +#line 620 "parse-gram.y" + { + code_props plain_code; + code_props_plain_init (&plain_code, (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); + code_props_translate_code (&plain_code); + gram_scanner_last_string_free (); + muscle_code_grow ("epilogue", plain_code.code, (yylsp[(2) - (2)])); + code_scanner_last_string_free (); + } + break; + + + +/* Line 1455 of yacc.c */ +#line 2628 "parse-gram.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + yyerror_range[0] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[0] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[0] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 630 "parse-gram.y" + + + +/* Return the location of the left-hand side of a rule whose + right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in + the right-hand side, and return an empty location equal to the end + boundary of RHS[0] if the right-hand side is empty. */ + +static YYLTYPE +lloc_default (YYLTYPE const *rhs, int n) +{ + int i; + YYLTYPE loc; + + /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;". + The bug is fixed in 7.4.2m, but play it safe for now. */ + loc.start = rhs[n].end; + loc.end = rhs[n].end; + + /* Ignore empty nonterminals the start of the the right-hand side. + Do not bother to ignore them at the end of the right-hand side, + since empty nonterminals have the same end as their predecessors. */ + for (i = 1; i <= n; i++) + if (! equal_boundaries (rhs[i].start, rhs[i].end)) + { + loc.start = rhs[i].start; + break; + } + + return loc; +} + + +/* Add a lex-param or a parse-param (depending on TYPE) with + declaration DECL and location LOC. */ + +static void +add_param (char const *type, char *decl, location loc) +{ + static char const alphanum[26 + 26 + 1 + 10] = + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "_" + "0123456789"; + char const *name_start = NULL; + char *p; + + /* Stop on last actual character. */ + for (p = decl; p[1]; p++) + if ((p == decl + || ! memchr (alphanum, p[-1], sizeof alphanum)) + && memchr (alphanum, p[0], sizeof alphanum - 10)) + name_start = p; + + /* Strip the surrounding '{' and '}', and any blanks just inside + the braces. */ + while (*--p == ' ' || *p == '\t') + continue; + p[1] = '\0'; + while (*++decl == ' ' || *decl == '\t') + continue; + + if (! name_start) + complain_at (loc, _("missing identifier in parameter declaration")); + else + { + char *name; + size_t name_len; + + for (name_len = 1; + memchr (alphanum, name_start[name_len], sizeof alphanum); + name_len++) + continue; + + name = xmalloc (name_len + 1); + memcpy (name, name_start, name_len); + name[name_len] = '\0'; + muscle_pair_list_grow (type, decl, name); + free (name); + } + + gram_scanner_last_string_free (); +} + + +static void +version_check (location const *loc, char const *version) +{ + if (strverscmp (version, PACKAGE_VERSION) > 0) + { + complain_at (*loc, "require bison %s, but have %s", + version, PACKAGE_VERSION); + exit (63); + } +} + +static void +gram_error (location const *loc, char const *msg) +{ + complain_at (*loc, "%s", msg); +} + +char const * +token_name (int type) +{ + return yytname[YYTRANSLATE (type)]; +} + +static char const * +char_name (char c) +{ + if (c == '\'') + return "'\\''"; + else + { + char buf[4]; + buf[0] = '\''; buf[1] = c; buf[2] = '\''; buf[3] = '\0'; + return quotearg_style (escape_quoting_style, buf); + } +} + diff --git a/src/parse-gram.h b/src/parse-gram.h new file mode 100644 index 0000000..938b201 --- /dev/null +++ b/src/parse-gram.h @@ -0,0 +1,201 @@ + +/* A Bison parser, made by GNU Bison 2.4.4-738cd. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 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 . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + GRAM_EOF = 0, + STRING = 258, + INT = 259, + PERCENT_TOKEN = 260, + PERCENT_NTERM = 261, + PERCENT_TYPE = 262, + PERCENT_DESTRUCTOR = 263, + PERCENT_PRINTER = 264, + PERCENT_LEFT = 265, + PERCENT_RIGHT = 266, + PERCENT_NONASSOC = 267, + PERCENT_PREC = 268, + PERCENT_DPREC = 269, + PERCENT_MERGE = 270, + PERCENT_CODE = 271, + PERCENT_DEBUG = 272, + PERCENT_DEFAULT_PREC = 273, + PERCENT_DEFINE = 274, + PERCENT_DEFINES = 275, + PERCENT_ERROR_VERBOSE = 276, + PERCENT_EXPECT = 277, + PERCENT_EXPECT_RR = 278, + PERCENT_FILE_PREFIX = 279, + PERCENT_GLR_PARSER = 280, + PERCENT_INITIAL_ACTION = 281, + PERCENT_LANGUAGE = 282, + PERCENT_LEX_PARAM = 283, + PERCENT_LOCATIONS = 284, + PERCENT_NAME_PREFIX = 285, + PERCENT_NO_DEFAULT_PREC = 286, + PERCENT_NO_LINES = 287, + PERCENT_NONDETERMINISTIC_PARSER = 288, + PERCENT_OUTPUT = 289, + PERCENT_PARSE_PARAM = 290, + PERCENT_PURE_PARSER = 291, + PERCENT_REQUIRE = 292, + PERCENT_SKELETON = 293, + PERCENT_START = 294, + PERCENT_TOKEN_TABLE = 295, + PERCENT_VERBOSE = 296, + PERCENT_YACC = 297, + BRACED_CODE = 298, + CHAR = 299, + EPILOGUE = 300, + EQUAL = 301, + ID = 302, + ID_COLON = 303, + PERCENT_PERCENT = 304, + PIPE = 305, + PROLOGUE = 306, + SEMICOLON = 307, + TYPE = 308, + TYPE_TAG_ANY = 309, + TYPE_TAG_NONE = 310, + PERCENT_UNION = 311 + }; +#endif +/* Tokens. */ +#define GRAM_EOF 0 +#define STRING 258 +#define INT 259 +#define PERCENT_TOKEN 260 +#define PERCENT_NTERM 261 +#define PERCENT_TYPE 262 +#define PERCENT_DESTRUCTOR 263 +#define PERCENT_PRINTER 264 +#define PERCENT_LEFT 265 +#define PERCENT_RIGHT 266 +#define PERCENT_NONASSOC 267 +#define PERCENT_PREC 268 +#define PERCENT_DPREC 269 +#define PERCENT_MERGE 270 +#define PERCENT_CODE 271 +#define PERCENT_DEBUG 272 +#define PERCENT_DEFAULT_PREC 273 +#define PERCENT_DEFINE 274 +#define PERCENT_DEFINES 275 +#define PERCENT_ERROR_VERBOSE 276 +#define PERCENT_EXPECT 277 +#define PERCENT_EXPECT_RR 278 +#define PERCENT_FILE_PREFIX 279 +#define PERCENT_GLR_PARSER 280 +#define PERCENT_INITIAL_ACTION 281 +#define PERCENT_LANGUAGE 282 +#define PERCENT_LEX_PARAM 283 +#define PERCENT_LOCATIONS 284 +#define PERCENT_NAME_PREFIX 285 +#define PERCENT_NO_DEFAULT_PREC 286 +#define PERCENT_NO_LINES 287 +#define PERCENT_NONDETERMINISTIC_PARSER 288 +#define PERCENT_OUTPUT 289 +#define PERCENT_PARSE_PARAM 290 +#define PERCENT_PURE_PARSER 291 +#define PERCENT_REQUIRE 292 +#define PERCENT_SKELETON 293 +#define PERCENT_START 294 +#define PERCENT_TOKEN_TABLE 295 +#define PERCENT_VERBOSE 296 +#define PERCENT_YACC 297 +#define BRACED_CODE 298 +#define CHAR 299 +#define EPILOGUE 300 +#define EQUAL 301 +#define ID 302 +#define ID_COLON 303 +#define PERCENT_PERCENT 304 +#define PIPE 305 +#define PROLOGUE 306 +#define SEMICOLON 307 +#define TYPE 308 +#define TYPE_TAG_ANY 309 +#define TYPE_TAG_NONE 310 +#define PERCENT_UNION 311 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1740 of yacc.c */ +#line 92 "parse-gram.y" + + symbol *symbol; + symbol_list *list; + int integer; + char const *chars; + char *code; + assoc assoc; + uniqstr uniqstr; + unsigned char character; + + + +/* Line 1740 of yacc.c */ +#line 179 "parse-gram.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + + diff --git a/src/parse-gram.y b/src/parse-gram.y new file mode 100644 index 0000000..a8526b2 --- /dev/null +++ b/src/parse-gram.y @@ -0,0 +1,749 @@ +%{/* Bison Grammar Parser -*- C -*- + + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include "complain.h" +#include "conflicts.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "muscle_tab.h" +#include "quotearg.h" +#include "reader.h" +#include "symlist.h" +#include "scan-gram.h" +#include "scan-code.h" + +#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) +static YYLTYPE lloc_default (YYLTYPE const *, int); + +#define YY_LOCATION_PRINT(File, Loc) \ + location_print (File, Loc) + +static void version_check (location const *loc, char const *version); + +/* Request detailed syntax error messages, and pass them to GRAM_ERROR. + FIXME: depends on the undocumented availability of YYLLOC. */ +#undef yyerror +#define yyerror(Msg) \ + gram_error (&yylloc, Msg) +static void gram_error (location const *, char const *); + +static char const *char_name (char); + +/** Add a lex-param or a parse-param. + * + * \param type \a lex_param or \a parse_param + * \param decl the formal argument + * \param loc the location in the source. + */ +static void add_param (char const *type, char *decl, location loc); + + +static symbol_class current_class = unknown_sym; +static uniqstr current_type = NULL; +static symbol *current_lhs; +static location current_lhs_location; +static int current_prec = 0; + +#define YYTYPE_INT16 int_fast16_t +#define YYTYPE_INT8 int_fast8_t +#define YYTYPE_UINT16 uint_fast16_t +#define YYTYPE_UINT8 uint_fast8_t +%} + +%debug +%verbose +%defines +%locations +%pure-parser +%error-verbose +%name-prefix="gram_" +%expect 0 + +%initial-action +{ + /* Bison's grammar can initial empty locations, hence a default + location is needed. */ + boundary_set (&@$.start, current_file, 1, 1); + boundary_set (&@$.end, current_file, 1, 1); +} + +%union +{ + symbol *symbol; + symbol_list *list; + int integer; + char const *chars; + char *code; + assoc assoc; + uniqstr uniqstr; + unsigned char character; +}; + +/* Define the tokens together with their human representation. */ +%token GRAM_EOF 0 "end of file" +%token STRING "string" +%token INT "integer" + +%token PERCENT_TOKEN "%token" +%token PERCENT_NTERM "%nterm" + +%token PERCENT_TYPE "%type" +%token PERCENT_DESTRUCTOR "%destructor" +%token PERCENT_PRINTER "%printer" + +%token PERCENT_LEFT "%left" +%token PERCENT_RIGHT "%right" +%token PERCENT_NONASSOC "%nonassoc" + +%token PERCENT_PREC "%prec" +%token PERCENT_DPREC "%dprec" +%token PERCENT_MERGE "%merge" + + +/*----------------------. +| Global Declarations. | +`----------------------*/ + +%token + PERCENT_CODE "%code" + PERCENT_DEBUG "%debug" + PERCENT_DEFAULT_PREC "%default-prec" + PERCENT_DEFINE "%define" + PERCENT_DEFINES "%defines" + PERCENT_ERROR_VERBOSE "%error-verbose" + PERCENT_EXPECT "%expect" + PERCENT_EXPECT_RR "%expect-rr" + PERCENT_FILE_PREFIX "%file-prefix" + PERCENT_GLR_PARSER "%glr-parser" + PERCENT_INITIAL_ACTION "%initial-action" + PERCENT_LANGUAGE "%language" + PERCENT_LEX_PARAM "%lex-param" + PERCENT_LOCATIONS "%locations" + PERCENT_NAME_PREFIX "%name-prefix" + PERCENT_NO_DEFAULT_PREC "%no-default-prec" + PERCENT_NO_LINES "%no-lines" + PERCENT_NONDETERMINISTIC_PARSER + "%nondeterministic-parser" + PERCENT_OUTPUT "%output" + PERCENT_PARSE_PARAM "%parse-param" + PERCENT_PURE_PARSER "%pure-parser" + PERCENT_REQUIRE "%require" + PERCENT_SKELETON "%skeleton" + PERCENT_START "%start" + PERCENT_TOKEN_TABLE "%token-table" + PERCENT_VERBOSE "%verbose" + PERCENT_YACC "%yacc" +; + +%token BRACED_CODE "{...}" +%token CHAR "char" +%token EPILOGUE "epilogue" +%token EQUAL "=" +%token ID "identifier" +%token ID_COLON "identifier:" +%token PERCENT_PERCENT "%%" +%token PIPE "|" +%token PROLOGUE "%{...%}" +%token SEMICOLON ";" +%token TYPE "type" +%token TYPE_TAG_ANY "<*>" +%token TYPE_TAG_NONE "<>" + +%type CHAR +%printer { fputs (char_name ($$), stderr); } CHAR + +/* braceless is not to be used for rule or symbol actions, as it + calls code_props_plain_init. */ +%type STRING "%{...%}" EPILOGUE braceless content.opt +%type "{...}" +%printer { fputs (quotearg_style (c_quoting_style, $$), stderr); } + STRING +%printer { fprintf (stderr, "{\n%s\n}", $$); } + braceless content.opt "{...}" "%{...%}" EPILOGUE + +%type TYPE ID ID_COLON variable +%printer { fprintf (stderr, "<%s>", $$); } TYPE +%printer { fputs ($$, stderr); } ID variable +%printer { fprintf (stderr, "%s:", $$); } ID_COLON + +%type INT +%printer { fprintf (stderr, "%d", $$); } INT + +%type id id_colon symbol symbol.prec string_as_id +%printer { fprintf (stderr, "%s", $$->tag); } id symbol string_as_id +%printer { fprintf (stderr, "%s:", $$->tag); } id_colon + +%type precedence_declarator +%type symbols.1 symbols.prec generic_symlist generic_symlist_item +%% + +input: + prologue_declarations "%%" grammar epilogue.opt +; + + + /*------------------------------------. + | Declarations: before the first %%. | + `------------------------------------*/ + +prologue_declarations: + /* Nothing */ +| prologue_declarations prologue_declaration +; + +prologue_declaration: + grammar_declaration +| "%{...%}" + { + code_props plain_code; + code_props_plain_init (&plain_code, $1, @1); + code_props_translate_code (&plain_code); + gram_scanner_last_string_free (); + muscle_code_grow (union_seen ? "post_prologue" : "pre_prologue", + plain_code.code, @1); + code_scanner_last_string_free (); + } +| "%debug" { debug_flag = true; } +| "%define" variable content.opt + { + muscle_percent_define_insert ($2, @2, $3); + } +| "%defines" { defines_flag = true; } +| "%defines" STRING + { + defines_flag = true; + spec_defines_file = xstrdup ($2); + } +| "%error-verbose" { error_verbose = true; } +| "%expect" INT { expected_sr_conflicts = $2; } +| "%expect-rr" INT { expected_rr_conflicts = $2; } +| "%file-prefix" STRING { spec_file_prefix = $2; } +| "%file-prefix" "=" STRING { spec_file_prefix = $3; } /* deprecated */ +| "%glr-parser" + { + nondeterministic_parser = true; + glr_parser = true; + } +| "%initial-action" "{...}" + { + code_props action; + code_props_symbol_action_init (&action, $2, @2); + code_props_translate_code (&action); + gram_scanner_last_string_free (); + muscle_code_grow ("initial_action", action.code, @2); + code_scanner_last_string_free (); + } +| "%language" STRING { language_argmatch ($2, grammar_prio, &@1); } +| "%lex-param" "{...}" { add_param ("lex_param", $2, @2); } +| "%locations" { locations_flag = true; } +| "%name-prefix" STRING { spec_name_prefix = $2; } +| "%name-prefix" "=" STRING { spec_name_prefix = $3; } /* deprecated */ +| "%no-lines" { no_lines_flag = true; } +| "%nondeterministic-parser" { nondeterministic_parser = true; } +| "%output" STRING { spec_outfile = $2; } +| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */ +| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); } +| "%pure-parser" + { + /* %pure-parser is deprecated in favor of `%define api.pure', so use + `%define api.pure' in a backward-compatible manner here. First, don't + complain if %pure-parser is specified multiple times. */ + if (!muscle_find_const ("percent_define(api.pure)")) + muscle_percent_define_insert ("api.pure", @1, ""); + /* In all cases, use api.pure now so that the backend doesn't complain if + the skeleton ignores api.pure, but do warn now if there's a previous + conflicting definition from an actual %define. */ + if (!muscle_percent_define_flag_if ("api.pure")) + muscle_percent_define_insert ("api.pure", @1, ""); + } +| "%require" STRING { version_check (&@2, $2); } +| "%skeleton" STRING + { + char const *skeleton_user = $2; + if (strchr (skeleton_user, '/')) + { + size_t dir_length = strlen (current_file); + char *skeleton_build; + while (dir_length && current_file[dir_length - 1] != '/') + --dir_length; + while (dir_length && current_file[dir_length - 1] == '/') + --dir_length; + skeleton_build = + xmalloc (dir_length + 1 + strlen (skeleton_user) + 1); + if (dir_length > 0) + { + strncpy (skeleton_build, current_file, dir_length); + skeleton_build[dir_length++] = '/'; + } + strcpy (skeleton_build + dir_length, skeleton_user); + skeleton_user = uniqstr_new (skeleton_build); + free (skeleton_build); + } + skeleton_arg (skeleton_user, grammar_prio, &@1); + } +| "%token-table" { token_table_flag = true; } +| "%verbose" { report_flag |= report_states; } +| "%yacc" { yacc_flag = true; } +| /*FIXME: Err? What is this horror doing here? */ ";" +; + +grammar_declaration: + precedence_declaration +| symbol_declaration +| "%start" symbol + { + grammar_start_symbol_set ($2, @2); + } +| "%destructor" "{...}" generic_symlist + { + symbol_list *list; + for (list = $3; list; list = list->next) + symbol_list_destructor_set (list, $2, @2); + symbol_list_free ($3); + } +| "%printer" "{...}" generic_symlist + { + symbol_list *list; + for (list = $3; list; list = list->next) + symbol_list_printer_set (list, $2, @2); + symbol_list_free ($3); + } +| "%default-prec" + { + default_prec = true; + } +| "%no-default-prec" + { + default_prec = false; + } +| "%code" braceless + { + /* Do not invoke muscle_percent_code_grow here since it invokes + muscle_user_name_list_grow. */ + muscle_code_grow ("percent_code()", $2, @2); + code_scanner_last_string_free (); + } +| "%code" ID braceless + { + muscle_percent_code_grow ($2, @2, $3, @3); + code_scanner_last_string_free (); + } +; + + +/*----------* + | %union. | + *----------*/ + +%token PERCENT_UNION "%union"; + +union_name: + /* Nothing. */ {} +| ID { muscle_code_grow ("union_name", $1, @1); } +; + +grammar_declaration: + "%union" union_name braceless + { + union_seen = true; + muscle_code_grow ("stype", $3, @3); + code_scanner_last_string_free (); + } +; + + + + +symbol_declaration: + "%nterm" { current_class = nterm_sym; } symbol_defs.1 + { + current_class = unknown_sym; + current_type = NULL; + } +| "%token" { current_class = token_sym; } symbol_defs.1 + { + current_class = unknown_sym; + current_type = NULL; + } +| "%type" TYPE symbols.1 + { + symbol_list *list; + tag_seen = true; + for (list = $3; list; list = list->next) + symbol_type_set (list->content.sym, $2, @2); + symbol_list_free ($3); + } +; + +precedence_declaration: + precedence_declarator type.opt symbols.prec + { + symbol_list *list; + ++current_prec; + for (list = $3; list; list = list->next) + { + symbol_type_set (list->content.sym, current_type, @2); + symbol_precedence_set (list->content.sym, current_prec, $1, @1); + } + symbol_list_free ($3); + current_type = NULL; + } +; + +precedence_declarator: + "%left" { $$ = left_assoc; } +| "%right" { $$ = right_assoc; } +| "%nonassoc" { $$ = non_assoc; } +; + +type.opt: + /* Nothing. */ { current_type = NULL; } +| TYPE { current_type = $1; tag_seen = true; } +; + +/* Just like symbols.1 but accept INT for the sake of POSIX. */ +symbols.prec: + symbol.prec + { $$ = symbol_list_sym_new ($1, @1); } +| symbols.prec symbol.prec + { $$ = symbol_list_prepend ($1, symbol_list_sym_new ($2, @2)); } +; + +symbol.prec: + symbol { $$ = $1; } + | symbol INT { $$ = $1; symbol_user_token_number_set ($1, $2, @2); } + ; + +/* One or more symbols to be %typed. */ +symbols.1: + symbol + { $$ = symbol_list_sym_new ($1, @1); } +| symbols.1 symbol + { $$ = symbol_list_prepend ($1, symbol_list_sym_new ($2, @2)); } +; + +generic_symlist: + generic_symlist_item { $$ = $1; } +| generic_symlist generic_symlist_item { $$ = symbol_list_prepend ($1, $2); } +; + +generic_symlist_item: + symbol { $$ = symbol_list_sym_new ($1, @1); } +| TYPE { $$ = symbol_list_type_new ($1, @1); } +| "<*>" { $$ = symbol_list_default_tagged_new (@1); } +| "<>" { $$ = symbol_list_default_tagless_new (@1); } +; + +/* One token definition. */ +symbol_def: + TYPE + { + current_type = $1; + tag_seen = true; + } +| id + { + symbol_class_set ($1, current_class, @1, true); + symbol_type_set ($1, current_type, @1); + } +| id INT + { + symbol_class_set ($1, current_class, @1, true); + symbol_type_set ($1, current_type, @1); + symbol_user_token_number_set ($1, $2, @2); + } +| id string_as_id + { + symbol_class_set ($1, current_class, @1, true); + symbol_type_set ($1, current_type, @1); + symbol_make_alias ($1, $2, @$); + } +| id INT string_as_id + { + symbol_class_set ($1, current_class, @1, true); + symbol_type_set ($1, current_type, @1); + symbol_user_token_number_set ($1, $2, @2); + symbol_make_alias ($1, $3, @$); + } +; + +/* One or more symbol definitions. */ +symbol_defs.1: + symbol_def +| symbol_defs.1 symbol_def +; + + + /*------------------------------------------. + | The grammar section: between the two %%. | + `------------------------------------------*/ + +grammar: + rules_or_grammar_declaration +| grammar rules_or_grammar_declaration +; + +/* As a Bison extension, one can use the grammar declarations in the + body of the grammar. */ +rules_or_grammar_declaration: + rules +| grammar_declaration ";" +| error ";" + { + yyerrok; + } +; + +rules: + id_colon { current_lhs = $1; current_lhs_location = @1; } rhses.1 +; + +rhses.1: + rhs { grammar_current_rule_end (@1); } +| rhses.1 "|" rhs { grammar_current_rule_end (@3); } +| rhses.1 ";" +; + +rhs: + /* Nothing. */ + { grammar_current_rule_begin (current_lhs, current_lhs_location); } +| rhs symbol + { grammar_current_rule_symbol_append ($2, @2); } +| rhs "{...}" + { grammar_current_rule_action_append ($2, @2); } +| rhs "%prec" symbol + { grammar_current_rule_prec_set ($3, @3); } +| rhs "%dprec" INT + { grammar_current_rule_dprec_set ($3, @3); } +| rhs "%merge" TYPE + { grammar_current_rule_merge_set ($3, @3); } +; + + +/*----------------------------* + | variable and content.opt. | + *---------------------------*/ + +variable: + ID + | STRING { $$ = uniqstr_new ($1); } /* deprecated and not M4-friendly */ + ; + +/* Some content or empty by default. */ +content.opt: + /* Nothing. */ + { + $$ = ""; + } +| STRING +; + + +/*-------------* + | braceless. | + *-------------*/ + +braceless: + "{...}" + { + code_props plain_code; + $1[strlen ($1) - 1] = '\n'; + code_props_plain_init (&plain_code, $1+1, @1); + code_props_translate_code (&plain_code); + gram_scanner_last_string_free (); + $$ = plain_code.code; + } +; + + +/*---------------* + | Identifiers. | + *---------------*/ + +/* Identifiers are returned as uniqstr values by the scanner. + Depending on their use, we may need to make them genuine symbols. */ + +id: + ID + { $$ = symbol_from_uniqstr ($1, @1); } +| CHAR + { + $$ = symbol_get (char_name ($1), @1); + symbol_class_set ($$, token_sym, @1, false); + symbol_user_token_number_set ($$, $1, @1); + } +; + +id_colon: + ID_COLON { $$ = symbol_from_uniqstr ($1, @1); } +; + + +symbol: + id +| string_as_id +; + +/* A string used as an ID: quote it. */ +string_as_id: + STRING + { + $$ = symbol_get (quotearg_style (c_quoting_style, $1), @1); + symbol_class_set ($$, token_sym, @1, false); + } +; + +epilogue.opt: + /* Nothing. */ +| "%%" EPILOGUE + { + code_props plain_code; + code_props_plain_init (&plain_code, $2, @2); + code_props_translate_code (&plain_code); + gram_scanner_last_string_free (); + muscle_code_grow ("epilogue", plain_code.code, @2); + code_scanner_last_string_free (); + } +; + +%% + + +/* Return the location of the left-hand side of a rule whose + right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in + the right-hand side, and return an empty location equal to the end + boundary of RHS[0] if the right-hand side is empty. */ + +static YYLTYPE +lloc_default (YYLTYPE const *rhs, int n) +{ + int i; + YYLTYPE loc; + + /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;". + The bug is fixed in 7.4.2m, but play it safe for now. */ + loc.start = rhs[n].end; + loc.end = rhs[n].end; + + /* Ignore empty nonterminals the start of the the right-hand side. + Do not bother to ignore them at the end of the right-hand side, + since empty nonterminals have the same end as their predecessors. */ + for (i = 1; i <= n; i++) + if (! equal_boundaries (rhs[i].start, rhs[i].end)) + { + loc.start = rhs[i].start; + break; + } + + return loc; +} + + +/* Add a lex-param or a parse-param (depending on TYPE) with + declaration DECL and location LOC. */ + +static void +add_param (char const *type, char *decl, location loc) +{ + static char const alphanum[26 + 26 + 1 + 10] = + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "_" + "0123456789"; + char const *name_start = NULL; + char *p; + + /* Stop on last actual character. */ + for (p = decl; p[1]; p++) + if ((p == decl + || ! memchr (alphanum, p[-1], sizeof alphanum)) + && memchr (alphanum, p[0], sizeof alphanum - 10)) + name_start = p; + + /* Strip the surrounding '{' and '}', and any blanks just inside + the braces. */ + while (*--p == ' ' || *p == '\t') + continue; + p[1] = '\0'; + while (*++decl == ' ' || *decl == '\t') + continue; + + if (! name_start) + complain_at (loc, _("missing identifier in parameter declaration")); + else + { + char *name; + size_t name_len; + + for (name_len = 1; + memchr (alphanum, name_start[name_len], sizeof alphanum); + name_len++) + continue; + + name = xmalloc (name_len + 1); + memcpy (name, name_start, name_len); + name[name_len] = '\0'; + muscle_pair_list_grow (type, decl, name); + free (name); + } + + gram_scanner_last_string_free (); +} + + +static void +version_check (location const *loc, char const *version) +{ + if (strverscmp (version, PACKAGE_VERSION) > 0) + { + complain_at (*loc, "require bison %s, but have %s", + version, PACKAGE_VERSION); + exit (63); + } +} + +static void +gram_error (location const *loc, char const *msg) +{ + complain_at (*loc, "%s", msg); +} + +char const * +token_name (int type) +{ + return yytname[YYTRANSLATE (type)]; +} + +static char const * +char_name (char c) +{ + if (c == '\'') + return "'\\''"; + else + { + char buf[4]; + buf[0] = '\''; buf[1] = c; buf[2] = '\''; buf[3] = '\0'; + return quotearg_style (escape_quoting_style, buf); + } +} diff --git a/src/print-xml.c b/src/print-xml.c new file mode 100644 index 0000000..cb6707d --- /dev/null +++ b/src/print-xml.c @@ -0,0 +1,536 @@ +/* Print an xml on generated parser, for Bison, + + Copyright (C) 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + Bison is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Bison is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Bison; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +#include +#include "system.h" + +#include + +#include +#include + +#include "LR0.h" +#include "closure.h" +#include "conflicts.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "lalr.h" +#include "print.h" +#include "print-xml.h" +#include "reader.h" +#include "reduce.h" +#include "state.h" +#include "symtab.h" +#include "tables.h" + +static bitset no_reduce_set; +struct escape_buf +{ + char *ptr; + size_t size; +}; +static struct escape_buf escape_bufs[2]; + + +/*--------------------------------. +| Report information on a state. | +`--------------------------------*/ + +static void +print_core (FILE *out, int level, state *s) +{ + size_t i; + item_number *sitems = s->items; + size_t snritems = s->nitems; + + /* Output all the items of a state, not only its kernel. */ + closure (sitems, snritems); + sitems = itemset; + snritems = nitemset; + + if (!snritems) { + xml_puts (out, level, ""); + return; + } + + xml_puts (out, level, ""); + + for (i = 0; i < snritems; i++) + { + bool printed = false; + item_number *sp; + item_number *sp1; + rule_number r; + + sp1 = sp = ritem + sitems[i]; + + while (*sp >= 0) + sp++; + + r = item_number_as_rule_number (*sp); + sp = rules[r].rhs; + + /* Display the lookahead tokens? */ + if (item_number_is_rule_number (*sp1)) + { + reductions *reds = s->reductions; + int red = state_reduction_find (s, &rules[r]); + /* Print item with lookaheads if there are. */ + if (reds->lookahead_tokens && red != -1) + { + xml_printf (out, level + 1, + "", + rules[r].number, sp1 - sp); + state_rule_lookahead_tokens_print_xml (s, &rules[r], + out, level + 2); + xml_puts (out, level + 1, ""); + printed = true; + } + } + + if (!printed) + { + xml_printf (out, level + 1, + "", + rules[r].number, + sp1 - sp); + } + } + xml_puts (out, level, ""); +} + + +/*-----------------------------------------------------------. +| Report the shifts if DISPLAY_SHIFTS_P or the gotos of S on | +| OUT. | +`-----------------------------------------------------------*/ + +static void +print_transitions (state *s, FILE *out, int level) +{ + transitions *trans = s->transitions; + int n = 0; + int i; + + for (i = 0; i < trans->num; i++) + if (!TRANSITION_IS_DISABLED (trans, i)) + { + n++; + } + + /* Nothing to report. */ + if (!n) { + xml_puts (out, level, ""); + return; + } + + /* Report lookahead tokens and shifts. */ + xml_puts (out, level, ""); + + for (i = 0; i < trans->num; i++) + if (!TRANSITION_IS_DISABLED (trans, i) + && TRANSITION_IS_SHIFT (trans, i)) + { + symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)]; + char const *tag = sym->tag; + state *s1 = trans->states[i]; + + xml_printf (out, level + 1, + "", + xml_escape (tag), s1->number); + } + + for (i = 0; i < trans->num; i++) + if (!TRANSITION_IS_DISABLED (trans, i) + && !TRANSITION_IS_SHIFT (trans, i)) + { + symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)]; + char const *tag = sym->tag; + state *s1 = trans->states[i]; + + xml_printf (out, level + 1, + "", + xml_escape (tag), s1->number); + } + + xml_puts (out, level, ""); +} + + +/*--------------------------------------------------------. +| Report the explicit errors of S raised from %nonassoc. | +`--------------------------------------------------------*/ + +static void +print_errs (FILE *out, int level, state *s) +{ + errs *errp = s->errs; + bool count = false; + int i; + + for (i = 0; i < errp->num; ++i) + if (errp->symbols[i]) + count = true; + + /* Nothing to report. */ + if (!count) { + xml_puts (out, level, ""); + return; + } + + /* Report lookahead tokens and errors. */ + xml_puts (out, level, ""); + for (i = 0; i < errp->num; ++i) + if (errp->symbols[i]) + { + char const *tag = errp->symbols[i]->tag; + xml_printf (out, level + 1, + "nonassociative", + xml_escape (tag)); + } + xml_puts (out, level, ""); +} + + +/*-------------------------------------------------------------------------. +| Report a reduction of RULE on LOOKAHEAD_TOKEN (which can be `default'). | +| If not ENABLED, the rule is masked by a shift or a reduce (S/R and | +| R/R conflicts). | +`-------------------------------------------------------------------------*/ + +static void +print_reduction (FILE *out, int level, char const *lookahead_token, + rule *r, bool enabled) +{ + if (r->number) + xml_printf (out, level, + "", + xml_escape (lookahead_token), + r->number, + enabled ? "true" : "false"); + else + xml_printf (out, level, + "", + xml_escape (lookahead_token), + enabled ? "true" : "false"); +} + + +/*-------------------------------------------. +| Report on OUT the reduction actions of S. | +`-------------------------------------------*/ + +static void +print_reductions (FILE *out, int level, state *s) +{ + transitions *trans = s->transitions; + reductions *reds = s->reductions; + rule *default_rule = NULL; + int report = false; + int i, j; + + if (reds->num == 0) { + xml_puts (out, level, ""); + return; + } + + if (yydefact[s->number] != 0) + default_rule = &rules[yydefact[s->number] - 1]; + + bitset_zero (no_reduce_set); + FOR_EACH_SHIFT (trans, i) + bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i)); + for (i = 0; i < s->errs->num; ++i) + if (s->errs->symbols[i]) + bitset_set (no_reduce_set, s->errs->symbols[i]->number); + + if (default_rule) + report = true; + + if (reds->lookahead_tokens) + for (i = 0; i < ntokens; i++) + { + bool count = bitset_test (no_reduce_set, i); + + for (j = 0; j < reds->num; ++j) + if (bitset_test (reds->lookahead_tokens[j], i)) + { + if (! count) + { + if (reds->rules[j] != default_rule) + report = true; + count = true; + } + else + { + report = true; + } + } + } + + /* Nothing to report. */ + if (!report) { + xml_puts (out, level, ""); + return; + } + + xml_puts (out, level, ""); + + /* Report lookahead tokens (or $default) and reductions. */ + if (reds->lookahead_tokens) + for (i = 0; i < ntokens; i++) + { + bool defaulted = false; + bool count = bitset_test (no_reduce_set, i); + + for (j = 0; j < reds->num; ++j) + if (bitset_test (reds->lookahead_tokens[j], i)) + { + if (! count) + { + if (reds->rules[j] != default_rule) + print_reduction (out, level + 1, symbols[i]->tag, + reds->rules[j], true); + else + defaulted = true; + count = true; + } + else + { + if (defaulted) + print_reduction (out, level + 1, symbols[i]->tag, + default_rule, true); + defaulted = false; + print_reduction (out, level + 1, symbols[i]->tag, + reds->rules[j], false); + } + } + } + + if (default_rule) + print_reduction (out, level + 1, + "$default", default_rule, true); + + xml_puts (out, level, ""); +} + + +/*--------------------------------------------------------------. +| Report on OUT all the actions (shifts, gotos, reductions, and | +| explicit erros from %nonassoc) of S. | +`--------------------------------------------------------------*/ + +static void +print_actions (FILE *out, int level, state *s) +{ + xml_puts (out, level, ""); + print_transitions (s, out, level + 1); + print_errs (out, level + 1, s); + print_reductions (out, level + 1, s); + xml_puts (out, level, ""); +} + + +/*----------------------------------. +| Report all the data on S on OUT. | +`----------------------------------*/ + +static void +print_state (FILE *out, int level, state *s) +{ + fputc ('\n', out); + xml_printf (out, level, "", s->number); + print_core (out, level + 1, s); + print_actions (out, level + 1, s); + if (s->solved_conflicts_xml) + { + xml_puts (out, level + 1, ""); + fputs (s->solved_conflicts_xml, out); + xml_puts (out, level + 1, ""); + } + else + xml_puts (out, level + 1, ""); + xml_puts (out, level, ""); +} + + +/*-----------------------------------------. +| Print information on the whole grammar. | +`-----------------------------------------*/ + +static void +print_grammar (FILE *out, int level) +{ + symbol_number i; + + fputc ('\n', out); + xml_puts (out, level, ""); + grammar_rules_print_xml (out, level); + + /* Terminals */ + xml_puts (out, level + 1, ""); + for (i = 0; i < max_user_token_number + 1; i++) + if (token_translations[i] != undeftoken->number) + { + char const *tag = symbols[token_translations[i]]->tag; + int precedence = symbols[token_translations[i]]->prec; + assoc associativity = symbols[token_translations[i]]->assoc; + xml_indent (out, level + 2); + fprintf (out, + "\n", out); + } + xml_puts (out, level + 1, ""); + + /* Nonterminals */ + xml_puts (out, level + 1, ""); + for (i = ntokens; i < nsyms + nuseless_nonterminals; i++) + { + char const *tag = symbols[i]->tag; + xml_printf (out, level + 2, + "", + i, xml_escape (tag), + reduce_nonterminal_useless_in_grammar (i) + ? "useless-in-grammar" : "useful"); + } + xml_puts (out, level + 1, ""); + xml_puts (out, level, ""); +} + +void +xml_indent (FILE *out, int level) +{ + int i; + for (i = 0; i < level; i++) + fputs (" ", out); +} + +void +xml_puts (FILE *out, int level, char const *s) +{ + xml_indent (out, level); + fputs (s, out); + fputc ('\n', out); +} + +void +xml_printf (FILE *out, int level, char const *fmt, ...) +{ + va_list arglist; + + xml_indent (out, level); + + va_start (arglist, fmt); + vfprintf (out, fmt, arglist); + va_end (arglist); + + fputc ('\n', out); +} + +static char const * +xml_escape_string (struct escape_buf *buf, char const *str) +{ + size_t len = strlen (str); + size_t max_expansion = sizeof """ - 1; + char *p; + + if (buf->size <= max_expansion * len) + { + buf->size = max_expansion * len + 1; + buf->ptr = x2realloc (buf->ptr, &buf->size); + } + p = buf->ptr; + + for (; *str; str++) + switch (*str) + { + default: *p++ = *str; break; + case '&': p = stpcpy (p, "&" ); break; + case '<': p = stpcpy (p, "<" ); break; + case '>': p = stpcpy (p, ">" ); break; + case '"': p = stpcpy (p, """); break; + } + + *p = '\0'; + return buf->ptr; +} + +char const * +xml_escape_n (int n, char const *str) +{ + return xml_escape_string (escape_bufs + n, str); +} + +char const * +xml_escape (char const *str) +{ + return xml_escape_n (0, str); +} + +void +print_xml (void) +{ + state_number i; + int level = 0; + + FILE *out = xfopen (spec_xml_file, "w"); + + fputs ("\n\n", out); + xml_printf (out, level, "", + xml_escape (VERSION)); + + fputc ('\n', out); + xml_printf (out, level + 1, "%s", + xml_escape (grammar_file)); + + /* print grammar */ + print_grammar (out, level + 1); + + new_closure (nritems); + no_reduce_set = bitset_create (ntokens, BITSET_FIXED); + + /* print automaton */ + fputc ('\n', out); + xml_puts (out, level + 1, ""); + for (i = 0; i < nstates; i++) + print_state (out, level + 2, states[i]); + xml_puts (out, level + 1, ""); + + bitset_free (no_reduce_set); + free_closure (); + + xml_puts (out, 0, ""); + + free (escape_bufs[0].ptr); + free (escape_bufs[1].ptr); + + xfclose (out); +} diff --git a/src/print-xml.h b/src/print-xml.h new file mode 100644 index 0000000..cdef489 --- /dev/null +++ b/src/print-xml.h @@ -0,0 +1,32 @@ +/* Output an xml of the generated parser, for Bison. + + Copyright (C) 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + Bison is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Bison is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Bison; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +#ifndef PRINT_XML_H_ +# define PRINT_XML_H_ + +void xml_indent (FILE *out, int level); +void xml_puts (FILE *, int, char const *); +void xml_printf (FILE *, int, char const *, ...); +char const *xml_escape_n (int n, char const *str); +char const *xml_escape (char const *str); +void print_xml (void); + +#endif /* !PRINT_XML_H_ */ diff --git a/src/print.c b/src/print.c new file mode 100644 index 0000000..ddd76a6 --- /dev/null +++ b/src/print.c @@ -0,0 +1,514 @@ +/* Print information on generated parser, for bison, + + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004, 2005, 2007 + Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include + +#include "LR0.h" +#include "closure.h" +#include "conflicts.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "lalr.h" +#include "print.h" +#include "reader.h" +#include "reduce.h" +#include "state.h" +#include "symtab.h" +#include "tables.h" + +static bitset no_reduce_set; + +#if 0 +static void +print_token (int extnum, int token) +{ + fprintf (out, _(" type %d is %s\n"), extnum, tags[token]); +} +#endif + + + +/*---------------------------------------. +| *WIDTH := max (*WIDTH, strlen (STR)). | +`---------------------------------------*/ + +static void +max_length (size_t *width, const char *str) +{ + size_t len = strlen (str); + if (len > *width) + *width = len; +} + +/*--------------------------------. +| Report information on a state. | +`--------------------------------*/ + +static void +print_core (FILE *out, state *s) +{ + size_t i; + item_number *sitems = s->items; + size_t snritems = s->nitems; + symbol *previous_lhs = NULL; + + /* Output all the items of a state, not only its kernel. */ + if (report_flag & report_itemsets) + { + closure (sitems, snritems); + sitems = itemset; + snritems = nitemset; + } + + if (!snritems) + return; + + fputc ('\n', out); + + for (i = 0; i < snritems; i++) + { + item_number *sp; + item_number *sp1; + rule_number r; + + sp1 = sp = ritem + sitems[i]; + + while (*sp >= 0) + sp++; + + r = item_number_as_rule_number (*sp); + + rule_lhs_print (&rules[r], previous_lhs, out); + previous_lhs = rules[r].lhs; + + for (sp = rules[r].rhs; sp < sp1; sp++) + fprintf (out, " %s", symbols[*sp]->tag); + fputs (" .", out); + for (/* Nothing */; *sp >= 0; ++sp) + fprintf (out, " %s", symbols[*sp]->tag); + + /* Display the lookahead tokens? */ + if (report_flag & report_lookahead_tokens + && item_number_is_rule_number (*sp1)) + state_rule_lookahead_tokens_print (s, &rules[r], out); + + fputc ('\n', out); + } +} + + +/*------------------------------------------------------------. +| Report the shifts iff DISPLAY_SHIFTS_P or the gotos of S on | +| OUT. | +`------------------------------------------------------------*/ + +static void +print_transitions (state *s, FILE *out, bool display_transitions_p) +{ + transitions *trans = s->transitions; + size_t width = 0; + int i; + + /* Compute the width of the lookahead token column. */ + for (i = 0; i < trans->num; i++) + if (!TRANSITION_IS_DISABLED (trans, i) + && TRANSITION_IS_SHIFT (trans, i) == display_transitions_p) + { + symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)]; + max_length (&width, sym->tag); + } + + /* Nothing to report. */ + if (!width) + return; + + fputc ('\n', out); + width += 2; + + /* Report lookahead tokens and shifts. */ + for (i = 0; i < trans->num; i++) + if (!TRANSITION_IS_DISABLED (trans, i) + && TRANSITION_IS_SHIFT (trans, i) == display_transitions_p) + { + symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)]; + const char *tag = sym->tag; + state *s1 = trans->states[i]; + int j; + + fprintf (out, " %s", tag); + for (j = width - strlen (tag); j > 0; --j) + fputc (' ', out); + if (display_transitions_p) + fprintf (out, _("shift, and go to state %d\n"), s1->number); + else + fprintf (out, _("go to state %d\n"), s1->number); + } +} + + +/*--------------------------------------------------------. +| Report the explicit errors of S raised from %nonassoc. | +`--------------------------------------------------------*/ + +static void +print_errs (FILE *out, state *s) +{ + errs *errp = s->errs; + size_t width = 0; + int i; + + /* Compute the width of the lookahead token column. */ + for (i = 0; i < errp->num; ++i) + if (errp->symbols[i]) + max_length (&width, errp->symbols[i]->tag); + + /* Nothing to report. */ + if (!width) + return; + + fputc ('\n', out); + width += 2; + + /* Report lookahead tokens and errors. */ + for (i = 0; i < errp->num; ++i) + if (errp->symbols[i]) + { + const char *tag = errp->symbols[i]->tag; + int j; + fprintf (out, " %s", tag); + for (j = width - strlen (tag); j > 0; --j) + fputc (' ', out); + fputs (_("error (nonassociative)\n"), out); + } +} + + +/*-------------------------------------------------------------------------. +| Report a reduction of RULE on LOOKAHEAD_TOKEN (which can be `default'). | +| If not ENABLED, the rule is masked by a shift or a reduce (S/R and | +| R/R conflicts). | +`-------------------------------------------------------------------------*/ + +static void +print_reduction (FILE *out, size_t width, + const char *lookahead_token, + rule *r, bool enabled) +{ + int j; + fprintf (out, " %s", lookahead_token); + for (j = width - strlen (lookahead_token); j > 0; --j) + fputc (' ', out); + if (!enabled) + fputc ('[', out); + if (r->number) + fprintf (out, _("reduce using rule %d (%s)"), r->number, r->lhs->tag); + else + fprintf (out, _("accept")); + if (!enabled) + fputc (']', out); + fputc ('\n', out); +} + + +/*-------------------------------------------. +| Report on OUT the reduction actions of S. | +`-------------------------------------------*/ + +static void +print_reductions (FILE *out, state *s) +{ + transitions *trans = s->transitions; + reductions *reds = s->reductions; + rule *default_rule = NULL; + size_t width = 0; + int i, j; + + if (reds->num == 0) + return; + + if (yydefact[s->number] != 0) + default_rule = &rules[yydefact[s->number] - 1]; + + bitset_zero (no_reduce_set); + FOR_EACH_SHIFT (trans, i) + bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i)); + for (i = 0; i < s->errs->num; ++i) + if (s->errs->symbols[i]) + bitset_set (no_reduce_set, s->errs->symbols[i]->number); + + /* Compute the width of the lookahead token column. */ + if (default_rule) + width = strlen (_("$default")); + + if (reds->lookahead_tokens) + for (i = 0; i < ntokens; i++) + { + bool count = bitset_test (no_reduce_set, i); + + for (j = 0; j < reds->num; ++j) + if (bitset_test (reds->lookahead_tokens[j], i)) + { + if (! count) + { + if (reds->rules[j] != default_rule) + max_length (&width, symbols[i]->tag); + count = true; + } + else + { + max_length (&width, symbols[i]->tag); + } + } + } + + /* Nothing to report. */ + if (!width) + return; + + fputc ('\n', out); + width += 2; + + /* Report lookahead tokens (or $default) and reductions. */ + if (reds->lookahead_tokens) + for (i = 0; i < ntokens; i++) + { + bool defaulted = false; + bool count = bitset_test (no_reduce_set, i); + + for (j = 0; j < reds->num; ++j) + if (bitset_test (reds->lookahead_tokens[j], i)) + { + if (! count) + { + if (reds->rules[j] != default_rule) + print_reduction (out, width, + symbols[i]->tag, + reds->rules[j], true); + else + defaulted = true; + count = true; + } + else + { + if (defaulted) + print_reduction (out, width, + symbols[i]->tag, + default_rule, true); + defaulted = false; + print_reduction (out, width, + symbols[i]->tag, + reds->rules[j], false); + } + } + } + + if (default_rule) + print_reduction (out, width, + _("$default"), default_rule, true); +} + + +/*--------------------------------------------------------------. +| Report on OUT all the actions (shifts, gotos, reductions, and | +| explicit erros from %nonassoc) of S. | +`--------------------------------------------------------------*/ + +static void +print_actions (FILE *out, state *s) +{ + /* Print shifts. */ + print_transitions (s, out, true); + print_errs (out, s); + print_reductions (out, s); + /* Print gotos. */ + print_transitions (s, out, false); +} + + +/*----------------------------------. +| Report all the data on S on OUT. | +`----------------------------------*/ + +static void +print_state (FILE *out, state *s) +{ + fputs ("\n\n", out); + fprintf (out, _("state %d"), s->number); + fputc ('\n', out); + print_core (out, s); + print_actions (out, s); + if ((report_flag & report_solved_conflicts) && s->solved_conflicts) + { + fputc ('\n', out); + fputs (s->solved_conflicts, out); + } +} + +/*-----------------------------------------. +| Print information on the whole grammar. | +`-----------------------------------------*/ + +#define END_TEST(End) \ +do { \ + if (column + strlen(buffer) > (End)) \ + { \ + fprintf (out, "%s\n ", buffer); \ + column = 3; \ + buffer[0] = 0; \ + } \ +} while (0) + + +static void +print_grammar (FILE *out) +{ + symbol_number i; + char buffer[90]; + int column = 0; + + grammar_rules_print (out); + + /* TERMINAL (type #) : rule #s terminal is on RHS */ + fprintf (out, "%s\n\n", _("Terminals, with rules where they appear")); + for (i = 0; i < max_user_token_number + 1; i++) + if (token_translations[i] != undeftoken->number) + { + const char *tag = symbols[token_translations[i]]->tag; + rule_number r; + item_number *rhsp; + + buffer[0] = 0; + column = strlen (tag); + fputs (tag, out); + END_TEST (65); + sprintf (buffer, " (%d)", i); + + for (r = 0; r < nrules; r++) + for (rhsp = rules[r].rhs; *rhsp >= 0; rhsp++) + if (item_number_as_symbol_number (*rhsp) == token_translations[i]) + { + END_TEST (65); + sprintf (buffer + strlen (buffer), " %d", r); + break; + } + fprintf (out, "%s\n", buffer); + } + fputs ("\n\n", out); + + + fprintf (out, "%s\n\n", _("Nonterminals, with rules where they appear")); + for (i = ntokens; i < nsyms; i++) + { + int left_count = 0, right_count = 0; + rule_number r; + const char *tag = symbols[i]->tag; + + for (r = 0; r < nrules; r++) + { + item_number *rhsp; + if (rules[r].lhs->number == i) + left_count++; + for (rhsp = rules[r].rhs; *rhsp >= 0; rhsp++) + if (item_number_as_symbol_number (*rhsp) == i) + { + right_count++; + break; + } + } + + buffer[0] = 0; + fputs (tag, out); + column = strlen (tag); + sprintf (buffer, " (%d)", i); + END_TEST (0); + + if (left_count > 0) + { + END_TEST (65); + sprintf (buffer + strlen (buffer), _(" on left:")); + + for (r = 0; r < nrules; r++) + { + if (rules[r].lhs->number == i) + { + END_TEST (65); + sprintf (buffer + strlen (buffer), " %d", r); + } + } + } + + if (right_count > 0) + { + if (left_count > 0) + sprintf (buffer + strlen (buffer), ","); + END_TEST (65); + sprintf (buffer + strlen (buffer), _(" on right:")); + for (r = 0; r < nrules; r++) + { + item_number *rhsp; + for (rhsp = rules[r].rhs; *rhsp >= 0; rhsp++) + if (item_number_as_symbol_number (*rhsp) == i) + { + END_TEST (65); + sprintf (buffer + strlen (buffer), " %d", r); + break; + } + } + } + fprintf (out, "%s\n", buffer); + } +} + +void +print_results (void) +{ + state_number i; + + /* We used to use just .out if SPEC_NAME_PREFIX (-p) was used, but + that conflicts with Posix. */ + FILE *out = xfopen (spec_verbose_file, "w"); + + reduce_output (out); + grammar_rules_partial_print (out, + _("Rules useless in parser due to conflicts"), + rule_useless_in_parser_p); + conflicts_output (out); + + print_grammar (out); + + /* If the whole state item sets, not only the kernels, are wanted, + `closure' will be run, which needs memory allocation/deallocation. */ + if (report_flag & report_itemsets) + new_closure (nritems); + /* Storage for print_reductions. */ + no_reduce_set = bitset_create (ntokens, BITSET_FIXED); + for (i = 0; i < nstates; i++) + print_state (out, states[i]); + bitset_free (no_reduce_set); + if (report_flag & report_itemsets) + free_closure (); + + xfclose (out); +} diff --git a/src/print.h b/src/print.h new file mode 100644 index 0000000..b8f5869 --- /dev/null +++ b/src/print.h @@ -0,0 +1,24 @@ +/* Print information on generated parser, for bison, + Copyright 2000 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef PRINT_H_ +# define PRINT_H_ + +void print_results (void); + +#endif /* !PRINT_H_ */ diff --git a/src/print_graph.c b/src/print_graph.c new file mode 100644 index 0000000..9d7da18 --- /dev/null +++ b/src/print_graph.c @@ -0,0 +1,185 @@ +/* Output a graph of the generated parser, for Bison. + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include + +#include "LR0.h" +#include "closure.h" +#include "complain.h" +#include "conflicts.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "graphviz.h" +#include "lalr.h" +#include "print_graph.h" +#include "reader.h" +#include "state.h" +#include "symtab.h" + + +/*----------------------------. +| Construct the node labels. | +`----------------------------*/ + +static void +print_core (struct obstack *oout, state *s) +{ + size_t i; + item_number *sitems = s->items; + size_t snritems = s->nitems; + + /* Output all the items of a state, not only its kernel. */ + if (report_flag & report_itemsets) + { + closure (sitems, snritems); + sitems = itemset; + snritems = nitemset; + } + + obstack_fgrow1 (oout, "%d", s->number); + for (i = 0; i < snritems; i++) + { + item_number *sp; + item_number *sp1; + rule_number r; + + sp1 = sp = ritem + sitems[i]; + + while (*sp >= 0) + sp++; + + r = item_number_as_rule_number (*sp); + + obstack_fgrow1 (oout, "\n%s -> ", rules[r].lhs->tag); + + for (sp = rules[r].rhs; sp < sp1; sp++) + obstack_fgrow1 (oout, "%s ", symbols[*sp]->tag); + + obstack_1grow (oout, '.'); + + for (/* Nothing */; *sp >= 0; ++sp) + obstack_fgrow1 (oout, " %s", symbols[*sp]->tag); + + /* Experimental feature: display the lookahead tokens. */ + if (report_flag & report_lookahead_tokens + && item_number_is_rule_number (*sp1)) + { + /* Find the reduction we are handling. */ + reductions *reds = s->reductions; + int redno = state_reduction_find (s, &rules[r]); + + /* Print them if there are. */ + if (reds->lookahead_tokens && redno != -1) + { + bitset_iterator biter; + int k; + char const *sep = ""; + obstack_sgrow (oout, "["); + BITSET_FOR_EACH (biter, reds->lookahead_tokens[redno], k, 0) + { + obstack_fgrow2 (oout, "%s%s", sep, symbols[k]->tag); + sep = ", "; + } + obstack_sgrow (oout, "]"); + } + } + } +} + + +/*---------------------------------------------------------------. +| Output in graph_obstack edges specifications in incidence with | +| current node. | +`---------------------------------------------------------------*/ + +static void +print_actions (state const *s, FILE *fgraph) +{ + int i; + + transitions const *trans = s->transitions; + + if (!trans->num && !s->reductions) + return; + + for (i = 0; i < trans->num; i++) + if (!TRANSITION_IS_DISABLED (trans, i)) + { + state *s1 = trans->states[i]; + symbol_number sym = s1->accessing_symbol; + + /* Shifts are solid, gotos are dashed, and error is dotted. */ + char const *style = + (TRANSITION_IS_ERROR (trans, i) ? "dotted" + : TRANSITION_IS_SHIFT (trans, i) ? "solid" + : "dashed"); + + if (TRANSITION_IS_ERROR (trans, i) + && strcmp (symbols[sym]->tag, "error") != 0) + abort (); + output_edge (s->number, s1->number, + TRANSITION_IS_ERROR (trans, i) ? NULL : symbols[sym]->tag, + style, fgraph); + } +} + + +/*-------------------------------------------------------------. +| Output in FGRAPH the current node specifications and exiting | +| edges. | +`-------------------------------------------------------------*/ + +static void +print_state (state *s, FILE *fgraph) +{ + struct obstack node_obstack; + + /* A node's label contains its items. */ + obstack_init (&node_obstack); + print_core (&node_obstack, s); + obstack_1grow (&node_obstack, '\0'); + output_node (s->number, obstack_finish (&node_obstack), fgraph); + obstack_free (&node_obstack, 0); + + /* Output the edges. */ + print_actions (s, fgraph); +} + + +void +print_graph (void) +{ + state_number i; + FILE *fgraph = xfopen (spec_graph_file, "w"); + start_graph (fgraph); + + /* Output nodes and edges. */ + new_closure (nritems); + for (i = 0; i < nstates; i++) + print_state (states[i], fgraph); + free_closure (); + + finish_graph (fgraph); + xfclose (fgraph); +} diff --git a/src/print_graph.h b/src/print_graph.h new file mode 100644 index 0000000..297e8c3 --- /dev/null +++ b/src/print_graph.h @@ -0,0 +1,25 @@ +/* Output a graph of the generated parser, for Bison. + + Copyright 2000, 2006 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef PRINT_GRAPH_H_ +# define PRINT_GRAPH_H_ + +void print_graph (void); + +#endif /* !PRINT_GRAPH_H_ */ diff --git a/src/reader.c b/src/reader.c new file mode 100644 index 0000000..7758c77 --- /dev/null +++ b/src/reader.c @@ -0,0 +1,652 @@ +/* Input parser for Bison + + Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003, + 2005, 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include + +#include "complain.h" +#include "conflicts.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "muscle_tab.h" +#include "reader.h" +#include "symlist.h" +#include "symtab.h" +#include "scan-gram.h" +#include "scan-code.h" + +static void check_and_convert_grammar (void); + +static symbol_list *grammar = NULL; +static bool start_flag = false; +merger_list *merge_functions; + +/* Was %union seen? */ +bool union_seen = false; + +/* Was a tag seen? */ +bool tag_seen = false; + +/* Should rules have a default precedence? */ +bool default_prec = true; + +/*-----------------------. +| Set the start symbol. | +`-----------------------*/ + +void +grammar_start_symbol_set (symbol *sym, location loc) +{ + if (start_flag) + complain_at (loc, _("multiple %s declarations"), "%start"); + else + { + start_flag = true; + startsymbol = sym; + startsymbol_location = loc; + } +} + + + +/*------------------------------------------------------------------------. +| Return the merger index for a merging function named NAME. Records the | +| function, if new, in MERGER_LIST. | +`------------------------------------------------------------------------*/ + +static int +get_merge_function (uniqstr name) +{ + merger_list *syms; + merger_list head; + int n; + + if (! glr_parser) + return 0; + + head.next = merge_functions; + for (syms = &head, n = 1; syms->next; syms = syms->next, n += 1) + if (UNIQSTR_EQ (name, syms->next->name)) + break; + if (syms->next == NULL) + { + syms->next = xmalloc (sizeof syms->next[0]); + syms->next->name = uniqstr_new (name); + /* After all symbol type declarations have been parsed, packgram invokes + record_merge_function_type to set the type. */ + syms->next->type = NULL; + syms->next->next = NULL; + merge_functions = head.next; + } + return n; +} + +/*-------------------------------------------------------------------------. +| For the existing merging function with index MERGER, record the result | +| type as TYPE as required by the lhs of the rule whose %merge declaration | +| is at DECLARATION_LOC. | +`-------------------------------------------------------------------------*/ + +static void +record_merge_function_type (int merger, uniqstr type, location declaration_loc) +{ + int merger_find; + merger_list *merge_function; + + if (merger <= 0) + return; + + if (type == NULL) + type = uniqstr_new (""); + + merger_find = 1; + for (merge_function = merge_functions; + merge_function != NULL && merger_find != merger; + merge_function = merge_function->next) + merger_find += 1; + aver (merge_function != NULL && merger_find == merger); + if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type)) + { + complain_at (declaration_loc, + _("result type clash on merge function `%s': <%s> != <%s>"), + merge_function->name, type, merge_function->type); + complain_at (merge_function->type_declaration_location, + _("previous declaration")); + } + merge_function->type = uniqstr_new (type); + merge_function->type_declaration_location = declaration_loc; +} + +/*--------------------------------------. +| Free all merge-function definitions. | +`--------------------------------------*/ + +void +free_merger_functions (void) +{ + merger_list *L0 = merge_functions; + while (L0) + { + merger_list *L1 = L0->next; + free (L0); + L0 = L1; + } +} + + +/*-------------------------------------------------------------------. +| Parse the input grammar into a one symbol_list structure. Each | +| rule is represented by a sequence of symbols: the left hand side | +| followed by the contents of the right hand side, followed by a | +| null pointer instead of a symbol to terminate the rule. The next | +| symbol is the lhs of the following rule. | +| | +| All actions are copied out, labelled by the rule number they apply | +| to. | +`-------------------------------------------------------------------*/ + +/* The (currently) last symbol of GRAMMAR. */ +static symbol_list *grammar_end = NULL; + +/* Append SYM to the grammar. */ +static void +grammar_symbol_append (symbol *sym, location loc) +{ + symbol_list *p = symbol_list_sym_new (sym, loc); + + if (grammar_end) + grammar_end->next = p; + else + grammar = p; + + grammar_end = p; + + /* A null SYM stands for an end of rule; it is not an actual + part of it. */ + if (sym) + ++nritems; +} + +/* The rule currently being defined, and the previous rule. + CURRENT_RULE points to the first LHS of the current rule, while + PREVIOUS_RULE_END points to the *end* of the previous rule (NULL). */ +static symbol_list *current_rule = NULL; +static symbol_list *previous_rule_end = NULL; + + +/*----------------------------------------------. +| Create a new rule for LHS in to the GRAMMAR. | +`----------------------------------------------*/ + +void +grammar_current_rule_begin (symbol *lhs, location loc) +{ + /* Start a new rule and record its lhs. */ + ++nrules; + previous_rule_end = grammar_end; + grammar_symbol_append (lhs, loc); + current_rule = grammar_end; + + /* Mark the rule's lhs as a nonterminal if not already so. */ + if (lhs->class == unknown_sym) + { + lhs->class = nterm_sym; + lhs->number = nvars; + ++nvars; + } + else if (lhs->class == token_sym) + complain_at (loc, _("rule given for %s, which is a token"), lhs->tag); +} + + +/*----------------------------------------------------------------------. +| A symbol should be used if either: | +| 1. It has a destructor. | +| 2. --warnings=midrule-values and the symbol is a mid-rule symbol | +| (i.e., the generated LHS replacing a mid-rule action) that was | +| assigned to or used, as in "exp: { $$ = 1; } { $$ = $1; }". | +`----------------------------------------------------------------------*/ + +static bool +symbol_should_be_used (symbol_list const *s) +{ + if (symbol_destructor_get (s->content.sym)->code) + return true; + if (warnings_flag & warnings_midrule_values) + return ((s->midrule && s->midrule->action_props.is_value_used) + || (s->midrule_parent_rule + && symbol_list_n_get (s->midrule_parent_rule, + s->midrule_parent_rhs_index) + ->action_props.is_value_used)); + return false; +} + +/*----------------------------------------------------------------. +| Check that the rule R is properly defined. For instance, there | +| should be no type clash on the default action. | +`----------------------------------------------------------------*/ + +static void +grammar_rule_check (const symbol_list *r) +{ + /* Type check. + + If there is an action, then there is nothing we can do: the user + is allowed to shoot herself in the foot. + + Don't worry about the default action if $$ is untyped, since $$'s + value can't be used. */ + if (!r->action_props.code && r->content.sym->type_name) + { + symbol *first_rhs = r->next->content.sym; + /* If $$ is being set in default way, report if any type mismatch. */ + if (first_rhs) + { + char const *lhs_type = r->content.sym->type_name; + const char *rhs_type = + first_rhs->type_name ? first_rhs->type_name : ""; + if (!UNIQSTR_EQ (lhs_type, rhs_type)) + warn_at (r->location, + _("type clash on default action: <%s> != <%s>"), + lhs_type, rhs_type); + } + /* Warn if there is no default for $$ but we need one. */ + else + warn_at (r->location, + _("empty rule for typed nonterminal, and no action")); + } + + /* Check that symbol values that should be used are in fact used. */ + { + symbol_list const *l = r; + int n = 0; + for (; l && l->content.sym; l = l->next, ++n) + if (! (l->action_props.is_value_used + || !symbol_should_be_used (l) + /* The default action, $$ = $1, `uses' both. */ + || (!r->action_props.code && (n == 0 || n == 1)))) + { + if (n) + warn_at (r->location, _("unused value: $%d"), n); + else + warn_at (r->location, _("unset value: $$")); + } + } +} + + +/*-------------------------------------. +| End the currently being grown rule. | +`-------------------------------------*/ + +void +grammar_current_rule_end (location loc) +{ + /* Put an empty link in the list to mark the end of this rule */ + grammar_symbol_append (NULL, grammar_end->location); + current_rule->location = loc; +} + + +/*-------------------------------------------------------------------. +| The previous action turns out the be a mid-rule action. Attach it | +| to the current rule, i.e., create a dummy symbol, attach it this | +| mid-rule action, and append this dummy nonterminal to the current | +| rule. | +`-------------------------------------------------------------------*/ + +void +grammar_midrule_action (void) +{ + /* Since the action was written out with this rule's number, we must + give the new rule this number by inserting the new rule before + it. */ + + /* Make a DUMMY nonterminal, whose location is that of the midrule + action. Create the MIDRULE. */ + location dummy_location = current_rule->action_props.location; + symbol *dummy = dummy_symbol_get (dummy_location); + symbol_list *midrule = symbol_list_sym_new (dummy, dummy_location); + + /* Make a new rule, whose body is empty, before the current one, so + that the action just read can belong to it. */ + ++nrules; + ++nritems; + /* Attach its location and actions to that of the DUMMY. */ + midrule->location = dummy_location; + code_props_rule_action_init (&midrule->action_props, + current_rule->action_props.code, + current_rule->action_props.location, + midrule); + code_props_none_init (¤t_rule->action_props); + + if (previous_rule_end) + previous_rule_end->next = midrule; + else + grammar = midrule; + + /* End the dummy's rule. */ + midrule->next = symbol_list_sym_new (NULL, dummy_location); + midrule->next->next = current_rule; + + previous_rule_end = midrule->next; + + /* Insert the dummy nonterminal replacing the midrule action into + the current rule. Bind it to its dedicated rule. */ + grammar_current_rule_symbol_append (dummy, dummy_location); + grammar_end->midrule = midrule; + midrule->midrule_parent_rule = current_rule; + midrule->midrule_parent_rhs_index = symbol_list_length (current_rule->next); +} + +/* Set the precedence symbol of the current rule to PRECSYM. */ + +void +grammar_current_rule_prec_set (symbol *precsym, location loc) +{ + symbol_class_set (precsym, token_sym, loc, false); + if (current_rule->ruleprec) + complain_at (loc, _("only one %s allowed per rule"), "%prec"); + current_rule->ruleprec = precsym; +} + +/* Attach dynamic precedence DPREC to the current rule. */ + +void +grammar_current_rule_dprec_set (int dprec, location loc) +{ + if (! glr_parser) + warn_at (loc, _("%s affects only GLR parsers"), "%dprec"); + if (dprec <= 0) + complain_at (loc, _("%s must be followed by positive number"), "%dprec"); + else if (current_rule->dprec != 0) + complain_at (loc, _("only one %s allowed per rule"), "%dprec"); + current_rule->dprec = dprec; +} + +/* Attach a merge function NAME with argument type TYPE to current + rule. */ + +void +grammar_current_rule_merge_set (uniqstr name, location loc) +{ + if (! glr_parser) + warn_at (loc, _("%s affects only GLR parsers"), "%merge"); + if (current_rule->merger != 0) + complain_at (loc, _("only one %s allowed per rule"), "%merge"); + current_rule->merger = get_merge_function (name); + current_rule->merger_declaration_location = loc; +} + +/* Attach SYM to the current rule. If needed, move the previous + action as a mid-rule action. */ + +void +grammar_current_rule_symbol_append (symbol *sym, location loc) +{ + if (current_rule->action_props.code) + grammar_midrule_action (); + grammar_symbol_append (sym, loc); +} + +/* Attach an ACTION to the current rule. */ + +void +grammar_current_rule_action_append (const char *action, location loc) +{ + if (current_rule->action_props.code) + grammar_midrule_action (); + /* After all symbol declarations have been parsed, packgram invokes + code_props_translate_code. */ + code_props_rule_action_init (¤t_rule->action_props, action, loc, + current_rule); +} + + +/*---------------------------------------------------------------. +| Convert the rules into the representation using RRHS, RLHS and | +| RITEM. | +`---------------------------------------------------------------*/ + +static void +packgram (void) +{ + unsigned int itemno = 0; + rule_number ruleno = 0; + symbol_list *p = grammar; + + ritem = xnmalloc (nritems + 1, sizeof *ritem); + + /* This sentinel is used by build_relations in gram.c. */ + *ritem++ = 0; + + rules = xnmalloc (nrules, sizeof *rules); + + while (p) + { + int rule_length = 0; + symbol *ruleprec = p->ruleprec; + record_merge_function_type (p->merger, p->content.sym->type_name, + p->merger_declaration_location); + rules[ruleno].user_number = ruleno; + rules[ruleno].number = ruleno; + rules[ruleno].lhs = p->content.sym; + rules[ruleno].rhs = ritem + itemno; + rules[ruleno].prec = NULL; + rules[ruleno].dprec = p->dprec; + rules[ruleno].merger = p->merger; + rules[ruleno].precsym = NULL; + rules[ruleno].location = p->location; + rules[ruleno].useful = true; + rules[ruleno].action = p->action_props.code; + rules[ruleno].action_location = p->action_props.location; + + /* If the midrule's $$ is set or its $n is used, remove the `$' from the + symbol name so that it's a user-defined symbol so that the default + %destructor and %printer apply. */ + if (p->midrule_parent_rule + && (p->action_props.is_value_used + || symbol_list_n_get (p->midrule_parent_rule, + p->midrule_parent_rhs_index) + ->action_props.is_value_used)) + p->content.sym->tag += 1; + + /* Don't check the generated rule 0. It has no action, so some rhs + symbols may appear unused, but the parsing algorithm ensures that + %destructor's are invoked appropriately. */ + if (p != grammar) + grammar_rule_check (p); + + for (p = p->next; p && p->content.sym; p = p->next) + { + ++rule_length; + + /* Don't allow rule_length == INT_MAX, since that might + cause confusion with strtol if INT_MAX == LONG_MAX. */ + if (rule_length == INT_MAX) + fatal_at (rules[ruleno].location, _("rule is too long")); + + /* item_number = symbol_number. + But the former needs to contain more: negative rule numbers. */ + ritem[itemno++] = + symbol_number_as_item_number (p->content.sym->number); + /* A rule gets by default the precedence and associativity + of its last token. */ + if (p->content.sym->class == token_sym && default_prec) + rules[ruleno].prec = p->content.sym; + } + + /* If this rule has a %prec, + the specified symbol's precedence replaces the default. */ + if (ruleprec) + { + rules[ruleno].precsym = ruleprec; + rules[ruleno].prec = ruleprec; + } + /* An item ends by the rule number (negated). */ + ritem[itemno++] = rule_number_as_item_number (ruleno); + aver (itemno < ITEM_NUMBER_MAX); + ++ruleno; + aver (ruleno < RULE_NUMBER_MAX); + + if (p) + p = p->next; + } + + aver (itemno == nritems); + + if (trace_flag & trace_sets) + ritem_print (stderr); +} + +/*------------------------------------------------------------------. +| Read in the grammar specification and record it in the format | +| described in gram.h. All actions are copied into ACTION_OBSTACK, | +| in each case forming the body of a C function (YYACTION) which | +| contains a switch statement to decide which action to execute. | +`------------------------------------------------------------------*/ + +void +reader (void) +{ + /* Initialize the symbol table. */ + symbols_new (); + + /* Construct the accept symbol. */ + accept = symbol_get ("$accept", empty_location); + accept->class = nterm_sym; + accept->number = nvars++; + + /* Construct the error token */ + errtoken = symbol_get ("error", empty_location); + errtoken->class = token_sym; + errtoken->number = ntokens++; + + /* Construct a token that represents all undefined literal tokens. + It is always token number 2. */ + undeftoken = symbol_get ("$undefined", empty_location); + undeftoken->class = token_sym; + undeftoken->number = ntokens++; + + gram_in = xfopen (grammar_file, "r"); + + gram__flex_debug = trace_flag & trace_scan; + gram_debug = trace_flag & trace_parse; + gram_scanner_initialize (); + gram_parse (); + + if (! complaint_issued) + check_and_convert_grammar (); + + xfclose (gram_in); +} + + +/*-------------------------------------------------------------. +| Check the grammar that has just been read, and convert it to | +| internal form. | +`-------------------------------------------------------------*/ + +static void +check_and_convert_grammar (void) +{ + /* Grammar has been read. Do some checking. */ + if (nrules == 0) + fatal (_("no rules in the input grammar")); + + /* Report any undefined symbols and consider them nonterminals. */ + symbols_check_defined (); + + /* If the user did not define her ENDTOKEN, do it now. */ + if (!endtoken) + { + endtoken = symbol_get ("$end", empty_location); + endtoken->class = token_sym; + endtoken->number = 0; + /* Value specified by POSIX. */ + endtoken->user_token_number = 0; + } + + /* Find the start symbol if no %start. */ + if (!start_flag) + { + symbol_list *node; + for (node = grammar; + node != NULL && symbol_is_dummy (node->content.sym); + node = node->next) + { + for (node = node->next; + node != NULL && node->content.sym != NULL; + node = node->next) + ; + } + aver (node != NULL); + grammar_start_symbol_set (node->content.sym, + node->content.sym->location); + } + + /* Insert the initial rule, whose line is that of the first rule + (not that of the start symbol): + + accept: %start EOF. */ + { + symbol_list *p = symbol_list_sym_new (accept, empty_location); + p->location = grammar->location; + p->next = symbol_list_sym_new (startsymbol, empty_location); + p->next->next = symbol_list_sym_new (endtoken, empty_location); + p->next->next->next = symbol_list_sym_new (NULL, empty_location); + p->next->next->next->next = grammar; + nrules += 1; + nritems += 3; + grammar = p; + } + + aver (nsyms <= SYMBOL_NUMBER_MAXIMUM && nsyms == ntokens + nvars); + + /* Assign the symbols their symbol numbers. Write #defines for the + token symbols into FDEFINES if requested. */ + symbols_pack (); + + /* Scan rule actions after invoking symbol_check_alias_consistency (in + symbols_pack above) so that token types are set correctly before the rule + action type checking. + + Before invoking grammar_rule_check (in packgram below) on any rule, make + sure all actions have already been scanned in order to set `used' flags. + Otherwise, checking that a midrule's $$ should be set will not always work + properly because the check must forward-reference the midrule's parent + rule. For the same reason, all the `used' flags must be set before + checking whether to remove `$' from any midrule symbol name (also in + packgram). */ + { + symbol_list *sym; + for (sym = grammar; sym; sym = sym->next) + code_props_translate_code (&sym->action_props); + } + + /* Convert the grammar into the format described in gram.h. */ + packgram (); + + /* The grammar as a symbol_list is no longer needed. */ + symbol_list_free (grammar); +} diff --git a/src/reader.h b/src/reader.h new file mode 100644 index 0000000..2d73ab3 --- /dev/null +++ b/src/reader.h @@ -0,0 +1,67 @@ +/* Input parser for Bison + + Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef READER_H_ +# define READER_H_ + +# include "location.h" +# include "symlist.h" + +# include "parse-gram.h" + +typedef struct merger_list +{ + struct merger_list* next; + uniqstr name; + uniqstr type; + location type_declaration_location; +} merger_list; + +/* From the parser. */ +extern int gram_debug; +int gram_parse (void); +char const *token_name (int type); + + +/* From reader.c. */ +void grammar_start_symbol_set (symbol *sym, location loc); +void grammar_current_rule_begin (symbol *lhs, location loc); +void grammar_current_rule_end (location loc); +void grammar_midrule_action (void); +void grammar_current_rule_prec_set (symbol *precsym, location loc); +void grammar_current_rule_dprec_set (int dprec, location loc); +void grammar_current_rule_merge_set (uniqstr name, location loc); +void grammar_current_rule_symbol_append (symbol *sym, location loc); +void grammar_current_rule_action_append (const char *action, location loc); +void reader (void); +void free_merger_functions (void); + +extern merger_list *merge_functions; + +/* Was %union seen? */ +extern bool union_seen; + +/* Was a tag seen? */ +extern bool tag_seen; + +/* Should rules have a default precedence? */ +extern bool default_prec; + +#endif /* !READER_H_ */ diff --git a/src/reduce.c b/src/reduce.c new file mode 100644 index 0000000..596a26b --- /dev/null +++ b/src/reduce.c @@ -0,0 +1,474 @@ +/* Grammar reduction for Bison. + + Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003, 2005, 2006, + 2007, 2008 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + + +/* Reduce the grammar: Find and eliminate unreachable terminals, + nonterminals, and productions. David S. Bakin. */ + +/* Don't eliminate unreachable terminals: They may be used by the + user's parser. */ + +#include +#include "system.h" + +#include +#include + +#include "complain.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "print-xml.h" +#include "reader.h" +#include "reduce.h" +#include "symtab.h" + +/* Set of all nonterminals which are not useless. */ +static bitset N; + +/* Set of all rules which have no useless nonterminals in their RHS. */ +static bitset P; + +/* Set of all accessible symbols. */ +static bitset V; + +/* Set of symbols used to define rule precedence (so they are + `useless', but no warning should be issued). */ +static bitset V1; + +static rule_number nuseful_productions; +rule_number nuseless_productions; +static int nuseful_nonterminals; +symbol_number nuseless_nonterminals; + +/*-------------------------------------------------------------------. +| Another way to do this would be with a set for each production and | +| then do subset tests against N0, but even for the C grammar the | +| whole reducing process takes only 2 seconds on my 8Mhz AT. | +`-------------------------------------------------------------------*/ + +static bool +useful_production (rule_number r, bitset N0) +{ + item_number *rhsp; + + /* A production is useful if all of the nonterminals in its appear + in the set of useful nonterminals. */ + + for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp) + if (ISVAR (*rhsp) && !bitset_test (N0, *rhsp - ntokens)) + return false; + return true; +} + + +/*---------------------------------------------------------. +| Remember that rules are 1-origin, symbols are 0-origin. | +`---------------------------------------------------------*/ + +static void +useless_nonterminals (void) +{ + bitset Np, Ns; + rule_number r; + + /* N is set as built. Np is set being built this iteration. P is + set of all productions which have a RHS all in N. */ + + Np = bitset_create (nvars, BITSET_FIXED); + + + /* The set being computed is a set of nonterminals which can derive + the empty string or strings consisting of all terminals. At each + iteration a nonterminal is added to the set if there is a + production with that nonterminal as its LHS for which all the + nonterminals in its RHS are already in the set. Iterate until + the set being computed remains unchanged. Any nonterminals not + in the set at that point are useless in that they will never be + used in deriving a sentence of the language. + + This iteration doesn't use any special traversal over the + productions. A set is kept of all productions for which all the + nonterminals in the RHS are in useful. Only productions not in + this set are scanned on each iteration. At the end, this set is + saved to be used when finding useful productions: only + productions in this set will appear in the final grammar. */ + + while (1) + { + bitset_copy (Np, N); + for (r = 0; r < nrules; r++) + if (!bitset_test (P, r) + && useful_production (r, N)) + { + bitset_set (Np, rules[r].lhs->number - ntokens); + bitset_set (P, r); + } + if (bitset_equal_p (N, Np)) + break; + Ns = Np; + Np = N; + N = Ns; + } + bitset_free (N); + N = Np; +} + + +static void +inaccessable_symbols (void) +{ + bitset Vp, Vs, Pp; + + /* Find out which productions are reachable and which symbols are + used. Starting with an empty set of productions and a set of + symbols which only has the start symbol in it, iterate over all + productions until the set of productions remains unchanged for an + iteration. For each production which has a LHS in the set of + reachable symbols, add the production to the set of reachable + productions, and add all of the nonterminals in the RHS of the + production to the set of reachable symbols. + + Consider only the (partially) reduced grammar which has only + nonterminals in N and productions in P. + + The result is the set P of productions in the reduced grammar, + and the set V of symbols in the reduced grammar. + + Although this algorithm also computes the set of terminals which + are reachable, no terminal will be deleted from the grammar. Some + terminals might not be in the grammar but might be generated by + semantic routines, and so the user might want them available with + specified numbers. (Is this true?) However, the nonreachable + terminals are printed (if running in verbose mode) so that the + user can know. */ + + Vp = bitset_create (nsyms, BITSET_FIXED); + Pp = bitset_create (nrules, BITSET_FIXED); + + /* If the start symbol isn't useful, then nothing will be useful. */ + if (bitset_test (N, accept->number - ntokens)) + { + bitset_set (V, accept->number); + + while (1) + { + rule_number r; + bitset_copy (Vp, V); + for (r = 0; r < nrules; r++) + { + if (!bitset_test (Pp, r) + && bitset_test (P, r) + && bitset_test (V, rules[r].lhs->number)) + { + item_number *rhsp; + for (rhsp = rules[r].rhs; *rhsp >= 0; rhsp++) + if (ISTOKEN (*rhsp) || bitset_test (N, *rhsp - ntokens)) + bitset_set (Vp, *rhsp); + bitset_set (Pp, r); + } + } + if (bitset_equal_p (V, Vp)) + break; + Vs = Vp; + Vp = V; + V = Vs; + } + } + + bitset_free (V); + V = Vp; + + /* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */ + bitset_set (V, endtoken->number); /* end-of-input token */ + bitset_set (V, errtoken->number); /* error token */ + bitset_set (V, undeftoken->number); /* some undefined token */ + + bitset_free (P); + P = Pp; + + nuseful_productions = bitset_count (P); + nuseless_productions = nrules - nuseful_productions; + + nuseful_nonterminals = 0; + { + symbol_number i; + for (i = ntokens; i < nsyms; i++) + if (bitset_test (V, i)) + nuseful_nonterminals++; + } + nuseless_nonterminals = nvars - nuseful_nonterminals; + + /* A token that was used in %prec should not be warned about. */ + { + rule_number r; + for (r = 0; r < nrules; ++r) + if (rules[r].precsym != 0) + bitset_set (V1, rules[r].precsym->number); + } +} + + +/*-------------------------------------------------------------------. +| Put the useless productions at the end of RULES, and adjust NRULES | +| accordingly. | +`-------------------------------------------------------------------*/ + +static void +reduce_grammar_tables (void) +{ + /* Report and flag useless productions. */ + { + rule_number r; + for (r = 0; r < nrules; r++) + rules[r].useful = bitset_test (P, r); + grammar_rules_useless_report (_("rule useless in grammar")); + } + + /* Map the nonterminals to their new index: useful first, useless + afterwards. Kept for later report. */ + { + int useful = 0; + int useless = nrules - nuseless_productions; + rule *rules_sorted = xnmalloc (nrules, sizeof *rules_sorted); + rule_number r; + for (r = 0; r < nrules; ++r) + rules_sorted[rules[r].useful ? useful++ : useless++] = rules[r]; + free (rules); + rules = rules_sorted; + + /* Renumber the rules markers in RITEMS. */ + for (r = 0; r < nrules; ++r) + { + item_number *rhsp = rules[r].rhs; + for (/* Nothing. */; *rhsp >= 0; ++rhsp) + /* Nothing. */; + *rhsp = rule_number_as_item_number (r); + rules[r].number = r; + } + nrules -= nuseless_productions; + } + + /* Adjust NRITEMS. */ + { + rule_number r; + int length; + for (r = nrules; r < nrules + nuseless_productions; ++r) + { + length = rule_rhs_length (&rules[r]); + nritems -= length + 1; + } + } +} + + +/*------------------------------. +| Remove useless nonterminals. | +`------------------------------*/ + +static void +nonterminals_reduce (void) +{ + symbol_number i, n; + + /* Map the nonterminals to their new index: useful first, useless + afterwards. Kept for later report. */ + + symbol_number *nontermmap = xnmalloc (nvars, sizeof *nontermmap); + n = ntokens; + for (i = ntokens; i < nsyms; i++) + if (bitset_test (V, i)) + nontermmap[i - ntokens] = n++; + for (i = ntokens; i < nsyms; i++) + if (!bitset_test (V, i)) + { + nontermmap[i - ntokens] = n++; + warn_at (symbols[i]->location, _("nonterminal useless in grammar: %s"), + symbols[i]->tag); + } + + + /* Shuffle elements of tables indexed by symbol number. */ + { + symbol **symbols_sorted = xnmalloc (nvars, sizeof *symbols_sorted); + + for (i = ntokens; i < nsyms; i++) + symbols[i]->number = nontermmap[i - ntokens]; + for (i = ntokens; i < nsyms; i++) + symbols_sorted[nontermmap[i - ntokens] - ntokens] = symbols[i]; + for (i = ntokens; i < nsyms; i++) + symbols[i] = symbols_sorted[i - ntokens]; + free (symbols_sorted); + } + + { + rule_number r; + for (r = 0; r < nrules; ++r) + { + item_number *rhsp; + for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp) + if (ISVAR (*rhsp)) + *rhsp = symbol_number_as_item_number (nontermmap[*rhsp + - ntokens]); + } + accept->number = nontermmap[accept->number - ntokens]; + } + + nsyms -= nuseless_nonterminals; + nvars -= nuseless_nonterminals; + + free (nontermmap); +} + + +/*------------------------------------------------------------------. +| Output the detailed results of the reductions. For FILE.output. | +`------------------------------------------------------------------*/ + +void +reduce_output (FILE *out) +{ + if (nuseless_nonterminals > 0) + { + int i; + fprintf (out, "%s\n\n", _("Nonterminals useless in grammar")); + for (i = 0; i < nuseless_nonterminals; ++i) + fprintf (out, " %s\n", symbols[nsyms + i]->tag); + fputs ("\n\n", out); + } + + { + bool b = false; + int i; + for (i = 0; i < ntokens; i++) + if (reduce_token_unused_in_grammar (i)) + { + if (!b) + fprintf (out, "%s\n\n", _("Terminals unused in grammar")); + b = true; + fprintf (out, " %s\n", symbols[i]->tag); + } + if (b) + fputs ("\n\n", out); + } + + if (nuseless_productions > 0) + grammar_rules_partial_print (out, _("Rules useless in grammar"), + rule_useless_in_grammar_p); +} + + +/*-------------------------------. +| Report the results to STDERR. | +`-------------------------------*/ + +static void +reduce_print (void) +{ + if (nuseless_nonterminals > 0) + { + fprintf (stderr, "%s: %s: ", grammar_file, _("warning")); + fprintf (stderr, ngettext ("%d nonterminal useless in grammar", + "%d nonterminals useless in grammar", + nuseless_nonterminals), + nuseless_nonterminals); + fprintf (stderr, "\n"); + } + if (nuseless_productions > 0) + { + fprintf (stderr, "%s: %s: ", grammar_file, _("warning")); + fprintf (stderr, ngettext ("%d rule useless in grammar", + "%d rules useless in grammar", + nuseless_productions), + nuseless_productions); + fprintf (stderr, "\n"); + } +} + +void +reduce_grammar (void) +{ + bool reduced; + + /* Allocate the global sets used to compute the reduced grammar */ + + N = bitset_create (nvars, BITSET_FIXED); + P = bitset_create (nrules, BITSET_FIXED); + V = bitset_create (nsyms, BITSET_FIXED); + V1 = bitset_create (nsyms, BITSET_FIXED); + + useless_nonterminals (); + inaccessable_symbols (); + + reduced = (nuseless_nonterminals + nuseless_productions > 0); + if (!reduced) + return; + + reduce_print (); + + if (!bitset_test (N, accept->number - ntokens)) + fatal_at (startsymbol_location, + _("start symbol %s does not derive any sentence"), + startsymbol->tag); + + /* First reduce the nonterminals, as they renumber themselves in the + whole grammar. If you change the order, nonterms would be + renumbered only in the reduced grammar. */ + if (nuseless_nonterminals > 0) + nonterminals_reduce (); + if (nuseless_productions > 0) + reduce_grammar_tables (); + + if (trace_flag & trace_grammar) + { + grammar_dump (stderr, "Reduced Grammar"); + + fprintf (stderr, "reduced %s defines %d terminals, %d nonterminals\ +, and %d productions.\n", + grammar_file, ntokens, nvars, nrules); + } +} + +bool +reduce_token_unused_in_grammar (symbol_number i) +{ + aver (i < ntokens); + return !bitset_test (V, i) && !bitset_test (V1, i); +} + +bool +reduce_nonterminal_useless_in_grammar (symbol_number i) +{ + aver (ntokens <= i && i < nsyms + nuseless_nonterminals); + return nsyms <= i; +} + +/*-----------------------------------------------------------. +| Free the global sets used to compute the reduced grammar. | +`-----------------------------------------------------------*/ + +void +reduce_free (void) +{ + bitset_free (N); + bitset_free (V); + bitset_free (V1); + bitset_free (P); +} diff --git a/src/reduce.h b/src/reduce.h new file mode 100644 index 0000000..3d039ef --- /dev/null +++ b/src/reduce.h @@ -0,0 +1,31 @@ +/* Grammar reduction for Bison. + + Copyright (C) 2000, 2001, 2002, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef REDUCE_H_ +# define REDUCE_H_ + +void reduce_grammar (void); +void reduce_output (FILE *out); +bool reduce_token_unused_in_grammar (symbol_number i); +bool reduce_nonterminal_useless_in_grammar (symbol_number i); +void reduce_free (void); + +extern symbol_number nuseless_nonterminals; +extern rule_number nuseless_productions; +#endif /* !REDUCE_H_ */ diff --git a/src/relation.c b/src/relation.c new file mode 100644 index 0000000..c5bf05b --- /dev/null +++ b/src/relation.c @@ -0,0 +1,181 @@ +/* Binary relations. + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include + +#include "getargs.h" +#include "relation.h" + +void +relation_print (relation r, relation_node size, FILE *out) +{ + relation_node i; + relation_node j; + + for (i = 0; i < size; ++i) + { + fprintf (out, "%3lu: ", (unsigned long int) i); + if (r[i]) + for (j = 0; r[i][j] != END_NODE; ++j) + fprintf (out, "%3lu ", (unsigned long int) r[i][j]); + fputc ('\n', out); + } + fputc ('\n', out); +} + + +/*---------------------------------------------------------------. +| digraph & traverse. | +| | +| The following variables are used as common storage between the | +| two. | +`---------------------------------------------------------------*/ + +static relation R; +static relation_nodes INDEX; +static relation_nodes VERTICES; +static relation_node top; +static relation_node infinity; +static bitsetv F; + +static void +traverse (relation_node i) +{ + relation_node j; + relation_node height; + + VERTICES[++top] = i; + INDEX[i] = height = top; + + if (R[i]) + for (j = 0; R[i][j] != END_NODE; ++j) + { + if (INDEX[R[i][j]] == 0) + traverse (R[i][j]); + + if (INDEX[i] > INDEX[R[i][j]]) + INDEX[i] = INDEX[R[i][j]]; + + bitset_or (F[i], F[i], F[R[i][j]]); + } + + if (INDEX[i] == height) + for (;;) + { + j = VERTICES[top--]; + INDEX[j] = infinity; + + if (i == j) + break; + + bitset_copy (F[j], F[i]); + } +} + + +void +relation_digraph (relation r, relation_node size, bitsetv *function) +{ + relation_node i; + + infinity = size + 2; + INDEX = xcalloc (size + 1, sizeof *INDEX); + VERTICES = xnmalloc (size + 1, sizeof *VERTICES); + top = 0; + + R = r; + F = *function; + + for (i = 0; i < size; i++) + if (INDEX[i] == 0 && R[i]) + traverse (i); + + free (INDEX); + free (VERTICES); + + *function = F; +} + + +/*-------------------------------------------. +| Destructively transpose R_ARG, of size N. | +`-------------------------------------------*/ + +void +relation_transpose (relation *R_arg, relation_node n) +{ + relation r = *R_arg; + /* The result. */ + relation new_R = xnmalloc (n, sizeof *new_R); + /* END_R[I] -- next entry of NEW_R[I]. */ + relation end_R = xnmalloc (n, sizeof *end_R); + /* NEDGES[I] -- total size of NEW_R[I]. */ + size_t *nedges = xcalloc (n, sizeof *nedges); + relation_node i; + relation_node j; + + if (trace_flag & trace_sets) + { + fputs ("relation_transpose: input\n", stderr); + relation_print (r, n, stderr); + } + + /* Count. */ + for (i = 0; i < n; i++) + if (r[i]) + for (j = 0; r[i][j] != END_NODE; ++j) + ++nedges[r[i][j]]; + + /* Allocate. */ + for (i = 0; i < n; i++) + { + relation_node *sp = NULL; + if (nedges[i] > 0) + { + sp = xnmalloc (nedges[i] + 1, sizeof *sp); + sp[nedges[i]] = END_NODE; + } + new_R[i] = sp; + end_R[i] = sp; + } + + /* Store. */ + for (i = 0; i < n; i++) + if (r[i]) + for (j = 0; r[i][j] != END_NODE; ++j) + *end_R[r[i][j]]++ = i; + + free (nedges); + free (end_R); + + /* Free the input: it is replaced with the result. */ + for (i = 0; i < n; i++) + free (r[i]); + free (r); + + if (trace_flag & trace_sets) + { + fputs ("relation_transpose: output\n", stderr); + relation_print (new_R, n, stderr); + } + + *R_arg = new_R; +} diff --git a/src/relation.h b/src/relation.h new file mode 100644 index 0000000..8be164b --- /dev/null +++ b/src/relation.h @@ -0,0 +1,48 @@ +/* Binary relations. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + + +#ifndef RELATION_H_ +# define RELATION_H_ + +/* Performing operations on graphs coded as list of adjacency. + + If GRAPH is a relation, then GRAPH[Node] is a list of adjacent + nodes, ended with END_NODE. */ + +#define END_NODE ((relation_node) -1) + +typedef size_t relation_node; +typedef relation_node *relation_nodes; +typedef relation_nodes *relation; + + +/* Report a relation R that has SIZE vertices. */ +void relation_print (relation r, relation_node size, FILE *out); + +/* Compute the transitive closure of the FUNCTION on the relation R + with SIZE vertices. + + If R (NODE-1, NODE-2) then on exit FUNCTION[NODE - 1] was extended + (unioned) with FUNCTION[NODE - 2]. */ +void relation_digraph (relation r, relation_node size, bitsetv *function); + +/* Destructively transpose *R_ARG, of size N. */ +void relation_transpose (relation *R_arg, relation_node n); + +#endif /* ! RELATION_H_ */ diff --git a/src/scan-code-c.c b/src/scan-code-c.c new file mode 100644 index 0000000..4a018f8 --- /dev/null +++ b/src/scan-code-c.c @@ -0,0 +1,3 @@ +#include +#include "system.h" +#include "scan-code.c" diff --git a/src/scan-code.c b/src/scan-code.c new file mode 100644 index 0000000..6f718d8 --- /dev/null +++ b/src/scan-code.c @@ -0,0 +1,2613 @@ +#line 2 "scan-code.c" + +#line 4 "scan-code.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +/* %not-for-header */ + +/* %if-c-only */ +/* %if-not-reentrant */ +#define yy_create_buffer code__create_buffer +#define yy_delete_buffer code__delete_buffer +#define yy_flex_debug code__flex_debug +#define yy_init_buffer code__init_buffer +#define yy_flush_buffer code__flush_buffer +#define yy_load_buffer_state code__load_buffer_state +#define yy_switch_to_buffer code__switch_to_buffer +#define yyin code_in +#define yyleng code_leng +#define yylex code_lex +#define yylineno code_lineno +#define yyout code_out +#define yyrestart code_restart +#define yytext code_text +#define yywrap code_wrap +#define yyalloc code_alloc +#define yyrealloc code_realloc +#define yyfree code_free + +/* %endif */ +/* %endif */ +/* %ok-for-header */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ +#include +#include +#include +#include +/* %endif */ + +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* %not-for-header */ + +/* Returned upon end-of-file. */ +#define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE code_restart(code_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +/* %if-not-reentrant */ +extern int code_leng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +extern FILE *code_in, *code_out; +/* %endif */ +/* %endif */ + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up code_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up code_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { +/* %if-c-only */ + FILE *yy_input_file; +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via code_restart()), so that the user can continue scanning by + * just pointing code_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %if-not-reentrant */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ + +/* yy_hold_char holds the character lost when code_text is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int code_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow code_wrap()'s to do buffer switches + * instead of setting up a fresh code_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; +/* %ok-for-header */ + +/* %endif */ + +void code_restart (FILE *input_file ); +void code__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE code__create_buffer (FILE *file,int size ); +void code__delete_buffer (YY_BUFFER_STATE b ); +void code__flush_buffer (YY_BUFFER_STATE b ); +void code_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void code_pop_buffer_state (void ); + +static void code_ensure_buffer_stack (void ); +static void code__load_buffer_state (void ); +static void code__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER code__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE code__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE code__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE code__scan_bytes (yyconst char *bytes,int len ); + +/* %endif */ + +void *code_alloc (yy_size_t ); +void *code_realloc (void *,yy_size_t ); +void code_free (void * ); + +#define yy_new_buffer code__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + code_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + code__create_buffer(code_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + code_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + code__create_buffer(code_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* %% [1.0] code_text/code_in/code_out/yy_state_type/code_lineno etc. def's & init go here */ +/* Begin user sect3 */ + +#define code_wrap(n) 1 +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG + +typedef unsigned char YY_CHAR; + +FILE *code_in = (FILE *) 0, *code_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int code_lineno; + +int code_lineno = 1; + +extern char *code_text; +#define yytext_ptr code_text + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* %endif */ + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up code_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle code_text and code_leng for yymore() goes here \ */\ + code_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to code_text[] goes here, if %array \ */\ + (yy_c_buf_p) = yy_cp; + +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ +#define YY_NUM_RULES 24 +#define YY_END_OF_BUFFER 25 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[68] = + { 0, + 0, 0, 0, 0, 3, 3, 4, 4, 4, 4, + 0, 0, 0, 0, 25, 23, 19, 20, 21, 22, + 23, 2, 23, 6, 23, 5, 8, 13, 7, 23, + 14, 15, 16, 19, 20, 1, 0, 0, 3, 4, + 4, 4, 4, 11, 0, 11, 0, 9, 10, 0, + 12, 0, 12, 17, 18, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 1, 5, 1, 1, 6, 1, + 1, 7, 1, 1, 8, 1, 9, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 1, 1, 11, + 1, 12, 1, 13, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 14, 15, 16, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 17, 1, 18, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[20] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 2 + } ; + +static yyconst flex_int16_t yy_base[71] = + { 0, + 0, 12, 84, 82, 0, 3, 4, 5, 6, 16, + 28, 0, 43, 0, 88, 97, 97, 97, 97, 97, + 14, 97, 8, 97, 55, 97, 97, 66, 97, 71, + 82, 97, 97, 80, 79, 97, 33, 36, 68, 97, + 40, 67, 48, 97, 69, 65, 0, 97, 97, 51, + 97, 45, 34, 97, 97, 57, 15, 59, 61, 63, + 65, 66, 28, 70, 0, 16, 97, 92, 94, 0 + } ; + +static yyconst flex_int16_t yy_def[71] = + { 0, + 68, 68, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 11, 2, 13, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 69, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 70, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 69, 70, 67, 30, 28, 0, 67, 67, 67 + } ; + +static yyconst flex_int16_t yy_nxt[117] = + { 0, + 63, 67, 22, 67, 17, 22, 67, 24, 24, 38, + 39, 26, 18, 19, 23, 20, 17, 23, 25, 25, + 25, 26, 36, 36, 18, 19, 67, 20, 37, 37, + 25, 27, 28, 29, 56, 57, 30, 38, 39, 66, + 31, 59, 42, 53, 32, 33, 27, 34, 29, 61, + 62, 30, 64, 65, 53, 35, 41, 42, 56, 57, + 38, 39, 59, 42, 59, 42, 61, 62, 67, 43, + 44, 64, 65, 45, 46, 46, 47, 48, 46, 49, + 43, 60, 58, 55, 54, 50, 51, 67, 21, 52, + 21, 53, 16, 16, 40, 40, 15, 67, 67, 67, + + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67 + } ; + +static yyconst flex_int16_t yy_chk[117] = + { 0, + 70, 0, 5, 0, 1, 6, 0, 7, 8, 23, + 23, 9, 1, 1, 5, 1, 2, 6, 7, 8, + 9, 10, 21, 57, 2, 2, 66, 2, 21, 57, + 10, 11, 11, 11, 37, 37, 11, 38, 38, 63, + 11, 41, 41, 53, 11, 11, 13, 13, 13, 43, + 43, 13, 50, 50, 52, 13, 25, 25, 56, 56, + 58, 58, 59, 59, 60, 60, 61, 61, 62, 25, + 28, 64, 64, 28, 46, 28, 28, 30, 45, 30, + 62, 42, 39, 35, 34, 30, 31, 15, 4, 31, + 3, 31, 68, 68, 69, 69, 67, 67, 67, 67, + + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int code__flex_debug; +int code__flex_debug = 1; + +static yyconst flex_int16_t yy_rule_linenum[24] = + { 0, + 99, 109, 110, 120, 125, 130, 135, 139, 143, 147, + 155, 158, 162, 166, 171, 172, 201, 205, 218, 219, + 220, 221, 228 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *code_text; +#line 1 "scan-code.l" +/* Bison Action Scanner -*- C -*- + + Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ +#line 24 "scan-code.l" +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef code_wrap +#define code_wrap() 1 + +#define FLEX_PREFIX(Id) code_ ## Id +#include "flex-scanner.h" + +#include "complain.h" +#include "reader.h" +#include "getargs.h" +#include +#include + +#include "scan-code.h" +#include "symlist.h" + +/* The current calling start condition: SC_RULE_ACTION or + SC_SYMBOL_ACTION. */ +# define YY_DECL static char *code_lex (code_props *self, int sc_context) +YY_DECL; + +#define YY_USER_ACTION location_compute (loc, &loc->end, code_text, code_leng); + +static void handle_action_dollar (symbol_list *rule, char *cp, + location dollar_loc); +static void handle_action_at (symbol_list *rule, char *cp, location at_loc); +static location the_location; +static location *loc = &the_location; + +/* A string representing the most recent translation. */ +static char *last_string; + +/* True if an untyped $$ or $n was seen. */ +static bool untyped_var_seen; +/* C and C++ comments in code. */ + +/* Strings and characters in code. */ + +/* Whether in a rule or symbol action. Specifies the translation +of $ and @. */ + +/* POSIX says that a tag must be both an id and a C union member, but + historically almost any character is allowed in a tag. We disallow + NUL and newline, as this simplifies our implementation. */ +/* Zero or more instances of backslash-newline. Following GCC, allow + white space between the backslash and the newline. */ +#line 670 "scan-code.c" + +#define INITIAL 0 +#define SC_COMMENT 1 +#define SC_LINE_COMMENT 2 +#define SC_STRING 3 +#define SC_CHARACTER 4 +#define SC_RULE_ACTION 5 +#define SC_SYMBOL_ACTION 6 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +#include +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-c-only */ + +static int yy_init_globals (void ); + +/* %endif */ +/* %if-reentrant */ +/* %endif */ +/* %endif End reentrant structures and macros. */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int code_lex_destroy (void ); + +int code_get_debug (void ); + +void code_set_debug (int debug_flag ); + +YY_EXTRA_TYPE code_get_extra (void ); + +void code_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *code_get_in (void ); + +void code_set_in (FILE * in_str ); + +FILE *code_get_out (void ); + +void code_set_out (FILE * out_str ); + +int code_get_leng (void ); + +char *code_get_text (void ); + +int code_get_lineno (void ); + +void code_set_lineno (int line_number ); + +/* %if-bison-bridge */ +/* %endif */ + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int code_wrap (void ); +#else +extern int code_wrap (void ); +#endif +#endif + +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif +/* %ok-for-header */ + +/* %endif */ +#endif + +/* %if-c-only */ + +/* %endif */ + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( code_text, code_leng, 1, code_out ) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( code_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( code_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, code_in))==0 && ferror(code_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(code_in); \ + } \ + }\ +\ +/* %if-c++-only C++ definition \ */\ +/* %endif */ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +/* %if-c-only */ +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %not-for-header */ + +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ + +extern int code_lex (void); + +#define YY_DECL int code_lex (void) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after code_text and code_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +/* %% [6.0] YY_RULE_SETUP definition goes here */ +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/* %not-for-header */ + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +/* %% [7.0] user's declarations go here */ +#line 78 "scan-code.l" + + + + /* Nesting level of the current code in braces. */ + int braces_level = 0; + + /* This scanner is special: it is invoked only once, henceforth + is expected to return only once. This initialization is + therefore done once per action to translate. */ + aver (sc_context == SC_SYMBOL_ACTION + || sc_context == SC_RULE_ACTION + || sc_context == INITIAL); + BEGIN sc_context; + + + /*------------------------------------------------------------. + | Scanning a C comment. The initial `/ *' is already eaten. | + `------------------------------------------------------------*/ + +#line 936 "scan-code.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! code_in ) +/* %if-c-only */ + code_in = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! code_out ) +/* %if-c-only */ + code_out = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! YY_CURRENT_BUFFER ) { + code_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + code__create_buffer(code_in,YY_BUF_SIZE ); + } + + code__load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); + + /* Support of code_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 68 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 67 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: +/* %% [10.0] code to find the action number goes here */ + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +/* %% [11.0] code for code_lineno update goes here */ + +do_action: /* This label is used only to access EOF actions. */ + +/* %% [12.0] debug code goes here */ + if ( code__flex_debug ) + { + if ( yy_act == 0 ) + fprintf( stderr, "--scanner backing up\n" ); + else if ( yy_act < 24 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], code_text ); + else if ( yy_act == 24 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + code_text ); + else if ( yy_act == 25 ) + fprintf( stderr, "--(end of buffer or a NUL)\n" ); + else + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + } + + switch ( yy_act ) + { /* beginning of action switch */ +/* %% [13.0] actions go here */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +/* rule 1 can match eol */ +YY_RULE_SETUP +#line 99 "scan-code.l" +STRING_GROW; BEGIN sc_context; + YY_BREAK + +/*--------------------------------------------------------------. + | Scanning a line comment. The initial `//' is already eaten. | + `--------------------------------------------------------------*/ + + +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 109 "scan-code.l" +STRING_GROW; BEGIN sc_context; + YY_BREAK +case 3: +/* rule 3 can match eol */ +YY_RULE_SETUP +#line 110 "scan-code.l" +STRING_GROW; + YY_BREAK + +/*--------------------------------------------. + | Scanning user-code characters and strings. | + `--------------------------------------------*/ + + +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +#line 120 "scan-code.l" +STRING_GROW; + YY_BREAK + + + +case 5: +YY_RULE_SETUP +#line 125 "scan-code.l" +STRING_GROW; BEGIN sc_context; + YY_BREAK + + + +case 6: +YY_RULE_SETUP +#line 130 "scan-code.l" +STRING_GROW; BEGIN sc_context; + YY_BREAK + + +case 7: +YY_RULE_SETUP +#line 135 "scan-code.l" +{ + STRING_GROW; + BEGIN SC_CHARACTER; + } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 139 "scan-code.l" +{ + STRING_GROW; + BEGIN SC_STRING; + } + YY_BREAK +case 9: +/* rule 9 can match eol */ +YY_RULE_SETUP +#line 143 "scan-code.l" +{ + STRING_GROW; + BEGIN SC_COMMENT; + } + YY_BREAK +case 10: +/* rule 10 can match eol */ +YY_RULE_SETUP +#line 147 "scan-code.l" +{ + STRING_GROW; + BEGIN SC_LINE_COMMENT; + } + YY_BREAK + + + +case 11: +YY_RULE_SETUP +#line 155 "scan-code.l" +{ + handle_action_dollar (self->rule, code_text, *loc); + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 158 "scan-code.l" +{ + handle_action_at (self->rule, code_text, *loc); + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 162 "scan-code.l" +{ + warn_at (*loc, _("stray `$'")); + obstack_sgrow (&obstack_for_string, "$]["); + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 166 "scan-code.l" +{ + warn_at (*loc, _("stray `@'")); + obstack_sgrow (&obstack_for_string, "@@"); + } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 171 "scan-code.l" +STRING_GROW; ++braces_level; + YY_BREAK +case 16: +YY_RULE_SETUP +#line 172 "scan-code.l" +{ + bool outer_brace = --braces_level == 0; + + /* As an undocumented Bison extension, append `;' before the last + brace in braced code, so that the user code can omit trailing + `;'. But do not append `;' if emulating Yacc, since Yacc does + not append one. Also, some output languages (like Java) do not + accept an extra semicolon, so don't append if the user specified + a skeleton or language. + + FIXME: Bison should warn if a semicolon seems to be necessary + here, and should omit the semicolon if it seems unnecessary + (e.g., after ';', '{', or '}', each followed by comments or + white space). Such a warning shouldn't depend on --yacc; it + should depend on a new --pedantic option, which would cause + Bison to warn if it detects an extension to POSIX. --pedantic + should also diagnose other Bison extensions like %yacc. + Perhaps there should also be a GCC-style --pedantic-errors + option, so that such warnings are diagnosed as errors. */ + if (outer_brace && !yacc_flag && language_prio == default_prio + && skeleton_prio == default_prio) + obstack_1grow (&obstack_for_string, ';'); + + STRING_GROW; + } + YY_BREAK + + + +case 17: +YY_RULE_SETUP +#line 201 "scan-code.l" +{ + obstack_sgrow (&obstack_for_string, "]b4_dollar_dollar["); + self->is_value_used = true; + } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 205 "scan-code.l" +{ + obstack_sgrow (&obstack_for_string, "]b4_at_dollar["); + locations_flag = true; + } + YY_BREAK + +/*-----------------------------------------. + | Escape M4 quoting characters in C code. | + `-----------------------------------------*/ + + +case 19: +YY_RULE_SETUP +#line 218 "scan-code.l" +obstack_sgrow (&obstack_for_string, "$]["); + YY_BREAK +case 20: +YY_RULE_SETUP +#line 219 "scan-code.l" +obstack_sgrow (&obstack_for_string, "@@"); + YY_BREAK +case 21: +YY_RULE_SETUP +#line 220 "scan-code.l" +obstack_sgrow (&obstack_for_string, "@{"); + YY_BREAK +case 22: +YY_RULE_SETUP +#line 221 "scan-code.l" +obstack_sgrow (&obstack_for_string, "@}"); + YY_BREAK + +/*-----------------------------------------------------. + | By default, grow the string obstack with the input. | + `-----------------------------------------------------*/ +case 23: +/* rule 23 can match eol */ +YY_RULE_SETUP +#line 228 "scan-code.l" +STRING_GROW; + YY_BREAK +/* End of processing. */ +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(SC_COMMENT): +case YY_STATE_EOF(SC_LINE_COMMENT): +case YY_STATE_EOF(SC_STRING): +case YY_STATE_EOF(SC_CHARACTER): +case YY_STATE_EOF(SC_RULE_ACTION): +case YY_STATE_EOF(SC_SYMBOL_ACTION): +#line 231 "scan-code.l" +{ + STRING_FINISH; + return last_string; + } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 236 "scan-code.l" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 1275 "scan-code.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed code_in at a new source and called + * code_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = code_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( code_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * code_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of code_lex */ +/* %ok-for-header */ + +/* %if-c++-only */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +/* %if-c-only */ +static int yy_get_next_buffer (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + code_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + code_restart(code_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) code_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +/* %if-c-only */ +/* %not-for-header */ + + static yy_state_type yy_get_previous_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register yy_state_type yy_current_state; + register char *yy_cp; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { +/* %% [16.0] code to find the next state goes here */ + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 19); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 68 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +/* %if-c-only */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register int yy_is_jam; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 19; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 68 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 67); + + return yy_is_jam ? 0 : yy_current_state; +} + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + code_restart(code_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( code_wrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve code_text */ + (yy_hold_char) = *++(yy_c_buf_p); + +/* %% [19.0] update BOL and code_lineno */ + + return c; +} +/* %if-c-only */ +#endif /* ifndef YY_NO_INPUT */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void code_restart (FILE * input_file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + code_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + code__create_buffer(code_in,YY_BUF_SIZE ); + } + + code__init_buffer(YY_CURRENT_BUFFER,input_file ); + code__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ + void code__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * code_pop_buffer_state(); + * code_push_buffer_state(new_buffer); + */ + code_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + code__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (code_wrap()) processing, but the only time this flag + * is looked at is after code_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +/* %if-c-only */ +static void code__load_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + code_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE code__create_buffer (FILE * file, int size ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) code_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in code__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) code_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in code__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + code__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with code__create_buffer() + * + */ +/* %if-c-only */ + void code__delete_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + code_free((void *) b->yy_ch_buf ); + + code_free((void *) b ); +} + +/* %if-c-only */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a code_restart() or at EOF. + */ +/* %if-c-only */ + static void code__init_buffer (YY_BUFFER_STATE b, FILE * file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +{ + int oerrno = errno; + + code__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then code__init_buffer was _probably_ + * called from code_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + +/* %if-c-only */ + + b->yy_is_interactive = 0; + +/* %endif */ +/* %if-c++-only */ +/* %endif */ + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ + void code__flush_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + code__load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +void code_push_buffer_state (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (new_buffer == NULL) + return; + + code_ensure_buffer_stack(); + + /* This block is copied from code__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from code__switch_to_buffer. */ + code__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +void code_pop_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + code__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + code__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +static void code_ensure_buffer_stack (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)code_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in code_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)code_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in code_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE code__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) code_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in code__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + code__switch_to_buffer(b ); + + return b; +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan a string. The next call to code_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * code__scan_bytes() instead. + */ +YY_BUFFER_STATE code__scan_string (yyconst char * yystr ) +{ + + return code__scan_bytes(yystr,strlen(yystr) ); +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan the given bytes. The next call to code_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE code__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) code_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in code__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = code__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in code__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} +/* %endif */ + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +/* %if-c-only */ +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up code_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + code_text[code_leng] = (yy_hold_char); \ + (yy_c_buf_p) = code_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + code_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ + +/** Get the current line number. + * + */ +int code_get_lineno (void) +{ + + return code_lineno; +} + +/** Get the input stream. + * + */ +FILE *code_get_in (void) +{ + return code_in; +} + +/** Get the output stream. + * + */ +FILE *code_get_out (void) +{ + return code_out; +} + +/** Get the length of the current token. + * + */ +int code_get_leng (void) +{ + return code_leng; +} + +/** Get the current token. + * + */ + +char *code_get_text (void) +{ + return code_text; +} + +/* %if-reentrant */ +/* %endif */ + +/** Set the current line number. + * @param line_number + * + */ +void code_set_lineno (int line_number ) +{ + + code_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see code__switch_to_buffer + */ +void code_set_in (FILE * in_str ) +{ + code_in = in_str ; +} + +void code_set_out (FILE * out_str ) +{ + code_out = out_str ; +} + +int code_get_debug (void) +{ + return code__flex_debug; +} + +void code_set_debug (int bdebug ) +{ + code__flex_debug = bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif if-c-only */ + +/* %if-c-only */ +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from code_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + code_in = stdin; + code_out = stdout; +#else + code_in = (FILE *) 0; + code_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * code_lex_init() + */ + return 0; +} +/* %endif */ + +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ +/* code_lex_destroy is for both reentrant and non-reentrant scanners. */ +int code_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + code__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + code_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + code_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * code_lex() is called, initialization will occur. */ + yy_init_globals( ); + +/* %if-reentrant */ +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *code_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *code_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void code_free (void * ptr ) +{ + free( (char *) ptr ); /* see code_realloc() for (char *) cast */ +} + +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + +#line 236 "scan-code.l" + + + +/* Keeps track of the maximum number of semantic values to the left of + a handle (those referenced by $0, $-1, etc.) are required by the + semantic actions of this grammar. */ +int max_left_semantic_context = 0; + + +/*------------------------------------------------------------------. +| TEXT is pointing to a wannabee semantic value (i.e., a `$'). | +| | +| Possible inputs: $[]($|integer) | +| | +| Output to OBSTACK_FOR_STRING a reference to this semantic value. | +`------------------------------------------------------------------*/ + +static void +handle_action_dollar (symbol_list *rule, char *text, location dollar_loc) +{ + char const *type_name = NULL; + char *cp = text + 1; + symbol_list *effective_rule; + int effective_rule_length; + + if (rule->midrule_parent_rule) + { + effective_rule = rule->midrule_parent_rule; + effective_rule_length = rule->midrule_parent_rhs_index - 1; + } + else + { + effective_rule = rule; + effective_rule_length = symbol_list_length (rule->next); + } + + /* Get the type name if explicit. */ + if (*cp == '<') + { + type_name = ++cp; + while (*cp != '>') + ++cp; + *cp = '\0'; + ++cp; + if (untyped_var_seen) + complain_at (dollar_loc, _("explicit type given in untyped grammar")); + tag_seen = true; + } + + if (*cp == '$') + { + if (!type_name) + type_name = symbol_list_n_type_name_get (rule, dollar_loc, 0); + + if (!type_name) + { + if (union_seen | tag_seen) + { + if (rule->midrule_parent_rule) + complain_at (dollar_loc, + _("$$ for the midrule at $%d of `%s'" + " has no declared type"), + rule->midrule_parent_rhs_index, + effective_rule->content.sym->tag); + else + complain_at (dollar_loc, _("$$ of `%s' has no declared type"), + rule->content.sym->tag); + } + else + untyped_var_seen = true; + type_name = ""; + } + + obstack_fgrow1 (&obstack_for_string, + "]b4_lhs_value([%s])[", type_name); + rule->action_props.is_value_used = true; + } + else + { + long int num = strtol (cp, NULL, 10); + + if (1 - INT_MAX + effective_rule_length <= num + && num <= effective_rule_length) + { + int n = num; + if (max_left_semantic_context < 1 - n) + max_left_semantic_context = 1 - n; + if (!type_name && 0 < n) + type_name = + symbol_list_n_type_name_get (effective_rule, dollar_loc, n); + if (!type_name) + { + if (union_seen | tag_seen) + complain_at (dollar_loc, _("$%d of `%s' has no declared type"), + n, effective_rule->content.sym->tag); + else + untyped_var_seen = true; + type_name = ""; + } + + obstack_fgrow3 (&obstack_for_string, + "]b4_rhs_value(%d, %d, [%s])[", + effective_rule_length, n, type_name); + if (n > 0) + symbol_list_n_get (effective_rule, n)->action_props.is_value_used = + true; + } + else + complain_at (dollar_loc, _("integer out of range: %s"), quote (text)); + } +} + + +/*------------------------------------------------------. +| TEXT is a location token (i.e., a `@...'). Output to | +| OBSTACK_FOR_STRING a reference to this location. | +`------------------------------------------------------*/ + +static void +handle_action_at (symbol_list *rule, char *text, location at_loc) +{ + char *cp = text + 1; + int effective_rule_length = + (rule->midrule_parent_rule + ? rule->midrule_parent_rhs_index - 1 + : symbol_list_length (rule->next)); + + locations_flag = true; + + if (*cp == '$') + obstack_sgrow (&obstack_for_string, "]b4_lhs_location["); + else + { + long int num = strtol (cp, NULL, 10); + + if (1 - INT_MAX + effective_rule_length <= num + && num <= effective_rule_length) + { + int n = num; + obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[", + effective_rule_length, n); + } + else + complain_at (at_loc, _("integer out of range: %s"), quote (text)); + } +} + + +/*-------------------------. +| Initialize the scanner. | +`-------------------------*/ + +/* Translate the dollars and ats in \a self, in the context \a sc_context + (SC_RULE_ACTION, SC_SYMBOL_ACTION, INITIAL). */ + +static char const * +translate_action (code_props *self, int sc_context) +{ + char *res; + static bool initialized = false; + if (!initialized) + { + obstack_init (&obstack_for_string); + code__flex_debug = 0; + initialized = true; + } + + loc->start = loc->end = self->location.start; + code__switch_to_buffer (code__scan_string (self->code)); + res = code_lex (self, sc_context); + code__delete_buffer (YY_CURRENT_BUFFER); + + return res; +} + +/*------------------------------------------------------------------------. +| Implementation of the public interface as documented in "scan-code.h". | +`------------------------------------------------------------------------*/ + +void +code_props_none_init (code_props *self) +{ + *self = code_props_none; +} + +code_props const code_props_none = CODE_PROPS_NONE_INIT; + +void +code_props_plain_init (code_props *self, char const *code, location code_loc) +{ + self->kind = CODE_PROPS_PLAIN; + self->code = code; + self->location = code_loc; + self->is_value_used = false; + self->rule = NULL; +} + +void +code_props_symbol_action_init (code_props *self, char const *code, + location code_loc) +{ + self->kind = CODE_PROPS_SYMBOL_ACTION; + self->code = code; + self->location = code_loc; + self->is_value_used = false; + self->rule = NULL; +} + +void +code_props_rule_action_init (code_props *self, char const *code, + location code_loc, symbol_list *rule) +{ + self->kind = CODE_PROPS_RULE_ACTION; + self->code = code; + self->location = code_loc; + self->is_value_used = false; + self->rule = rule; +} + +void +code_props_translate_code (code_props *self) +{ + switch (self->kind) + { + case CODE_PROPS_NONE: + break; + case CODE_PROPS_PLAIN: + self->code = translate_action (self, INITIAL); + break; + case CODE_PROPS_SYMBOL_ACTION: + self->code = translate_action (self, SC_SYMBOL_ACTION); + break; + case CODE_PROPS_RULE_ACTION: + self->code = translate_action (self, SC_RULE_ACTION); + break; + } +} + +void +code_scanner_last_string_free (void) +{ + STRING_FREE; +} + +void +code_scanner_free (void) +{ + obstack_free (&obstack_for_string, 0); + /* Reclaim Flex's buffers. */ + code_lex_destroy (); +} + diff --git a/src/scan-code.h b/src/scan-code.h new file mode 100644 index 0000000..a980b86 --- /dev/null +++ b/src/scan-code.h @@ -0,0 +1,168 @@ +/* Bison code properties structure and scanner. + + Copyright (C) 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef SCAN_CODE_H_ +# define SCAN_CODE_H_ + +# include "location.h" + +struct symbol_list; + +/** + * Keeps track of the maximum number of semantic values to the left of a handle + * (those referenced by $0, $-1, etc.) that are required by the semantic + * actions of this grammar. + */ +extern int max_left_semantic_context; + +/** + * A code passage captured from the grammar file and possibly translated, + * and/or properties associated with such a code passage. Don't break + * encapsulation by modifying the fields directly. Use the provided interface + * functions. + */ +typedef struct code_props { + /** Set by the init functions. */ + enum { + CODE_PROPS_NONE, CODE_PROPS_PLAIN, + CODE_PROPS_SYMBOL_ACTION, CODE_PROPS_RULE_ACTION + } kind; + + /** \c NULL iff \c code_props::kind is \c CODE_PROPS_NONE. */ + char const *code; + /** Undefined iff \c code_props::code is \c NULL. */ + location location; + + /** + * \c false iff either: + * - \c code_props_translate_code has never previously been invoked for + * the \c code_props that would contain the code passage associated + * with \c self. (That \c code_props is not the same as this one if this + * one is for a RHS \c symbol_list node. Instead, it's the \c code_props + * for the LHS symbol of the same rule.) + * - \c code_props_translate_code has been invoked for that \c code_props, + * but the symbol value associated with this \c code_props was not + * referenced in the code passage. + */ + bool is_value_used; + + /** \c NULL iff \c code_props::kind is not \c CODE_PROPS_RULE_ACTION. */ + struct symbol_list *rule; +} code_props; + +/** + * \pre + * - self != NULL. + * \post + * - \c self has been overwritten to contain no code. + */ +void code_props_none_init (code_props *self); + +/** Equivalent to \c code_props_none_init. */ +#define CODE_PROPS_NONE_INIT \ + {CODE_PROPS_NONE, NULL, EMPTY_LOCATION_INIT, false, NULL} + +/** Initialized by \c CODE_PROPS_NONE_INIT with no further modification. */ +extern code_props const code_props_none; + +/** + * \pre + * - self != NULL. + * - code != NULL. + * - \c code is an untranslated code passage containing no Bison escapes. + * - \c code was extracted from the grammar file at \c code_loc. + * \post + * - \c self has been overwritten to represent the specified plain code + * passage. + * - \c self will become invalid if the caller frees \c code before invoking + * \c code_props_translate_code on \c self. + */ +void code_props_plain_init (code_props *self, char const *code, + location code_loc); + +/** + * \pre + * - self != NULL. + * - code != NULL. + * - \c code is an untranslated code passage. The only Bison escapes it + * might contain are $$ and \@$, referring to a single symbol. + * - \c code was extracted from the grammar file at \c code_loc. + * \post + * - \c self has been overwritten to represent the specified symbol action. + * - \c self will become invalid if the caller frees \c code before invoking + * \c code_props_translate_code on \c self. + */ +void code_props_symbol_action_init (code_props *self, char const *code, + location code_loc); + +/** + * \pre + * - self != NULL. + * - code != NULL. + * - rule != NULL. + * - \c code is the untranslated action of the rule for which \c rule is the + * LHS node. Thus, \c code possibly contains Bison escapes such as $$, $1, + * $2, etc referring to the values of the rule. + * - \c code was extracted from the grammar file at \c code_loc. + * \post + * - \c self has been overwritten to represent the specified rule action. + * - \c self does not claim responsibility for the memory of \c rule. + * - \c self will become invalid if: + * - The caller frees \c code before invoking \c code_props_translate_code + * on \c self. + * - The caller frees \c rule. + */ +void code_props_rule_action_init (code_props *self, char const *code, + location code_loc, struct symbol_list *rule); + +/** + * \pre + * - If there's a code passage contained in \c self and it contains Bison + * escapes, all grammar declarations have already been parsed as they may + * affect warnings and complaints issued here. + * \post + * - All M4-special symbols and Bison escapes have been translated in + * \c self->code. + * - self->code != self->code\@pre unless + * self->code\@pre = NULL. + */ +void code_props_translate_code (code_props *self); + +/** + * \pre + * - None. + * \post + * - The dynamic memory allocated by the previous invocation of + * \c code_props_translate_code (if any) was freed. The \c code_props + * instance for which \c code_props_translate_code was invoked is now + * invalid. + */ +void code_scanner_last_string_free (void); + +/** + * \pre + * - None. + * \post + * - All dynamic memory allocated during invocations of + * \c code_props_translate_code (if any) has been freed. All \c code_props + * instances may now be invalid. + */ +void code_scanner_free (void); + +#endif /* !SCAN_CODE_H_ */ diff --git a/src/scan-code.l b/src/scan-code.l new file mode 100644 index 0000000..13a78c2 --- /dev/null +++ b/src/scan-code.l @@ -0,0 +1,485 @@ +/* Bison Action Scanner -*- C -*- + + Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +%option debug nodefault nounput noyywrap never-interactive +%option prefix="code_" outfile="lex.yy.c" + +%{ +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef code_wrap +#define code_wrap() 1 + +#define FLEX_PREFIX(Id) code_ ## Id +#include "flex-scanner.h" + +#include "complain.h" +#include "reader.h" +#include "getargs.h" +#include +#include + +#include "scan-code.h" +#include "symlist.h" + +/* The current calling start condition: SC_RULE_ACTION or + SC_SYMBOL_ACTION. */ +# define YY_DECL static char *code_lex (code_props *self, int sc_context) +YY_DECL; + +#define YY_USER_ACTION location_compute (loc, &loc->end, yytext, yyleng); + +static void handle_action_dollar (symbol_list *rule, char *cp, + location dollar_loc); +static void handle_action_at (symbol_list *rule, char *cp, location at_loc); +static location the_location; +static location *loc = &the_location; + +/* A string representing the most recent translation. */ +static char *last_string; + +/* True if an untyped $$ or $n was seen. */ +static bool untyped_var_seen; +%} + /* C and C++ comments in code. */ +%x SC_COMMENT SC_LINE_COMMENT + /* Strings and characters in code. */ +%x SC_STRING SC_CHARACTER + /* Whether in a rule or symbol action. Specifies the translation + of $ and @. */ +%x SC_RULE_ACTION SC_SYMBOL_ACTION + + +/* POSIX says that a tag must be both an id and a C union member, but + historically almost any character is allowed in a tag. We disallow + NUL and newline, as this simplifies our implementation. */ +tag [^\0\n>]+ + +/* Zero or more instances of backslash-newline. Following GCC, allow + white space between the backslash and the newline. */ +splice (\\[ \f\t\v]*\n)* + +%% + +%{ + /* Nesting level of the current code in braces. */ + int braces_level = 0; + + /* This scanner is special: it is invoked only once, henceforth + is expected to return only once. This initialization is + therefore done once per action to translate. */ + aver (sc_context == SC_SYMBOL_ACTION + || sc_context == SC_RULE_ACTION + || sc_context == INITIAL); + BEGIN sc_context; +%} + + /*------------------------------------------------------------. + | Scanning a C comment. The initial `/ *' is already eaten. | + `------------------------------------------------------------*/ + + +{ + "*"{splice}"/" STRING_GROW; BEGIN sc_context; +} + + + /*--------------------------------------------------------------. + | Scanning a line comment. The initial `//' is already eaten. | + `--------------------------------------------------------------*/ + + +{ + "\n" STRING_GROW; BEGIN sc_context; + {splice} STRING_GROW; +} + + + /*--------------------------------------------. + | Scanning user-code characters and strings. | + `--------------------------------------------*/ + + +{ + {splice}|\\{splice}. STRING_GROW; +} + + +{ + "'" STRING_GROW; BEGIN sc_context; +} + + +{ + "\"" STRING_GROW; BEGIN sc_context; +} + + +{ + "'" { + STRING_GROW; + BEGIN SC_CHARACTER; + } + "\"" { + STRING_GROW; + BEGIN SC_STRING; + } + "/"{splice}"*" { + STRING_GROW; + BEGIN SC_COMMENT; + } + "/"{splice}"/" { + STRING_GROW; + BEGIN SC_LINE_COMMENT; + } +} + + +{ + "$"("<"{tag}">")?(-?[0-9]+|"$") { + handle_action_dollar (self->rule, yytext, *loc); + } + "@"(-?[0-9]+|"$") { + handle_action_at (self->rule, yytext, *loc); + } + + "$" { + warn_at (*loc, _("stray `$'")); + obstack_sgrow (&obstack_for_string, "$]["); + } + "@" { + warn_at (*loc, _("stray `@'")); + obstack_sgrow (&obstack_for_string, "@@"); + } + + "{" STRING_GROW; ++braces_level; + "}" { + bool outer_brace = --braces_level == 0; + + /* As an undocumented Bison extension, append `;' before the last + brace in braced code, so that the user code can omit trailing + `;'. But do not append `;' if emulating Yacc, since Yacc does + not append one. Also, some output languages (like Java) do not + accept an extra semicolon, so don't append if the user specified + a skeleton or language. + + FIXME: Bison should warn if a semicolon seems to be necessary + here, and should omit the semicolon if it seems unnecessary + (e.g., after ';', '{', or '}', each followed by comments or + white space). Such a warning shouldn't depend on --yacc; it + should depend on a new --pedantic option, which would cause + Bison to warn if it detects an extension to POSIX. --pedantic + should also diagnose other Bison extensions like %yacc. + Perhaps there should also be a GCC-style --pedantic-errors + option, so that such warnings are diagnosed as errors. */ + if (outer_brace && !yacc_flag && language_prio == default_prio + && skeleton_prio == default_prio) + obstack_1grow (&obstack_for_string, ';'); + + STRING_GROW; + } +} + + +{ + "$$" { + obstack_sgrow (&obstack_for_string, "]b4_dollar_dollar["); + self->is_value_used = true; + } + "@$" { + obstack_sgrow (&obstack_for_string, "]b4_at_dollar["); + locations_flag = true; + } +} + + + /*-----------------------------------------. + | Escape M4 quoting characters in C code. | + `-----------------------------------------*/ + +<*> +{ + \$ obstack_sgrow (&obstack_for_string, "$]["); + \@ obstack_sgrow (&obstack_for_string, "@@"); + \[ obstack_sgrow (&obstack_for_string, "@{"); + \] obstack_sgrow (&obstack_for_string, "@}"); +} + + /*-----------------------------------------------------. + | By default, grow the string obstack with the input. | + `-----------------------------------------------------*/ + +<*>.|\n STRING_GROW; + + /* End of processing. */ +<*><> { + STRING_FINISH; + return last_string; + } + +%% + +/* Keeps track of the maximum number of semantic values to the left of + a handle (those referenced by $0, $-1, etc.) are required by the + semantic actions of this grammar. */ +int max_left_semantic_context = 0; + + +/*------------------------------------------------------------------. +| TEXT is pointing to a wannabee semantic value (i.e., a `$'). | +| | +| Possible inputs: $[]($|integer) | +| | +| Output to OBSTACK_FOR_STRING a reference to this semantic value. | +`------------------------------------------------------------------*/ + +static void +handle_action_dollar (symbol_list *rule, char *text, location dollar_loc) +{ + char const *type_name = NULL; + char *cp = text + 1; + symbol_list *effective_rule; + int effective_rule_length; + + if (rule->midrule_parent_rule) + { + effective_rule = rule->midrule_parent_rule; + effective_rule_length = rule->midrule_parent_rhs_index - 1; + } + else + { + effective_rule = rule; + effective_rule_length = symbol_list_length (rule->next); + } + + /* Get the type name if explicit. */ + if (*cp == '<') + { + type_name = ++cp; + while (*cp != '>') + ++cp; + *cp = '\0'; + ++cp; + if (untyped_var_seen) + complain_at (dollar_loc, _("explicit type given in untyped grammar")); + tag_seen = true; + } + + if (*cp == '$') + { + if (!type_name) + type_name = symbol_list_n_type_name_get (rule, dollar_loc, 0); + + if (!type_name) + { + if (union_seen | tag_seen) + { + if (rule->midrule_parent_rule) + complain_at (dollar_loc, + _("$$ for the midrule at $%d of `%s'" + " has no declared type"), + rule->midrule_parent_rhs_index, + effective_rule->content.sym->tag); + else + complain_at (dollar_loc, _("$$ of `%s' has no declared type"), + rule->content.sym->tag); + } + else + untyped_var_seen = true; + type_name = ""; + } + + obstack_fgrow1 (&obstack_for_string, + "]b4_lhs_value([%s])[", type_name); + rule->action_props.is_value_used = true; + } + else + { + long int num = strtol (cp, NULL, 10); + + if (1 - INT_MAX + effective_rule_length <= num + && num <= effective_rule_length) + { + int n = num; + if (max_left_semantic_context < 1 - n) + max_left_semantic_context = 1 - n; + if (!type_name && 0 < n) + type_name = + symbol_list_n_type_name_get (effective_rule, dollar_loc, n); + if (!type_name) + { + if (union_seen | tag_seen) + complain_at (dollar_loc, _("$%d of `%s' has no declared type"), + n, effective_rule->content.sym->tag); + else + untyped_var_seen = true; + type_name = ""; + } + + obstack_fgrow3 (&obstack_for_string, + "]b4_rhs_value(%d, %d, [%s])[", + effective_rule_length, n, type_name); + if (n > 0) + symbol_list_n_get (effective_rule, n)->action_props.is_value_used = + true; + } + else + complain_at (dollar_loc, _("integer out of range: %s"), quote (text)); + } +} + + +/*------------------------------------------------------. +| TEXT is a location token (i.e., a `@...'). Output to | +| OBSTACK_FOR_STRING a reference to this location. | +`------------------------------------------------------*/ + +static void +handle_action_at (symbol_list *rule, char *text, location at_loc) +{ + char *cp = text + 1; + int effective_rule_length = + (rule->midrule_parent_rule + ? rule->midrule_parent_rhs_index - 1 + : symbol_list_length (rule->next)); + + locations_flag = true; + + if (*cp == '$') + obstack_sgrow (&obstack_for_string, "]b4_lhs_location["); + else + { + long int num = strtol (cp, NULL, 10); + + if (1 - INT_MAX + effective_rule_length <= num + && num <= effective_rule_length) + { + int n = num; + obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[", + effective_rule_length, n); + } + else + complain_at (at_loc, _("integer out of range: %s"), quote (text)); + } +} + + +/*-------------------------. +| Initialize the scanner. | +`-------------------------*/ + +/* Translate the dollars and ats in \a self, in the context \a sc_context + (SC_RULE_ACTION, SC_SYMBOL_ACTION, INITIAL). */ + +static char const * +translate_action (code_props *self, int sc_context) +{ + char *res; + static bool initialized = false; + if (!initialized) + { + obstack_init (&obstack_for_string); + yy_flex_debug = 0; + initialized = true; + } + + loc->start = loc->end = self->location.start; + yy_switch_to_buffer (yy_scan_string (self->code)); + res = code_lex (self, sc_context); + yy_delete_buffer (YY_CURRENT_BUFFER); + + return res; +} + +/*------------------------------------------------------------------------. +| Implementation of the public interface as documented in "scan-code.h". | +`------------------------------------------------------------------------*/ + +void +code_props_none_init (code_props *self) +{ + *self = code_props_none; +} + +code_props const code_props_none = CODE_PROPS_NONE_INIT; + +void +code_props_plain_init (code_props *self, char const *code, location code_loc) +{ + self->kind = CODE_PROPS_PLAIN; + self->code = code; + self->location = code_loc; + self->is_value_used = false; + self->rule = NULL; +} + +void +code_props_symbol_action_init (code_props *self, char const *code, + location code_loc) +{ + self->kind = CODE_PROPS_SYMBOL_ACTION; + self->code = code; + self->location = code_loc; + self->is_value_used = false; + self->rule = NULL; +} + +void +code_props_rule_action_init (code_props *self, char const *code, + location code_loc, symbol_list *rule) +{ + self->kind = CODE_PROPS_RULE_ACTION; + self->code = code; + self->location = code_loc; + self->is_value_used = false; + self->rule = rule; +} + +void +code_props_translate_code (code_props *self) +{ + switch (self->kind) + { + case CODE_PROPS_NONE: + break; + case CODE_PROPS_PLAIN: + self->code = translate_action (self, INITIAL); + break; + case CODE_PROPS_SYMBOL_ACTION: + self->code = translate_action (self, SC_SYMBOL_ACTION); + break; + case CODE_PROPS_RULE_ACTION: + self->code = translate_action (self, SC_RULE_ACTION); + break; + } +} + +void +code_scanner_last_string_free (void) +{ + STRING_FREE; +} + +void +code_scanner_free (void) +{ + obstack_free (&obstack_for_string, 0); + /* Reclaim Flex's buffers. */ + yylex_destroy (); +} diff --git a/src/scan-gram-c.c b/src/scan-gram-c.c new file mode 100644 index 0000000..6bacac6 --- /dev/null +++ b/src/scan-gram-c.c @@ -0,0 +1,3 @@ +#include +#include "system.h" +#include "scan-gram.c" diff --git a/src/scan-gram.c b/src/scan-gram.c new file mode 100644 index 0000000..33e3f31 --- /dev/null +++ b/src/scan-gram.c @@ -0,0 +1,3513 @@ +#line 2 "scan-gram.c" + +#line 4 "scan-gram.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +/* %not-for-header */ + +/* %if-c-only */ +/* %if-not-reentrant */ +#define yy_create_buffer gram__create_buffer +#define yy_delete_buffer gram__delete_buffer +#define yy_flex_debug gram__flex_debug +#define yy_init_buffer gram__init_buffer +#define yy_flush_buffer gram__flush_buffer +#define yy_load_buffer_state gram__load_buffer_state +#define yy_switch_to_buffer gram__switch_to_buffer +#define yyin gram_in +#define yyleng gram_leng +#define yylex gram_lex +#define yylineno gram_lineno +#define yyout gram_out +#define yyrestart gram_restart +#define yytext gram_text +#define yywrap gram_wrap +#define yyalloc gram_alloc +#define yyrealloc gram_realloc +#define yyfree gram_free + +/* %endif */ +/* %endif */ +/* %ok-for-header */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ +#include +#include +#include +#include +/* %endif */ + +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* %not-for-header */ + +/* Returned upon end-of-file. */ +#define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE gram_restart(gram_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +/* %if-not-reentrant */ +extern int gram_leng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +extern FILE *gram_in, *gram_out; +/* %endif */ +/* %endif */ + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up gram_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up gram_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { +/* %if-c-only */ + FILE *yy_input_file; +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via gram_restart()), so that the user can continue scanning by + * just pointing gram_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %if-not-reentrant */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ + +/* yy_hold_char holds the character lost when gram_text is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int gram_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow gram_wrap()'s to do buffer switches + * instead of setting up a fresh gram_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; +/* %ok-for-header */ + +/* %endif */ + +void gram_restart (FILE *input_file ); +void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE gram__create_buffer (FILE *file,int size ); +void gram__delete_buffer (YY_BUFFER_STATE b ); +void gram__flush_buffer (YY_BUFFER_STATE b ); +void gram_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void gram_pop_buffer_state (void ); + +static void gram_ensure_buffer_stack (void ); +static void gram__load_buffer_state (void ); +static void gram__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER gram__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE gram__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE gram__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE gram__scan_bytes (yyconst char *bytes,int len ); + +/* %endif */ + +void *gram_alloc (yy_size_t ); +void *gram_realloc (void *,yy_size_t ); +void gram_free (void * ); + +#define yy_new_buffer gram__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + gram_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gram__create_buffer(gram_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + gram_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gram__create_buffer(gram_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* %% [1.0] gram_text/gram_in/gram_out/yy_state_type/gram_lineno etc. def's & init go here */ +/* Begin user sect3 */ + +#define gram_wrap(n) 1 +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG + +typedef unsigned char YY_CHAR; + +FILE *gram_in = (FILE *) 0, *gram_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int gram_lineno; + +int gram_lineno = 1; + +extern char *gram_text; +#define yytext_ptr gram_text + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* %endif */ + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up gram_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle gram_text and gram_leng for yymore() goes here \ */\ + gram_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to gram_text[] goes here, if %array \ */\ + (yy_c_buf_p) = yy_cp; + +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ +#define YY_NUM_RULES 102 +#define YY_END_OF_BUFFER 103 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[453] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 70, 70, + 86, 86, 86, 86, 103, 63, 2, 2, 58, 63, + 57, 1, 54, 63, 55, 55, 51, 63, 49, 60, + 50, 63, 67, 67, 100, 71, 71, 100, 73, 72, + 72, 65, 2, 1, 65, 64, 65, 101, 92, 100, + 91, 100, 100, 100, 95, 97, 100, 69, 100, 90, + 89, 100, 88, 87, 62, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 59, 54, 4, 3, 55, 0, + + 0, 0, 53, 0, 66, 85, 83, 74, 85, 76, + 77, 78, 79, 80, 81, 85, 82, 85, 99, 93, + 94, 0, 96, 0, 95, 98, 0, 68, 0, 0, + 70, 86, 86, 86, 86, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 3, 56, 61, 52, + 0, 74, 0, 0, 75, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 0, 74, 0, 0, 48, 7, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 22, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 34, 48, 48, 48, 48, 48, + 48, 41, 48, 44, 48, 48, 47, 0, 0, 0, + 48, 8, 48, 48, 48, 13, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 25, 48, 48, 48, 48, + 48, 31, 48, 48, 48, 48, 48, 38, 48, 40, + + 42, 45, 48, 0, 0, 84, 6, 48, 10, 48, + 48, 15, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 32, 48, 48, 48, 48, 48, + 48, 48, 0, 48, 11, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 35, 48, 37, 48, 48, 46, 0, 48, 48, + 48, 48, 48, 48, 48, 48, 21, 48, 48, 48, + 48, 28, 29, 48, 48, 48, 39, 48, 0, 48, + 48, 48, 16, 48, 48, 48, 48, 23, 24, 48, + 48, 48, 48, 48, 48, 0, 0, 48, 12, 48, + + 48, 48, 20, 48, 48, 48, 48, 48, 48, 48, + 5, 48, 48, 17, 48, 48, 26, 48, 48, 33, + 36, 43, 9, 48, 48, 48, 48, 48, 14, 48, + 48, 48, 48, 48, 19, 48, 48, 48, 27, 48, + 48, 48, 48, 48, 18, 48, 48, 48, 48, 48, + 30, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 5, 6, 1, 7, 1, 8, 1, + 1, 9, 1, 10, 11, 12, 13, 14, 15, 15, + 15, 15, 15, 15, 15, 16, 16, 17, 18, 19, + 20, 21, 22, 1, 23, 23, 23, 23, 23, 23, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 24, 12, 12, 25, 12, 12, + 26, 27, 26, 1, 28, 1, 29, 30, 31, 32, + + 33, 34, 35, 36, 37, 12, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 12, 50, + 51, 12, 52, 53, 54, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[56] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 3, 4, 1, 5, 5, 5, 1, 1, 1, 1, + 1, 1, 5, 4, 4, 6, 1, 4, 5, 5, + 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 1, 1, 7 + } ; + +static yyconst flex_int16_t yy_base[473] = + { 0, + 0, 654, 650, 649, 53, 54, 57, 58, 60, 65, + 83, 90, 97, 112, 119, 125, 80, 98, 84, 91, + 118, 131, 132, 134, 657, 661, 661, 661, 661, 160, + 661, 661, 0, 63, 132, 138, 661, 105, 661, 661, + 661, 617, 661, 642, 661, 661, 661, 208, 661, 661, + 661, 661, 661, 661, 130, 661, 615, 661, 661, 599, + 661, 147, 123, 207, 661, 661, 79, 661, 166, 661, + 661, 216, 661, 661, 661, 0, 615, 609, 122, 29, + 613, 610, 607, 144, 614, 133, 598, 188, 188, 140, + 208, 604, 611, 614, 661, 0, 661, 0, 213, 0, + + 621, 620, 661, 603, 661, 661, 661, 225, 0, 661, + 661, 661, 661, 661, 661, 0, 661, 0, 661, 661, + 661, 242, 661, 258, 661, 661, 261, 661, 264, 267, + 612, 661, 270, 611, 273, 0, 596, 604, 248, 590, + 589, 590, 240, 587, 594, 589, 129, 598, 583, 587, + 269, 593, 578, 579, 214, 578, 578, 586, 587, 590, + 573, 579, 573, 578, 569, 582, 0, 0, 661, 661, + 571, 269, 0, 0, 0, 283, 279, 296, 227, 299, + 286, 305, 268, 312, 315, 318, 321, 301, 582, 577, + 561, 297, 561, 574, 564, 572, 571, 570, 591, 554, + + 565, 552, 587, 568, 561, 562, 192, 298, 549, 550, + 546, 560, 549, 556, 540, 551, 547, 540, 544, 550, + 549, 539, 550, 548, 545, 661, 0, 0, 532, 0, + 541, 527, 533, 528, 541, 526, 539, 558, 536, 524, + 529, 517, 0, 521, 516, 529, 301, 528, 523, 513, + 525, 517, 508, 522, 0, 507, 320, 516, 505, 518, + 503, 0, 508, 0, 507, 505, 0, 542, 0, 0, + 494, 0, 505, 510, 494, 0, 321, 494, 497, 322, + 510, 509, 508, 507, 498, 0, 491, 499, 491, 485, + 483, 0, 482, 517, 494, 483, 480, 0, 477, 0, + + 324, 0, 477, 322, 0, 661, 0, 475, 475, 489, + 470, 328, 473, 475, 471, 476, 479, 468, 470, 466, + 481, 476, 466, 474, 0, 463, 460, 475, 470, 460, + 454, 467, 339, 329, 0, 452, 465, 452, 463, 447, + 448, 482, 459, 462, 449, 456, 440, 441, 455, 440, + 455, 0, 438, 0, 441, 452, 0, 475, 436, 436, + 432, 431, 441, 427, 440, 443, 0, 431, 424, 435, + 429, 0, 0, 427, 421, 419, 0, 434, 458, 417, + 416, 430, 0, 422, 415, 412, 425, 0, 0, 418, + 407, 416, 423, 418, 411, 444, 286, 415, 0, 405, + + 396, 397, 0, 397, 393, 330, 401, 401, 395, 406, + 661, 407, 391, 0, 389, 398, 0, 391, 396, 0, + 0, 0, 0, 399, 331, 389, 385, 383, 0, 394, + 386, 393, 378, 387, 0, 392, 385, 382, 0, 389, + 381, 396, 355, 341, 0, 322, 302, 300, 312, 299, + 0, 661, 359, 366, 373, 377, 382, 388, 395, 400, + 405, 306, 291, 247, 210, 176, 171, 166, 136, 124, + 94, 412 + } ; + +static yyconst flex_int16_t yy_def[473] = + { 0, + 452, 1, 453, 453, 454, 454, 454, 454, 455, 455, + 454, 454, 454, 454, 454, 454, 454, 454, 454, 454, + 454, 454, 454, 454, 452, 452, 452, 452, 452, 452, + 452, 452, 456, 452, 452, 452, 452, 457, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 458, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 459, 452, 452, 452, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 452, 456, 452, 461, 452, 462, + + 457, 457, 452, 452, 452, 452, 452, 452, 463, 452, + 452, 452, 452, 452, 452, 464, 452, 465, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 461, 462, 452, 452, + 452, 452, 466, 467, 465, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 459, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 452, 452, 468, 469, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 452, 470, 471, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + + 460, 460, 460, 452, 464, 452, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 452, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 452, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 472, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 472, 472, 460, 460, 460, + + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 452, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 0, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452 + } ; + +static yyconst flex_int16_t yy_nxt[717] = + { 0, + 26, 27, 28, 27, 29, 26, 30, 31, 26, 32, + 26, 33, 34, 35, 36, 36, 26, 37, 38, 39, + 26, 26, 33, 33, 33, 26, 26, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 40, 41, 26, 26, 46, 46, 47, 47, 50, + 50, 53, 28, 53, 51, 51, 53, 28, 53, 54, + 57, 97, 55, 141, 54, 98, 56, 55, 142, 48, + 48, 56, 58, 48, 48, 58, 68, 59, 67, 60, + 61, 128, 58, 68, 59, 62, 60, 61, 306, 58, + + 58, 59, 62, 63, 61, 129, 67, 49, 49, 62, + 69, 49, 49, 102, 58, 64, 59, 69, 63, 61, + 70, 58, 71, 59, 62, 103, 61, 58, 305, 59, + 64, 62, 61, 70, 73, 71, 73, 62, 97, 74, + 270, 74, 98, 123, 72, 99, 99, 99, 65, 124, + 66, 99, 99, 99, 139, 120, 100, 72, 72, 121, + 72, 150, 202, 65, 140, 66, 75, 130, 131, 130, + 269, 76, 146, 122, 151, 228, 147, 159, 203, 152, + 227, 100, 76, 76, 76, 148, 160, 76, 76, 77, + 78, 79, 80, 81, 82, 76, 83, 76, 84, 85, + + 86, 87, 88, 76, 89, 90, 91, 92, 93, 76, + 94, 95, 107, 125, 175, 107, 154, 133, 134, 133, + 157, 108, 108, 248, 158, 126, 99, 99, 99, 107, + 249, 109, 155, 127, 107, 156, 110, 111, 172, 172, + 161, 112, 135, 176, 177, 176, 212, 123, 113, 162, + 213, 174, 114, 124, 115, 116, 117, 118, 163, 178, + 179, 178, 180, 181, 180, 182, 183, 182, 130, 131, + 130, 185, 134, 185, 187, 188, 187, 191, 197, 207, + 128, 192, 226, 226, 176, 177, 176, 120, 411, 198, + 397, 121, 125, 193, 129, 173, 207, 178, 179, 178, + + 180, 181, 180, 452, 126, 122, 182, 183, 182, 208, + 168, 287, 127, 130, 131, 130, 185, 134, 185, 185, + 134, 185, 187, 188, 187, 232, 250, 135, 287, 251, + 296, 311, 314, 233, 331, 333, 333, 333, 338, 359, + 418, 430, 358, 451, 450, 449, 448, 296, 311, 314, + 447, 331, 333, 333, 333, 338, 359, 418, 430, 43, + 43, 43, 43, 43, 43, 43, 45, 45, 45, 45, + 45, 45, 45, 52, 52, 52, 52, 52, 52, 52, + 96, 96, 101, 446, 101, 101, 101, 101, 106, 106, + 106, 106, 106, 106, 106, 132, 132, 132, 132, 132, + + 445, 132, 136, 136, 136, 167, 444, 167, 167, 167, + 167, 167, 396, 443, 396, 396, 396, 396, 396, 442, + 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, + 431, 429, 428, 427, 426, 425, 424, 423, 422, 421, + 420, 419, 417, 416, 415, 414, 413, 412, 397, 410, + 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, + 399, 398, 397, 395, 394, 393, 392, 391, 390, 389, + 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, + 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, + 368, 367, 366, 365, 364, 363, 362, 361, 360, 357, + + 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, + 346, 345, 344, 343, 342, 341, 340, 339, 337, 336, + 335, 334, 332, 330, 329, 328, 327, 326, 325, 324, + 323, 322, 321, 320, 319, 318, 317, 316, 315, 313, + 312, 310, 309, 308, 307, 304, 303, 302, 301, 300, + 299, 298, 297, 295, 294, 293, 292, 291, 290, 289, + 288, 286, 285, 284, 283, 282, 281, 280, 279, 278, + 277, 276, 275, 274, 273, 272, 271, 268, 267, 266, + 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, + 255, 254, 253, 252, 247, 246, 245, 244, 243, 242, + + 241, 240, 239, 238, 237, 236, 235, 234, 231, 230, + 229, 225, 224, 223, 222, 221, 220, 219, 218, 217, + 216, 215, 214, 211, 210, 209, 206, 205, 204, 201, + 200, 199, 196, 195, 194, 190, 189, 186, 184, 171, + 170, 169, 166, 165, 164, 153, 149, 145, 144, 143, + 138, 137, 119, 104, 105, 104, 452, 44, 44, 42, + 25, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452 + } ; + +static yyconst flex_int16_t yy_chk[717] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 5, 6, 5, 6, 7, + 8, 9, 9, 9, 7, 8, 10, 10, 10, 9, + 10, 34, 9, 80, 10, 34, 9, 10, 80, 5, + 6, 10, 17, 7, 8, 11, 19, 11, 17, 11, + 11, 67, 12, 20, 12, 11, 12, 12, 471, 13, + + 18, 13, 12, 13, 13, 67, 18, 5, 6, 13, + 19, 7, 8, 38, 14, 13, 14, 20, 14, 14, + 21, 15, 21, 15, 14, 38, 15, 16, 470, 16, + 14, 15, 16, 22, 23, 22, 24, 16, 55, 23, + 469, 24, 55, 63, 21, 35, 35, 35, 13, 63, + 13, 36, 36, 36, 79, 62, 35, 22, 23, 62, + 24, 86, 147, 14, 79, 14, 30, 69, 69, 69, + 468, 30, 84, 62, 86, 467, 84, 90, 147, 86, + 466, 35, 30, 30, 30, 84, 90, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 48, 64, 465, 48, 88, 72, 72, 72, + 89, 48, 48, 207, 89, 64, 99, 99, 99, 48, + 207, 48, 88, 64, 48, 88, 48, 48, 108, 108, + 91, 48, 72, 122, 122, 122, 155, 179, 48, 91, + 155, 464, 48, 179, 48, 48, 48, 48, 91, 124, + 124, 124, 127, 127, 127, 129, 129, 129, 130, 130, + 130, 133, 133, 133, 135, 135, 135, 139, 143, 151, + 183, 139, 172, 172, 176, 176, 176, 177, 397, 143, + 397, 177, 181, 139, 183, 463, 151, 178, 178, 178, + + 180, 180, 180, 188, 181, 177, 182, 182, 182, 151, + 462, 247, 181, 184, 184, 184, 185, 185, 185, 186, + 186, 186, 187, 187, 187, 192, 208, 188, 247, 208, + 257, 277, 280, 192, 301, 304, 304, 304, 312, 334, + 406, 425, 333, 450, 449, 448, 447, 257, 277, 280, + 446, 301, 333, 333, 333, 312, 334, 406, 425, 453, + 453, 453, 453, 453, 453, 453, 454, 454, 454, 454, + 454, 454, 454, 455, 455, 455, 455, 455, 455, 455, + 456, 456, 457, 444, 457, 457, 457, 457, 458, 458, + 458, 458, 458, 458, 458, 459, 459, 459, 459, 459, + + 443, 459, 460, 460, 460, 461, 442, 461, 461, 461, + 461, 461, 472, 441, 472, 472, 472, 472, 472, 440, + 438, 437, 436, 434, 433, 432, 431, 430, 428, 427, + 426, 424, 419, 418, 416, 415, 413, 412, 410, 409, + 408, 407, 405, 404, 402, 401, 400, 398, 396, 395, + 394, 393, 392, 391, 390, 387, 386, 385, 384, 382, + 381, 380, 379, 378, 376, 375, 374, 371, 370, 369, + 368, 366, 365, 364, 363, 362, 361, 360, 359, 358, + 356, 355, 353, 351, 350, 349, 348, 347, 346, 345, + 344, 343, 342, 341, 340, 339, 338, 337, 336, 332, + + 331, 330, 329, 328, 327, 326, 324, 323, 322, 321, + 320, 319, 318, 317, 316, 315, 314, 313, 311, 310, + 309, 308, 303, 299, 297, 296, 295, 294, 293, 291, + 290, 289, 288, 287, 285, 284, 283, 282, 281, 279, + 278, 275, 274, 273, 271, 268, 266, 265, 263, 261, + 260, 259, 258, 256, 254, 253, 252, 251, 250, 249, + 248, 246, 245, 244, 242, 241, 240, 239, 238, 237, + 236, 235, 234, 233, 232, 231, 229, 225, 224, 223, + 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, + 212, 211, 210, 209, 206, 205, 204, 203, 202, 201, + + 200, 199, 198, 197, 196, 195, 194, 193, 191, 190, + 189, 171, 166, 165, 164, 163, 162, 161, 160, 159, + 158, 157, 156, 154, 153, 152, 150, 149, 148, 146, + 145, 144, 142, 141, 140, 138, 137, 134, 131, 104, + 102, 101, 94, 93, 92, 87, 85, 83, 82, 81, + 78, 77, 60, 57, 44, 42, 25, 4, 3, 2, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int gram__flex_debug; +int gram__flex_debug = 1; + +static yyconst flex_int16_t yy_rule_linenum[102] = + { 0, + 135, 136, 137, 138, 146, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 200, 204, 205, + 206, 207, 208, 210, 216, 220, 226, 229, 232, 235, + 243, 251, 258, 275, 280, 301, 302, 313, 324, 325, + 337, 363, 390, 400, 410, 421, 422, 423, 424, 425, + 426, 427, 430, 432, 441, 453, 458, 459, 465, 466, + 477, 483, 489, 495, 511, 512, 513, 529, 548, 588, + + 589 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *gram_text; +#line 1 "scan-gram.l" +/* Bison Grammar Scanner -*- C -*- + + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, + Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ +#line 25 "scan-gram.l" +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef gram_wrap +#define gram_wrap() 1 + +#define FLEX_PREFIX(Id) gram_ ## Id +#include "flex-scanner.h" + +#include "complain.h" +#include "files.h" +#include "gram.h" +#include "quotearg.h" +#include "reader.h" +#include "uniqstr.h" + +#include +#include + +#include "scan-gram.h" + +#define YY_DECL GRAM_LEX_DECL + +#define YY_USER_INIT \ + code_start = scanner_cursor = loc->start; \ + +/* Location of scanner cursor. */ +static boundary scanner_cursor; + +#define YY_USER_ACTION location_compute (loc, &scanner_cursor, gram_text, gram_leng); + +static size_t no_cr_read (FILE *, char *, size_t); +#define YY_INPUT(buf, result, size) ((result) = no_cr_read (gram_in, buf, size)) + +/* A string representing the most recently saved token. */ +static char *last_string; + +void +gram_scanner_last_string_free (void) +{ + STRING_FREE; +} + +static void handle_syncline (char *, location); +static unsigned long int scan_integer (char const *p, int base, location loc); +static int convert_ucn_to_byte (char const *hex_text); +static void unexpected_eof (boundary, char const *); +static void unexpected_newline (boundary, char const *); + +/* A C-like comment in directives/rules. */ + +/* Strings and characters in directives/rules. */ + +/* A identifier was just read in directives/rules. Special state +to capture the sequence `identifier :'. */ + +/* Three types of user code: +- prologue (code between `%{' `%}' in the first section, before %%); +- actions, printers, union, etc, (between braced in the middle section); +- epilogue (everything after the second %%). */ + +/* C and C++ comments in code. */ + +/* Strings and characters in code. */ + +/* POSIX says that a tag must be both an id and a C union member, but + historically almost any character is allowed in a tag. We disallow + NUL and newline, as this simplifies our implementation. */ +/* Zero or more instances of backslash-newline. Following GCC, allow + white space between the backslash and the newline. */ +#line 971 "scan-gram.c" + +#define INITIAL 0 +#define SC_YACC_COMMENT 1 +#define SC_ESCAPED_STRING 2 +#define SC_ESCAPED_CHARACTER 3 +#define SC_AFTER_IDENTIFIER 4 +#define SC_PROLOGUE 5 +#define SC_BRACED_CODE 6 +#define SC_EPILOGUE 7 +#define SC_COMMENT 8 +#define SC_LINE_COMMENT 9 +#define SC_STRING 10 +#define SC_CHARACTER 11 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +#include +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-c-only */ + +static int yy_init_globals (void ); + +/* %endif */ +/* %if-reentrant */ +/* %endif */ +/* %endif End reentrant structures and macros. */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int gram_lex_destroy (void ); + +int gram_get_debug (void ); + +void gram_set_debug (int debug_flag ); + +YY_EXTRA_TYPE gram_get_extra (void ); + +void gram_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *gram_get_in (void ); + +void gram_set_in (FILE * in_str ); + +FILE *gram_get_out (void ); + +void gram_set_out (FILE * out_str ); + +int gram_get_leng (void ); + +char *gram_get_text (void ); + +int gram_get_lineno (void ); + +void gram_set_lineno (int line_number ); + +/* %if-bison-bridge */ +/* %endif */ + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int gram_wrap (void ); +#else +extern int gram_wrap (void ); +#endif +#endif + +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif +/* %ok-for-header */ + +/* %endif */ +#endif + +/* %if-c-only */ + +/* %endif */ + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( gram_text, gram_leng, 1, gram_out ) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( gram_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( gram_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, gram_in))==0 && ferror(gram_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(gram_in); \ + } \ + }\ +\ +/* %if-c++-only C++ definition \ */\ +/* %endif */ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +/* %if-c-only */ +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %not-for-header */ + +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ + +extern int gram_lex (void); + +#define YY_DECL int gram_lex (void) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after gram_text and gram_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +/* %% [6.0] YY_RULE_SETUP definition goes here */ +#define YY_RULE_SETUP \ + if ( gram_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (gram_text[gram_leng - 1] == '\n'); \ + YY_USER_ACTION + +/* %not-for-header */ + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +/* %% [7.0] user's declarations go here */ +#line 106 "scan-gram.l" + + + /* Nesting level of the current code in braces. */ + int braces_level IF_LINT (= 0); + + /* Parent context state, when applicable. */ + int context_state IF_LINT (= 0); + + /* Location of most recent identifier, when applicable. */ + location id_loc IF_LINT (= empty_location); + + /* Where containing code started, when applicable. Its initial + value is relevant only when gram_lex is invoked in the SC_EPILOGUE + start condition. */ + boundary code_start = scanner_cursor; + + /* Where containing comment or string or character literal started, + when applicable. */ + boundary token_start IF_LINT (= scanner_cursor); + + + + /*-----------------------. + | Scanning white space. | + `-----------------------*/ + +#line 1252 "scan-gram.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! gram_in ) +/* %if-c-only */ + gram_in = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! gram_out ) +/* %if-c-only */ + gram_out = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! YY_CURRENT_BUFFER ) { + gram_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gram__create_buffer(gram_in,YY_BUF_SIZE ); + } + + gram__load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); + + /* Support of gram_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 453 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 452 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: +/* %% [10.0] code to find the action number goes here */ + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +/* %% [11.0] code for gram_lineno update goes here */ + +do_action: /* This label is used only to access EOF actions. */ + +/* %% [12.0] debug code goes here */ + if ( gram__flex_debug ) + { + if ( yy_act == 0 ) + fprintf( stderr, "--scanner backing up\n" ); + else if ( yy_act < 102 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], gram_text ); + else if ( yy_act == 102 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + gram_text ); + else if ( yy_act == 103 ) + fprintf( stderr, "--(end of buffer or a NUL)\n" ); + else + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + } + + switch ( yy_act ) + { /* beginning of action switch */ +/* %% [13.0] actions go here */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +/* Comments and white space. */ +case 1: +YY_RULE_SETUP +#line 135 "scan-gram.l" +warn_at (*loc, _("stray `,' treated as white space")); + YY_BREAK +case 2: +/* rule 2 can match eol */ +#line 137 "scan-gram.l" +case 3: +/* rule 3 can match eol */ +YY_RULE_SETUP +#line 137 "scan-gram.l" +; + YY_BREAK +case 4: +YY_RULE_SETUP +#line 138 "scan-gram.l" +{ + token_start = loc->start; + context_state = YY_START; + BEGIN SC_YACC_COMMENT; + } + YY_BREAK +/* #line directives are not documented, and may be withdrawn or + modified in future versions of Bison. */ +case 5: +/* rule 5 can match eol */ +YY_RULE_SETUP +#line 146 "scan-gram.l" +{ + handle_syncline (gram_text + sizeof "#line " - 1, *loc); + } + YY_BREAK + +/*----------------------------. + | Scanning Bison directives. | + `----------------------------*/ + + +case 6: +YY_RULE_SETUP +#line 157 "scan-gram.l" +return PERCENT_NONASSOC; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 158 "scan-gram.l" +return PERCENT_CODE; + YY_BREAK +case 8: +YY_RULE_SETUP +#line 159 "scan-gram.l" +return PERCENT_DEBUG; + YY_BREAK +case 9: +YY_RULE_SETUP +#line 160 "scan-gram.l" +return PERCENT_DEFAULT_PREC; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 161 "scan-gram.l" +return PERCENT_DEFINE; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 162 "scan-gram.l" +return PERCENT_DEFINES; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 163 "scan-gram.l" +return PERCENT_DESTRUCTOR; + YY_BREAK +case 13: +YY_RULE_SETUP +#line 164 "scan-gram.l" +return PERCENT_DPREC; + YY_BREAK +case 14: +YY_RULE_SETUP +#line 165 "scan-gram.l" +return PERCENT_ERROR_VERBOSE; + YY_BREAK +case 15: +YY_RULE_SETUP +#line 166 "scan-gram.l" +return PERCENT_EXPECT; + YY_BREAK +case 16: +YY_RULE_SETUP +#line 167 "scan-gram.l" +return PERCENT_EXPECT_RR; + YY_BREAK +case 17: +YY_RULE_SETUP +#line 168 "scan-gram.l" +return PERCENT_FILE_PREFIX; + YY_BREAK +case 18: +YY_RULE_SETUP +#line 169 "scan-gram.l" +return PERCENT_YACC; + YY_BREAK +case 19: +YY_RULE_SETUP +#line 170 "scan-gram.l" +return PERCENT_INITIAL_ACTION; + YY_BREAK +case 20: +YY_RULE_SETUP +#line 171 "scan-gram.l" +return PERCENT_GLR_PARSER; + YY_BREAK +case 21: +YY_RULE_SETUP +#line 172 "scan-gram.l" +return PERCENT_LANGUAGE; + YY_BREAK +case 22: +YY_RULE_SETUP +#line 173 "scan-gram.l" +return PERCENT_LEFT; + YY_BREAK +case 23: +YY_RULE_SETUP +#line 174 "scan-gram.l" +return PERCENT_LEX_PARAM; + YY_BREAK +case 24: +YY_RULE_SETUP +#line 175 "scan-gram.l" +return PERCENT_LOCATIONS; + YY_BREAK +case 25: +YY_RULE_SETUP +#line 176 "scan-gram.l" +return PERCENT_MERGE; + YY_BREAK +case 26: +YY_RULE_SETUP +#line 177 "scan-gram.l" +return PERCENT_NAME_PREFIX; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 178 "scan-gram.l" +return PERCENT_NO_DEFAULT_PREC; + YY_BREAK +case 28: +YY_RULE_SETUP +#line 179 "scan-gram.l" +return PERCENT_NO_LINES; + YY_BREAK +case 29: +YY_RULE_SETUP +#line 180 "scan-gram.l" +return PERCENT_NONASSOC; + YY_BREAK +case 30: +YY_RULE_SETUP +#line 181 "scan-gram.l" +return PERCENT_NONDETERMINISTIC_PARSER; + YY_BREAK +case 31: +YY_RULE_SETUP +#line 182 "scan-gram.l" +return PERCENT_NTERM; + YY_BREAK +case 32: +YY_RULE_SETUP +#line 183 "scan-gram.l" +return PERCENT_OUTPUT; + YY_BREAK +case 33: +YY_RULE_SETUP +#line 184 "scan-gram.l" +return PERCENT_PARSE_PARAM; + YY_BREAK +case 34: +YY_RULE_SETUP +#line 185 "scan-gram.l" +return PERCENT_PREC; + YY_BREAK +case 35: +YY_RULE_SETUP +#line 186 "scan-gram.l" +return PERCENT_PRINTER; + YY_BREAK +case 36: +YY_RULE_SETUP +#line 187 "scan-gram.l" +return PERCENT_PURE_PARSER; + YY_BREAK +case 37: +YY_RULE_SETUP +#line 188 "scan-gram.l" +return PERCENT_REQUIRE; + YY_BREAK +case 38: +YY_RULE_SETUP +#line 189 "scan-gram.l" +return PERCENT_RIGHT; + YY_BREAK +case 39: +YY_RULE_SETUP +#line 190 "scan-gram.l" +return PERCENT_SKELETON; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 191 "scan-gram.l" +return PERCENT_START; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 192 "scan-gram.l" +return PERCENT_TOKEN; + YY_BREAK +case 42: +YY_RULE_SETUP +#line 193 "scan-gram.l" +return PERCENT_TOKEN; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 194 "scan-gram.l" +return PERCENT_TOKEN_TABLE; + YY_BREAK +case 44: +YY_RULE_SETUP +#line 195 "scan-gram.l" +return PERCENT_TYPE; + YY_BREAK +case 45: +YY_RULE_SETUP +#line 196 "scan-gram.l" +return PERCENT_UNION; + YY_BREAK +case 46: +YY_RULE_SETUP +#line 197 "scan-gram.l" +return PERCENT_VERBOSE; + YY_BREAK +case 47: +YY_RULE_SETUP +#line 198 "scan-gram.l" +return PERCENT_YACC; + YY_BREAK +case 48: +YY_RULE_SETUP +#line 200 "scan-gram.l" +{ + complain_at (*loc, _("invalid directive: %s"), quote (gram_text)); + } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 204 "scan-gram.l" +return EQUAL; + YY_BREAK +case 50: +YY_RULE_SETUP +#line 205 "scan-gram.l" +return PIPE; + YY_BREAK +case 51: +YY_RULE_SETUP +#line 206 "scan-gram.l" +return SEMICOLON; + YY_BREAK +case 52: +YY_RULE_SETUP +#line 207 "scan-gram.l" +return TYPE_TAG_ANY; + YY_BREAK +case 53: +YY_RULE_SETUP +#line 208 "scan-gram.l" +return TYPE_TAG_NONE; + YY_BREAK +case 54: +YY_RULE_SETUP +#line 210 "scan-gram.l" +{ + val->uniqstr = uniqstr_new (gram_text); + id_loc = *loc; + BEGIN SC_AFTER_IDENTIFIER; + } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 216 "scan-gram.l" +{ + val->integer = scan_integer (gram_text, 10, *loc); + return INT; + } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 220 "scan-gram.l" +{ + val->integer = scan_integer (gram_text, 16, *loc); + return INT; + } + YY_BREAK +/* Characters. We don't check there is only one. */ +case 57: +YY_RULE_SETUP +#line 226 "scan-gram.l" +STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; + YY_BREAK +/* Strings. */ +case 58: +YY_RULE_SETUP +#line 229 "scan-gram.l" +token_start = loc->start; BEGIN SC_ESCAPED_STRING; + YY_BREAK +/* Prologue. */ +case 59: +YY_RULE_SETUP +#line 232 "scan-gram.l" +code_start = loc->start; BEGIN SC_PROLOGUE; + YY_BREAK +/* Code in between braces. */ +case 60: +YY_RULE_SETUP +#line 235 "scan-gram.l" +{ + STRING_GROW; + braces_level = 0; + code_start = loc->start; + BEGIN SC_BRACED_CODE; + } + YY_BREAK +/* A type. */ +case 61: +YY_RULE_SETUP +#line 243 "scan-gram.l" +{ + obstack_grow (&obstack_for_string, gram_text + 1, gram_leng - 2); + STRING_FINISH; + val->uniqstr = uniqstr_new (last_string); + STRING_FREE; + return TYPE; + } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 251 "scan-gram.l" +{ + static int percent_percent_count; + if (++percent_percent_count == 2) + BEGIN SC_EPILOGUE; + return PERCENT_PERCENT; + } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 258 "scan-gram.l" +{ + complain_at (*loc, _("invalid character: %s"), quote (gram_text)); + } + YY_BREAK +case YY_STATE_EOF(INITIAL): +#line 262 "scan-gram.l" +{ + loc->start = loc->end = scanner_cursor; + yyterminate (); + } + YY_BREAK + +/*-----------------------------------------------------------------. + | Scanning after an identifier, checking whether a colon is next. | + `-----------------------------------------------------------------*/ + + +case 64: +YY_RULE_SETUP +#line 275 "scan-gram.l" +{ + *loc = id_loc; + BEGIN INITIAL; + return ID_COLON; + } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 280 "scan-gram.l" +{ + scanner_cursor.column -= mbsnwidth (gram_text, gram_leng, 0); + yyless (0); + *loc = id_loc; + BEGIN INITIAL; + return ID; + } + YY_BREAK +case YY_STATE_EOF(SC_AFTER_IDENTIFIER): +#line 287 "scan-gram.l" +{ + *loc = id_loc; + BEGIN INITIAL; + return ID; + } + YY_BREAK + +/*---------------------------------------------------------------. + | Scanning a Yacc comment. The initial `/ *' is already eaten. | + `---------------------------------------------------------------*/ + + +case 66: +YY_RULE_SETUP +#line 301 "scan-gram.l" +BEGIN context_state; + YY_BREAK +case 67: +/* rule 67 can match eol */ +YY_RULE_SETUP +#line 302 "scan-gram.l" +; + YY_BREAK +case YY_STATE_EOF(SC_YACC_COMMENT): +#line 303 "scan-gram.l" +unexpected_eof (token_start, "*/"); BEGIN context_state; + YY_BREAK + +/*------------------------------------------------------------. + | Scanning a C comment. The initial `/ *' is already eaten. | + `------------------------------------------------------------*/ + + +case 68: +/* rule 68 can match eol */ +YY_RULE_SETUP +#line 313 "scan-gram.l" +STRING_GROW; BEGIN context_state; + YY_BREAK +case YY_STATE_EOF(SC_COMMENT): +#line 314 "scan-gram.l" +unexpected_eof (token_start, "*/"); BEGIN context_state; + YY_BREAK + +/*--------------------------------------------------------------. + | Scanning a line comment. The initial `//' is already eaten. | + `--------------------------------------------------------------*/ + + +case 69: +/* rule 69 can match eol */ +YY_RULE_SETUP +#line 324 "scan-gram.l" +STRING_GROW; BEGIN context_state; + YY_BREAK +case 70: +/* rule 70 can match eol */ +YY_RULE_SETUP +#line 325 "scan-gram.l" +STRING_GROW; + YY_BREAK +case YY_STATE_EOF(SC_LINE_COMMENT): +#line 326 "scan-gram.l" +BEGIN context_state; + YY_BREAK + +/*------------------------------------------------. + | Scanning a Bison string, including its escapes. | + | The initial quote is already eaten. | + `------------------------------------------------*/ + + +case 71: +/* rule 71 can match eol */ +YY_RULE_SETUP +#line 337 "scan-gram.l" +{ + if (gram_text[0] == '\n') + unexpected_newline (token_start, "\""); + STRING_FINISH; + loc->start = token_start; + val->chars = last_string; + BEGIN INITIAL; + return STRING; + } + YY_BREAK +case YY_STATE_EOF(SC_ESCAPED_STRING): +#line 346 "scan-gram.l" +{ + unexpected_eof (token_start, "\""); + STRING_FINISH; + loc->start = token_start; + val->chars = last_string; + BEGIN INITIAL; + return STRING; + } + YY_BREAK + +/*----------------------------------------------------------. + | Scanning a Bison character literal, decoding its escapes. | + | The initial quote is already eaten. | + `----------------------------------------------------------*/ + + +case 72: +/* rule 72 can match eol */ +YY_RULE_SETUP +#line 363 "scan-gram.l" +{ + if (gram_text[0] == '\n') + unexpected_newline (token_start, "'"); + STRING_GROW; + STRING_FINISH; + loc->start = token_start; + val->character = last_string[1]; + STRING_FREE; + BEGIN INITIAL; + return CHAR; + } + YY_BREAK +case YY_STATE_EOF(SC_ESCAPED_CHARACTER): +#line 374 "scan-gram.l" +{ + unexpected_eof (token_start, "'"); + STRING_FINISH; + loc->start = token_start; + if (strlen(last_string) > 1) + val->character = last_string[1]; + else + val->character = last_string[0]; + STRING_FREE; + BEGIN INITIAL; + return CHAR; + } + YY_BREAK + + + +case 73: +YY_RULE_SETUP +#line 390 "scan-gram.l" +complain_at (*loc, _("invalid null character")); + YY_BREAK + +/*----------------------------. + | Decode escaped characters. | + `----------------------------*/ + + +case 74: +YY_RULE_SETUP +#line 400 "scan-gram.l" +{ + unsigned long int c = strtoul (gram_text + 1, NULL, 8); + if (UCHAR_MAX < c) + complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); + else if (! c) + complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); + else + obstack_1grow (&obstack_for_string, c); + } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 410 "scan-gram.l" +{ + verify (UCHAR_MAX < ULONG_MAX); + unsigned long int c = strtoul (gram_text + 2, NULL, 16); + if (UCHAR_MAX < c) + complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); + else if (! c) + complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); + else + obstack_1grow (&obstack_for_string, c); + } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 421 "scan-gram.l" +obstack_1grow (&obstack_for_string, '\a'); + YY_BREAK +case 77: +YY_RULE_SETUP +#line 422 "scan-gram.l" +obstack_1grow (&obstack_for_string, '\b'); + YY_BREAK +case 78: +YY_RULE_SETUP +#line 423 "scan-gram.l" +obstack_1grow (&obstack_for_string, '\f'); + YY_BREAK +case 79: +YY_RULE_SETUP +#line 424 "scan-gram.l" +obstack_1grow (&obstack_for_string, '\n'); + YY_BREAK +case 80: +YY_RULE_SETUP +#line 425 "scan-gram.l" +obstack_1grow (&obstack_for_string, '\r'); + YY_BREAK +case 81: +YY_RULE_SETUP +#line 426 "scan-gram.l" +obstack_1grow (&obstack_for_string, '\t'); + YY_BREAK +case 82: +YY_RULE_SETUP +#line 427 "scan-gram.l" +obstack_1grow (&obstack_for_string, '\v'); + YY_BREAK +/* \\[\"\'?\\] would be shorter, but it confuses xgettext. */ +case 83: +YY_RULE_SETUP +#line 430 "scan-gram.l" +obstack_1grow (&obstack_for_string, gram_text[1]); + YY_BREAK +case 84: +YY_RULE_SETUP +#line 432 "scan-gram.l" +{ + int c = convert_ucn_to_byte (gram_text); + if (c < 0) + complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); + else if (! c) + complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); + else + obstack_1grow (&obstack_for_string, c); + } + YY_BREAK +case 85: +/* rule 85 can match eol */ +YY_RULE_SETUP +#line 441 "scan-gram.l" +{ + complain_at (*loc, _("unrecognized escape sequence: %s"), quote (gram_text)); + STRING_GROW; + } + YY_BREAK + +/*--------------------------------------------. + | Scanning user-code characters and strings. | + `--------------------------------------------*/ + + +case 86: +/* rule 86 can match eol */ +YY_RULE_SETUP +#line 453 "scan-gram.l" +STRING_GROW; + YY_BREAK + + + +case 87: +YY_RULE_SETUP +#line 458 "scan-gram.l" +STRING_GROW; BEGIN context_state; + YY_BREAK +case 88: +/* rule 88 can match eol */ +YY_RULE_SETUP +#line 459 "scan-gram.l" +unexpected_newline (token_start, "'"); BEGIN context_state; + YY_BREAK +case YY_STATE_EOF(SC_CHARACTER): +#line 460 "scan-gram.l" +unexpected_eof (token_start, "'"); BEGIN context_state; + YY_BREAK + + + +case 89: +YY_RULE_SETUP +#line 465 "scan-gram.l" +STRING_GROW; BEGIN context_state; + YY_BREAK +case 90: +/* rule 90 can match eol */ +YY_RULE_SETUP +#line 466 "scan-gram.l" +unexpected_newline (token_start, "\""); BEGIN context_state; + YY_BREAK +case YY_STATE_EOF(SC_STRING): +#line 467 "scan-gram.l" +unexpected_eof (token_start, "\""); BEGIN context_state; + YY_BREAK + +/*---------------------------------------------------. + | Strings, comments etc. can be found in user code. | + `---------------------------------------------------*/ + + +case 91: +YY_RULE_SETUP +#line 477 "scan-gram.l" +{ + STRING_GROW; + context_state = YY_START; + token_start = loc->start; + BEGIN SC_CHARACTER; + } + YY_BREAK +case 92: +YY_RULE_SETUP +#line 483 "scan-gram.l" +{ + STRING_GROW; + context_state = YY_START; + token_start = loc->start; + BEGIN SC_STRING; + } + YY_BREAK +case 93: +/* rule 93 can match eol */ +YY_RULE_SETUP +#line 489 "scan-gram.l" +{ + STRING_GROW; + context_state = YY_START; + token_start = loc->start; + BEGIN SC_COMMENT; + } + YY_BREAK +case 94: +/* rule 94 can match eol */ +YY_RULE_SETUP +#line 495 "scan-gram.l" +{ + STRING_GROW; + context_state = YY_START; + BEGIN SC_LINE_COMMENT; + } + YY_BREAK + +/*-----------------------------------------------------------. + | Scanning some code in braces (actions). The initial "{" is | + | already eaten. | + `-----------------------------------------------------------*/ + + +case 95: +/* rule 95 can match eol */ +YY_RULE_SETUP +#line 511 "scan-gram.l" +STRING_GROW; braces_level++; + YY_BREAK +case 96: +/* rule 96 can match eol */ +YY_RULE_SETUP +#line 512 "scan-gram.l" +STRING_GROW; braces_level--; + YY_BREAK +case 97: +YY_RULE_SETUP +#line 513 "scan-gram.l" +{ + obstack_1grow (&obstack_for_string, '}'); + + --braces_level; + if (braces_level < 0) + { + STRING_FINISH; + loc->start = code_start; + val->code = last_string; + BEGIN INITIAL; + return BRACED_CODE; + } + } + YY_BREAK +/* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly + (as `<' `<%'). */ +case 98: +/* rule 98 can match eol */ +YY_RULE_SETUP +#line 529 "scan-gram.l" +STRING_GROW; + YY_BREAK +case YY_STATE_EOF(SC_BRACED_CODE): +#line 531 "scan-gram.l" +{ + unexpected_eof (code_start, "}"); + STRING_FINISH; + loc->start = code_start; + val->code = last_string; + BEGIN INITIAL; + return BRACED_CODE; + } + YY_BREAK + +/*--------------------------------------------------------------. + | Scanning some prologue: from "%{" (already scanned) to "%}". | + `--------------------------------------------------------------*/ + + +case 99: +YY_RULE_SETUP +#line 548 "scan-gram.l" +{ + STRING_FINISH; + loc->start = code_start; + val->chars = last_string; + BEGIN INITIAL; + return PROLOGUE; + } + YY_BREAK +case YY_STATE_EOF(SC_PROLOGUE): +#line 556 "scan-gram.l" +{ + unexpected_eof (code_start, "%}"); + STRING_FINISH; + loc->start = code_start; + val->chars = last_string; + BEGIN INITIAL; + return PROLOGUE; + } + YY_BREAK + +/*---------------------------------------------------------------. + | Scanning the epilogue (everything after the second "%%", which | + | has already been eaten). | + `---------------------------------------------------------------*/ + + +case YY_STATE_EOF(SC_EPILOGUE): +#line 574 "scan-gram.l" +{ + STRING_FINISH; + loc->start = code_start; + val->chars = last_string; + BEGIN INITIAL; + return EPILOGUE; + } + YY_BREAK + +/*-----------------------------------------------------. + | By default, grow the string obstack with the input. | + `-----------------------------------------------------*/ +case 100: +#line 589 "scan-gram.l" +case 101: +/* rule 101 can match eol */ +YY_RULE_SETUP +#line 589 "scan-gram.l" +STRING_GROW; + YY_BREAK +case 102: +YY_RULE_SETUP +#line 591 "scan-gram.l" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 2214 "scan-gram.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed gram_in at a new source and called + * gram_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = gram_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( gram_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * gram_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of gram_lex */ +/* %ok-for-header */ + +/* %if-c++-only */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +/* %if-c-only */ +static int yy_get_next_buffer (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + gram_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + gram_restart(gram_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gram_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +/* %if-c-only */ +/* %not-for-header */ + + static yy_state_type yy_get_previous_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register yy_state_type yy_current_state; + register char *yy_cp; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { +/* %% [16.0] code to find the next state goes here */ + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 55); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 453 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +/* %if-c-only */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register int yy_is_jam; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 55; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 453 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 452); + + return yy_is_jam ? 0 : yy_current_state; +} + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + gram_restart(gram_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( gram_wrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve gram_text */ + (yy_hold_char) = *++(yy_c_buf_p); + +/* %% [19.0] update BOL and gram_lineno */ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +/* %if-c-only */ +#endif /* ifndef YY_NO_INPUT */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void gram_restart (FILE * input_file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + gram_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gram__create_buffer(gram_in,YY_BUF_SIZE ); + } + + gram__init_buffer(YY_CURRENT_BUFFER,input_file ); + gram__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ + void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * gram_pop_buffer_state(); + * gram_push_buffer_state(new_buffer); + */ + gram_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + gram__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (gram_wrap()) processing, but the only time this flag + * is looked at is after gram_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +/* %if-c-only */ +static void gram__load_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + gram_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE gram__create_buffer (FILE * file, int size ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) gram_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + gram__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with gram__create_buffer() + * + */ +/* %if-c-only */ + void gram__delete_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + gram_free((void *) b->yy_ch_buf ); + + gram_free((void *) b ); +} + +/* %if-c-only */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a gram_restart() or at EOF. + */ +/* %if-c-only */ + static void gram__init_buffer (YY_BUFFER_STATE b, FILE * file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +{ + int oerrno = errno; + + gram__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then gram__init_buffer was _probably_ + * called from gram_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + +/* %if-c-only */ + + b->yy_is_interactive = 0; + +/* %endif */ +/* %if-c++-only */ +/* %endif */ + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ + void gram__flush_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + gram__load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +void gram_push_buffer_state (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (new_buffer == NULL) + return; + + gram_ensure_buffer_stack(); + + /* This block is copied from gram__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from gram__switch_to_buffer. */ + gram__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +void gram_pop_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + gram__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + gram__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +static void gram_ensure_buffer_stack (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)gram_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gram_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)gram_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gram_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gram__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gram__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + gram__switch_to_buffer(b ); + + return b; +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan a string. The next call to gram_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * gram__scan_bytes() instead. + */ +YY_BUFFER_STATE gram__scan_string (yyconst char * yystr ) +{ + + return gram__scan_bytes(yystr,strlen(yystr) ); +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan the given bytes. The next call to gram_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gram__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) gram_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in gram__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = gram__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in gram__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} +/* %endif */ + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +/* %if-c-only */ +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up gram_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + gram_text[gram_leng] = (yy_hold_char); \ + (yy_c_buf_p) = gram_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + gram_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ + +/** Get the current line number. + * + */ +int gram_get_lineno (void) +{ + + return gram_lineno; +} + +/** Get the input stream. + * + */ +FILE *gram_get_in (void) +{ + return gram_in; +} + +/** Get the output stream. + * + */ +FILE *gram_get_out (void) +{ + return gram_out; +} + +/** Get the length of the current token. + * + */ +int gram_get_leng (void) +{ + return gram_leng; +} + +/** Get the current token. + * + */ + +char *gram_get_text (void) +{ + return gram_text; +} + +/* %if-reentrant */ +/* %endif */ + +/** Set the current line number. + * @param line_number + * + */ +void gram_set_lineno (int line_number ) +{ + + gram_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see gram__switch_to_buffer + */ +void gram_set_in (FILE * in_str ) +{ + gram_in = in_str ; +} + +void gram_set_out (FILE * out_str ) +{ + gram_out = out_str ; +} + +int gram_get_debug (void) +{ + return gram__flex_debug; +} + +void gram_set_debug (int bdebug ) +{ + gram__flex_debug = bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif if-c-only */ + +/* %if-c-only */ +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from gram_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + gram_in = stdin; + gram_out = stdout; +#else + gram_in = (FILE *) 0; + gram_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * gram_lex_init() + */ + return 0; +} +/* %endif */ + +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ +/* gram_lex_destroy is for both reentrant and non-reentrant scanners. */ +int gram_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + gram__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + gram_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + gram_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * gram_lex() is called, initialization will occur. */ + yy_init_globals( ); + +/* %if-reentrant */ +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *gram_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *gram_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void gram_free (void * ptr ) +{ + free( (char *) ptr ); /* see gram_realloc() for (char *) cast */ +} + +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + +#line 591 "scan-gram.l" + + + +/* Read bytes from FP into buffer BUF of size SIZE. Return the + number of bytes read. Remove '\r' from input, treating \r\n + and isolated \r as \n. */ + +static size_t +no_cr_read (FILE *fp, char *buf, size_t size) +{ + size_t bytes_read = fread (buf, 1, size, fp); + if (bytes_read) + { + char *w = memchr (buf, '\r', bytes_read); + if (w) + { + char const *r = ++w; + char const *lim = buf + bytes_read; + + for (;;) + { + /* Found an '\r'. Treat it like '\n', but ignore any + '\n' that immediately follows. */ + w[-1] = '\n'; + if (r == lim) + { + int ch = getc (fp); + if (ch != '\n' && ungetc (ch, fp) != ch) + break; + } + else if (*r == '\n') + r++; + + /* Copy until the next '\r'. */ + do + { + if (r == lim) + return w - buf; + } + while ((*w++ = *r++) != '\r'); + } + + return w - buf; + } + } + + return bytes_read; +} + + + +/*------------------------------------------------------. +| Scan NUMBER for a base-BASE integer at location LOC. | +`------------------------------------------------------*/ + +static unsigned long int +scan_integer (char const *number, int base, location loc) +{ + verify (INT_MAX < ULONG_MAX); + unsigned long int num = strtoul (number, NULL, base); + + if (INT_MAX < num) + { + complain_at (loc, _("integer out of range: %s"), quote (number)); + num = INT_MAX; + } + + return num; +} + + +/*------------------------------------------------------------------. +| Convert universal character name UCN to a single-byte character, | +| and return that character. Return -1 if UCN does not correspond | +| to a single-byte character. | +`------------------------------------------------------------------*/ + +static int +convert_ucn_to_byte (char const *ucn) +{ + verify (UCHAR_MAX <= INT_MAX); + unsigned long int code = strtoul (ucn + 2, NULL, 16); + + /* FIXME: Currently we assume Unicode-compatible unibyte characters + on ASCII hosts (i.e., Latin-1 on hosts with 8-bit bytes). On + non-ASCII hosts we support only the portable C character set. + These limitations should be removed once we add support for + multibyte characters. */ + + if (UCHAR_MAX < code) + return -1; + +#if ! ('$' == 0x24 && '@' == 0x40 && '`' == 0x60 && '~' == 0x7e) + { + /* A non-ASCII host. Use CODE to index into a table of the C + basic execution character set, which is guaranteed to exist on + all Standard C platforms. This table also includes '$', '@', + and '`', which are not in the basic execution character set but + which are unibyte characters on all the platforms that we know + about. */ + static signed char const table[] = + { + '\0', -1, -1, -1, -1, -1, -1, '\a', + '\b', '\t', '\n', '\v', '\f', '\r', -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~' + }; + + code = code < sizeof table ? table[code] : -1; + } +#endif + + return code; +} + + +/*----------------------------------------------------------------. +| Handle `#line INT "FILE"'. ARGS has already skipped `#line '. | +`----------------------------------------------------------------*/ + +static void +handle_syncline (char *args, location loc) +{ + char *after_num; + unsigned long int lineno = strtoul (args, &after_num, 10); + char *file = strchr (after_num, '"') + 1; + *strchr (file, '"') = '\0'; + if (INT_MAX <= lineno) + { + warn_at (loc, _("line number overflow")); + lineno = INT_MAX; + } + current_file = uniqstr_new (file); + boundary_set (&scanner_cursor, current_file, lineno, 1); +} + + +/*----------------------------------------------------------------. +| For a token or comment starting at START, report message MSGID, | +| which should say that an end marker was found before | +| the expected TOKEN_END. | +`----------------------------------------------------------------*/ + +static void +unexpected_end (boundary start, char const *msgid, char const *token_end) +{ + location loc; + loc.start = start; + loc.end = scanner_cursor; + complain_at (loc, _(msgid), token_end); +} + + +/*------------------------------------------------------------------------. +| Report an unexpected EOF in a token or comment starting at START. | +| An end of file was encountered and the expected TOKEN_END was missing. | +`------------------------------------------------------------------------*/ + +static void +unexpected_eof (boundary start, char const *token_end) +{ + unexpected_end (start, N_("missing `%s' at end of file"), token_end); +} + + +/*----------------------------------------. +| Likewise, but for unexpected newlines. | +`----------------------------------------*/ + +static void +unexpected_newline (boundary start, char const *token_end) +{ + unexpected_end (start, N_("missing `%s' at end of line"), token_end); +} + + +/*-------------------------. +| Initialize the scanner. | +`-------------------------*/ + +void +gram_scanner_initialize (void) +{ + obstack_init (&obstack_for_string); +} + + +/*-----------------------------------------------. +| Free all the memory allocated to the scanner. | +`-----------------------------------------------*/ + +void +gram_scanner_free (void) +{ + obstack_free (&obstack_for_string, 0); + /* Reclaim Flex's buffers. */ + gram_lex_destroy (); +} + diff --git a/src/scan-gram.h b/src/scan-gram.h new file mode 100644 index 0000000..b7983f1 --- /dev/null +++ b/src/scan-gram.h @@ -0,0 +1,38 @@ +/* Bison Grammar Scanner + + Copyright (C) 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef SCAN_GRAM_H_ +# define SCAN_GRAM_H_ + +/* From the scanner. */ +extern FILE *gram_in; +extern int gram__flex_debug; +void gram_scanner_initialize (void); +void gram_scanner_free (void); +void gram_scanner_last_string_free (void); + +/* These are declared by the scanner, but not used. We put them here + to pacify "make syntax-check". */ +extern FILE *gram_out; +extern int gram_lineno; + +# define GRAM_LEX_DECL int gram_lex (YYSTYPE *val, location *loc) +GRAM_LEX_DECL; + +#endif /* !SCAN_GRAM_H_ */ diff --git a/src/scan-gram.l b/src/scan-gram.l new file mode 100644 index 0000000..697f52f --- /dev/null +++ b/src/scan-gram.l @@ -0,0 +1,799 @@ +/* Bison Grammar Scanner -*- C -*- + + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, + Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +%option debug nodefault nounput noyywrap never-interactive +%option prefix="gram_" outfile="lex.yy.c" + +%{ +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef gram_wrap +#define gram_wrap() 1 + +#define FLEX_PREFIX(Id) gram_ ## Id +#include "flex-scanner.h" + +#include "complain.h" +#include "files.h" +#include "gram.h" +#include "quotearg.h" +#include "reader.h" +#include "uniqstr.h" + +#include +#include + +#include "scan-gram.h" + +#define YY_DECL GRAM_LEX_DECL + +#define YY_USER_INIT \ + code_start = scanner_cursor = loc->start; \ + +/* Location of scanner cursor. */ +static boundary scanner_cursor; + +#define YY_USER_ACTION location_compute (loc, &scanner_cursor, yytext, yyleng); + +static size_t no_cr_read (FILE *, char *, size_t); +#define YY_INPUT(buf, result, size) ((result) = no_cr_read (yyin, buf, size)) + +/* A string representing the most recently saved token. */ +static char *last_string; + +void +gram_scanner_last_string_free (void) +{ + STRING_FREE; +} + +static void handle_syncline (char *, location); +static unsigned long int scan_integer (char const *p, int base, location loc); +static int convert_ucn_to_byte (char const *hex_text); +static void unexpected_eof (boundary, char const *); +static void unexpected_newline (boundary, char const *); + +%} + /* A C-like comment in directives/rules. */ +%x SC_YACC_COMMENT + /* Strings and characters in directives/rules. */ +%x SC_ESCAPED_STRING SC_ESCAPED_CHARACTER + /* A identifier was just read in directives/rules. Special state + to capture the sequence `identifier :'. */ +%x SC_AFTER_IDENTIFIER + + /* Three types of user code: + - prologue (code between `%{' `%}' in the first section, before %%); + - actions, printers, union, etc, (between braced in the middle section); + - epilogue (everything after the second %%). */ +%x SC_PROLOGUE SC_BRACED_CODE SC_EPILOGUE + /* C and C++ comments in code. */ +%x SC_COMMENT SC_LINE_COMMENT + /* Strings and characters in code. */ +%x SC_STRING SC_CHARACTER + +letter [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_] +id {letter}({letter}|[0-9])* +directive %{letter}({letter}|[0-9]|-)* +int [0-9]+ + +/* POSIX says that a tag must be both an id and a C union member, but + historically almost any character is allowed in a tag. We disallow + NUL and newline, as this simplifies our implementation. */ +tag [^\0\n>]+ + +/* Zero or more instances of backslash-newline. Following GCC, allow + white space between the backslash and the newline. */ +splice (\\[ \f\t\v]*\n)* + +%% +%{ + /* Nesting level of the current code in braces. */ + int braces_level IF_LINT (= 0); + + /* Parent context state, when applicable. */ + int context_state IF_LINT (= 0); + + /* Location of most recent identifier, when applicable. */ + location id_loc IF_LINT (= empty_location); + + /* Where containing code started, when applicable. Its initial + value is relevant only when yylex is invoked in the SC_EPILOGUE + start condition. */ + boundary code_start = scanner_cursor; + + /* Where containing comment or string or character literal started, + when applicable. */ + boundary token_start IF_LINT (= scanner_cursor); +%} + + + /*-----------------------. + | Scanning white space. | + `-----------------------*/ + + +{ + /* Comments and white space. */ + "," warn_at (*loc, _("stray `,' treated as white space")); + [ \f\n\t\v] | + "//".* ; + "/*" { + token_start = loc->start; + context_state = YY_START; + BEGIN SC_YACC_COMMENT; + } + + /* #line directives are not documented, and may be withdrawn or + modified in future versions of Bison. */ + ^"#line "{int}" \"".*"\"\n" { + handle_syncline (yytext + sizeof "#line " - 1, *loc); + } +} + + + /*----------------------------. + | Scanning Bison directives. | + `----------------------------*/ + +{ + "%binary" return PERCENT_NONASSOC; + "%code" return PERCENT_CODE; + "%debug" return PERCENT_DEBUG; + "%default"[-_]"prec" return PERCENT_DEFAULT_PREC; + "%define" return PERCENT_DEFINE; + "%defines" return PERCENT_DEFINES; + "%destructor" return PERCENT_DESTRUCTOR; + "%dprec" return PERCENT_DPREC; + "%error"[-_]"verbose" return PERCENT_ERROR_VERBOSE; + "%expect" return PERCENT_EXPECT; + "%expect"[-_]"rr" return PERCENT_EXPECT_RR; + "%file-prefix" return PERCENT_FILE_PREFIX; + "%fixed"[-_]"output"[-_]"files" return PERCENT_YACC; + "%initial-action" return PERCENT_INITIAL_ACTION; + "%glr-parser" return PERCENT_GLR_PARSER; + "%language" return PERCENT_LANGUAGE; + "%left" return PERCENT_LEFT; + "%lex-param" return PERCENT_LEX_PARAM; + "%locations" return PERCENT_LOCATIONS; + "%merge" return PERCENT_MERGE; + "%name"[-_]"prefix" return PERCENT_NAME_PREFIX; + "%no"[-_]"default"[-_]"prec" return PERCENT_NO_DEFAULT_PREC; + "%no"[-_]"lines" return PERCENT_NO_LINES; + "%nonassoc" return PERCENT_NONASSOC; + "%nondeterministic-parser" return PERCENT_NONDETERMINISTIC_PARSER; + "%nterm" return PERCENT_NTERM; + "%output" return PERCENT_OUTPUT; + "%parse-param" return PERCENT_PARSE_PARAM; + "%prec" return PERCENT_PREC; + "%printer" return PERCENT_PRINTER; + "%pure"[-_]"parser" return PERCENT_PURE_PARSER; + "%require" return PERCENT_REQUIRE; + "%right" return PERCENT_RIGHT; + "%skeleton" return PERCENT_SKELETON; + "%start" return PERCENT_START; + "%term" return PERCENT_TOKEN; + "%token" return PERCENT_TOKEN; + "%token"[-_]"table" return PERCENT_TOKEN_TABLE; + "%type" return PERCENT_TYPE; + "%union" return PERCENT_UNION; + "%verbose" return PERCENT_VERBOSE; + "%yacc" return PERCENT_YACC; + + {directive} { + complain_at (*loc, _("invalid directive: %s"), quote (yytext)); + } + + "=" return EQUAL; + "|" return PIPE; + ";" return SEMICOLON; + "<*>" return TYPE_TAG_ANY; + "<>" return TYPE_TAG_NONE; + + {id} { + val->uniqstr = uniqstr_new (yytext); + id_loc = *loc; + BEGIN SC_AFTER_IDENTIFIER; + } + + {int} { + val->integer = scan_integer (yytext, 10, *loc); + return INT; + } + 0[xX][0-9abcdefABCDEF]+ { + val->integer = scan_integer (yytext, 16, *loc); + return INT; + } + + /* Characters. We don't check there is only one. */ + "'" STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; + + /* Strings. */ + "\"" token_start = loc->start; BEGIN SC_ESCAPED_STRING; + + /* Prologue. */ + "%{" code_start = loc->start; BEGIN SC_PROLOGUE; + + /* Code in between braces. */ + "{" { + STRING_GROW; + braces_level = 0; + code_start = loc->start; + BEGIN SC_BRACED_CODE; + } + + /* A type. */ + "<"{tag}">" { + obstack_grow (&obstack_for_string, yytext + 1, yyleng - 2); + STRING_FINISH; + val->uniqstr = uniqstr_new (last_string); + STRING_FREE; + return TYPE; + } + + "%%" { + static int percent_percent_count; + if (++percent_percent_count == 2) + BEGIN SC_EPILOGUE; + return PERCENT_PERCENT; + } + + . { + complain_at (*loc, _("invalid character: %s"), quote (yytext)); + } + + <> { + loc->start = loc->end = scanner_cursor; + yyterminate (); + } +} + + + /*-----------------------------------------------------------------. + | Scanning after an identifier, checking whether a colon is next. | + `-----------------------------------------------------------------*/ + + +{ + ":" { + *loc = id_loc; + BEGIN INITIAL; + return ID_COLON; + } + . { + scanner_cursor.column -= mbsnwidth (yytext, yyleng, 0); + yyless (0); + *loc = id_loc; + BEGIN INITIAL; + return ID; + } + <> { + *loc = id_loc; + BEGIN INITIAL; + return ID; + } +} + + + /*---------------------------------------------------------------. + | Scanning a Yacc comment. The initial `/ *' is already eaten. | + `---------------------------------------------------------------*/ + + +{ + "*/" BEGIN context_state; + .|\n ; + <> unexpected_eof (token_start, "*/"); BEGIN context_state; +} + + + /*------------------------------------------------------------. + | Scanning a C comment. The initial `/ *' is already eaten. | + `------------------------------------------------------------*/ + + +{ + "*"{splice}"/" STRING_GROW; BEGIN context_state; + <> unexpected_eof (token_start, "*/"); BEGIN context_state; +} + + + /*--------------------------------------------------------------. + | Scanning a line comment. The initial `//' is already eaten. | + `--------------------------------------------------------------*/ + + +{ + "\n" STRING_GROW; BEGIN context_state; + {splice} STRING_GROW; + <> BEGIN context_state; +} + + + /*------------------------------------------------. + | Scanning a Bison string, including its escapes. | + | The initial quote is already eaten. | + `------------------------------------------------*/ + + +{ + "\""|"\n" { + if (yytext[0] == '\n') + unexpected_newline (token_start, "\""); + STRING_FINISH; + loc->start = token_start; + val->chars = last_string; + BEGIN INITIAL; + return STRING; + } + <> { + unexpected_eof (token_start, "\""); + STRING_FINISH; + loc->start = token_start; + val->chars = last_string; + BEGIN INITIAL; + return STRING; + } +} + + /*----------------------------------------------------------. + | Scanning a Bison character literal, decoding its escapes. | + | The initial quote is already eaten. | + `----------------------------------------------------------*/ + + +{ + "'"|"\n" { + if (yytext[0] == '\n') + unexpected_newline (token_start, "'"); + STRING_GROW; + STRING_FINISH; + loc->start = token_start; + val->character = last_string[1]; + STRING_FREE; + BEGIN INITIAL; + return CHAR; + } + <> { + unexpected_eof (token_start, "'"); + STRING_FINISH; + loc->start = token_start; + if (strlen(last_string) > 1) + val->character = last_string[1]; + else + val->character = last_string[0]; + STRING_FREE; + BEGIN INITIAL; + return CHAR; + } +} + + +{ + \0 complain_at (*loc, _("invalid null character")); +} + + + /*----------------------------. + | Decode escaped characters. | + `----------------------------*/ + + +{ + \\[0-7]{1,3} { + unsigned long int c = strtoul (yytext + 1, NULL, 8); + if (UCHAR_MAX < c) + complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext)); + else if (! c) + complain_at (*loc, _("invalid null character: %s"), quote (yytext)); + else + obstack_1grow (&obstack_for_string, c); + } + + \\x[0-9abcdefABCDEF]+ { + verify (UCHAR_MAX < ULONG_MAX); + unsigned long int c = strtoul (yytext + 2, NULL, 16); + if (UCHAR_MAX < c) + complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext)); + else if (! c) + complain_at (*loc, _("invalid null character: %s"), quote (yytext)); + else + obstack_1grow (&obstack_for_string, c); + } + + \\a obstack_1grow (&obstack_for_string, '\a'); + \\b obstack_1grow (&obstack_for_string, '\b'); + \\f obstack_1grow (&obstack_for_string, '\f'); + \\n obstack_1grow (&obstack_for_string, '\n'); + \\r obstack_1grow (&obstack_for_string, '\r'); + \\t obstack_1grow (&obstack_for_string, '\t'); + \\v obstack_1grow (&obstack_for_string, '\v'); + + /* \\[\"\'?\\] would be shorter, but it confuses xgettext. */ + \\("\""|"'"|"?"|"\\") obstack_1grow (&obstack_for_string, yytext[1]); + + \\(u|U[0-9abcdefABCDEF]{4})[0-9abcdefABCDEF]{4} { + int c = convert_ucn_to_byte (yytext); + if (c < 0) + complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext)); + else if (! c) + complain_at (*loc, _("invalid null character: %s"), quote (yytext)); + else + obstack_1grow (&obstack_for_string, c); + } + \\(.|\n) { + complain_at (*loc, _("unrecognized escape sequence: %s"), quote (yytext)); + STRING_GROW; + } +} + + /*--------------------------------------------. + | Scanning user-code characters and strings. | + `--------------------------------------------*/ + + +{ + {splice}|\\{splice}[^\n\[\]] STRING_GROW; +} + + +{ + "'" STRING_GROW; BEGIN context_state; + \n unexpected_newline (token_start, "'"); BEGIN context_state; + <> unexpected_eof (token_start, "'"); BEGIN context_state; +} + + +{ + "\"" STRING_GROW; BEGIN context_state; + \n unexpected_newline (token_start, "\""); BEGIN context_state; + <> unexpected_eof (token_start, "\""); BEGIN context_state; +} + + + /*---------------------------------------------------. + | Strings, comments etc. can be found in user code. | + `---------------------------------------------------*/ + + +{ + "'" { + STRING_GROW; + context_state = YY_START; + token_start = loc->start; + BEGIN SC_CHARACTER; + } + "\"" { + STRING_GROW; + context_state = YY_START; + token_start = loc->start; + BEGIN SC_STRING; + } + "/"{splice}"*" { + STRING_GROW; + context_state = YY_START; + token_start = loc->start; + BEGIN SC_COMMENT; + } + "/"{splice}"/" { + STRING_GROW; + context_state = YY_START; + BEGIN SC_LINE_COMMENT; + } +} + + + + /*-----------------------------------------------------------. + | Scanning some code in braces (actions). The initial "{" is | + | already eaten. | + `-----------------------------------------------------------*/ + + +{ + "{"|"<"{splice}"%" STRING_GROW; braces_level++; + "%"{splice}">" STRING_GROW; braces_level--; + "}" { + obstack_1grow (&obstack_for_string, '}'); + + --braces_level; + if (braces_level < 0) + { + STRING_FINISH; + loc->start = code_start; + val->code = last_string; + BEGIN INITIAL; + return BRACED_CODE; + } + } + + /* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly + (as `<' `<%'). */ + "<"{splice}"<" STRING_GROW; + + <> { + unexpected_eof (code_start, "}"); + STRING_FINISH; + loc->start = code_start; + val->code = last_string; + BEGIN INITIAL; + return BRACED_CODE; + } +} + + + /*--------------------------------------------------------------. + | Scanning some prologue: from "%{" (already scanned) to "%}". | + `--------------------------------------------------------------*/ + + +{ + "%}" { + STRING_FINISH; + loc->start = code_start; + val->chars = last_string; + BEGIN INITIAL; + return PROLOGUE; + } + + <> { + unexpected_eof (code_start, "%}"); + STRING_FINISH; + loc->start = code_start; + val->chars = last_string; + BEGIN INITIAL; + return PROLOGUE; + } +} + + + /*---------------------------------------------------------------. + | Scanning the epilogue (everything after the second "%%", which | + | has already been eaten). | + `---------------------------------------------------------------*/ + + +{ + <> { + STRING_FINISH; + loc->start = code_start; + val->chars = last_string; + BEGIN INITIAL; + return EPILOGUE; + } +} + + + /*-----------------------------------------------------. + | By default, grow the string obstack with the input. | + `-----------------------------------------------------*/ + +. | +\n STRING_GROW; + +%% + +/* Read bytes from FP into buffer BUF of size SIZE. Return the + number of bytes read. Remove '\r' from input, treating \r\n + and isolated \r as \n. */ + +static size_t +no_cr_read (FILE *fp, char *buf, size_t size) +{ + size_t bytes_read = fread (buf, 1, size, fp); + if (bytes_read) + { + char *w = memchr (buf, '\r', bytes_read); + if (w) + { + char const *r = ++w; + char const *lim = buf + bytes_read; + + for (;;) + { + /* Found an '\r'. Treat it like '\n', but ignore any + '\n' that immediately follows. */ + w[-1] = '\n'; + if (r == lim) + { + int ch = getc (fp); + if (ch != '\n' && ungetc (ch, fp) != ch) + break; + } + else if (*r == '\n') + r++; + + /* Copy until the next '\r'. */ + do + { + if (r == lim) + return w - buf; + } + while ((*w++ = *r++) != '\r'); + } + + return w - buf; + } + } + + return bytes_read; +} + + + +/*------------------------------------------------------. +| Scan NUMBER for a base-BASE integer at location LOC. | +`------------------------------------------------------*/ + +static unsigned long int +scan_integer (char const *number, int base, location loc) +{ + verify (INT_MAX < ULONG_MAX); + unsigned long int num = strtoul (number, NULL, base); + + if (INT_MAX < num) + { + complain_at (loc, _("integer out of range: %s"), quote (number)); + num = INT_MAX; + } + + return num; +} + + +/*------------------------------------------------------------------. +| Convert universal character name UCN to a single-byte character, | +| and return that character. Return -1 if UCN does not correspond | +| to a single-byte character. | +`------------------------------------------------------------------*/ + +static int +convert_ucn_to_byte (char const *ucn) +{ + verify (UCHAR_MAX <= INT_MAX); + unsigned long int code = strtoul (ucn + 2, NULL, 16); + + /* FIXME: Currently we assume Unicode-compatible unibyte characters + on ASCII hosts (i.e., Latin-1 on hosts with 8-bit bytes). On + non-ASCII hosts we support only the portable C character set. + These limitations should be removed once we add support for + multibyte characters. */ + + if (UCHAR_MAX < code) + return -1; + +#if ! ('$' == 0x24 && '@' == 0x40 && '`' == 0x60 && '~' == 0x7e) + { + /* A non-ASCII host. Use CODE to index into a table of the C + basic execution character set, which is guaranteed to exist on + all Standard C platforms. This table also includes '$', '@', + and '`', which are not in the basic execution character set but + which are unibyte characters on all the platforms that we know + about. */ + static signed char const table[] = + { + '\0', -1, -1, -1, -1, -1, -1, '\a', + '\b', '\t', '\n', '\v', '\f', '\r', -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~' + }; + + code = code < sizeof table ? table[code] : -1; + } +#endif + + return code; +} + + +/*----------------------------------------------------------------. +| Handle `#line INT "FILE"'. ARGS has already skipped `#line '. | +`----------------------------------------------------------------*/ + +static void +handle_syncline (char *args, location loc) +{ + char *after_num; + unsigned long int lineno = strtoul (args, &after_num, 10); + char *file = strchr (after_num, '"') + 1; + *strchr (file, '"') = '\0'; + if (INT_MAX <= lineno) + { + warn_at (loc, _("line number overflow")); + lineno = INT_MAX; + } + current_file = uniqstr_new (file); + boundary_set (&scanner_cursor, current_file, lineno, 1); +} + + +/*----------------------------------------------------------------. +| For a token or comment starting at START, report message MSGID, | +| which should say that an end marker was found before | +| the expected TOKEN_END. | +`----------------------------------------------------------------*/ + +static void +unexpected_end (boundary start, char const *msgid, char const *token_end) +{ + location loc; + loc.start = start; + loc.end = scanner_cursor; + complain_at (loc, _(msgid), token_end); +} + + +/*------------------------------------------------------------------------. +| Report an unexpected EOF in a token or comment starting at START. | +| An end of file was encountered and the expected TOKEN_END was missing. | +`------------------------------------------------------------------------*/ + +static void +unexpected_eof (boundary start, char const *token_end) +{ + unexpected_end (start, N_("missing `%s' at end of file"), token_end); +} + + +/*----------------------------------------. +| Likewise, but for unexpected newlines. | +`----------------------------------------*/ + +static void +unexpected_newline (boundary start, char const *token_end) +{ + unexpected_end (start, N_("missing `%s' at end of line"), token_end); +} + + +/*-------------------------. +| Initialize the scanner. | +`-------------------------*/ + +void +gram_scanner_initialize (void) +{ + obstack_init (&obstack_for_string); +} + + +/*-----------------------------------------------. +| Free all the memory allocated to the scanner. | +`-----------------------------------------------*/ + +void +gram_scanner_free (void) +{ + obstack_free (&obstack_for_string, 0); + /* Reclaim Flex's buffers. */ + yylex_destroy (); +} diff --git a/src/scan-skel-c.c b/src/scan-skel-c.c new file mode 100644 index 0000000..fb1aea6 --- /dev/null +++ b/src/scan-skel-c.c @@ -0,0 +1,3 @@ +#include +#include "system.h" +#include "scan-skel.c" diff --git a/src/scan-skel.c b/src/scan-skel.c new file mode 100644 index 0000000..c345a2e --- /dev/null +++ b/src/scan-skel.c @@ -0,0 +1,2438 @@ +#line 2 "scan-skel.c" + +#line 4 "scan-skel.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +/* %not-for-header */ + +/* %if-c-only */ +/* %if-not-reentrant */ +#define yy_create_buffer skel__create_buffer +#define yy_delete_buffer skel__delete_buffer +#define yy_flex_debug skel__flex_debug +#define yy_init_buffer skel__init_buffer +#define yy_flush_buffer skel__flush_buffer +#define yy_load_buffer_state skel__load_buffer_state +#define yy_switch_to_buffer skel__switch_to_buffer +#define yyin skel_in +#define yyleng skel_leng +#define yylex skel_lex +#define yylineno skel_lineno +#define yyout skel_out +#define yyrestart skel_restart +#define yytext skel_text +#define yywrap skel_wrap +#define yyalloc skel_alloc +#define yyrealloc skel_realloc +#define yyfree skel_free + +/* %endif */ +/* %endif */ +/* %ok-for-header */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ +#include +#include +#include +#include +/* %endif */ + +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* %not-for-header */ + +/* Returned upon end-of-file. */ +#define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE skel_restart(skel_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +/* %if-not-reentrant */ +extern int skel_leng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +extern FILE *skel_in, *skel_out; +/* %endif */ +/* %endif */ + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up skel_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up skel_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { +/* %if-c-only */ + FILE *yy_input_file; +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via skel_restart()), so that the user can continue scanning by + * just pointing skel_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %if-not-reentrant */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ + +/* yy_hold_char holds the character lost when skel_text is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int skel_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow skel_wrap()'s to do buffer switches + * instead of setting up a fresh skel_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; +/* %ok-for-header */ + +/* %endif */ + +void skel_restart (FILE *input_file ); +void skel__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE skel__create_buffer (FILE *file,int size ); +void skel__delete_buffer (YY_BUFFER_STATE b ); +void skel__flush_buffer (YY_BUFFER_STATE b ); +void skel_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void skel_pop_buffer_state (void ); + +static void skel_ensure_buffer_stack (void ); +static void skel__load_buffer_state (void ); +static void skel__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER skel__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE skel__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE skel__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE skel__scan_bytes (yyconst char *bytes,int len ); + +/* %endif */ + +void *skel_alloc (yy_size_t ); +void *skel_realloc (void *,yy_size_t ); +void skel_free (void * ); + +#define yy_new_buffer skel__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + skel_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + skel__create_buffer(skel_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + skel_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + skel__create_buffer(skel_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* %% [1.0] skel_text/skel_in/skel_out/yy_state_type/skel_lineno etc. def's & init go here */ +/* Begin user sect3 */ + +#define skel_wrap(n) 1 +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG + +typedef unsigned char YY_CHAR; + +FILE *skel_in = (FILE *) 0, *skel_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int skel_lineno; + +int skel_lineno = 1; + +extern char *skel_text; +#define yytext_ptr skel_text + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* %endif */ + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up skel_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle skel_text and skel_leng for yymore() goes here \ */\ + skel_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to skel_text[] goes here, if %array \ */\ + (yy_c_buf_p) = yy_cp; + +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ +#define YY_NUM_RULES 23 +#define YY_END_OF_BUFFER 24 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[56] = + { 0, + 0, 0, 0, 0, 0, 0, 24, 12, 11, 10, + 13, 20, 22, 21, 21, 12, 10, 5, 1, 10, + 4, 10, 10, 2, 3, 13, 20, 18, 19, 14, + 17, 15, 16, 9, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 7, 6, 10, + 10, 10, 10, 8, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 4, + 5, 1, 1, 5, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 7, 8, 9, 9, 9, 10, + + 11, 12, 9, 9, 13, 9, 9, 14, 9, 15, + 16, 17, 9, 18, 9, 9, 9, 9, 9, 19, + 9, 9, 20, 1, 21, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[22] = + { 0, + 1, 1, 2, 3, 1, 4, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 3 + } ; + +static yyconst flex_int16_t yy_base[63] = + { 0, + 0, 1, 60, 58, 6, 8, 63, 0, 93, 11, + 0, 30, 93, 93, 93, 0, 0, 93, 93, 49, + 93, 49, 25, 93, 93, 0, 93, 93, 93, 93, + 93, 93, 93, 93, 43, 47, 45, 49, 40, 34, + 31, 36, 35, 27, 38, 37, 31, 93, 93, 29, + 27, 15, 9, 93, 93, 70, 74, 78, 82, 85, + 88, 0 + } ; + +static yyconst flex_int16_t yy_def[63] = + { 0, + 56, 56, 57, 57, 58, 58, 55, 59, 55, 55, + 60, 61, 55, 55, 55, 59, 62, 55, 55, 10, + 55, 20, 20, 55, 55, 60, 55, 55, 55, 55, + 55, 55, 55, 55, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 55, 55, 20, + 20, 20, 20, 55, 0, 55, 55, 55, 55, 55, + 55, 55 + } ; + +static yyconst flex_int16_t yy_nxt[115] = + { 0, + 17, 55, 9, 9, 55, 10, 10, 14, 15, 14, + 15, 17, 17, 18, 54, 17, 19, 20, 21, 20, + 22, 20, 20, 20, 20, 20, 23, 20, 20, 20, + 24, 25, 28, 53, 29, 30, 36, 31, 37, 52, + 51, 50, 49, 48, 47, 46, 45, 44, 43, 32, + 33, 55, 34, 42, 55, 41, 55, 40, 20, 39, + 38, 35, 55, 12, 20, 12, 55, 55, 55, 55, + 8, 8, 8, 8, 11, 11, 11, 11, 13, 13, + 13, 13, 16, 55, 16, 26, 26, 26, 27, 27, + 27, 27, 7, 55, 55, 55, 55, 55, 55, 55, + + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55 + } ; + +static yyconst flex_int16_t yy_chk[115] = + { 0, + 62, 0, 1, 2, 0, 1, 2, 5, 5, 6, + 6, 10, 10, 10, 53, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 12, 52, 12, 12, 23, 12, 23, 51, + 50, 47, 46, 45, 44, 43, 42, 41, 40, 12, + 12, 20, 20, 39, 20, 38, 20, 37, 20, 36, + 35, 22, 7, 4, 20, 3, 0, 0, 20, 20, + 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, + 58, 58, 59, 0, 59, 60, 60, 60, 61, 61, + 61, 61, 55, 55, 55, 55, 55, 55, 55, 55, + + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int skel__flex_debug; +int skel__flex_debug = 1; + +static yyconst flex_int16_t yy_rule_linenum[23] = + { 0, + 73, 74, 75, 76, 77, 79, 80, 81, 83, 92, + 93, 94, 106, 108, 109, 110, 111, 113, 115, 136, + 140, 141 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *skel_text; +#line 1 "scan-skel.l" +/* Scan Bison Skeletons. -*- C -*- + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ +#line 25 "scan-skel.l" +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef skel_wrap +#define skel_wrap() 1 + +#define FLEX_PREFIX(Id) skel_ ## Id +#include "flex-scanner.h" + +#include +#include +#include + +#include "complain.h" +#include "getargs.h" +#include "files.h" +#include "scan-skel.h" + +#define YY_DECL static int skel_lex (void) +YY_DECL; + +#define QPUTS(String) \ + fputs (quotearg_style (c_quoting_style, String), skel_out) + +static void at_directive_perform (int at_directive_argc, + char *at_directive_argv[], + char **outnamep, int *out_linenop); +static void fail_for_at_directive_too_many_args (char const *at_directive_name); +static void fail_for_at_directive_too_few_args (char const *at_directive_name); +static void fail_for_invalid_at (char const *at); + + +#line 655 "scan-skel.c" + +#define INITIAL 0 +#define SC_AT_DIRECTIVE_ARGS 1 +#define SC_AT_DIRECTIVE_SKIP_WS 2 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +#include +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-c-only */ + +static int yy_init_globals (void ); + +/* %endif */ +/* %if-reentrant */ +/* %endif */ +/* %endif End reentrant structures and macros. */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int skel_lex_destroy (void ); + +int skel_get_debug (void ); + +void skel_set_debug (int debug_flag ); + +YY_EXTRA_TYPE skel_get_extra (void ); + +void skel_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *skel_get_in (void ); + +void skel_set_in (FILE * in_str ); + +FILE *skel_get_out (void ); + +void skel_set_out (FILE * out_str ); + +int skel_get_leng (void ); + +char *skel_get_text (void ); + +int skel_get_lineno (void ); + +void skel_set_lineno (int line_number ); + +/* %if-bison-bridge */ +/* %endif */ + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int skel_wrap (void ); +#else +extern int skel_wrap (void ); +#endif +#endif + +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif +/* %ok-for-header */ + +/* %endif */ +#endif + +/* %if-c-only */ + +/* %endif */ + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( skel_text, skel_leng, 1, skel_out ) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( skel_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( skel_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, skel_in))==0 && ferror(skel_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(skel_in); \ + } \ + }\ +\ +/* %if-c++-only C++ definition \ */\ +/* %endif */ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +/* %if-c-only */ +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %not-for-header */ + +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ + +extern int skel_lex (void); + +#define YY_DECL int skel_lex (void) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after skel_text and skel_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +/* %% [6.0] YY_RULE_SETUP definition goes here */ +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/* %not-for-header */ + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +/* %% [7.0] user's declarations go here */ +#line 59 "scan-skel.l" + + + + int out_lineno IF_LINT (= 0); + char *outname = NULL; + + /* Currently, only the @warn, @complain, @fatal, @warn_at, @complain_at, and + @fatal_at directives take multiple arguments, and the last three already + can't take more than 7. at_directive_argv[0] is the directive name. */ + #define AT_DIRECTIVE_ARGC_MAX 8 + int at_directive_argc = 0; + char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX]; + + +#line 912 "scan-skel.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! skel_in ) +/* %if-c-only */ + skel_in = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! skel_out ) +/* %if-c-only */ + skel_out = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! YY_CURRENT_BUFFER ) { + skel_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + skel__create_buffer(skel_in,YY_BUF_SIZE ); + } + + skel__load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); + + /* Support of skel_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 56 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 55 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: +/* %% [10.0] code to find the action number goes here */ + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +/* %% [11.0] code for skel_lineno update goes here */ + +do_action: /* This label is used only to access EOF actions. */ + +/* %% [12.0] debug code goes here */ + if ( skel__flex_debug ) + { + if ( yy_act == 0 ) + fprintf( stderr, "--scanner backing up\n" ); + else if ( yy_act < 23 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], skel_text ); + else if ( yy_act == 23 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + skel_text ); + else if ( yy_act == 24 ) + fprintf( stderr, "--(end of buffer or a NUL)\n" ); + else + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + } + + switch ( yy_act ) + { /* beginning of action switch */ +/* %% [13.0] actions go here */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 73 "scan-skel.l" +fputc ('@', skel_out); + YY_BREAK +case 2: +YY_RULE_SETUP +#line 74 "scan-skel.l" +fputc ('[', skel_out); + YY_BREAK +case 3: +YY_RULE_SETUP +#line 75 "scan-skel.l" +fputc (']', skel_out); + YY_BREAK +case 4: +YY_RULE_SETUP +#line 76 "scan-skel.l" +/* Emtpy. Used by b4_cat in ../data/bison.m4. */ + YY_BREAK +case 5: +/* rule 5 can match eol */ +YY_RULE_SETUP +#line 77 "scan-skel.l" +/* Likewise. */ + YY_BREAK +case 6: +YY_RULE_SETUP +#line 79 "scan-skel.l" +fprintf (skel_out, "%d", out_lineno + 1); + YY_BREAK +case 7: +YY_RULE_SETUP +#line 80 "scan-skel.l" +QPUTS (outname); + YY_BREAK +case 8: +YY_RULE_SETUP +#line 81 "scan-skel.l" +QPUTS (dir_prefix); + YY_BREAK +case 9: +YY_RULE_SETUP +#line 83 "scan-skel.l" +{ + skel_text[skel_leng-1] = '\0'; + obstack_grow (&obstack_for_string, skel_text, skel_leng); + at_directive_argv[at_directive_argc++] = + obstack_finish (&obstack_for_string); + BEGIN SC_AT_DIRECTIVE_ARGS; +} + YY_BREAK +/* This pattern must not match more than the previous @ patterns. */ +case 10: +YY_RULE_SETUP +#line 92 "scan-skel.l" +fail_for_invalid_at (skel_text); + YY_BREAK +case 11: +/* rule 11 can match eol */ +YY_RULE_SETUP +#line 93 "scan-skel.l" +out_lineno++; ECHO; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 94 "scan-skel.l" +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): +#line 96 "scan-skel.l" +{ + if (outname) + { + free (outname); + xfclose (skel_out); + } + return EOF; +} + YY_BREAK + +case 13: +/* rule 13 can match eol */ +YY_RULE_SETUP +#line 106 "scan-skel.l" +{ STRING_GROW; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 108 "scan-skel.l" +{ obstack_1grow (&obstack_for_string, '@'); } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 109 "scan-skel.l" +{ obstack_1grow (&obstack_for_string, '['); } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 110 "scan-skel.l" +{ obstack_1grow (&obstack_for_string, ']'); } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 111 "scan-skel.l" +/* Emtpy. Useful for starting an argument + that begins with whitespace. */ + YY_BREAK +case 18: +/* rule 18 can match eol */ +YY_RULE_SETUP +#line 113 "scan-skel.l" +/* Empty. */ + YY_BREAK +case 19: +YY_RULE_SETUP +#line 115 "scan-skel.l" +{ + if (at_directive_argc >= AT_DIRECTIVE_ARGC_MAX) + fail_for_at_directive_too_many_args (at_directive_argv[0]); + + obstack_1grow (&obstack_for_string, '\0'); + at_directive_argv[at_directive_argc++] = + obstack_finish (&obstack_for_string); + + /* Like M4, skip whitespace after a comma. */ + if (skel_text[1] == ',') + BEGIN SC_AT_DIRECTIVE_SKIP_WS; + else + { + at_directive_perform (at_directive_argc, at_directive_argv, + &outname, &out_lineno); + obstack_free (&obstack_for_string, at_directive_argv[0]); + at_directive_argc = 0; + BEGIN INITIAL; + } + } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 136 "scan-skel.l" +{ fail_for_invalid_at (skel_text); } + YY_BREAK + + +case 21: +/* rule 21 can match eol */ +YY_RULE_SETUP +#line 140 "scan-skel.l" + + YY_BREAK +case 22: +YY_RULE_SETUP +#line 141 "scan-skel.l" +{ yyless (0); BEGIN SC_AT_DIRECTIVE_ARGS; } + YY_BREAK + + +case YY_STATE_EOF(SC_AT_DIRECTIVE_ARGS): +case YY_STATE_EOF(SC_AT_DIRECTIVE_SKIP_WS): +#line 145 "scan-skel.l" +{ + fatal (_("unclosed %s directive in skeleton"), at_directive_argv[0]); + } + YY_BREAK + +case 23: +YY_RULE_SETUP +#line 150 "scan-skel.l" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 1193 "scan-skel.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed skel_in at a new source and called + * skel_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = skel_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( skel_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * skel_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of skel_lex */ +/* %ok-for-header */ + +/* %if-c++-only */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +/* %if-c-only */ +static int yy_get_next_buffer (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + skel_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + skel_restart(skel_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) skel_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +/* %if-c-only */ +/* %not-for-header */ + + static yy_state_type yy_get_previous_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register yy_state_type yy_current_state; + register char *yy_cp; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { +/* %% [16.0] code to find the next state goes here */ + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 56 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +/* %if-c-only */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register int yy_is_jam; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 56 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 55); + + return yy_is_jam ? 0 : yy_current_state; +} + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + skel_restart(skel_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( skel_wrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve skel_text */ + (yy_hold_char) = *++(yy_c_buf_p); + +/* %% [19.0] update BOL and skel_lineno */ + + return c; +} +/* %if-c-only */ +#endif /* ifndef YY_NO_INPUT */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void skel_restart (FILE * input_file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + skel_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + skel__create_buffer(skel_in,YY_BUF_SIZE ); + } + + skel__init_buffer(YY_CURRENT_BUFFER,input_file ); + skel__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ + void skel__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * skel_pop_buffer_state(); + * skel_push_buffer_state(new_buffer); + */ + skel_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + skel__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (skel_wrap()) processing, but the only time this flag + * is looked at is after skel_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +/* %if-c-only */ +static void skel__load_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + skel_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE skel__create_buffer (FILE * file, int size ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) skel_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in skel__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) skel_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in skel__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + skel__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with skel__create_buffer() + * + */ +/* %if-c-only */ + void skel__delete_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + skel_free((void *) b->yy_ch_buf ); + + skel_free((void *) b ); +} + +/* %if-c-only */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a skel_restart() or at EOF. + */ +/* %if-c-only */ + static void skel__init_buffer (YY_BUFFER_STATE b, FILE * file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +{ + int oerrno = errno; + + skel__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then skel__init_buffer was _probably_ + * called from skel_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + +/* %if-c-only */ + + b->yy_is_interactive = 0; + +/* %endif */ +/* %if-c++-only */ +/* %endif */ + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ + void skel__flush_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + skel__load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +void skel_push_buffer_state (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (new_buffer == NULL) + return; + + skel_ensure_buffer_stack(); + + /* This block is copied from skel__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from skel__switch_to_buffer. */ + skel__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +void skel_pop_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + skel__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + skel__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +static void skel_ensure_buffer_stack (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)skel_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in skel_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)skel_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in skel_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE skel__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) skel_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in skel__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + skel__switch_to_buffer(b ); + + return b; +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan a string. The next call to skel_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * skel__scan_bytes() instead. + */ +YY_BUFFER_STATE skel__scan_string (yyconst char * yystr ) +{ + + return skel__scan_bytes(yystr,strlen(yystr) ); +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan the given bytes. The next call to skel_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE skel__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) skel_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in skel__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = skel__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in skel__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} +/* %endif */ + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +/* %if-c-only */ +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up skel_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + skel_text[skel_leng] = (yy_hold_char); \ + (yy_c_buf_p) = skel_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + skel_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ + +/** Get the current line number. + * + */ +int skel_get_lineno (void) +{ + + return skel_lineno; +} + +/** Get the input stream. + * + */ +FILE *skel_get_in (void) +{ + return skel_in; +} + +/** Get the output stream. + * + */ +FILE *skel_get_out (void) +{ + return skel_out; +} + +/** Get the length of the current token. + * + */ +int skel_get_leng (void) +{ + return skel_leng; +} + +/** Get the current token. + * + */ + +char *skel_get_text (void) +{ + return skel_text; +} + +/* %if-reentrant */ +/* %endif */ + +/** Set the current line number. + * @param line_number + * + */ +void skel_set_lineno (int line_number ) +{ + + skel_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see skel__switch_to_buffer + */ +void skel_set_in (FILE * in_str ) +{ + skel_in = in_str ; +} + +void skel_set_out (FILE * out_str ) +{ + skel_out = out_str ; +} + +int skel_get_debug (void) +{ + return skel__flex_debug; +} + +void skel_set_debug (int bdebug ) +{ + skel__flex_debug = bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif if-c-only */ + +/* %if-c-only */ +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from skel_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + skel_in = stdin; + skel_out = stdout; +#else + skel_in = (FILE *) 0; + skel_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * skel_lex_init() + */ + return 0; +} +/* %endif */ + +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ +/* skel_lex_destroy is for both reentrant and non-reentrant scanners. */ +int skel_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + skel__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + skel_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + skel_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * skel_lex() is called, initialization will occur. */ + yy_init_globals( ); + +/* %if-reentrant */ +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *skel_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *skel_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void skel_free (void * ptr ) +{ + free( (char *) ptr ); /* see skel_realloc() for (char *) cast */ +} + +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + +#line 150 "scan-skel.l" + + + +/*------------------------. +| Scan a Bison skeleton. | +`------------------------*/ + +void +scan_skel (FILE *in) +{ + static bool initialized = false; + if (!initialized) + { + initialized = true; + obstack_init (&obstack_for_string); + } + skel_in = in; + skel__flex_debug = trace_flag & trace_skeleton; + skel_lex (); +} + +void +skel_scanner_free (void) +{ + obstack_free (&obstack_for_string, 0); + /* Reclaim Flex's buffers. */ + skel_lex_destroy (); +} + +static +void at_directive_perform (int at_directive_argc, + char *at_directive_argv[], + char **outnamep, int *out_linenop) +{ + if (0 == strcmp (at_directive_argv[0], "@basename")) + { + if (at_directive_argc > 2) + fail_for_at_directive_too_many_args (at_directive_argv[0]); + fputs (last_component (at_directive_argv[1]), skel_out); + } + else if (0 == strcmp (at_directive_argv[0], "@warn") + || 0 == strcmp (at_directive_argv[0], "@complain") + || 0 == strcmp (at_directive_argv[0], "@fatal")) + { + void (*func)(char const *, ...); + switch (at_directive_argv[0][1]) + { + case 'w': func = warn; break; + case 'c': func = complain; break; + case 'f': func = fatal; break; + default: aver (false); break; + } + switch (at_directive_argc) + { + case 2: + func (_(at_directive_argv[1])); + break; + case 3: + func (_(at_directive_argv[1]), at_directive_argv[2]); + break; + case 4: + func (_(at_directive_argv[1]), at_directive_argv[2], + at_directive_argv[3]); + break; + case 5: + func (_(at_directive_argv[1]), at_directive_argv[2], + at_directive_argv[3], at_directive_argv[4]); + break; + case 6: + func (_(at_directive_argv[1]), at_directive_argv[2], + at_directive_argv[3], at_directive_argv[4], + at_directive_argv[5]); + break; + default: + fail_for_at_directive_too_many_args (at_directive_argv[0]); + break; + } + } + else if (0 == strcmp (at_directive_argv[0], "@warn_at") + || 0 == strcmp (at_directive_argv[0], "@complain_at") + || 0 == strcmp (at_directive_argv[0], "@fatal_at")) + { + void (*func)(location, char const *, ...); + location loc; + if (at_directive_argc < 4) + fail_for_at_directive_too_few_args (at_directive_argv[0]); + switch (at_directive_argv[0][1]) + { + case 'w': func = warn_at; break; + case 'c': func = complain_at; break; + case 'f': func = fatal_at; break; + default: aver (false); break; + } + boundary_set_from_string (&loc.start, at_directive_argv[1]); + boundary_set_from_string (&loc.end, at_directive_argv[2]); + switch (at_directive_argc) + { + case 4: + func (loc, _(at_directive_argv[3])); + break; + case 5: + func (loc, _(at_directive_argv[3]), at_directive_argv[4]); + break; + case 6: + func (loc, _(at_directive_argv[3]), at_directive_argv[4], + at_directive_argv[5]); + break; + case 7: + func (loc, _(at_directive_argv[3]), at_directive_argv[4], + at_directive_argv[5], at_directive_argv[6]); + break; + case 8: + func (loc, _(at_directive_argv[3]), at_directive_argv[4], + at_directive_argv[5], at_directive_argv[6], + at_directive_argv[7]); + break; + default: + fail_for_at_directive_too_many_args (at_directive_argv[0]); + break; + } + } + else if (0 == strcmp (at_directive_argv[0], "@output")) + { + if (at_directive_argc > 2) + fail_for_at_directive_too_many_args (at_directive_argv[0]); + if (*outnamep) + { + free (*outnamep); + xfclose (skel_out); + } + *outnamep = xstrdup (at_directive_argv[1]); + output_file_name_check (*outnamep); + skel_out = xfopen (*outnamep, "w"); + *out_linenop = 1; + } + else + fail_for_invalid_at (at_directive_argv[0]); +} + +static void +fail_for_at_directive_too_few_args (char const *at_directive_name) +{ + fatal (_("too few arguments for %s directive in skeleton"), + at_directive_name); +} + +static void +fail_for_at_directive_too_many_args (char const *at_directive_name) +{ + fatal (_("too many arguments for %s directive in skeleton"), + at_directive_name); +} + +static void +fail_for_invalid_at (char const *at) +{ + fatal ("invalid @ in skeleton: %s", at); +} + diff --git a/src/scan-skel.h b/src/scan-skel.h new file mode 100644 index 0000000..c9b4da6 --- /dev/null +++ b/src/scan-skel.h @@ -0,0 +1,27 @@ +/* Scan Bison Skeletons. + + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +void scan_skel (FILE *); + +/* Pacify "make syntax-check". */ +extern FILE *skel_in; +extern FILE *skel_out; +extern int skel__flex_debug; +extern int skel_lineno; +void skel_scanner_free (void); diff --git a/src/scan-skel.l b/src/scan-skel.l new file mode 100644 index 0000000..6ef5351 --- /dev/null +++ b/src/scan-skel.l @@ -0,0 +1,306 @@ +/* Scan Bison Skeletons. -*- C -*- + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +%option nodefault noyywrap nounput never-interactive debug +%option prefix="skel_" outfile="lex.yy.c" + +%{ +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef skel_wrap +#define skel_wrap() 1 + +#define FLEX_PREFIX(Id) skel_ ## Id +#include "flex-scanner.h" + +#include +#include +#include + +#include "complain.h" +#include "getargs.h" +#include "files.h" +#include "scan-skel.h" + +#define YY_DECL static int skel_lex (void) +YY_DECL; + +#define QPUTS(String) \ + fputs (quotearg_style (c_quoting_style, String), yyout) + +static void at_directive_perform (int at_directive_argc, + char *at_directive_argv[], + char **outnamep, int *out_linenop); +static void fail_for_at_directive_too_many_args (char const *at_directive_name); +static void fail_for_at_directive_too_few_args (char const *at_directive_name); +static void fail_for_invalid_at (char const *at); +%} + +%x SC_AT_DIRECTIVE_ARGS +%x SC_AT_DIRECTIVE_SKIP_WS + +%% + +%{ + int out_lineno IF_LINT (= 0); + char *outname = NULL; + + /* Currently, only the @warn, @complain, @fatal, @warn_at, @complain_at, and + @fatal_at directives take multiple arguments, and the last three already + can't take more than 7. at_directive_argv[0] is the directive name. */ + #define AT_DIRECTIVE_ARGC_MAX 8 + int at_directive_argc = 0; + char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX]; +%} + +"@@" fputc ('@', yyout); +"@{" fputc ('[', yyout); +"@}" fputc (']', yyout); +"@`" /* Emtpy. Used by b4_cat in ../data/bison.m4. */ +@\n /* Likewise. */ + +"@oline@" fprintf (yyout, "%d", out_lineno + 1); +"@ofile@" QPUTS (outname); +"@dir_prefix@" QPUTS (dir_prefix); + +@[a-z_]+"(" { + yytext[yyleng-1] = '\0'; + obstack_grow (&obstack_for_string, yytext, yyleng); + at_directive_argv[at_directive_argc++] = + obstack_finish (&obstack_for_string); + BEGIN SC_AT_DIRECTIVE_ARGS; +} + + /* This pattern must not match more than the previous @ patterns. */ +@[^@{}`(\n]* fail_for_invalid_at (yytext); +\n out_lineno++; ECHO; +[^@\n]+ ECHO; + +<> { + if (outname) + { + free (outname); + xfclose (yyout); + } + return EOF; +} + +{ + [^@]+ { STRING_GROW; } + + "@@" { obstack_1grow (&obstack_for_string, '@'); } + "@{" { obstack_1grow (&obstack_for_string, '['); } + "@}" { obstack_1grow (&obstack_for_string, ']'); } + "@`" /* Emtpy. Useful for starting an argument + that begins with whitespace. */ + @\n /* Empty. */ + + @[,)] { + if (at_directive_argc >= AT_DIRECTIVE_ARGC_MAX) + fail_for_at_directive_too_many_args (at_directive_argv[0]); + + obstack_1grow (&obstack_for_string, '\0'); + at_directive_argv[at_directive_argc++] = + obstack_finish (&obstack_for_string); + + /* Like M4, skip whitespace after a comma. */ + if (yytext[1] == ',') + BEGIN SC_AT_DIRECTIVE_SKIP_WS; + else + { + at_directive_perform (at_directive_argc, at_directive_argv, + &outname, &out_lineno); + obstack_free (&obstack_for_string, at_directive_argv[0]); + at_directive_argc = 0; + BEGIN INITIAL; + } + } + + @.? { fail_for_invalid_at (yytext); } +} + +{ + [ \t\r\n] + . { yyless (0); BEGIN SC_AT_DIRECTIVE_ARGS; } +} + +{ + <> { + fatal (_("unclosed %s directive in skeleton"), at_directive_argv[0]); + } +} + +%% + +/*------------------------. +| Scan a Bison skeleton. | +`------------------------*/ + +void +scan_skel (FILE *in) +{ + static bool initialized = false; + if (!initialized) + { + initialized = true; + obstack_init (&obstack_for_string); + } + skel_in = in; + skel__flex_debug = trace_flag & trace_skeleton; + skel_lex (); +} + +void +skel_scanner_free (void) +{ + obstack_free (&obstack_for_string, 0); + /* Reclaim Flex's buffers. */ + yylex_destroy (); +} + +static +void at_directive_perform (int at_directive_argc, + char *at_directive_argv[], + char **outnamep, int *out_linenop) +{ + if (0 == strcmp (at_directive_argv[0], "@basename")) + { + if (at_directive_argc > 2) + fail_for_at_directive_too_many_args (at_directive_argv[0]); + fputs (last_component (at_directive_argv[1]), yyout); + } + else if (0 == strcmp (at_directive_argv[0], "@warn") + || 0 == strcmp (at_directive_argv[0], "@complain") + || 0 == strcmp (at_directive_argv[0], "@fatal")) + { + void (*func)(char const *, ...); + switch (at_directive_argv[0][1]) + { + case 'w': func = warn; break; + case 'c': func = complain; break; + case 'f': func = fatal; break; + default: aver (false); break; + } + switch (at_directive_argc) + { + case 2: + func (_(at_directive_argv[1])); + break; + case 3: + func (_(at_directive_argv[1]), at_directive_argv[2]); + break; + case 4: + func (_(at_directive_argv[1]), at_directive_argv[2], + at_directive_argv[3]); + break; + case 5: + func (_(at_directive_argv[1]), at_directive_argv[2], + at_directive_argv[3], at_directive_argv[4]); + break; + case 6: + func (_(at_directive_argv[1]), at_directive_argv[2], + at_directive_argv[3], at_directive_argv[4], + at_directive_argv[5]); + break; + default: + fail_for_at_directive_too_many_args (at_directive_argv[0]); + break; + } + } + else if (0 == strcmp (at_directive_argv[0], "@warn_at") + || 0 == strcmp (at_directive_argv[0], "@complain_at") + || 0 == strcmp (at_directive_argv[0], "@fatal_at")) + { + void (*func)(location, char const *, ...); + location loc; + if (at_directive_argc < 4) + fail_for_at_directive_too_few_args (at_directive_argv[0]); + switch (at_directive_argv[0][1]) + { + case 'w': func = warn_at; break; + case 'c': func = complain_at; break; + case 'f': func = fatal_at; break; + default: aver (false); break; + } + boundary_set_from_string (&loc.start, at_directive_argv[1]); + boundary_set_from_string (&loc.end, at_directive_argv[2]); + switch (at_directive_argc) + { + case 4: + func (loc, _(at_directive_argv[3])); + break; + case 5: + func (loc, _(at_directive_argv[3]), at_directive_argv[4]); + break; + case 6: + func (loc, _(at_directive_argv[3]), at_directive_argv[4], + at_directive_argv[5]); + break; + case 7: + func (loc, _(at_directive_argv[3]), at_directive_argv[4], + at_directive_argv[5], at_directive_argv[6]); + break; + case 8: + func (loc, _(at_directive_argv[3]), at_directive_argv[4], + at_directive_argv[5], at_directive_argv[6], + at_directive_argv[7]); + break; + default: + fail_for_at_directive_too_many_args (at_directive_argv[0]); + break; + } + } + else if (0 == strcmp (at_directive_argv[0], "@output")) + { + if (at_directive_argc > 2) + fail_for_at_directive_too_many_args (at_directive_argv[0]); + if (*outnamep) + { + free (*outnamep); + xfclose (yyout); + } + *outnamep = xstrdup (at_directive_argv[1]); + output_file_name_check (*outnamep); + yyout = xfopen (*outnamep, "w"); + *out_linenop = 1; + } + else + fail_for_invalid_at (at_directive_argv[0]); +} + +static void +fail_for_at_directive_too_few_args (char const *at_directive_name) +{ + fatal (_("too few arguments for %s directive in skeleton"), + at_directive_name); +} + +static void +fail_for_at_directive_too_many_args (char const *at_directive_name) +{ + fatal (_("too many arguments for %s directive in skeleton"), + at_directive_name); +} + +static void +fail_for_invalid_at (char const *at) +{ + fatal ("invalid @ in skeleton: %s", at); +} diff --git a/src/state.c b/src/state.c new file mode 100644 index 0000000..d3460c1 --- /dev/null +++ b/src/state.c @@ -0,0 +1,439 @@ +/* Type definitions for nondeterministic finite state machine for Bison. + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software + Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include + +#include "complain.h" +#include "gram.h" +#include "state.h" +#include "print-xml.h" + + + /*-------------------. + | Shifts and Gotos. | + `-------------------*/ + + +/*-----------------------------------------. +| Create a new array of NUM shifts/gotos. | +`-----------------------------------------*/ + +static transitions * +transitions_new (int num, state **the_states) +{ + size_t states_size = num * sizeof *the_states; + transitions *res = xmalloc (offsetof (transitions, states) + states_size); + res->num = num; + memcpy (res->states, the_states, states_size); + return res; +} + + +/*-------------------------------------------------------. +| Return the state such that SHIFTS contain a shift/goto | +| to it on SYM. Abort if none found. | +`-------------------------------------------------------*/ + +state * +transitions_to (transitions *shifts, symbol_number sym) +{ + int j; + for (j = 0; ; j++) + { + aver (j < shifts->num); + if (TRANSITION_SYMBOL (shifts, j) == sym) + return shifts->states[j]; + } +} + + + /*--------------------. + | Error transitions. | + `--------------------*/ + + +/*---------------------------------. +| Create a new array of NUM errs. | +`---------------------------------*/ + +errs * +errs_new (int num, symbol **tokens) +{ + size_t symbols_size = num * sizeof *tokens; + errs *res = xmalloc (offsetof (errs, symbols) + symbols_size); + res->num = num; + memcpy (res->symbols, tokens, symbols_size); + return res; +} + + + + + /*-------------. + | Reductions. | + `-------------*/ + + +/*---------------------------------------. +| Create a new array of NUM reductions. | +`---------------------------------------*/ + +static reductions * +reductions_new (int num, rule **reds) +{ + size_t rules_size = num * sizeof *reds; + reductions *res = xmalloc (offsetof (reductions, rules) + rules_size); + res->num = num; + res->lookahead_tokens = NULL; + memcpy (res->rules, reds, rules_size); + return res; +} + + + + /*---------. + | States. | + `---------*/ + + +state_number nstates = 0; +/* FINAL_STATE is properly set by new_state when it recognizes its + accessing symbol: $end. */ +state *final_state = NULL; + + +/*------------------------------------------------------------------. +| Create a new state with ACCESSING_SYMBOL, for those items. Store | +| it in the state hash table. | +`------------------------------------------------------------------*/ + +state * +state_new (symbol_number accessing_symbol, + size_t nitems, item_number *core) +{ + state *res; + size_t items_size = nitems * sizeof *core; + + aver (nstates < STATE_NUMBER_MAXIMUM); + + res = xmalloc (offsetof (state, items) + items_size); + res->number = nstates++; + res->accessing_symbol = accessing_symbol; + res->transitions = NULL; + res->reductions = NULL; + res->errs = NULL; + res->consistent = 0; + res->solved_conflicts = NULL; + res->solved_conflicts_xml = NULL; + + res->nitems = nitems; + memcpy (res->items, core, items_size); + + state_hash_insert (res); + + return res; +} + + +/*---------. +| Free S. | +`---------*/ + +static void +state_free (state *s) +{ + free (s->transitions); + free (s->reductions); + free (s->errs); + free (s); +} + + +/*---------------------------. +| Set the transitions of S. | +`---------------------------*/ + +void +state_transitions_set (state *s, int num, state **trans) +{ + aver (!s->transitions); + s->transitions = transitions_new (num, trans); +} + + +/*--------------------------. +| Set the reductions of S. | +`--------------------------*/ + +void +state_reductions_set (state *s, int num, rule **reds) +{ + aver (!s->reductions); + s->reductions = reductions_new (num, reds); +} + + +int +state_reduction_find (state *s, rule *r) +{ + int i; + reductions *reds = s->reductions; + for (i = 0; i < reds->num; ++i) + if (reds->rules[i] == r) + return i; + return -1; +} + + +/*--------------------. +| Set the errs of S. | +`--------------------*/ + +void +state_errs_set (state *s, int num, symbol **tokens) +{ + aver (!s->errs); + s->errs = errs_new (num, tokens); +} + + + +/*--------------------------------------------------. +| Print on OUT all the lookahead tokens such that S | +| wants to reduce R. | +`--------------------------------------------------*/ + +void +state_rule_lookahead_tokens_print (state *s, rule *r, FILE *out) +{ + /* Find the reduction we are handling. */ + reductions *reds = s->reductions; + int red = state_reduction_find (s, r); + + /* Print them if there are. */ + if (reds->lookahead_tokens && red != -1) + { + bitset_iterator biter; + int k; + char const *sep = ""; + fprintf (out, " ["); + BITSET_FOR_EACH (biter, reds->lookahead_tokens[red], k, 0) + { + fprintf (out, "%s%s", sep, symbols[k]->tag); + sep = ", "; + } + fprintf (out, "]"); + } +} + +void +state_rule_lookahead_tokens_print_xml (state *s, rule *r, + FILE *out, int level) +{ + /* Find the reduction we are handling. */ + reductions *reds = s->reductions; + int red = state_reduction_find (s, r); + + /* Print them if there are. */ + if (reds->lookahead_tokens && red != -1) + { + bitset_iterator biter; + int k; + xml_puts (out, level, ""); + BITSET_FOR_EACH (biter, reds->lookahead_tokens[red], k, 0) + { + xml_printf (out, level + 1, "%s", + xml_escape (symbols[k]->tag)); + } + xml_puts (out, level, ""); + } +} + + +/*---------------------. +| A state hash table. | +`---------------------*/ + +/* Initial capacity of states hash table. */ +#define HT_INITIAL_CAPACITY 257 + +static struct hash_table *state_table = NULL; + +/* Two states are equal if they have the same core items. */ +static inline bool +state_compare (state const *s1, state const *s2) +{ + size_t i; + + if (s1->nitems != s2->nitems) + return false; + + for (i = 0; i < s1->nitems; ++i) + if (s1->items[i] != s2->items[i]) + return false; + + return true; +} + +static bool +state_comparator (void const *s1, void const *s2) +{ + return state_compare (s1, s2); +} + +static inline size_t +state_hash (state const *s, size_t tablesize) +{ + /* Add up the state's item numbers to get a hash key. */ + size_t key = 0; + size_t i; + for (i = 0; i < s->nitems; ++i) + key += s->items[i]; + return key % tablesize; +} + +static size_t +state_hasher (void const *s, size_t tablesize) +{ + return state_hash (s, tablesize); +} + + +/*-------------------------------. +| Create the states hash table. | +`-------------------------------*/ + +void +state_hash_new (void) +{ + state_table = hash_initialize (HT_INITIAL_CAPACITY, + NULL, + state_hasher, + state_comparator, + NULL); +} + + +/*---------------------------------------------. +| Free the states hash table, not the states. | +`---------------------------------------------*/ + +void +state_hash_free (void) +{ + hash_free (state_table); +} + + +/*-----------------------------------. +| Insert S in the state hash table. | +`-----------------------------------*/ + +void +state_hash_insert (state *s) +{ + hash_insert (state_table, s); +} + + +/*------------------------------------------------------------------. +| Find the state associated to the CORE, and return it. If it does | +| not exist yet, return NULL. | +`------------------------------------------------------------------*/ + +state * +state_hash_lookup (size_t nitems, item_number *core) +{ + size_t items_size = nitems * sizeof *core; + state *probe = xmalloc (offsetof (state, items) + items_size); + state *entry; + + probe->nitems = nitems; + memcpy (probe->items, core, items_size); + entry = hash_lookup (state_table, probe); + free (probe); + return entry; +} + + +/*--------------------------------------------------------. +| Record S and all states reachable from S in REACHABLE. | +`--------------------------------------------------------*/ + +static void +state_record_reachable_states (state *s, bitset reachable) +{ + if (bitset_test (reachable, s->number)) + return; + bitset_set (reachable, s->number); + { + int i; + for (i = 0; i < s->transitions->num; ++i) + if (!TRANSITION_IS_DISABLED (s->transitions, i)) + state_record_reachable_states (s->transitions->states[i], reachable); + } +} + +void +state_remove_unreachable_states (state_number old_to_new[]) +{ + state_number nstates_reachable = 0; + bitset reachable = bitset_create (nstates, BITSET_FIXED); + state_record_reachable_states (states[0], reachable); + { + state_number i; + for (i = 0; i < nstates; ++i) + { + if (bitset_test (reachable, states[i]->number)) + { + states[nstates_reachable] = states[i]; + states[nstates_reachable]->number = nstates_reachable; + old_to_new[i] = nstates_reachable++; + } + else + { + state_free (states[i]); + old_to_new[i] = nstates; + } + } + } + nstates = nstates_reachable; + bitset_free (reachable); +} + +/* All the decorated states, indexed by the state number. */ +state **states = NULL; + + +/*----------------------. +| Free all the states. | +`----------------------*/ + +void +states_free (void) +{ + state_number i; + for (i = 0; i < nstates; ++i) + state_free (states[i]); + free (states); +} diff --git a/src/state.h b/src/state.h new file mode 100644 index 0000000..4afc1f0 --- /dev/null +++ b/src/state.h @@ -0,0 +1,266 @@ +/* Type definitions for nondeterministic finite state machine for Bison. + + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004, 2007 Free + Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + + +/* These type definitions are used to represent a nondeterministic + finite state machine that parses the specified grammar. This + information is generated by the function generate_states in the + file LR0. + + Each state of the machine is described by a set of items -- + particular positions in particular rules -- that are the possible + places where parsing could continue when the machine is in this + state. These symbols at these items are the allowable inputs that + can follow now. + + A core represents one state. States are numbered in the NUMBER + field. When generate_states is finished, the starting state is + state 0 and NSTATES is the number of states. (FIXME: This sentence + is no longer true: A transition to a state whose state number is + NSTATES indicates termination.) All the cores are chained together + and FIRST_STATE points to the first one (state 0). + + For each state there is a particular symbol which must have been + the last thing accepted to reach that state. It is the + ACCESSING_SYMBOL of the core. + + Each core contains a vector of NITEMS items which are the indices + in the RITEM vector of the items that are selected in this state. + + The two types of actions are shifts/gotos (push the lookahead token + and read another/goto to the state designated by a nterm) and + reductions (combine the last n things on the stack via a rule, + replace them with the symbol that the rule derives, and leave the + lookahead token alone). When the states are generated, these + actions are represented in two other lists. + + Each transition structure describes the possible transitions out + of one state, the state whose number is in the number field. Each + contains a vector of numbers of the states that transitions can go + to. The accessing_symbol fields of those states' cores say what + kind of input leads to them. + + A transition to state zero should be ignored: conflict resolution + deletes transitions by having them point to zero. + + Each reductions structure describes the possible reductions at the + state whose number is in the number field. rules is an array of + num rules. lookahead_tokens is an array of bitsets, one per rule. + + Conflict resolution can decide that certain tokens in certain + states should explicitly be errors (for implementing %nonassoc). + For each state, the tokens that are errors for this reason are + recorded in an errs structure, which holds the token numbers. + + There is at least one goto transition present in state zero. It + leads to a next-to-final state whose accessing_symbol is the + grammar's start symbol. The next-to-final state has one shift to + the final state, whose accessing_symbol is zero (end of input). + The final state has one shift, which goes to the termination state. + The reason for the extra state at the end is to placate the + parser's strategy of making all decisions one token ahead of its + actions. */ + +#ifndef STATE_H_ +# define STATE_H_ + +# include + +# include "gram.h" +# include "symtab.h" + + +/*-------------------. +| Numbering states. | +`-------------------*/ + +typedef int state_number; +# define STATE_NUMBER_MAXIMUM INT_MAX + +/* Be ready to map a state_number to an int. */ +static inline int +state_number_as_int (state_number s) +{ + return s; +} + + +typedef struct state state; + +/*--------------. +| Transitions. | +`--------------*/ + +typedef struct +{ + int num; + state *states[1]; +} transitions; + + +/* What is the symbol labelling the transition to + TRANSITIONS->states[Num]? Can be a token (amongst which the error + token), or non terminals in case of gotos. */ + +#define TRANSITION_SYMBOL(Transitions, Num) \ + (Transitions->states[Num]->accessing_symbol) + +/* Is the TRANSITIONS->states[Num] a shift? (as opposed to gotos). */ + +#define TRANSITION_IS_SHIFT(Transitions, Num) \ + (ISTOKEN (TRANSITION_SYMBOL (Transitions, Num))) + +/* Is the TRANSITIONS->states[Num] a goto?. */ + +#define TRANSITION_IS_GOTO(Transitions, Num) \ + (!TRANSITION_IS_SHIFT (Transitions, Num)) + +/* Is the TRANSITIONS->states[Num] labelled by the error token? */ + +#define TRANSITION_IS_ERROR(Transitions, Num) \ + (TRANSITION_SYMBOL (Transitions, Num) == errtoken->number) + +/* When resolving a SR conflicts, if the reduction wins, the shift is + disabled. */ + +#define TRANSITION_DISABLE(Transitions, Num) \ + (Transitions->states[Num] = NULL) + +#define TRANSITION_IS_DISABLED(Transitions, Num) \ + (Transitions->states[Num] == NULL) + + +/* Iterate over each transition over a token (shifts). */ +#define FOR_EACH_SHIFT(Transitions, Iter) \ + for (Iter = 0; \ + Iter < Transitions->num \ + && (TRANSITION_IS_DISABLED (Transitions, Iter) \ + || TRANSITION_IS_SHIFT (Transitions, Iter)); \ + ++Iter) \ + if (!TRANSITION_IS_DISABLED (Transitions, Iter)) + + +/* Return the state such SHIFTS contain a shift/goto to it on SYM. + Abort if none found. */ +struct state *transitions_to (transitions *shifts, symbol_number sym); + + +/*-------. +| Errs. | +`-------*/ + +typedef struct +{ + int num; + symbol *symbols[1]; +} errs; + +errs *errs_new (int num, symbol **tokens); + + +/*-------------. +| Reductions. | +`-------------*/ + +typedef struct +{ + int num; + bitset *lookahead_tokens; + /* Sorted ascendingly on rule number. */ + rule *rules[1]; +} reductions; + + + +/*---------. +| states. | +`---------*/ + +struct state +{ + state_number number; + symbol_number accessing_symbol; + transitions *transitions; + reductions *reductions; + errs *errs; + + /* If non-zero, then no lookahead sets on reduce actions are needed to + decide what to do in state S. */ + char consistent; + + /* If some conflicts were solved thanks to precedence/associativity, + a human readable description of the resolution. */ + const char *solved_conflicts; + const char *solved_conflicts_xml; + + /* Its items. Must be last, since ITEMS can be arbitrarily large. Sorted + ascendingly on item index in RITEM, which is sorted on rule number. */ + size_t nitems; + item_number items[1]; +}; + +extern state_number nstates; +extern state *final_state; + +/* Create a new state with ACCESSING_SYMBOL for those items. */ +state *state_new (symbol_number accessing_symbol, + size_t core_size, item_number *core); + +/* Set the transitions of STATE. */ +void state_transitions_set (state *s, int num, state **trans); + +/* Set the reductions of STATE. */ +void state_reductions_set (state *s, int num, rule **reds); + +int state_reduction_find (state *s, rule *r); + +/* Set the errs of STATE. */ +void state_errs_set (state *s, int num, symbol **errors); + +/* Print on OUT all the lookahead tokens such that this STATE wants to + reduce R. */ +void state_rule_lookahead_tokens_print (state *s, rule *r, FILE *out); +void state_rule_lookahead_tokens_print_xml (state *s, rule *r, + FILE *out, int level); + +/* Create/destroy the states hash table. */ +void state_hash_new (void); +void state_hash_free (void); + +/* Find the state associated to the CORE, and return it. If it does + not exist yet, return NULL. */ +state *state_hash_lookup (size_t core_size, item_number *core); + +/* Insert STATE in the state hash table. */ +void state_hash_insert (state *s); + +/* Remove unreachable states, renumber remaining states, update NSTATES, and + write to OLD_TO_NEW a mapping of old state numbers to new state numbers such + that the old value of NSTATES is written as the new state number for removed + states. The size of OLD_TO_NEW must be the old value of NSTATES. */ +void state_remove_unreachable_states (state_number old_to_new[]); + +/* All the states, indexed by the state number. */ +extern state **states; + +/* Free all the states. */ +void states_free (void); + +#endif /* !STATE_H_ */ diff --git a/src/symlist.c b/src/symlist.c new file mode 100644 index 0000000..6c6b57d --- /dev/null +++ b/src/symlist.c @@ -0,0 +1,253 @@ +/* Lists of symbols for Bison + + Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include "complain.h" +#include "symlist.h" + + +/*--------------------------------------. +| Create a list containing SYM at LOC. | +`--------------------------------------*/ + +symbol_list * +symbol_list_sym_new (symbol *sym, location loc) +{ + symbol_list *res = xmalloc (sizeof *res); + + res->content_type = SYMLIST_SYMBOL; + res->content.sym = sym; + res->location = loc; + + res->midrule = NULL; + res->midrule_parent_rule = NULL; + res->midrule_parent_rhs_index = 0; + + code_props_none_init (&res->action_props); + + res->ruleprec = NULL; + res->dprec = 0; + res->merger = 0; + + res->next = NULL; + + return res; +} + + +/*--------------------------------------------. +| Create a list containing TYPE_NAME at LOC. | +`--------------------------------------------*/ + +symbol_list * +symbol_list_type_new (uniqstr type_name, location loc) +{ + symbol_list *res = xmalloc (sizeof *res); + + res->content_type = SYMLIST_TYPE; + res->content.type_name = type_name; + res->location = loc; + res->next = NULL; + + return res; +} + + +/*----------------------------------------. +| Create a list containing a <*> at LOC. | +`----------------------------------------*/ + +symbol_list * +symbol_list_default_tagged_new (location loc) +{ + symbol_list *res = xmalloc (sizeof *res); + + res->content_type = SYMLIST_DEFAULT_TAGGED; + res->location = loc; + res->next = NULL; + + return res; +} + + +/*---------------------------------------. +| Create a list containing a <> at LOC. | +`---------------------------------------*/ + +symbol_list * +symbol_list_default_tagless_new (location loc) +{ + symbol_list *res = xmalloc (sizeof *res); + + res->content_type = SYMLIST_DEFAULT_TAGLESS; + res->location = loc; + res->next = NULL; + + return res; +} + + +/*-----------------------------------------------------------------------. +| Print this list, for which every content_type must be SYMLIST_SYMBOL. | +`-----------------------------------------------------------------------*/ + +void +symbol_list_syms_print (const symbol_list *l, FILE *f) +{ + for (/* Nothing. */; l && l->content.sym; l = l->next) + { + symbol_print (l->content.sym, f); + fprintf (stderr, l->action_props.is_value_used ? " used" : " unused"); + if (l && l->content.sym) + fprintf (f, ", "); + } +} + + +/*---------------------------. +| Prepend NODE to the LIST. | +`---------------------------*/ + +symbol_list * +symbol_list_prepend (symbol_list *list, symbol_list *node) +{ + node->next = list; + return node; +} + + +/*-----------------------------------------------. +| Free the LIST, but not the items it contains. | +`-----------------------------------------------*/ + +void +symbol_list_free (symbol_list *list) +{ + LIST_FREE (symbol_list, list); +} + + +/*--------------------. +| Return its length. | +`--------------------*/ + +int +symbol_list_length (symbol_list const *l) +{ + int res = 0; + for (/* Nothing. */; + l && !(l->content_type == SYMLIST_SYMBOL && l->content.sym == NULL); + l = l->next) + ++res; + return res; +} + + +/*------------------------------. +| Get item N in symbol list L. | +`------------------------------*/ + +symbol_list * +symbol_list_n_get (symbol_list *l, int n) +{ + int i; + + if (n < 0) + return NULL; + + for (i = 0; i < n; ++i) + { + l = l->next; + if (l == NULL + || (l->content_type == SYMLIST_SYMBOL && l->content.sym == NULL)) + return NULL; + } + + return l; +} + + +/*--------------------------------------------------------------. +| Get the data type (alternative in the union) of the value for | +| symbol N in symbol list L. | +`--------------------------------------------------------------*/ + +uniqstr +symbol_list_n_type_name_get (symbol_list *l, location loc, int n) +{ + l = symbol_list_n_get (l, n); + if (!l) + { + complain_at (loc, _("invalid $ value: $%d"), n); + return NULL; + } + aver (l->content_type == SYMLIST_SYMBOL); + return l->content.sym->type_name; +} + + +void +symbol_list_destructor_set (symbol_list *node, char const *code, location loc) +{ + code_props destructor; + code_props_symbol_action_init (&destructor, code, loc); + code_props_translate_code (&destructor); + switch (node->content_type) + { + case SYMLIST_SYMBOL: + symbol_destructor_set (node->content.sym, &destructor); + break; + case SYMLIST_TYPE: + semantic_type_destructor_set ( + semantic_type_get (node->content.type_name), &destructor); + break; + case SYMLIST_DEFAULT_TAGGED: + default_tagged_destructor_set (&destructor); + break; + case SYMLIST_DEFAULT_TAGLESS: + default_tagless_destructor_set (&destructor); + break; + } +} + +void +symbol_list_printer_set (symbol_list *node, char const *code, location loc) +{ + code_props printer; + code_props_symbol_action_init (&printer, code, loc); + code_props_translate_code (&printer); + switch (node->content_type) + { + case SYMLIST_SYMBOL: + symbol_printer_set (node->content.sym, &printer); + break; + case SYMLIST_TYPE: + semantic_type_printer_set ( + semantic_type_get (node->content.type_name), &printer); + break; + case SYMLIST_DEFAULT_TAGGED: + default_tagged_printer_set (&printer); + break; + case SYMLIST_DEFAULT_TAGLESS: + default_tagless_printer_set (&printer); + break; + } +} diff --git a/src/symlist.h b/src/symlist.h new file mode 100644 index 0000000..992fd4e --- /dev/null +++ b/src/symlist.h @@ -0,0 +1,118 @@ +/* Lists of symbols for Bison + + Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef SYMLIST_H_ +# define SYMLIST_H_ + +# include "location.h" +# include "scan-code.h" +# include "symtab.h" + +/* A list of symbols, used during the parsing to store the rules. */ +typedef struct symbol_list +{ + /** + * Whether this node contains a symbol, a semantic type, a \c <*>, or a + * \c <>. + */ + enum { + SYMLIST_SYMBOL, SYMLIST_TYPE, + SYMLIST_DEFAULT_TAGGED, SYMLIST_DEFAULT_TAGLESS + } content_type; + union { + /** + * The symbol or \c NULL iff + * symbol_list::content_type = SYMLIST_SYMBOL. + */ + symbol *sym; + /** + * The semantic type iff symbol_list::content_type = SYMLIST_TYPE. + */ + uniqstr type_name; + } content; + location location; + + /* If this symbol is the generated lhs for a midrule but this is the rule in + whose rhs it appears, MIDRULE = a pointer to that midrule. */ + struct symbol_list *midrule; + + /* If this symbol is the generated lhs for a midrule and this is that + midrule, MIDRULE_PARENT_RULE = a pointer to the rule in whose rhs it + appears, and MIDRULE_PARENT_RHS_INDEX = its rhs index (1-origin) in the + parent rule. */ + struct symbol_list *midrule_parent_rule; + int midrule_parent_rhs_index; + + /* The action is attached to the LHS of a rule, but action properties for + * each RHS are also stored here. */ + code_props action_props; + + /* Precedence/associativity. */ + symbol *ruleprec; + int dprec; + int merger; + location merger_declaration_location; + + /* The list. */ + struct symbol_list *next; +} symbol_list; + + +/** Create a list containing \c sym at \c loc. */ +symbol_list *symbol_list_sym_new (symbol *sym, location loc); + +/** Create a list containing \c type_name at \c loc. */ +symbol_list *symbol_list_type_new (uniqstr type_name, location loc); + +/** Create a list containing a \c <*> at \c loc. */ +symbol_list *symbol_list_default_tagged_new (location loc); +/** Create a list containing a \c <> at \c loc. */ +symbol_list *symbol_list_default_tagless_new (location loc); + +/** Print this list. + + \pre For every node \c n in the list, n->content_type = + SYMLIST_SYMBOL. */ +void symbol_list_syms_print (const symbol_list *l, FILE *f); + +/** Prepend \c node to \c list. */ +symbol_list *symbol_list_prepend (symbol_list *list, symbol_list *node); + +/** Free \c list, but not the items it contains. */ +void symbol_list_free (symbol_list *list); + +/** Return the length of \c l. */ +int symbol_list_length (symbol_list const *l); + +/** Get item \c n in symbol list \c l. */ +symbol_list *symbol_list_n_get (symbol_list *l, int n); + +/* Get the data type (alternative in the union) of the value for + symbol N in rule RULE. */ +uniqstr symbol_list_n_type_name_get (symbol_list *l, location loc, int n); + +/** Set the \c \%destructor for \c node as \c code at \c loc. */ +void symbol_list_destructor_set (symbol_list *node, char const *code, + location loc); + +/** Set the \c \%printer for \c node as \c code at \c loc. */ +void symbol_list_printer_set (symbol_list *node, char const *code, + location loc); + +#endif /* !SYMLIST_H_ */ diff --git a/src/symtab.c b/src/symtab.c new file mode 100644 index 0000000..1db83f6 --- /dev/null +++ b/src/symtab.c @@ -0,0 +1,952 @@ +/* Symbol table manager for Bison. + + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include + +#include "complain.h" +#include "gram.h" +#include "symtab.h" + +/*------------------------. +| Distinguished symbols. | +`------------------------*/ + +symbol *errtoken = NULL; +symbol *undeftoken = NULL; +symbol *endtoken = NULL; +symbol *accept = NULL; +symbol *startsymbol = NULL; +location startsymbol_location; + +/*---------------------------------------. +| Default %destructor's and %printer's. | +`---------------------------------------*/ + +static code_props default_tagged_destructor = CODE_PROPS_NONE_INIT; +static code_props default_tagless_destructor = CODE_PROPS_NONE_INIT; +static code_props default_tagged_printer = CODE_PROPS_NONE_INIT; +static code_props default_tagless_printer = CODE_PROPS_NONE_INIT; + +/*---------------------------------. +| Create a new symbol, named TAG. | +`---------------------------------*/ + +static symbol * +symbol_new (uniqstr tag, location loc) +{ + symbol *res = xmalloc (sizeof *res); + + uniqstr_assert (tag); + res->tag = tag; + res->location = loc; + + res->type_name = NULL; + code_props_none_init (&res->destructor); + code_props_none_init (&res->printer); + + res->number = NUMBER_UNDEFINED; + res->prec = 0; + res->assoc = undef_assoc; + res->user_token_number = USER_NUMBER_UNDEFINED; + + res->alias = NULL; + res->class = unknown_sym; + res->declared = false; + + if (nsyms == SYMBOL_NUMBER_MAXIMUM) + fatal (_("too many symbols in input grammar (limit is %d)"), + SYMBOL_NUMBER_MAXIMUM); + nsyms++; + return res; +} + +/*----------------------------------------. +| Create a new semantic type, named TAG. | +`----------------------------------------*/ + +static semantic_type * +semantic_type_new (uniqstr tag) +{ + semantic_type *res = xmalloc (sizeof *res); + + uniqstr_assert (tag); + res->tag = tag; + code_props_none_init (&res->destructor); + code_props_none_init (&res->printer); + + return res; +} + + +/*-----------------. +| Print a symbol. | +`-----------------*/ + +#define SYMBOL_ATTR_PRINT(Attr) \ + if (s->Attr) \ + fprintf (f, " %s { %s }", #Attr, s->Attr) + +#define SYMBOL_CODE_PRINT(Attr) \ + if (s->Attr.code) \ + fprintf (f, " %s { %s }", #Attr, s->Attr.code) + +void +symbol_print (symbol *s, FILE *f) +{ + if (s) + { + fprintf (f, "\"%s\"", s->tag); + SYMBOL_ATTR_PRINT (type_name); + SYMBOL_CODE_PRINT (destructor); + SYMBOL_CODE_PRINT (printer); + } + else + fprintf (f, ""); +} + +#undef SYMBOL_ATTR_PRINT +#undef SYMBOL_CODE_PRINT + +/*------------------------------------------------------------------. +| Complain that S's WHAT is redeclared at SECOND, and was first set | +| at FIRST. | +`------------------------------------------------------------------*/ + +static void +symbol_redeclaration (symbol *s, const char *what, location first, + location second) +{ + complain_at (second, _("%s redeclaration for %s"), what, s->tag); + complain_at (first, _("previous declaration")); +} + +static void +semantic_type_redeclaration (semantic_type *s, const char *what, location first, + location second) +{ + complain_at (second, _("%s redeclaration for <%s>"), what, s->tag); + complain_at (first, _("previous declaration")); +} + + +/*-----------------------------------------------------------------. +| Set the TYPE_NAME associated with SYM. Does nothing if passed 0 | +| as TYPE_NAME. | +`-----------------------------------------------------------------*/ + +void +symbol_type_set (symbol *sym, uniqstr type_name, location loc) +{ + if (type_name) + { + if (sym->type_name) + symbol_redeclaration (sym, "%type", sym->type_location, loc); + uniqstr_assert (type_name); + sym->type_name = type_name; + sym->type_location = loc; + } +} + +/*-----------------------------------. +| Get the CLASS associated with SYM. | +`-----------------------------------*/ + +const char * +symbol_class_get_string (symbol *sym) +{ + if (sym->class) + { + if (sym->class == token_sym) + return "terminal"; + else if (sym->class == nterm_sym) + return "nonterminal"; + } + return "unknown"; +} + + +/*-----------------------------------------. +| Set the DESTRUCTOR associated with SYM. | +`-----------------------------------------*/ + +void +symbol_destructor_set (symbol *sym, code_props const *destructor) +{ + if (sym->destructor.code) + symbol_redeclaration (sym, "%destructor", sym->destructor.location, + destructor->location); + sym->destructor = *destructor; +} + +/*------------------------------------------. +| Set the DESTRUCTOR associated with TYPE. | +`------------------------------------------*/ + +void +semantic_type_destructor_set (semantic_type *type, + code_props const *destructor) +{ + if (type->destructor.code) + semantic_type_redeclaration (type, "%destructor", + type->destructor.location, + destructor->location); + type->destructor = *destructor; +} + +/*---------------------------------------. +| Get the computed %destructor for SYM. | +`---------------------------------------*/ + +code_props const * +symbol_destructor_get (symbol const *sym) +{ + /* Per-symbol %destructor. */ + if (sym->destructor.code) + return &sym->destructor; + + /* Per-type %destructor. */ + if (sym->type_name) + { + code_props const *destructor = + &semantic_type_get (sym->type_name)->destructor; + if (destructor->code) + return destructor; + } + + /* Apply default %destructor's only to user-defined symbols. */ + if (sym->tag[0] == '$' || sym == errtoken) + return &code_props_none; + + if (sym->type_name) + return &default_tagged_destructor; + return &default_tagless_destructor; +} + +/*--------------------------------------. +| Set the PRINTER associated with SYM. | +`--------------------------------------*/ + +void +symbol_printer_set (symbol *sym, code_props const *printer) +{ + if (sym->printer.code) + symbol_redeclaration (sym, "%printer", + sym->printer.location, printer->location); + sym->printer = *printer; +} + +/*---------------------------------------. +| Set the PRINTER associated with TYPE. | +`---------------------------------------*/ + +void +semantic_type_printer_set (semantic_type *type, code_props const *printer) +{ + if (type->printer.code) + semantic_type_redeclaration (type, "%printer", + type->printer.location, printer->location); + type->printer = *printer; +} + +/*------------------------------------. +| Get the computed %printer for SYM. | +`------------------------------------*/ + +code_props const * +symbol_printer_get (symbol const *sym) +{ + /* Per-symbol %printer. */ + if (sym->printer.code) + return &sym->printer; + + /* Per-type %printer. */ + if (sym->type_name) + { + code_props const *printer = &semantic_type_get (sym->type_name)->printer; + if (printer->code) + return printer; + } + + /* Apply the default %printer only to user-defined symbols. */ + if (sym->tag[0] == '$' || sym == errtoken) + return &code_props_none; + + if (sym->type_name) + return &default_tagged_printer; + return &default_tagless_printer; +} + +/*-----------------------------------------------------------------. +| Set the PRECEDENCE associated with SYM. Does nothing if invoked | +| with UNDEF_ASSOC as ASSOC. | +`-----------------------------------------------------------------*/ + +void +symbol_precedence_set (symbol *sym, int prec, assoc a, location loc) +{ + if (a != undef_assoc) + { + if (sym->prec != 0) + symbol_redeclaration (sym, assoc_to_string (a), sym->prec_location, + loc); + sym->prec = prec; + sym->assoc = a; + sym->prec_location = loc; + } + + /* Only terminals have a precedence. */ + symbol_class_set (sym, token_sym, loc, false); +} + + +/*------------------------------------. +| Set the CLASS associated with SYM. | +`------------------------------------*/ + +void +symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring) +{ + if (sym->class != unknown_sym && sym->class != class) + { + complain_at (loc, _("symbol %s redefined"), sym->tag); + sym->declared = false; + } + + if (class == nterm_sym && sym->class != nterm_sym) + sym->number = nvars++; + else if (class == token_sym && sym->number == NUMBER_UNDEFINED) + sym->number = ntokens++; + + sym->class = class; + + if (declaring) + { + if (sym->declared) + warn_at (loc, _("symbol %s redeclared"), sym->tag); + sym->declared = true; + } +} + + +/*------------------------------------------------. +| Set the USER_TOKEN_NUMBER associated with SYM. | +`------------------------------------------------*/ + +void +symbol_user_token_number_set (symbol *sym, int user_token_number, location loc) +{ + int *user_token_numberp; + + if (sym->user_token_number != USER_NUMBER_ALIAS) + user_token_numberp = &sym->user_token_number; + else + user_token_numberp = &sym->alias->user_token_number; + if (*user_token_numberp != USER_NUMBER_UNDEFINED + && *user_token_numberp != user_token_number) + complain_at (loc, _("redefining user token number of %s"), sym->tag); + + *user_token_numberp = user_token_number; + /* User defined $end token? */ + if (user_token_number == 0) + { + endtoken = sym; + endtoken->number = 0; + /* It is always mapped to 0, so it was already counted in + NTOKENS. */ + --ntokens; + } +} + + +/*----------------------------------------------------------. +| If SYM is not defined, report an error, and consider it a | +| nonterminal. | +`----------------------------------------------------------*/ + +static inline bool +symbol_check_defined (symbol *sym) +{ + if (sym->class == unknown_sym) + { + complain_at + (sym->location, + _("symbol %s is used, but is not defined as a token and has no rules"), + sym->tag); + sym->class = nterm_sym; + sym->number = nvars++; + } + + return true; +} + +static bool +symbol_check_defined_processor (void *sym, void *null ATTRIBUTE_UNUSED) +{ + return symbol_check_defined (sym); +} + + +/*------------------------------------------------------------------. +| Declare the new symbol SYM. Make it an alias of SYMVAL, and type | +| SYMVAL with SYM's type. | +`------------------------------------------------------------------*/ + +void +symbol_make_alias (symbol *sym, symbol *symval, location loc) +{ + if (symval->alias) + warn_at (loc, _("symbol `%s' used more than once as a literal string"), + symval->tag); + else if (sym->alias) + warn_at (loc, _("symbol `%s' given more than one literal string"), + sym->tag); + else + { + symval->class = token_sym; + symval->user_token_number = sym->user_token_number; + sym->user_token_number = USER_NUMBER_ALIAS; + symval->alias = sym; + sym->alias = symval; + symval->number = sym->number; + symbol_type_set (symval, sym->type_name, loc); + } +} + + +/*---------------------------------------------------------. +| Check that THIS, and its alias, have same precedence and | +| associativity. | +`---------------------------------------------------------*/ + +static inline void +symbol_check_alias_consistency (symbol *this) +{ + symbol *alias = this; + symbol *orig = this->alias; + + /* Check only those that _are_ the aliases. */ + if (!(this->alias && this->user_token_number == USER_NUMBER_ALIAS)) + return; + + if (orig->type_name != alias->type_name) + { + if (orig->type_name) + symbol_type_set (alias, orig->type_name, orig->type_location); + else + symbol_type_set (orig, alias->type_name, alias->type_location); + } + + + if (orig->destructor.code || alias->destructor.code) + { + if (orig->destructor.code) + symbol_destructor_set (alias, &orig->destructor); + else + symbol_destructor_set (orig, &alias->destructor); + } + + if (orig->printer.code || alias->printer.code) + { + if (orig->printer.code) + symbol_printer_set (alias, &orig->printer); + else + symbol_printer_set (orig, &alias->printer); + } + + if (alias->prec || orig->prec) + { + if (orig->prec) + symbol_precedence_set (alias, orig->prec, orig->assoc, + orig->prec_location); + else + symbol_precedence_set (orig, alias->prec, alias->assoc, + alias->prec_location); + } +} + +static bool +symbol_check_alias_consistency_processor (void *this, + void *null ATTRIBUTE_UNUSED) +{ + symbol_check_alias_consistency (this); + return true; +} + + +/*-------------------------------------------------------------------. +| Assign a symbol number, and write the definition of the token name | +| into FDEFINES. Put in SYMBOLS. | +`-------------------------------------------------------------------*/ + +static inline bool +symbol_pack (symbol *this) +{ + if (this->class == nterm_sym) + { + this->number += ntokens; + } + else if (this->alias) + { + /* This symbol and its alias are a single token defn. + Allocate a tokno, and assign to both check agreement of + prec and assoc fields and make both the same */ + if (this->number == NUMBER_UNDEFINED) + { + if (this == endtoken || this->alias == endtoken) + this->number = this->alias->number = 0; + else + { + aver (this->alias->number != NUMBER_UNDEFINED); + this->number = this->alias->number; + } + } + /* Do not do processing below for USER_NUMBER_ALIASes. */ + if (this->user_token_number == USER_NUMBER_ALIAS) + return true; + } + else /* this->class == token_sym */ + aver (this->number != NUMBER_UNDEFINED); + + symbols[this->number] = this; + return true; +} + +static bool +symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED) +{ + return symbol_pack (this); +} + + + + +/*--------------------------------------------------. +| Put THIS in TOKEN_TRANSLATIONS if it is a token. | +`--------------------------------------------------*/ + +static inline bool +symbol_translation (symbol *this) +{ + /* Non-terminal? */ + if (this->class == token_sym + && this->user_token_number != USER_NUMBER_ALIAS) + { + /* A token which translation has already been set? */ + if (token_translations[this->user_token_number] != undeftoken->number) + complain_at (this->location, + _("tokens %s and %s both assigned number %d"), + symbols[token_translations[this->user_token_number]]->tag, + this->tag, this->user_token_number); + + token_translations[this->user_token_number] = this->number; + } + + return true; +} + +static bool +symbol_translation_processor (void *this, void *null ATTRIBUTE_UNUSED) +{ + return symbol_translation (this); +} + + +/*---------------------------------------. +| Symbol and semantic type hash tables. | +`---------------------------------------*/ + +/* Initial capacity of symbol and semantic type hash table. */ +#define HT_INITIAL_CAPACITY 257 + +static struct hash_table *symbol_table = NULL; +static struct hash_table *semantic_type_table = NULL; + +static inline bool +hash_compare_symbol (const symbol *m1, const symbol *m2) +{ + /* Since tags are unique, we can compare the pointers themselves. */ + return UNIQSTR_EQ (m1->tag, m2->tag); +} + +static inline bool +hash_compare_semantic_type (const semantic_type *m1, const semantic_type *m2) +{ + /* Since names are unique, we can compare the pointers themselves. */ + return UNIQSTR_EQ (m1->tag, m2->tag); +} + +static bool +hash_symbol_comparator (void const *m1, void const *m2) +{ + return hash_compare_symbol (m1, m2); +} + +static bool +hash_semantic_type_comparator (void const *m1, void const *m2) +{ + return hash_compare_semantic_type (m1, m2); +} + +static inline size_t +hash_symbol (const symbol *m, size_t tablesize) +{ + /* Since tags are unique, we can hash the pointer itself. */ + return ((uintptr_t) m->tag) % tablesize; +} + +static inline size_t +hash_semantic_type (const semantic_type *m, size_t tablesize) +{ + /* Since names are unique, we can hash the pointer itself. */ + return ((uintptr_t) m->tag) % tablesize; +} + +static size_t +hash_symbol_hasher (void const *m, size_t tablesize) +{ + return hash_symbol (m, tablesize); +} + +static size_t +hash_semantic_type_hasher (void const *m, size_t tablesize) +{ + return hash_semantic_type (m, tablesize); +} + +/*-------------------------------. +| Create the symbol hash table. | +`-------------------------------*/ + +void +symbols_new (void) +{ + symbol_table = hash_initialize (HT_INITIAL_CAPACITY, + NULL, + hash_symbol_hasher, + hash_symbol_comparator, + free); + semantic_type_table = hash_initialize (HT_INITIAL_CAPACITY, + NULL, + hash_semantic_type_hasher, + hash_semantic_type_comparator, + free); +} + + +/*----------------------------------------------------------------. +| Find the symbol named KEY, and return it. If it does not exist | +| yet, create it. | +`----------------------------------------------------------------*/ + +symbol * +symbol_from_uniqstr (const uniqstr key, location loc) +{ + symbol probe; + symbol *entry; + + probe.tag = key; + entry = hash_lookup (symbol_table, &probe); + + if (!entry) + { + /* First insertion in the hash. */ + entry = symbol_new (key, loc); + hash_insert (symbol_table, entry); + } + return entry; +} + + +/*-----------------------------------------------------------------------. +| Find the semantic type named KEY, and return it. If it does not exist | +| yet, create it. | +`-----------------------------------------------------------------------*/ + +semantic_type * +semantic_type_from_uniqstr (const uniqstr key) +{ + semantic_type probe; + semantic_type *entry; + + probe.tag = key; + entry = hash_lookup (semantic_type_table, &probe); + + if (!entry) + { + /* First insertion in the hash. */ + entry = semantic_type_new (key); + hash_insert (semantic_type_table, entry); + } + return entry; +} + + +/*----------------------------------------------------------------. +| Find the symbol named KEY, and return it. If it does not exist | +| yet, create it. | +`----------------------------------------------------------------*/ + +symbol * +symbol_get (const char *key, location loc) +{ + return symbol_from_uniqstr (uniqstr_new (key), loc); +} + + +/*-----------------------------------------------------------------------. +| Find the semantic type named KEY, and return it. If it does not exist | +| yet, create it. | +`-----------------------------------------------------------------------*/ + +semantic_type * +semantic_type_get (const char *key) +{ + return semantic_type_from_uniqstr (uniqstr_new (key)); +} + + +/*------------------------------------------------------------------. +| Generate a dummy nonterminal, whose name cannot conflict with the | +| user's names. | +`------------------------------------------------------------------*/ + +symbol * +dummy_symbol_get (location loc) +{ + /* Incremented for each generated symbol. */ + static int dummy_count = 0; + static char buf[256]; + + symbol *sym; + + sprintf (buf, "$@%d", ++dummy_count); + sym = symbol_get (buf, loc); + sym->class = nterm_sym; + sym->number = nvars++; + return sym; +} + +bool +symbol_is_dummy (const symbol *sym) +{ + return sym->tag[0] == '@' || (sym->tag[0] == '$' && sym->tag[1] == '@'); +} + +/*-------------------. +| Free the symbols. | +`-------------------*/ + +void +symbols_free (void) +{ + hash_free (symbol_table); + hash_free (semantic_type_table); + free (symbols); +} + + +/*---------------------------------------------------------------. +| Look for undefined symbols, report an error, and consider them | +| terminals. | +`---------------------------------------------------------------*/ + +static void +symbols_do (Hash_processor processor, void *processor_data) +{ + hash_do_for_each (symbol_table, processor, processor_data); +} + + +/*--------------------------------------------------------------. +| Check that all the symbols are defined. Report any undefined | +| symbols and consider them nonterminals. | +`--------------------------------------------------------------*/ + +void +symbols_check_defined (void) +{ + symbols_do (symbol_check_defined_processor, NULL); +} + +/*------------------------------------------------------------------. +| Set TOKEN_TRANSLATIONS. Check that no two symbols share the same | +| number. | +`------------------------------------------------------------------*/ + +static void +symbols_token_translations_init (void) +{ + bool num_256_available_p = true; + int i; + + /* Find the highest user token number, and whether 256, the POSIX + preferred user token number for the error token, is used. */ + max_user_token_number = 0; + for (i = 0; i < ntokens; ++i) + { + symbol *this = symbols[i]; + if (this->user_token_number != USER_NUMBER_UNDEFINED) + { + if (this->user_token_number > max_user_token_number) + max_user_token_number = this->user_token_number; + if (this->user_token_number == 256) + num_256_available_p = false; + } + } + + /* If 256 is not used, assign it to error, to follow POSIX. */ + if (num_256_available_p + && errtoken->user_token_number == USER_NUMBER_UNDEFINED) + errtoken->user_token_number = 256; + + /* Set the missing user numbers. */ + if (max_user_token_number < 256) + max_user_token_number = 256; + + for (i = 0; i < ntokens; ++i) + { + symbol *this = symbols[i]; + if (this->user_token_number == USER_NUMBER_UNDEFINED) + this->user_token_number = ++max_user_token_number; + if (this->user_token_number > max_user_token_number) + max_user_token_number = this->user_token_number; + } + + token_translations = xnmalloc (max_user_token_number + 1, + sizeof *token_translations); + + /* Initialize all entries for literal tokens to 2, the internal + token number for $undefined, which represents all invalid inputs. + */ + for (i = 0; i < max_user_token_number + 1; i++) + token_translations[i] = undeftoken->number; + symbols_do (symbol_translation_processor, NULL); +} + + +/*----------------------------------------------------------------. +| Assign symbol numbers, and write definition of token names into | +| FDEFINES. Set up vectors SYMBOL_TABLE, TAGS of symbols. | +`----------------------------------------------------------------*/ + +void +symbols_pack (void) +{ + symbols_do (symbol_check_alias_consistency_processor, NULL); + + symbols = xcalloc (nsyms, sizeof *symbols); + symbols_do (symbol_pack_processor, NULL); + + /* Aliases leave empty slots in symbols, so remove them. */ + { + int writei; + int readi; + int nsyms_old = nsyms; + for (writei = 0, readi = 0; readi < nsyms_old; readi += 1) + { + if (symbols[readi] == NULL) + { + nsyms -= 1; + ntokens -= 1; + } + else + { + symbols[writei] = symbols[readi]; + symbols[writei]->number = writei; + if (symbols[writei]->alias) + symbols[writei]->alias->number = writei; + writei += 1; + } + } + } + symbols = xnrealloc (symbols, nsyms, sizeof *symbols); + + symbols_token_translations_init (); + + if (startsymbol->class == unknown_sym) + fatal_at (startsymbol_location, + _("the start symbol %s is undefined"), + startsymbol->tag); + else if (startsymbol->class == token_sym) + fatal_at (startsymbol_location, + _("the start symbol %s is a token"), + startsymbol->tag); +} + + +/*--------------------------------------------------. +| Set default tagged/tagless %destructor/%printer. | +`--------------------------------------------------*/ + +void +default_tagged_destructor_set (code_props const *destructor) +{ + if (default_tagged_destructor.code) + { + complain_at (destructor->location, + _("redeclaration for default tagged %%destructor")); + complain_at (default_tagged_destructor.location, + _("previous declaration")); + } + default_tagged_destructor = *destructor; +} + +void +default_tagless_destructor_set (code_props const *destructor) +{ + if (default_tagless_destructor.code) + { + complain_at (destructor->location, + _("redeclaration for default tagless %%destructor")); + complain_at (default_tagless_destructor.location, + _("previous declaration")); + } + default_tagless_destructor = *destructor; +} + +void +default_tagged_printer_set (code_props const *printer) +{ + if (default_tagged_printer.code) + { + complain_at (printer->location, + _("redeclaration for default tagged %%printer")); + complain_at (default_tagged_printer.location, + _("previous declaration")); + } + default_tagged_printer = *printer; +} + +void +default_tagless_printer_set (code_props const *printer) +{ + if (default_tagless_printer.code) + { + complain_at (printer->location, + _("redeclaration for default tagless %%printer")); + complain_at (default_tagless_printer.location, + _("previous declaration")); + } + default_tagless_printer = *printer; +} diff --git a/src/symtab.h b/src/symtab.h new file mode 100644 index 0000000..fe37716 --- /dev/null +++ b/src/symtab.h @@ -0,0 +1,249 @@ +/* Definitions for symtab.c and callers, part of Bison. + + Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +/** + * \file symtab.h + * \brief Manipulating ::symbol. + */ + +#ifndef SYMTAB_H_ +# define SYMTAB_H_ + +# include "assoc.h" +# include "location.h" +# include "scan-code.h" +# include "uniqstr.h" + +/*----------. +| Symbols. | +`----------*/ + +/** Symbol classes. */ +typedef enum +{ + unknown_sym, /**< Undefined. */ + token_sym, /**< Terminal. */ + nterm_sym /**< Non-terminal. */ +} symbol_class; + + +/** Internal token numbers. */ +typedef int symbol_number; +#define SYMBOL_NUMBER_MAXIMUM INT_MAX + + +typedef struct symbol symbol; + +/* When extending this structure, be sure to complete + symbol_check_alias_consistency. */ +struct symbol +{ + /** The key, name of the symbol. */ + uniqstr tag; + /** The location of its first occurrence. */ + location location; + + /** Its \c \%type. */ + uniqstr type_name; + /** Its \c \%type's location. */ + location type_location; + + /** Any \c \%destructor declared specifically for this symbol. + + Access this field only through symbol's interface functions. For + example, if symbol::destructor = NULL, a default \c \%destructor + or a per-type \c \%destructor might be appropriate, and + \c symbol_destructor_get will compute the correct one. */ + code_props destructor; + + /** Any \c \%printer declared specifically for this symbol. + + Access this field only through symbol's interface functions. + \sa symbol::destructor */ + code_props printer; + + symbol_number number; + location prec_location; + int prec; + assoc assoc; + int user_token_number; + + /* Points to the other in the identifier-symbol pair for an alias. + Special value USER_NUMBER_ALIAS in the identifier half of the + identifier-symbol pair for an alias. */ + symbol *alias; + symbol_class class; + bool declared; +}; + +/** Undefined user number. */ +#define USER_NUMBER_UNDEFINED -1 + +/* `symbol->user_token_number == USER_NUMBER_ALIAS' means this symbol + *has* (not is) a string literal alias. For instance, `%token foo + "foo"' has `"foo"' numbered regularly, and `foo' numbered as + USER_NUMBER_ALIAS. */ +#define USER_NUMBER_ALIAS -9991 + +/* Undefined internal token number. */ +#define NUMBER_UNDEFINED (-1) + +/** Print a symbol (for debugging). */ +void symbol_print (symbol *s, FILE *f); + +/** Fetch (or create) the symbol associated to KEY. */ +symbol *symbol_from_uniqstr (const uniqstr key, location loc); + +/** Fetch (or create) the symbol associated to KEY. */ +symbol *symbol_get (const char *key, location loc); + +/** Generate a dummy nonterminal. + + Its name cannot conflict with the user's names. */ +symbol *dummy_symbol_get (location loc); + +/** Is this a dummy nonterminal? */ +bool symbol_is_dummy (const symbol *sym); + +/** Declare the new symbol \c sym. Make it an alias of \c symval. */ +void symbol_make_alias (symbol *sym, symbol *symval, location loc); + +/** Set the \c type_name associated with \c sym. + + Do nothing if passed 0 as \c type_name. */ +void symbol_type_set (symbol *sym, uniqstr type_name, location loc); + +/** Get the \c class string associated with \c sym. */ +const char *symbol_class_get_string (symbol *sym); + +/** Set the \c destructor associated with \c sym. */ +void symbol_destructor_set (symbol *sym, code_props const *destructor); + +/** Get the computed \c \%destructor for \c sym, which was initialized with + \c code_props_none_init if there's no \c \%destructor. */ +code_props const *symbol_destructor_get (symbol const *sym); + +/** Set the \c printer associated with \c sym. */ +void symbol_printer_set (symbol *sym, code_props const *printer); + +/** Get the computed \c \%printer for \c sym, which was initialized with + \c code_props_none_init if there's no \c \%printer. */ +code_props const *symbol_printer_get (symbol const *sym); + +/* Set the \c precedence associated with \c sym. + + Ensure that \a symbol is a terminal. + Do nothing if invoked with \c undef_assoc as \c assoc. */ +void symbol_precedence_set (symbol *sym, int prec, assoc a, location loc); + +/** Set the \c class associated with \c sym. */ +void symbol_class_set (symbol *sym, symbol_class class, location loc, + bool declaring); + +/** Set the \c user_token_number associated with \c sym. */ +void symbol_user_token_number_set (symbol *sym, int user_number, location loc); + + +/** The error token. */ +extern symbol *errtoken; +/** The token for unknown tokens. */ +extern symbol *undeftoken; +/** The end of input token. */ +extern symbol *endtoken; +/** The genuine start symbol. + + $accept: start-symbol $end */ +extern symbol *accept; + +/** The user start symbol. */ +extern symbol *startsymbol; +/** The location of the \c \%start declaration. */ +extern location startsymbol_location; + + +/*-----------------. +| Semantic types. | +`-----------------*/ + +/** A semantic type and its associated \c \%destructor and \c \%printer. + + Access the fields of this struct only through the interface functions in + this file. \sa symbol::destructor */ +typedef struct { + /** The key, name of the semantic type. */ + uniqstr tag; + + /** Any \c %destructor declared for this semantic type. */ + code_props destructor; + /** Any \c %printer declared for this semantic type. */ + code_props printer; +} semantic_type; + +/** Fetch (or create) the semantic type associated to KEY. */ +semantic_type *semantic_type_from_uniqstr (const uniqstr key); + +/** Fetch (or create) the semantic type associated to KEY. */ +semantic_type *semantic_type_get (const char *key); + +/** Set the \c destructor associated with \c type. */ +void semantic_type_destructor_set (semantic_type *type, + code_props const *destructor); + +/** Set the \c printer associated with \c type. */ +void semantic_type_printer_set (semantic_type *type, + code_props const *printer); + +/*----------------------------------. +| Symbol and semantic type tables. | +`----------------------------------*/ + +/** Create the symbol and semantic type tables. */ +void symbols_new (void); + +/** Free all the memory allocated for symbols and semantic types. */ +void symbols_free (void); + +/** Check that all the symbols are defined. + + Report any undefined symbols and consider them nonterminals. */ +void symbols_check_defined (void); + +/** Sanity checks and #token_translations construction. + + Perform various sanity checks, assign symbol numbers, and set up + #token_translations. */ +void symbols_pack (void); + + +/*---------------------------------------. +| Default %destructor's and %printer's. | +`---------------------------------------*/ + +/** Set the default \c \%destructor for tagged values. */ +void default_tagged_destructor_set (code_props const *destructor); +/** Set the default \c \%destructor for tagless values. */ +void default_tagless_destructor_set (code_props const *destructor); + +/** Set the default \c \%printer for tagged values. */ +void default_tagged_printer_set (code_props const *printer); +/** Set the default \c \%printer for tagless values. */ +void default_tagless_printer_set (code_props const *printer); + +#endif /* !SYMTAB_H_ */ diff --git a/src/system.h b/src/system.h new file mode 100644 index 0000000..57a432d --- /dev/null +++ b/src/system.h @@ -0,0 +1,219 @@ +/* System-dependent definitions for Bison. + + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 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 . */ + +#ifndef BISON_SYSTEM_H +#define BISON_SYSTEM_H + +/* flex 2.5.31 gratutiously defines macros like INT8_MIN. But this + runs afoul of pre-C99 compilers that have or + , which are included below if available. It also runs + afoul of pre-C99 compilers that define these macros in . */ +#if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901 +# undef INT8_MIN +# undef INT16_MIN +# undef INT32_MIN +# undef INT8_MAX +# undef INT16_MAX +# undef UINT8_MAX +# undef INT32_MAX +# undef UINT16_MAX +# undef UINT32_MAX +#endif + +#include +#include +#include +#include + +#if HAVE_SYS_TYPES_H +# include +#endif + +#include +#include + +#ifndef UINTPTR_MAX +/* This isn't perfect, but it's good enough for Bison, which needs + only to hash pointers. */ +typedef size_t uintptr_t; +#endif + + +/*---------. +| Gnulib. | +`---------*/ + +#include +#include +#include + + +/*-----------------. +| GCC extensions. | +`-----------------*/ + +/* Use this to suppress gcc's `...may be used before initialized' + warnings. */ +#ifdef lint +# define IF_LINT(Code) Code +#else +# define IF_LINT(Code) /* empty */ +#endif + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__) +# define __attribute__(Spec) /* empty */ +# endif +#endif + +/* The __-protected variants of `format' and `printf' attributes + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +# define __format__ format +# define __printf__ printf +#endif + +#ifndef ATTRIBUTE_NORETURN +# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +#endif + +#ifndef ATTRIBUTE_UNUSED +# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#endif + +#define FUNCTION_PRINT() fprintf (stderr, "%s: ", __func__) + +/*------. +| NLS. | +`------*/ + +#include + +#include +#define _(Msgid) gettext (Msgid) +#define N_(Msgid) (Msgid) + + +/*-----------. +| Booleans. | +`-----------*/ + +#include + + + +/*-------------. +| Assertions. | +`-------------*/ + +/* 's assertions are too heavyweight, and can be disabled + too easily, so use aver rather than assert. */ +static inline void +aver (bool assertion) +{ + if (! assertion) + abort (); +} + + +/*-----------. +| Obstacks. | +`-----------*/ + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free +#include + +#define obstack_sgrow(Obs, Str) \ + obstack_grow (Obs, Str, strlen (Str)) + +#define obstack_fgrow1(Obs, Format, Arg1) \ +do { \ + char buf[4096]; \ + sprintf (buf, Format, Arg1); \ + obstack_grow (Obs, buf, strlen (buf)); \ +} while (0) + +#define obstack_fgrow2(Obs, Format, Arg1, Arg2) \ +do { \ + char buf[4096]; \ + sprintf (buf, Format, Arg1, Arg2); \ + obstack_grow (Obs, buf, strlen (buf)); \ +} while (0) + +#define obstack_fgrow3(Obs, Format, Arg1, Arg2, Arg3) \ +do { \ + char buf[4096]; \ + sprintf (buf, Format, Arg1, Arg2, Arg3); \ + obstack_grow (Obs, buf, strlen (buf)); \ +} while (0) + +#define obstack_fgrow4(Obs, Format, Arg1, Arg2, Arg3, Arg4) \ +do { \ + char buf[4096]; \ + sprintf (buf, Format, Arg1, Arg2, Arg3, Arg4); \ + obstack_grow (Obs, buf, strlen (buf)); \ +} while (0) + + + +/*-----------------------------------------. +| Extensions to use for the output files. | +`-----------------------------------------*/ + +#ifndef OUTPUT_EXT +# define OUTPUT_EXT ".output" +#endif + +#ifndef TAB_EXT +# define TAB_EXT ".tab" +#endif + +#ifndef DEFAULT_TMPDIR +# define DEFAULT_TMPDIR "/tmp" +#endif + + + +/*---------------------. +| Free a linked list. | +`---------------------*/ + +#define LIST_FREE(Type, List) \ +do { \ + Type *_node, *_next; \ + for (_node = List; _node; _node = _next) \ + { \ + _next = _node->next; \ + free (_node); \ + } \ +} while (0) + + +/*---------------------------------------------. +| Debugging memory allocation (must be last). | +`---------------------------------------------*/ + +# if WITH_DMALLOC +# define DMALLOC_FUNC_CHECK +# include +# endif /* WITH_DMALLOC */ + +#endif /* ! BISON_SYSTEM_H */ diff --git a/src/tables.c b/src/tables.c new file mode 100644 index 0000000..e22b089 --- /dev/null +++ b/src/tables.c @@ -0,0 +1,859 @@ +/* Output the generated parsing program for Bison. + + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, + 2005, 2006 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include + +#include "complain.h" +#include "conflicts.h" +#include "files.h" +#include "getargs.h" +#include "gram.h" +#include "lalr.h" +#include "reader.h" +#include "symtab.h" +#include "tables.h" + +/* Several tables are indexed both by state and nonterminal numbers. + We call such an index a `vector'; i.e., a vector is either a state + or a nonterminal number. + + Of course vector_number_t ought to be wide enough to contain + state_number and symbol_number. */ +typedef int vector_number; + +#if 0 /* Not currently used. */ +static inline vector_number +state_number_to_vector_number (state_number s) +{ + return s; +} +#endif + +static inline vector_number +symbol_number_to_vector_number (symbol_number sym) +{ + return state_number_as_int (nstates) + sym - ntokens; +} + +int nvectors; + + +/* FROMS and TOS are indexed by vector_number. + + If VECTOR is a nonterminal, (FROMS[VECTOR], TOS[VECTOR]) form an + array of state numbers of the non defaulted GOTO on VECTOR. + + If VECTOR is a state, TOS[VECTOR] is the array of actions to do on + the (array of) symbols FROMS[VECTOR]. + + In both cases, TALLY[VECTOR] is the size of the arrays + FROMS[VECTOR], TOS[VECTOR]; and WIDTH[VECTOR] = + (FROMS[VECTOR][SIZE] - FROMS[VECTOR][0] + 1) where SIZE = + TALLY[VECTOR]. + + FROMS therefore contains symbol_number and action_number, + TOS state_number and action_number, + TALLY sizes, + WIDTH differences of FROMS. + + Let base_number be the type of FROMS, TOS, and WIDTH. */ +#define BASE_MAXIMUM INT_MAX +#define BASE_MINIMUM INT_MIN + +static base_number **froms; +static base_number **tos; +static unsigned int **conflict_tos; +static int *tally; +static base_number *width; + + +/* For a given state, N = ACTROW[SYMBOL]: + + If N = 0, stands for `run the default action'. + If N = MIN, stands for `raise a syntax error'. + If N > 0, stands for `shift SYMBOL and go to n'. + If N < 0, stands for `reduce -N'. */ +typedef int action_number; +#define ACTION_NUMBER_MINIMUM INT_MIN + +static action_number *actrow; + +/* FROMS and TOS are reordered to be compressed. ORDER[VECTOR] is the + new vector number of VECTOR. We skip `empty' vectors (i.e., + TALLY[VECTOR] = 0), and call these `entries'. */ +static vector_number *order; +static int nentries; + +base_number *base = NULL; +/* A distinguished value of BASE, negative infinite. During the + computation equals to BASE_MINIMUM, later mapped to BASE_NINF to + keep parser tables small. */ +base_number base_ninf = 0; +static base_number *pos = NULL; + +static unsigned int *conflrow; +unsigned int *conflict_table; +unsigned int *conflict_list; +int conflict_list_cnt; +static int conflict_list_free; + +/* TABLE_SIZE is the allocated size of both TABLE and CHECK. We start + with more or less the original hard-coded value (which was + SHRT_MAX). */ +static int table_size = 32768; +base_number *table; +base_number *check; +/* The value used in TABLE to denote explicit syntax errors + (%nonassoc), a negative infinite. First defaults to ACTION_NUMBER_MININUM, + but in order to keep small tables, renumbered as TABLE_ERROR, which + is the smallest (non error) value minus 1. */ +base_number table_ninf = 0; +static int lowzero; +int high; + +state_number *yydefgoto; +rule_number *yydefact; + +/*----------------------------------------------------------------. +| If TABLE (and CHECK) appear to be small to be addressed at | +| DESIRED, grow them. Note that TABLE[DESIRED] is to be used, so | +| the desired size is at least DESIRED + 1. | +`----------------------------------------------------------------*/ + +static void +table_grow (int desired) +{ + int old_size = table_size; + + while (table_size <= desired) + table_size *= 2; + + if (trace_flag & trace_resource) + fprintf (stderr, "growing table and check from: %d to %d\n", + old_size, table_size); + + table = xnrealloc (table, table_size, sizeof *table); + conflict_table = xnrealloc (conflict_table, table_size, + sizeof *conflict_table); + check = xnrealloc (check, table_size, sizeof *check); + + for (/* Nothing. */; old_size < table_size; ++old_size) + { + table[old_size] = 0; + conflict_table[old_size] = 0; + check[old_size] = -1; + } +} + + + + +/*-------------------------------------------------------------------. +| For GLR parsers, for each conflicted token in S, as indicated | +| by non-zero entries in CONFLROW, create a list of possible | +| reductions that are alternatives to the shift or reduction | +| currently recorded for that token in S. Store the alternative | +| reductions followed by a 0 in CONFLICT_LIST, updating | +| CONFLICT_LIST_CNT, and storing an index to the start of the list | +| back into CONFLROW. | +`-------------------------------------------------------------------*/ + +static void +conflict_row (state *s) +{ + int i, j; + reductions *reds = s->reductions; + + if (!nondeterministic_parser) + return; + + for (j = 0; j < ntokens; j += 1) + if (conflrow[j]) + { + conflrow[j] = conflict_list_cnt; + + /* Find all reductions for token J, and record all that do not + match ACTROW[J]. */ + for (i = 0; i < reds->num; i += 1) + if (bitset_test (reds->lookahead_tokens[i], j) + && (actrow[j] + != rule_number_as_item_number (reds->rules[i]->number))) + { + aver (0 < conflict_list_free); + conflict_list[conflict_list_cnt] = reds->rules[i]->number + 1; + conflict_list_cnt += 1; + conflict_list_free -= 1; + } + + /* Leave a 0 at the end. */ + aver (0 < conflict_list_free); + conflict_list[conflict_list_cnt] = 0; + conflict_list_cnt += 1; + conflict_list_free -= 1; + } +} + + +/*------------------------------------------------------------------. +| Decide what to do for each type of token if seen as the | +| lookahead in specified state. The value returned is used as the | +| default action (yydefact) for the state. In addition, ACTROW is | +| filled with what to do for each kind of token, index by symbol | +| number, with zero meaning do the default action. The value | +| ACTION_NUMBER_MINIMUM, a very negative number, means this | +| situation is an error. The parser recognizes this value | +| specially. | +| | +| This is where conflicts are resolved. The loop over lookahead | +| rules considered lower-numbered rules last, and the last rule | +| considered that likes a token gets to handle it. | +| | +| For GLR parsers, also sets CONFLROW[SYM] to an index into | +| CONFLICT_LIST iff there is an unresolved conflict (s/r or r/r) | +| with symbol SYM. The default reduction is not used for a symbol | +| that has any such conflicts. | +`------------------------------------------------------------------*/ + +static rule * +action_row (state *s) +{ + int i; + rule *default_rule = NULL; + reductions *reds = s->reductions; + transitions *trans = s->transitions; + errs *errp = s->errs; + /* Set to nonzero to inhibit having any default reduction. */ + bool nodefault = false; + bool conflicted = false; + + for (i = 0; i < ntokens; i++) + actrow[i] = conflrow[i] = 0; + + if (reds->lookahead_tokens) + { + int j; + bitset_iterator biter; + /* loop over all the rules available here which require + lookahead (in reverse order to give precedence to the first + rule) */ + for (i = reds->num - 1; i >= 0; --i) + /* and find each token which the rule finds acceptable + to come next */ + BITSET_FOR_EACH (biter, reds->lookahead_tokens[i], j, 0) + { + /* and record this rule as the rule to use if that + token follows. */ + if (actrow[j] != 0) + { + conflicted = true; + conflrow[j] = 1; + } + actrow[j] = rule_number_as_item_number (reds->rules[i]->number); + } + } + + /* Now see which tokens are allowed for shifts in this state. For + them, record the shift as the thing to do. So shift is preferred + to reduce. */ + FOR_EACH_SHIFT (trans, i) + { + symbol_number sym = TRANSITION_SYMBOL (trans, i); + state *shift_state = trans->states[i]; + + if (actrow[sym] != 0) + { + conflicted = true; + conflrow[sym] = 1; + } + actrow[sym] = state_number_as_int (shift_state->number); + + /* Do not use any default reduction if there is a shift for + error */ + if (sym == errtoken->number) + nodefault = true; + } + + /* See which tokens are an explicit error in this state (due to + %nonassoc). For them, record ACTION_NUMBER_MINIMUM as the + action. */ + for (i = 0; i < errp->num; i++) + { + symbol *sym = errp->symbols[i]; + actrow[sym->number] = ACTION_NUMBER_MINIMUM; + } + + /* Now find the most common reduction and make it the default action + for this state. */ + + if (reds->num >= 1 && !nodefault) + { + if (s->consistent) + default_rule = reds->rules[0]; + else + { + int max = 0; + for (i = 0; i < reds->num; i++) + { + int count = 0; + rule *r = reds->rules[i]; + symbol_number j; + + for (j = 0; j < ntokens; j++) + if (actrow[j] == rule_number_as_item_number (r->number)) + count++; + + if (count > max) + { + max = count; + default_rule = r; + } + } + + /* GLR parsers need space for conflict lists, so we can't + default conflicted entries. For non-conflicted entries + or as long as we are not building a GLR parser, + actions that match the default are replaced with zero, + which means "use the default". */ + + if (max > 0) + { + int j; + for (j = 0; j < ntokens; j++) + if (actrow[j] == rule_number_as_item_number (default_rule->number) + && ! (nondeterministic_parser && conflrow[j])) + actrow[j] = 0; + } + } + } + + /* If have no default rule, the default is an error. + So replace any action which says "error" with "use default". */ + + if (!default_rule) + for (i = 0; i < ntokens; i++) + if (actrow[i] == ACTION_NUMBER_MINIMUM) + actrow[i] = 0; + + if (conflicted) + conflict_row (s); + + return default_rule; +} + + +/*----------------------------------------. +| Set FROMS, TOS, TALLY and WIDTH for S. | +`----------------------------------------*/ + +static void +save_row (state_number s) +{ + symbol_number i; + int count; + base_number *sp; + base_number *sp1; + base_number *sp2; + unsigned int *sp3; + + /* Number of non default actions in S. */ + count = 0; + for (i = 0; i < ntokens; i++) + if (actrow[i] != 0) + count++; + + if (count == 0) + return; + + /* Allocate non defaulted actions. */ + froms[s] = sp = sp1 = xnmalloc (count, sizeof *sp1); + tos[s] = sp2 = xnmalloc (count, sizeof *sp2); + conflict_tos[s] = sp3 = + nondeterministic_parser ? xnmalloc (count, sizeof *sp3) : NULL; + + /* Store non defaulted actions. */ + for (i = 0; i < ntokens; i++) + if (actrow[i] != 0) + { + *sp1++ = i; + *sp2++ = actrow[i]; + if (nondeterministic_parser) + *sp3++ = conflrow[i]; + } + + tally[s] = count; + width[s] = sp1[-1] - sp[0] + 1; +} + + +/*------------------------------------------------------------------. +| Figure out the actions for the specified state, indexed by | +| lookahead token type. | +| | +| The YYDEFACT table is output now. The detailed info is saved for | +| putting into YYTABLE later. | +`------------------------------------------------------------------*/ + +static void +token_actions (void) +{ + state_number i; + symbol_number j; + rule_number r; + + int nconflict = nondeterministic_parser ? conflicts_total_count () : 0; + + yydefact = xnmalloc (nstates, sizeof *yydefact); + + actrow = xnmalloc (ntokens, sizeof *actrow); + conflrow = xnmalloc (ntokens, sizeof *conflrow); + + conflict_list = xnmalloc (1 + 2 * nconflict, sizeof *conflict_list); + conflict_list_free = 2 * nconflict; + conflict_list_cnt = 1; + + /* Find the rules which are reduced. */ + if (!nondeterministic_parser) + for (r = 0; r < nrules; ++r) + rules[r].useful = false; + + for (i = 0; i < nstates; ++i) + { + rule *default_rule = action_row (states[i]); + yydefact[i] = default_rule ? default_rule->number + 1 : 0; + save_row (i); + + /* Now that the parser was computed, we can find which rules are + really reduced, and which are not because of SR or RR + conflicts. */ + if (!nondeterministic_parser) + { + for (j = 0; j < ntokens; ++j) + if (actrow[j] < 0 && actrow[j] != ACTION_NUMBER_MINIMUM) + rules[item_number_as_rule_number (actrow[j])].useful = true; + if (yydefact[i]) + rules[yydefact[i] - 1].useful = true; + } + } + + free (actrow); + free (conflrow); +} + + +/*------------------------------------------------------------------. +| Compute FROMS[VECTOR], TOS[VECTOR], TALLY[VECTOR], WIDTH[VECTOR], | +| i.e., the information related to non defaulted GOTO on the nterm | +| SYM. | +| | +| DEFAULT_STATE is the principal destination on SYM, i.e., the | +| default GOTO destination on SYM. | +`------------------------------------------------------------------*/ + +static void +save_column (symbol_number sym, state_number default_state) +{ + goto_number i; + base_number *sp; + base_number *sp1; + base_number *sp2; + int count; + vector_number symno = symbol_number_to_vector_number (sym); + + goto_number begin = goto_map[sym - ntokens]; + goto_number end = goto_map[sym - ntokens + 1]; + + /* Number of non default GOTO. */ + count = 0; + for (i = begin; i < end; i++) + if (to_state[i] != default_state) + count++; + + if (count == 0) + return; + + /* Allocate room for non defaulted gotos. */ + froms[symno] = sp = sp1 = xnmalloc (count, sizeof *sp1); + tos[symno] = sp2 = xnmalloc (count, sizeof *sp2); + + /* Store the state numbers of the non defaulted gotos. */ + for (i = begin; i < end; i++) + if (to_state[i] != default_state) + { + *sp1++ = from_state[i]; + *sp2++ = to_state[i]; + } + + tally[symno] = count; + width[symno] = sp1[-1] - sp[0] + 1; +} + + +/*-------------------------------------------------------------. +| Return `the' most common destination GOTO on SYM (a nterm). | +`-------------------------------------------------------------*/ + +static state_number +default_goto (symbol_number sym, size_t state_count[]) +{ + state_number s; + goto_number i; + goto_number m = goto_map[sym - ntokens]; + goto_number n = goto_map[sym - ntokens + 1]; + state_number default_state = -1; + size_t max = 0; + + if (m == n) + return -1; + + for (s = 0; s < nstates; s++) + state_count[s] = 0; + + for (i = m; i < n; i++) + state_count[to_state[i]]++; + + for (s = 0; s < nstates; s++) + if (state_count[s] > max) + { + max = state_count[s]; + default_state = s; + } + + return default_state; +} + + +/*-------------------------------------------------------------------. +| Figure out what to do after reducing with each rule, depending on | +| the saved state from before the beginning of parsing the data that | +| matched this rule. | +| | +| The YYDEFGOTO table is output now. The detailed info is saved for | +| putting into YYTABLE later. | +`-------------------------------------------------------------------*/ + +static void +goto_actions (void) +{ + symbol_number i; + size_t *state_count = xnmalloc (nstates, sizeof *state_count); + yydefgoto = xnmalloc (nvars, sizeof *yydefgoto); + + /* For a given nterm I, STATE_COUNT[S] is the number of times there + is a GOTO to S on I. */ + for (i = ntokens; i < nsyms; ++i) + { + state_number default_state = default_goto (i, state_count); + save_column (i, default_state); + yydefgoto[i - ntokens] = default_state; + } + free (state_count); +} + + +/*------------------------------------------------------------------. +| Compute ORDER, a reordering of vectors, in order to decide how to | +| pack the actions and gotos information into yytable. | +`------------------------------------------------------------------*/ + +static void +sort_actions (void) +{ + int i; + + nentries = 0; + + for (i = 0; i < nvectors; i++) + if (tally[i] > 0) + { + int k; + int t = tally[i]; + int w = width[i]; + int j = nentries - 1; + + while (j >= 0 && (width[order[j]] < w)) + j--; + + while (j >= 0 && (width[order[j]] == w) && (tally[order[j]] < t)) + j--; + + for (k = nentries - 1; k > j; k--) + order[k + 1] = order[k]; + + order[j + 1] = i; + nentries++; + } +} + + +/* If VECTOR is a state which actions (reflected by FROMS, TOS, TALLY + and WIDTH of VECTOR) are common to a previous state, return this + state number. + + In any other case, return -1. */ + +static state_number +matching_state (vector_number vector) +{ + vector_number i = order[vector]; + int t; + int w; + int prev; + + /* If VECTOR is a nterm, return -1. */ + if (nstates <= i) + return -1; + + t = tally[i]; + w = width[i]; + + /* If VECTOR has GLR conflicts, return -1 */ + if (conflict_tos[i] != NULL) + { + int j; + for (j = 0; j < t; j += 1) + if (conflict_tos[i][j] != 0) + return -1; + } + + for (prev = vector - 1; prev >= 0; prev--) + { + vector_number j = order[prev]; + int k; + int match = 1; + + /* Given how ORDER was computed, if the WIDTH or TALLY is + different, there cannot be a matching state. */ + if (width[j] != w || tally[j] != t) + return -1; + + for (k = 0; match && k < t; k++) + if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k] + || (conflict_tos[j] != NULL && conflict_tos[j][k] != 0)) + match = 0; + + if (match) + return j; + } + + return -1; +} + + +static base_number +pack_vector (vector_number vector) +{ + vector_number i = order[vector]; + int j; + int t = tally[i]; + int loc = 0; + base_number *from = froms[i]; + base_number *to = tos[i]; + unsigned int *conflict_to = conflict_tos[i]; + + aver (t != 0); + + for (j = lowzero - from[0]; ; j++) + { + int k; + bool ok = true; + + aver (j < table_size); + + for (k = 0; ok && k < t; k++) + { + loc = j + state_number_as_int (from[k]); + if (table_size <= loc) + table_grow (loc); + + if (table[loc] != 0) + ok = false; + } + + for (k = 0; ok && k < vector; k++) + if (pos[k] == j) + ok = false; + + if (ok) + { + for (k = 0; k < t; k++) + { + loc = j + from[k]; + table[loc] = to[k]; + if (nondeterministic_parser && conflict_to != NULL) + conflict_table[loc] = conflict_to[k]; + check[loc] = from[k]; + } + + while (table[lowzero] != 0) + lowzero++; + + if (loc > high) + high = loc; + + aver (BASE_MINIMUM <= j && j <= BASE_MAXIMUM); + return j; + } + } +} + + +/*-------------------------------------------------------------. +| Remap the negative infinite in TAB from NINF to the greatest | +| possible smallest value. Return it. | +| | +| In most case this allows us to use shorts instead of ints in | +| parsers. | +`-------------------------------------------------------------*/ + +static base_number +table_ninf_remap (base_number tab[], int size, base_number ninf) +{ + base_number res = 0; + int i; + + for (i = 0; i < size; i++) + if (tab[i] < res && tab[i] != ninf) + res = tab[i]; + + --res; + + for (i = 0; i < size; i++) + if (tab[i] == ninf) + tab[i] = res; + + return res; +} + +static void +pack_table (void) +{ + int i; + + base = xnmalloc (nvectors, sizeof *base); + pos = xnmalloc (nentries, sizeof *pos); + table = xcalloc (table_size, sizeof *table); + conflict_table = xcalloc (table_size, sizeof *conflict_table); + check = xnmalloc (table_size, sizeof *check); + + lowzero = 0; + high = 0; + + for (i = 0; i < nvectors; i++) + base[i] = BASE_MINIMUM; + + for (i = 0; i < table_size; i++) + check[i] = -1; + + for (i = 0; i < nentries; i++) + { + state_number s = matching_state (i); + base_number place; + + if (s < 0) + /* A new set of state actions, or a nonterminal. */ + place = pack_vector (i); + else + /* Action of I were already coded for S. */ + place = base[s]; + + pos[i] = place; + base[order[i]] = place; + } + + /* Use the greatest possible negative infinites. */ + base_ninf = table_ninf_remap (base, nvectors, BASE_MINIMUM); + table_ninf = table_ninf_remap (table, high + 1, ACTION_NUMBER_MINIMUM); + + free (pos); +} + + + +/*-----------------------------------------------------------------. +| Compute and output yydefact, yydefgoto, yypact, yypgoto, yytable | +| and yycheck. | +`-----------------------------------------------------------------*/ + +void +tables_generate (void) +{ + int i; + + /* This is a poor way to make sure the sizes are properly + correlated. In particular the signedness is not taken into + account. But it's not useless. */ + verify (sizeof nstates <= sizeof nvectors + && sizeof nvars <= sizeof nvectors); + + nvectors = state_number_as_int (nstates) + nvars; + + froms = xcalloc (nvectors, sizeof *froms); + tos = xcalloc (nvectors, sizeof *tos); + conflict_tos = xcalloc (nvectors, sizeof *conflict_tos); + tally = xcalloc (nvectors, sizeof *tally); + width = xnmalloc (nvectors, sizeof *width); + + token_actions (); + + goto_actions (); + free (goto_map); + free (from_state); + free (to_state); + + order = xcalloc (nvectors, sizeof *order); + sort_actions (); + pack_table (); + free (order); + + free (tally); + free (width); + + for (i = 0; i < nvectors; i++) + { + free (froms[i]); + free (tos[i]); + free (conflict_tos[i]); + } + + free (froms); + free (tos); + free (conflict_tos); +} + + +/*-------------------------. +| Free the parser tables. | +`-------------------------*/ + +void +tables_free (void) +{ + free (base); + free (conflict_table); + free (conflict_list); + free (table); + free (check); + free (yydefgoto); + free (yydefact); +} diff --git a/src/tables.h b/src/tables.h new file mode 100644 index 0000000..b0fbe9a --- /dev/null +++ b/src/tables.h @@ -0,0 +1,117 @@ +/* Prepare the LALR and GLR parser tables. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef TABLES_H_ +# define TABLES_H_ + +# include "state.h" + +/* The parser tables consist of these tables. + + YYTRANSLATE = vector mapping yylex's token numbers into bison's + token numbers. + + YYTNAME = vector of string-names indexed by bison token number. + + YYTOKNUM = vector of yylex token numbers corresponding to entries + in YYTNAME. + + YYRLINE = vector of line-numbers of all rules. For yydebug + printouts. + + YYRHS = vector of items of all rules. This is exactly what RITEMS + contains. For yydebug and for semantic parser. + + YYPRHS[R] = index in YYRHS of first item for rule R. + + YYR1[R] = symbol number of symbol that rule R derives. + + YYR2[R] = number of symbols composing right hand side of rule R. + + YYSTOS[S] = the symbol number of the symbol that leads to state S. + + YYDEFACT[S] = default rule to reduce with in state s, when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. + + YYDEFGOTO[I] = default state to go to after a reduction of a rule + that generates variable NTOKENS + I, except when YYTABLE specifies + something else to do. + + YYPACT[S] = index in YYTABLE of the portion describing state S. + The lookahead token's type is used to index that portion to find + out what to do. + + If the value in YYTABLE is positive, we shift the token and go to + that state. + + If the value is negative, it is minus a rule number to reduce by. + + If the value is zero, the default action from YYDEFACT[S] is used. + + YYPGOTO[I] = the index in YYTABLE of the portion describing what to + do after reducing a rule that derives variable I + NTOKENS. This + portion is indexed by the parser state number, S, as of before the + text for this nonterminal was read. The value from YYTABLE is the + state to go to if the corresponding value in YYCHECK is S. + + YYTABLE = a vector filled with portions for different uses, found + via YYPACT and YYPGOTO. + + YYCHECK = a vector indexed in parallel with YYTABLE. It indicates, + in a roundabout way, the bounds of the portion you are trying to + examine. + + Suppose that the portion of YYTABLE starts at index P and the index + to be examined within the portion is I. Then if YYCHECK[P+I] != I, + I is outside the bounds of what is actually allocated, and the + default (from YYDEFACT or YYDEFGOTO) should be used. Otherwise, + YYTABLE[P+I] should be used. + + YYFINAL = the state number of the termination state. + + YYLAST ( = high) the number of the last element of YYTABLE, i.e., + sizeof (YYTABLE) - 1. */ + +extern int nvectors; + +typedef int base_number; +extern base_number *base; +/* A distinguished value of BASE, negative infinite. During the + computation equals to BASE_MINIMUM, later mapped to BASE_NINF to + keep parser tables small. */ +extern base_number base_ninf; + +extern unsigned int *conflict_table; +extern unsigned int *conflict_list; +extern int conflict_list_cnt; + +extern base_number *table; +extern base_number *check; +/* The value used in TABLE to denote explicit syntax errors + (%nonassoc), a negative infinite. */ +extern base_number table_ninf; + +extern state_number *yydefgoto; +extern rule_number *yydefact; +extern int high; + +void tables_generate (void); +void tables_free (void); + +#endif /* !TABLES_H_ */ diff --git a/src/uniqstr.c b/src/uniqstr.c new file mode 100644 index 0000000..644477b --- /dev/null +++ b/src/uniqstr.c @@ -0,0 +1,151 @@ +/* Keep a unique copy of strings. + + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#include +#include "system.h" + +#include +#include +#include + +#include "uniqstr.h" + +/*-----------------------. +| A uniqstr hash table. | +`-----------------------*/ + +/* Initial capacity of uniqstr hash table. */ +#define HT_INITIAL_CAPACITY 257 + +static struct hash_table *uniqstrs_table = NULL; + +/*-------------------------------------. +| Create the uniqstr for S if needed. | +`-------------------------------------*/ + +uniqstr +uniqstr_new (char const *str) +{ + uniqstr res = hash_lookup (uniqstrs_table, str); + if (!res) + { + /* First insertion in the hash. */ + res = xstrdup (str); + hash_insert (uniqstrs_table, res); + } + return res; +} + + +/*------------------------------. +| Abort if S is not a uniqstr. | +`------------------------------*/ + +void +uniqstr_assert (char const *str) +{ + if (!hash_lookup (uniqstrs_table, str)) + { + error (0, 0, + "not a uniqstr: %s", quotearg (str)); + abort (); + } +} + + +/*--------------------. +| Print the uniqstr. | +`--------------------*/ + +static inline bool +uniqstr_print (uniqstr ustr) +{ + fprintf (stderr, "%s\n", ustr); + return true; +} + +static bool +uniqstr_print_processor (void *ustr, void *null ATTRIBUTE_UNUSED) +{ + return uniqstr_print (ustr); +} + + +/*-----------------------. +| A uniqstr hash table. | +`-----------------------*/ + +static bool +hash_compare_uniqstr (void const *m1, void const *m2) +{ + return strcmp (m1, m2) == 0; +} + +static size_t +hash_uniqstr (void const *m, size_t tablesize) +{ + return hash_string (m, tablesize); +} + +/*----------------------------. +| Create the uniqstrs table. | +`----------------------------*/ + +void +uniqstrs_new (void) +{ + uniqstrs_table = hash_initialize (HT_INITIAL_CAPACITY, + NULL, + hash_uniqstr, + hash_compare_uniqstr, + free); +} + + +/*-------------------------------------. +| Perform a task on all the uniqstrs. | +`-------------------------------------*/ + +static void +uniqstrs_do (Hash_processor processor, void *processor_data) +{ + hash_do_for_each (uniqstrs_table, processor, processor_data); +} + + +/*-----------------. +| Print them all. | +`-----------------*/ + +void +uniqstrs_print (void) +{ + uniqstrs_do (uniqstr_print_processor, NULL); +} + + +/*--------------------. +| Free the uniqstrs. | +`--------------------*/ + +void +uniqstrs_free (void) +{ + hash_free (uniqstrs_table); +} diff --git a/src/uniqstr.h b/src/uniqstr.h new file mode 100644 index 0000000..3eb152d --- /dev/null +++ b/src/uniqstr.h @@ -0,0 +1,51 @@ +/* Keeping a unique copy of strings. + + Copyright (C) 2002, 2003 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + 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 . */ + +#ifndef UNIQSTR_H_ +# define UNIQSTR_H_ + +/*-----------------------------------------. +| Pointers to unique copies of C strings. | +`-----------------------------------------*/ + +typedef char const *uniqstr; + +/* Return the uniqstr for STR. */ +uniqstr uniqstr_new (char const *str); + +/* Two uniqstr values have the same value iff they are the same. */ +#define UNIQSTR_EQ(USTR1, USTR2) ((USTR1) == (USTR2)) + +/*--------------------------------------. +| Initializing, destroying, debugging. | +`--------------------------------------*/ + +/* Create the string table. */ +void uniqstrs_new (void); + +/* Die if STR is not a uniqstr. */ +void uniqstr_assert (char const *str); + +/* Free all the memory allocated for symbols. */ +void uniqstrs_free (void); + +/* Report them all. */ +void uniqstrs_print (void); + +#endif /* ! defined UNIQSTR_H_ */ diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..f686fdb --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,103 @@ +## Process this file with automake to create Makefile.in. + +## Makefile for Bison testsuite. + +## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 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 . + +EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 + +DISTCLEANFILES = atconfig $(check_SCRIPTS) +MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) + +## ------------ ## +## package.m4. ## +## ------------ ## + +$(srcdir)/package.m4: $(top_srcdir)/configure + { \ + echo '# Signature of the current package.'; \ + echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \ + echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \ + echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \ + echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \ + } >$(srcdir)/package.m4 + +## ------------ ## +## Test suite. ## +## ------------ ## + +TESTSUITE_AT = \ + local.at \ + testsuite.at \ + input.at \ + output.at sets.at reduce.at skeletons.at \ + synclines.at headers.at actions.at conflicts.at \ + calc.at \ + torture.at existing.at regression.at \ + c++.at \ + java.at \ + cxx-type.at glr-regression.at \ + push.at + +TESTSUITE = $(srcdir)/testsuite + +AUTOTEST = $(AUTOM4TE) --language=autotest +$(TESTSUITE): package.m4 $(TESTSUITE_AT) + $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp + mv $@.tmp $@ + +atconfig: $(top_builddir)/config.status + cd $(top_builddir) && ./config.status tests/$@ + +clean-local: + test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean + +check-local: atconfig atlocal $(TESTSUITE) + $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS) + +check_SCRIPTS = bison + +# Run the test suite on the *installed* tree. +installcheck-local: + $(SHELL) $(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS) + +# Be real mean with it. +.PHONY: maintainer-check-g++ +maintainer-check-g++: $(TESTSUITE) + $(TESTSUITE) CC='$(CXX)' + +.PHONY: maintainer-check-posix +maintainer-check-posix: $(TESTSUITE) + $(TESTSUITE) POSIXLY_CORRECT=1 _POSIX2_VERSION=200112 + +.PHONY: maintainer-check-valgrind +maintainer-check-valgrind: $(TESTSUITE) + test -z '$(VALGRIND)' || \ + VALGRIND_OPTS='--leak-check=full --show-reachable=yes' \ + $(TESTSUITE) PREBISON='$(VALGRIND) -q' PREPARSER='$(VALGRIND) -q' + +.PHONY: maintainer-check +maintainer-check: maintainer-check-posix maintainer-check-valgrind maintainer-check-g++ + +.PHONY: maintainer-push-check +maintainer-push-check: + BISON_USE_PUSH_FOR_PULL=1 $(MAKE) $(AM_MAKEFLAGS) maintainer-check + +.PHONY: maintainer-xml-check +maintainer-xml-check: + BISON_TEST_XML=1 $(MAKE) $(AM_MAKEFLAGS) maintainer-check diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..65bb5bb --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,706 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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 . +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = tests +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/atlocal.in $(srcdir)/bison.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/argmatch.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/c-working.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cxx.m4 \ + $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ + $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/hash.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/include_next.m4 \ + $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/javacomp.m4 $(top_srcdir)/m4/javaexec.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/m4.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \ + $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = atlocal bison +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH = @CLASSPATH@ +CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ +CONF_JAVA = @CONF_JAVA@ +CONF_JAVAC = @CONF_JAVAC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +GCC = @GCC@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNULIB_ATOLL = @GNULIB_ATOLL@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ +GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FSYNC = @GNULIB_FSYNC@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ +GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ +GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PUTENV = @GNULIB_PUTENV@ +GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ +GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_RPMATCH = @GNULIB_RPMATCH@ +GNULIB_SETENV = @GNULIB_SETENV@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLL = @GNULIB_STRTOLL@ +GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ +GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WRITE = @GNULIB_WRITE@ +GREP = @GREP@ +HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GCJ_C = @HAVE_GCJ_C@ +HAVE_GCJ_IN_PATH = @HAVE_GCJ_IN_PATH@ +HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ +HAVE_GIJ = @HAVE_GIJ@ +HAVE_GIJ_IN_PATH = @HAVE_GIJ_IN_PATH@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_JAVA = @HAVE_JAVA@ +HAVE_JAVAC = @HAVE_JAVAC@ +HAVE_JAVAC_ENVVAR = @HAVE_JAVAC_ENVVAR@ +HAVE_JAVAC_IN_PATH = @HAVE_JAVAC_IN_PATH@ +HAVE_JAVA_ENVVAR = @HAVE_JAVA_ENVVAR@ +HAVE_JAVA_IN_PATH = @HAVE_JAVA_IN_PATH@ +HAVE_JIKES = @HAVE_JIKES@ +HAVE_JIKES_IN_PATH = @HAVE_JIKES_IN_PATH@ +HAVE_JRE = @HAVE_JRE@ +HAVE_JRE_IN_PATH = @HAVE_JRE_IN_PATH@ +HAVE_JVIEW = @HAVE_JVIEW@ +HAVE_JVIEW_IN_PATH = @HAVE_JVIEW_IN_PATH@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_RANDOM_R = @HAVE_RANDOM_R@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_RPMATCH = @HAVE_RPMATCH@ +HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOULL = @HAVE_STRTOULL@ +HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +HELP2MAN = @HELP2MAN@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTTYPES_H = @INTTYPES_H@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBBISON_LIBDEPS = @LIBBISON_LIBDEPS@ +LIBBISON_LTLIBDEPS = @LIBBISON_LTLIBDEPS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT_YEAR = @PACKAGE_COPYRIGHT_YEAR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WRITE = @REPLACE_WRITE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +USE_NLS = @USE_NLS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XSLTPROC = @XSLTPROC@ +YACC = @YACC@ +YACC_LIBRARY = @YACC_LIBRARY@ +YACC_SCRIPT = @YACC_SCRIPT@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +aclocaldir = @aclocaldir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 +DISTCLEANFILES = atconfig $(check_SCRIPTS) +MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) +TESTSUITE_AT = \ + local.at \ + testsuite.at \ + input.at \ + output.at sets.at reduce.at skeletons.at \ + synclines.at headers.at actions.at conflicts.at \ + calc.at \ + torture.at existing.at regression.at \ + c++.at \ + java.at \ + cxx-type.at glr-regression.at \ + push.at + +TESTSUITE = $(srcdir)/testsuite +AUTOTEST = $(AUTOM4TE) --language=autotest +check_SCRIPTS = bison +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +atlocal: $(top_builddir)/config.status $(srcdir)/atlocal.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +bison: $(top_builddir)/config.status $(srcdir)/bison.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: installcheck-local + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am check-local clean clean-generic \ + clean-local distclean distclean-generic distdir dvi dvi-am \ + html html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installcheck-local installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + + +$(srcdir)/package.m4: $(top_srcdir)/configure + { \ + echo '# Signature of the current package.'; \ + echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \ + echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \ + echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \ + echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \ + } >$(srcdir)/package.m4 +$(TESTSUITE): package.m4 $(TESTSUITE_AT) + $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp + mv $@.tmp $@ + +atconfig: $(top_builddir)/config.status + cd $(top_builddir) && ./config.status tests/$@ + +clean-local: + test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean + +check-local: atconfig atlocal $(TESTSUITE) + $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS) + +# Run the test suite on the *installed* tree. +installcheck-local: + $(SHELL) $(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS) + +# Be real mean with it. +.PHONY: maintainer-check-g++ +maintainer-check-g++: $(TESTSUITE) + $(TESTSUITE) CC='$(CXX)' + +.PHONY: maintainer-check-posix +maintainer-check-posix: $(TESTSUITE) + $(TESTSUITE) POSIXLY_CORRECT=1 _POSIX2_VERSION=200112 + +.PHONY: maintainer-check-valgrind +maintainer-check-valgrind: $(TESTSUITE) + test -z '$(VALGRIND)' || \ + VALGRIND_OPTS='--leak-check=full --show-reachable=yes' \ + $(TESTSUITE) PREBISON='$(VALGRIND) -q' PREPARSER='$(VALGRIND) -q' + +.PHONY: maintainer-check +maintainer-check: maintainer-check-posix maintainer-check-valgrind maintainer-check-g++ + +.PHONY: maintainer-push-check +maintainer-push-check: + BISON_USE_PUSH_FOR_PULL=1 $(MAKE) $(AM_MAKEFLAGS) maintainer-check + +.PHONY: maintainer-xml-check +maintainer-xml-check: + BISON_TEST_XML=1 $(MAKE) $(AM_MAKEFLAGS) maintainer-check +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/actions.at b/tests/actions.at new file mode 100644 index 0000000..602eac8 --- /dev/null +++ b/tests/actions.at @@ -0,0 +1,1306 @@ +# Executing Actions. -*- Autotest -*- +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 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 . + +AT_BANNER([[User Actions.]]) + +## ------------------ ## +## Mid-rule actions. ## +## ------------------ ## + +AT_SETUP([Mid-rule actions]) + +# Bison once forgot the mid-rule actions. It was because the action +# was attached to the host rule (the one with the mid-rule action), +# instead of being attached to the empty rule dedicated to this +# action. + +AT_DATA_GRAMMAR([[input.y]], +[[%error-verbose +%debug +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +%} +%% +exp: { putchar ('0'); } + '1' { putchar ('1'); } + '2' { putchar ('2'); } + '3' { putchar ('3'); } + '4' { putchar ('4'); } + '5' { putchar ('5'); } + '6' { putchar ('6'); } + '7' { putchar ('7'); } + '8' { putchar ('8'); } + '9' { putchar ('9'); } + { putchar ('\n'); } + ; +%% +static int +yylex (void) +{ + static char const input[] = "123456789"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +]]) + +AT_BISON_CHECK([-d -v -o input.c input.y]) +AT_COMPILE([input]) +AT_PARSER_CHECK([./input], 0, +[[0123456789 +]]) + +AT_CLEANUP + + + + + +## ---------------- ## +## Exotic Dollars. ## +## ---------------- ## + +AT_SETUP([Exotic Dollars]) + +AT_DATA_GRAMMAR([[input.y]], +[[%error-verbose +%debug +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(Var) +%} + +%union +{ + int val; +}; + +%type a_1 a_2 a_5 + sum_of_the_five_previous_values + +%% +exp: a_1 a_2 { $$ = 3; } { $$ = $3 + 1; } a_5 + sum_of_the_five_previous_values + { + USE (($1, $2, $3, $4, $5)); + printf ("%d\n", $6); + } +; +a_1: { $$ = 1; }; +a_2: { $$ = 2; }; +a_5: { $$ = 5; }; + +sum_of_the_five_previous_values: + { + $$ = $0 + $-1 + $-2 + $-3 + $-4; + } +; + +%% +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return EOF; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +]]) + +AT_BISON_CHECK([-d -v -o input.c input.y], 0) +AT_COMPILE([input]) +AT_PARSER_CHECK([./input], 0, +[[15 +]]) + +AT_CLEANUP + + + +## -------------------------- ## +## Printers and Destructors. ## +## -------------------------- ## + +# _AT_CHECK_PRINTER_AND_DESTRUCTOR($1, $2, $3, $4, BISON-DIRECTIVE, UNION-FLAG) +# ----------------------------------------------------------------------------- +m4_define([_AT_CHECK_PRINTER_AND_DESTRUCTOR], +[# Make sure complex $n work. +m4_if([$1$2$3], $[1]$[2]$[3], [], + [m4_fatal([$0: Invalid arguments: $@])])dnl + +# Be sure to pass all the %directives to this macro to have correct +# helping macros. So don't put any directly in the Bison file. +AT_BISON_OPTION_PUSHDEFS([$5]) +AT_DATA_GRAMMAR([[input.y]], +[[%code requires { +#include +#include +#include +#include + +#define YYINITDEPTH 10 +#define YYMAXDEPTH 10 +]AT_LALR1_CC_IF( + [#define RANGE(Location) (Location).begin.line, (Location).end.line], + [#define RANGE(Location) (Location).first_line, (Location).last_line]) +[} + +$5] +m4_ifval([$6], [%union +{ + int ival; +}]) +AT_LALR1_CC_IF([%define global_tokens_and_yystype]) +m4_ifval([$6], [[%code provides {]], [[%code {]]) +AT_LALR1_CC_IF([typedef yy::location YYLTYPE;]) +[static int yylex (]AT_LEX_FORMALS[); +]AT_LALR1_CC_IF([], [static void yyerror (const char *msg);]) +[} + +]m4_ifval([$6], [%type '(' 'x' 'y' ')' ';' thing line input END])[ + +/* FIXME: This %printer isn't actually tested. */ +%printer + { + ]AT_LALR1_CC_IF([debug_stream () << $$;], + [fprintf (yyoutput, "%d", $$)])[; + } + input line thing 'x' 'y' + +%destructor + { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } + input + +%destructor + { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } + line + +%destructor + { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } + thing + +%destructor + { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'x' + +%destructor + { printf ("Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'y' + +%token END 0 +%destructor + { printf ("Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } + END + +%% +/* + This grammar is made to exercise error recovery. + "Lines" starting with `(' support error recovery, with + ')' as synchronizing token. Lines starting with 'x' can never + be recovered from if in error. +*/ + +input: + /* Nothing. */ + { + $$ = 0; + printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); + } +| line input /* Right recursive to load the stack so that popping at + END can be exercised. */ + { + $$ = 2; + printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); + } +; + +line: + thing thing thing ';' + { + $$ = $1; + printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); + } +| '(' error ')' + { + $$ = -1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) error (@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), RANGE (@2), $3, RANGE (@3)); + } +; + +thing: + 'x' + { + $$ = $1; + printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1)); + } +; +%% +/* Alias to ARGV[1]. */ +const char *source = 0; + +static int +yylex (]AT_LEX_FORMALS[) +{ + static unsigned int counter = 0; + + int c = ]AT_VAL[]m4_ifval([$6], [.ival])[ = counter++; + /* As in BASIC, line numbers go from 10 to 10. */ +]AT_LALR1_CC_IF( +[ AT_LOC.begin.line = AT_LOC.begin.column = 10 * c; + AT_LOC.end.line = AT_LOC.end.column = AT_LOC.begin.line + 9; +], +[ AT_LOC.first_line = AT_LOC.first_column = 10 * c; + AT_LOC.last_line = AT_LOC.last_column = AT_LOC.first_line + 9; +])[ + + if (! (0 <= c && c <= strlen (source))) + abort (); + if (source[c]) + printf ("sending: '%c'", source[c]); + else + printf ("sending: END"); + printf (" (%d@%d-%d)\n", c, RANGE (]AT_LOC[)); + return source[c]; +} + +]AT_LALR1_CC_IF( +[/* A C++ error reporting function. */ +void +yy::parser::error (const location& l, const std::string& m) +{ + printf ("%d-%d: %s\n", RANGE (l), m.c_str()); +} + +static bool yydebug; +int +yyparse () +{ + yy::parser parser; + parser.set_debug_level (yydebug); + return parser.parse (); +} +], +[static void +yyerror (const char *msg) +{ + printf ("%d-%d: %s\n", RANGE (yylloc), msg); +}])[ + +int +main (int argc, const char *argv[]) +{ + int status; + yydebug = !!getenv ("YYDEBUG"); + assert (argc == 2); + source = argv[1]; + status = yyparse (); + switch (status) + { + case 0: printf ("Successful parse.\n"); break; + case 1: printf ("Parsing FAILED.\n"); break; + default: printf ("Parsing FAILED (status %d).\n", status); break; + } + return status; +} +]]) + +AT_LALR1_CC_IF( + [AT_BISON_CHECK([-o input.cc input.y]) + AT_COMPILE_CXX([input])], + [AT_BISON_CHECK([-o input.c input.y]) + AT_COMPILE([input])]) + + +# Check the location of "empty" +# ----------------------------- +# I.e., epsilon-reductions, as in "(x)" which ends by reducing +# an empty "line" nterm. +# FIXME: This location is not satisfying. Depend on the lookahead? +AT_PARSER_CHECK([./input '(x)'], 0, +[[sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (0@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +]]) + + +# Check locations in error recovery +# --------------------------------- +# '(y)' is an error, but can be recovered from. But what's the location +# of the error itself ('y'), and of the resulting reduction ('(error)'). +AT_PARSER_CHECK([./input '(y)'], 0, +[[sending: '(' (0@0-9) +sending: 'y' (1@10-19) +10-19: syntax error, unexpected 'y', expecting 'x' +Freeing token 'y' (1@10-19) +sending: ')' (2@20-29) +line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (-1@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +]]) + + +# Syntax errors caught by the parser +# ---------------------------------- +# Exercise the discarding of stack top and input until `error' +# can be reduced. +# +# '(', 'x', 'x', 'x', 'x', 'x', ')', +# +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'y' +AT_PARSER_CHECK([./input '(xxxxx)(x)(x)y'], 1, +[[sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: 'x' (2@20-29) +thing (2@20-29): 'x' (2@20-29) +sending: 'x' (3@30-39) +30-39: syntax error, unexpected 'x', expecting ')' +Freeing nterm thing (2@20-29) +Freeing nterm thing (1@10-19) +Freeing token 'x' (3@30-39) +sending: 'x' (4@40-49) +Freeing token 'x' (4@40-49) +sending: 'x' (5@50-59) +Freeing token 'x' (5@50-59) +sending: ')' (6@60-69) +line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) +sending: '(' (7@70-79) +sending: 'x' (8@80-89) +thing (8@80-89): 'x' (8@80-89) +sending: ')' (9@90-99) +line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) +sending: '(' (10@100-109) +sending: 'x' (11@110-119) +thing (11@110-119): 'x' (11@110-119) +sending: ')' (12@120-129) +line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) +sending: 'y' (13@130-139) +input (0@129-129): /* Nothing */ +input (2@100-129): line (10@100-129) input (0@129-129) +input (2@70-129): line (7@70-99) input (2@100-129) +input (2@0-129): line (-1@0-69) input (2@70-129) +130-139: syntax error, unexpected 'y', expecting END +Freeing nterm input (2@0-129) +Freeing token 'y' (13@130-139) +Parsing FAILED. +]]) + + +# Syntax error caught by the parser where lookahead = END +# -------------------------------------------------------- +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'x' +AT_PARSER_CHECK([./input '(x)(x)x'], 1, +[[sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: 'x' (6@60-69) +thing (6@60-69): 'x' (6@60-69) +sending: END (7@70-79) +70-79: syntax error, unexpected END, expecting 'x' +Freeing nterm thing (6@60-69) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Freeing token END (7@70-79) +Parsing FAILED. +]]) + + +# Check destruction upon stack overflow +# ------------------------------------- +# Upon stack overflow, all symbols on the stack should be destroyed. +# Only check for yacc.c. +AT_YACC_IF([ +AT_PARSER_CHECK([./input '(x)(x)(x)(x)(x)(x)(x)'], 2, +[[sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: '(' (6@60-69) +sending: 'x' (7@70-79) +thing (7@70-79): 'x' (7@70-79) +sending: ')' (8@80-89) +line (6@60-89): '(' (6@60-69) thing (7@70-79) ')' (8@80-89) +sending: '(' (9@90-99) +sending: 'x' (10@100-109) +thing (10@100-109): 'x' (10@100-109) +sending: ')' (11@110-119) +line (9@90-119): '(' (9@90-99) thing (10@100-109) ')' (11@110-119) +sending: '(' (12@120-129) +sending: 'x' (13@130-139) +thing (13@130-139): 'x' (13@130-139) +sending: ')' (14@140-149) +line (12@120-149): '(' (12@120-129) thing (13@130-139) ')' (14@140-149) +sending: '(' (15@150-159) +sending: 'x' (16@160-169) +thing (16@160-169): 'x' (16@160-169) +sending: ')' (17@170-179) +line (15@150-179): '(' (15@150-159) thing (16@160-169) ')' (17@170-179) +sending: '(' (18@180-189) +sending: 'x' (19@190-199) +thing (19@190-199): 'x' (19@190-199) +sending: ')' (20@200-209) +200-209: memory exhausted +Freeing nterm thing (19@190-199) +Freeing nterm line (15@150-179) +Freeing nterm line (12@120-149) +Freeing nterm line (9@90-119) +Freeing nterm line (6@60-89) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Parsing FAILED (status 2). +]]) +]) + +]) + + +# AT_CHECK_PRINTER_AND_DESTRUCTOR([BISON-OPTIONS], [UNION-FLAG], [SKIP_FLAG]) +# --------------------------------------------------------------------------- +m4_define([AT_CHECK_PRINTER_AND_DESTRUCTOR], +[AT_SETUP([Printers and Destructors $2: $1]) + +$3 +_AT_CHECK_PRINTER_AND_DESTRUCTOR($[1], $[2], $[3], $[4], +[%error-verbose +%debug +%verbose +%locations +$1], [$2]) + +AT_CLEANUP +]) + + +AT_CHECK_PRINTER_AND_DESTRUCTOR([]) +AT_CHECK_PRINTER_AND_DESTRUCTOR([], [with union]) + +AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"]) +AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [with union]) + +AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser]) +AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [with union]) + + + +## ----------------------------------------- ## +## Default tagless %printer and %destructor. ## +## ----------------------------------------- ## + +# Check that the right %printer and %destructor are called, that they're not +# called for $end, and that $$ and @$ work correctly. + +AT_SETUP([Default tagless %printer and %destructor]) + +AT_DATA_GRAMMAR([[input.y]], +[[%error-verbose +%debug +%locations +%initial-action { + @$.first_line = @$.last_line = 1; + @$.first_column = @$.last_column = 1; +} + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%printer { + fprintf (yyoutput, "<*> printer should not be called.\n"); +} <*> + +%printer { + fprintf (yyoutput, "<> printer for '%c' @ %d", $$, @$.first_column); +} <> +%destructor { + fprintf (stdout, "<> destructor for '%c' @ %d.\n", $$, @$.first_column); +} <> + +%printer { + fprintf (yyoutput, "'b'/'c' printer for '%c' @ %d", $$, @$.first_column); +} 'b' 'c' +%destructor { + fprintf (stdout, "'b'/'c' destructor for '%c' @ %d.\n", $$, @$.first_column); +} 'b' 'c' + +%destructor { + fprintf (yyoutput, "<*> destructor should not be called.\n"); +} <*> + +%% + +start: 'a' 'b' 'c' 'd' 'e' { $$ = 'S'; USE(($1, $2, $3, $4, $5)); } ; + +%% + +static int +yylex (void) +{ + static char const input[] = "abcd"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylval = input[toknum++]; + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = toknum; + return yylval; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input]) +AT_PARSER_CHECK([./input], 1, +[[<> destructor for 'd' @ 4. +'b'/'c' destructor for 'c' @ 3. +'b'/'c' destructor for 'b' @ 2. +<> destructor for 'a' @ 1. +]], +[[Starting parse +Entering state 0 +Reading a token: Next token is token 'a' (1.1-1.1: <> printer for 'a' @ 1) +Shifting token 'a' (1.1-1.1: <> printer for 'a' @ 1) +Entering state 1 +Reading a token: Next token is token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2) +Shifting token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2) +Entering state 3 +Reading a token: Next token is token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3) +Shifting token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3) +Entering state 5 +Reading a token: Next token is token 'd' (1.4-1.4: <> printer for 'd' @ 4) +Shifting token 'd' (1.4-1.4: <> printer for 'd' @ 4) +Entering state 6 +Reading a token: Now at end of input. +syntax error, unexpected $end, expecting 'e' +Error: popping token 'd' (1.4-1.4: <> printer for 'd' @ 4) +Stack now 0 1 3 5 +Error: popping token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3) +Stack now 0 1 3 +Error: popping token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2) +Stack now 0 1 +Error: popping token 'a' (1.1-1.1: <> printer for 'a' @ 1) +Stack now 0 +Cleanup: discarding lookahead token $end (1.5-1.5: ) +Stack now 0 +]]) + +AT_CLEANUP + + + +## ------------------------------------------------------ ## +## Default tagged and per-type %printer and %destructor. ## +## ------------------------------------------------------ ## + +AT_SETUP([Default tagged and per-type %printer and %destructor]) + +AT_DATA_GRAMMAR([[input.y]], +[[%error-verbose +%debug + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%printer { + fprintf (yyoutput, "<> printer should not be called.\n"); +} <> + +%union { int field0; int field1; int field2; } +%type start 'a' 'g' +%type 'e' +%type 'f' +%printer { + fprintf (yyoutput, "<*>//e printer"); +} <*> 'e' +%destructor { + fprintf (stdout, "<*>//e destructor.\n"); +} <*> 'e' + +%type 'b' +%printer { fprintf (yyoutput, " printer"); } +%destructor { fprintf (stdout, " destructor.\n"); } + +%type 'c' +%printer { fprintf (yyoutput, "'c' printer"); } 'c' +%destructor { fprintf (stdout, "'c' destructor.\n"); } 'c' + +%type 'd' +%printer { fprintf (yyoutput, "'d' printer"); } 'd' +%destructor { fprintf (stdout, "'d' destructor.\n"); } 'd' + +%destructor { + fprintf (yyoutput, "<> destructor should not be called.\n"); +} <> + +%% + +start: + 'a' 'b' 'c' 'd' 'e' 'f' 'g' + { + USE(($1, $2, $3, $4, $5, $6, $7)); + $$ = 'S'; + } + ; + +%% + +static int +yylex (void) +{ + static char const input[] = "abcdef"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input]) +AT_PARSER_CHECK([./input], 1, +[[<*>//e destructor. +<*>//e destructor. +'d' destructor. +'c' destructor. + destructor. +<*>//e destructor. +]], +[[Starting parse +Entering state 0 +Reading a token: Next token is token 'a' (<*>//e printer) +Shifting token 'a' (<*>//e printer) +Entering state 1 +Reading a token: Next token is token 'b' ( printer) +Shifting token 'b' ( printer) +Entering state 3 +Reading a token: Next token is token 'c' ('c' printer) +Shifting token 'c' ('c' printer) +Entering state 5 +Reading a token: Next token is token 'd' ('d' printer) +Shifting token 'd' ('d' printer) +Entering state 6 +Reading a token: Next token is token 'e' (<*>//e printer) +Shifting token 'e' (<*>//e printer) +Entering state 7 +Reading a token: Next token is token 'f' (<*>//e printer) +Shifting token 'f' (<*>//e printer) +Entering state 8 +Reading a token: Now at end of input. +syntax error, unexpected $end, expecting 'g' +Error: popping token 'f' (<*>//e printer) +Stack now 0 1 3 5 6 7 +Error: popping token 'e' (<*>//e printer) +Stack now 0 1 3 5 6 +Error: popping token 'd' ('d' printer) +Stack now 0 1 3 5 +Error: popping token 'c' ('c' printer) +Stack now 0 1 3 +Error: popping token 'b' ( printer) +Stack now 0 1 +Error: popping token 'a' (<*>//e printer) +Stack now 0 +Cleanup: discarding lookahead token $end () +Stack now 0 +]]) + +AT_CLEANUP + + + +## ------------------------------------------------------------- ## +## Default %printer and %destructor for user-defined end token. ## +## ------------------------------------------------------------- ## + +AT_SETUP([Default %printer and %destructor for user-defined end token]) + +# _AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN(TYPED) +# ----------------------------------------------------------------------------- +m4_define([_AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN], +[m4_if($1, 0, + [m4_pushdef([kind], []) m4_pushdef([not_kind], [*])], + [m4_pushdef([kind], [*]) m4_pushdef([not_kind], [])]) + +AT_DATA_GRAMMAR([[input]]$1[[.y]], +[[%error-verbose +%debug +%locations +%initial-action { + @$.first_line = @$.last_line = 1; + @$.first_column = @$.last_column = 1; +} + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%destructor { + fprintf (yyoutput, "<]]not_kind[[> destructor should not be called.\n"); +} <]]not_kind[[> + +%token END 0 +%printer { + fprintf (yyoutput, "<]]kind[[> for '%c' @ %d", $$, @$.first_column); +} <]]kind[[> +%destructor { + fprintf (stdout, "<]]kind[[> for '%c' @ %d.\n", $$, @$.first_column); +} <]]kind[[> + +%printer { + fprintf (yyoutput, "<]]not_kind[[> printer should not be called.\n"); +} <]]not_kind[[> + +]]m4_if($1, 0, [[[ +]]], +[[[%union { char tag; } +%type start END]]])[[ + +%% + +start: { $$ = 'S'; } ; + +%% + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + yylval]]m4_if($1, 0,, [[[.tag]]])[[ = 'E'; + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; + return 0; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +]]) + +AT_BISON_CHECK([-o input$1.c input$1.y]) +AT_COMPILE([input$1]) +AT_PARSER_CHECK([./input$1], 0, +[[<]]kind[[> for 'E' @ 1. +<]]kind[[> for 'S' @ 1. +]], +[[Starting parse +Entering state 0 +Reducing stack by rule 1 (line 46): +-> $$ = nterm start (1.1-1.1: <]]kind[[> for 'S' @ 1) +Stack now 0 +Entering state 1 +Reading a token: Now at end of input. +Shifting token END (1.1-1.1: <]]kind[[> for 'E' @ 1) +Entering state 2 +Stack now 0 1 2 +Cleanup: popping token END (1.1-1.1: <]]kind[[> for 'E' @ 1) +Cleanup: popping nterm start (1.1-1.1: <]]kind[[> for 'S' @ 1) +]]) + +m4_popdef([kind]) +m4_popdef([not_kind]) +]) + +_AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN(0) +_AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN(1) + +AT_CLEANUP + + + +## ------------------------------------------------------------------ ## +## Default %printer and %destructor are not for error or $undefined. ## +## ------------------------------------------------------------------ ## + +AT_SETUP([Default %printer and %destructor are not for error or $undefined]) + +# If Bison were to apply the default %printer and %destructor to the error +# token or to $undefined: +# - For the error token: +# - It would generate warnings for unused $n. +# - It would invoke the %printer and %destructor on the error token's +# semantic value, which would be initialized from the lookahead, which +# would be destroyed separately. +# - For $undefined, who knows what the semantic value would be. + +AT_DATA_GRAMMAR([[input.y]], +[[%debug + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%printer { + fprintf (yyoutput, "'%c'", $$); +} <> <*> +%destructor { + fprintf (stderr, "DESTROY '%c'\n", $$); +} <> <*> + +%% + +start: + { $$ = 'S'; } + /* In order to reveal the problems that this bug caused during parsing, add + * $2 to USE. */ + | 'a' error 'b' 'c' { USE(($1, $3, $4)); $$ = 'S'; } + ; + +%% + +static int +yylex (void) +{ + static char const input[] = "abd"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylval = input[toknum++]; + return yylval; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input]) +AT_PARSER_CHECK([./input], [1], [], +[[Starting parse +Entering state 0 +Reading a token: Next token is token 'a' ('a') +Shifting token 'a' ('a') +Entering state 1 +Reading a token: Next token is token 'b' ('b') +syntax error +Shifting token error () +Entering state 3 +Next token is token 'b' ('b') +Shifting token 'b' ('b') +Entering state 5 +Reading a token: Next token is token $undefined () +Error: popping token 'b' ('b') +DESTROY 'b' +Stack now 0 1 3 +Error: popping token error () +Stack now 0 1 +Shifting token error () +Entering state 3 +Next token is token $undefined () +Error: discarding token $undefined () +Error: popping token error () +Stack now 0 1 +Shifting token error () +Entering state 3 +Reading a token: Now at end of input. +Cleanup: discarding lookahead token $end () +Stack now 0 1 3 +Cleanup: popping token error () +Cleanup: popping token 'a' ('a') +DESTROY 'a' +]]) + +AT_CLEANUP + + + +## ------------------------------------------------------ ## +## Default %printer and %destructor are not for $accept. ## +## ------------------------------------------------------ ## + +AT_SETUP([Default %printer and %destructor are not for $accept]) + +# If YYSTYPE is a union and Bison were to apply the default %printer and +# %destructor to $accept: +# - The %printer and %destructor code generated for $accept would always be +# dead code because $accept is currently never shifted onto the stack. +# - $$ for $accept would always be of type YYSTYPE because it's not possible +# to declare `%type $accept'. (Also true for $undefined.) +# - Thus, the compiler might complain that the user code assumes the wrong +# type for $$ since the code might assume the type associated with a +# specific union field, which is especially reasonable in C++ since that +# type may be a base type. This test case checks for this problem. (Also +# true for $undefined and the error token, so there are three warnings for +# %printer and three for %destructor.) + +AT_DATA_GRAMMAR([[input.y]], +[[%debug /* So that %printer is actually compiled. */ + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%printer { + char chr = $$; + fprintf (yyoutput, "'%c'", chr); +} <> <*> +%destructor { + char chr = $$; + fprintf (stderr, "DESTROY '%c'\n", chr); +} <> <*> + +%union { char chr; } +%type start + +%% + +start: { USE($$); } ; + +%% + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return 0; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input]) + +AT_CLEANUP + + + +## ------------------------------------------------------ ## +## Default %printer and %destructor for mid-rule values. ## +## ------------------------------------------------------ ## + +AT_SETUP([Default %printer and %destructor for mid-rule values]) + +AT_DATA_GRAMMAR([[input.y]], +[[%debug /* So that %printer is actually compiled. */ + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +# define YYLTYPE int +# define YYLLOC_DEFAULT(Current, Rhs, N) +# define YY_LOCATION_PRINT(File, Loc) +%} + +%printer { fprintf (yyoutput, "%d", @$); } <> +%destructor { fprintf (stderr, "DESTROY %d\n", @$); } <> +%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*> +%destructor { fprintf (yyoutput, "<*> destructor should not be called"); } <*> + +%% + +start: + { @$ = 1; } // Not set or used. + { USE ($$); @$ = 2; } // Both set and used. + { USE ($$); @$ = 3; } // Only set. + { @$ = 4; } // Only used. + 'c' + { USE (($$, $2, $4, $5)); @$ = 0; } + ; + +%% + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return 0; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +]]) + +AT_BISON_CHECK([-o input.c input.y], 0,, +[[input.y:33.3-23: warning: unset value: $$ +input.y:30.3-35.37: warning: unused value: $3 +]]) + +AT_COMPILE([input]) +AT_PARSER_CHECK([./input], 1,, +[[Starting parse +Entering state 0 +Reducing stack by rule 1 (line 30): +-> $$ = nterm $@1 (: ) +Stack now 0 +Entering state 2 +Reducing stack by rule 2 (line 31): +-> $$ = nterm @2 (: 2) +Stack now 0 2 +Entering state 4 +Reducing stack by rule 3 (line 32): +-> $$ = nterm @3 (: 3) +Stack now 0 2 4 +Entering state 5 +Reducing stack by rule 4 (line 33): +-> $$ = nterm @4 (: 4) +Stack now 0 2 4 5 +Entering state 6 +Reading a token: Now at end of input. +syntax error +Error: popping nterm @4 (: 4) +DESTROY 4 +Stack now 0 2 4 5 +Error: popping nterm @3 (: 3) +DESTROY 3 +Stack now 0 2 4 +Error: popping nterm @2 (: 2) +DESTROY 2 +Stack now 0 2 +Error: popping nterm $@1 (: ) +Stack now 0 +Cleanup: discarding lookahead token $end (: ) +Stack now 0 +]]) + +AT_CLEANUP + + +## ----------------------- ## +## @$ implies %locations. ## +## ----------------------- ## + +# Bison once forgot to check for @$ in actions other than semantic actions. + +# AT_CHECK_ACTION_LOCATIONS(ACTION-DIRECTIVE) +# ------------------------------------------------------- +m4_define([AT_CHECK_ACTION_LOCATIONS], +[AT_SETUP([[@$ in ]$1[ implies %locations]]) + +AT_DATA_GRAMMAR([[input.y]], +[[%code { + #include + static int yylex (void); + static void yyerror (char const *msg); +} + +%debug + +]$1[ { + printf ("%d\n", @$.first_line); +} ]m4_if($1, [%initial-action], [], [[start]])[ + +%% + +start: ; + +%% + +static int +yylex (void) +{ + return 0; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +]]) + +AT_BISON_CHECK([[-o input.c input.y]]) +AT_COMPILE([[input]]) + +AT_CLEANUP]) + +AT_CHECK_ACTION_LOCATIONS([[%initial-action]]) +AT_CHECK_ACTION_LOCATIONS([[%destructor]]) +AT_CHECK_ACTION_LOCATIONS([[%printer]]) diff --git a/tests/atlocal.in b/tests/atlocal.in new file mode 100644 index 0000000..1a5f5f4 --- /dev/null +++ b/tests/atlocal.in @@ -0,0 +1,41 @@ +# @configure_input@ -*- shell-script -*- +# Configurable variable values for Bison test suite. + +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free +# Software Foundation, Inc. + +# We need a C compiler. +CC='@CC@' + +# We want no optimization. +CFLAGS='@O0CFLAGS@ @WARN_CFLAGS@ @WERROR_CFLAGS@' + +# We need `config.h'. +CPPFLAGS="-I$abs_top_builddir/lib @CPPFLAGS@" + +# Is the compiler GCC? +GCC='@GCC@' + +# The C++ compiler. +CXX='@CXX@' + +# If 'exit 77'; skip all C++ tests; otherwise ':'. +BISON_CXX_WORKS='@BISON_CXX_WORKS@' + +# We want no optimization with C++, too. +CXXFLAGS='@O0CXXFLAGS@ @WARN_CXXFLAGS@ @WERROR_CFLAGS@' + +# Are special link options needed? +LDFLAGS='@LDFLAGS@' + +# Are special libraries needed? +LIBS='@LIBS@ @INTLLIBS@' + +# Empty if no javac was found +CONF_JAVAC='@CONF_JAVAC@' + +# Empty if no Java VM was found +CONF_JAVA='@CONF_JAVA@' + +# Empty if no xsltproc was found +XSLTPROC='@XSLTPROC@' diff --git a/tests/bison.in b/tests/bison.in new file mode 100644 index 0000000..b90c087 --- /dev/null +++ b/tests/bison.in @@ -0,0 +1,8 @@ +#! @SHELL@ +# @configure_input@ +# Wrapper around a non installed bison to make it work as an installed one. + +# Use the shipped files, not those installed. +BISON_PKGDATADIR='@abs_top_srcdir@/data' +export BISON_PKGDATADIR +exec $PREBISON '@abs_top_builddir@/src/bison' ${1+"$@"} diff --git a/tests/c++.at b/tests/c++.at new file mode 100644 index 0000000..3e742ee --- /dev/null +++ b/tests/c++.at @@ -0,0 +1,182 @@ +# Checking the output filenames. -*- Autotest -*- +# Copyright (C) 2004, 2005, 2007 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 . + +AT_BANNER([[C++ Features.]]) + + +## ----------------------- ## +## Doxygen Documentation. ## +## ----------------------- ## + +m4_define([AT_CHECK_DOXYGEN], +[m4_case([$1], + [Public], [m4_pushdef([AT_DOXYGEN_PRIVATE], [NO])], + [Private], [m4_pushdef([AT_DOXYGEN_PRIVATE], [YES])], + [m4_fatal([invalid argument: $1])]) +AT_SETUP([Doxygen $1 Documentation]) + +AT_DATA([input.yy], +[[%skeleton "lalr1.cc" +%locations +%debug +%defines +%% +exp:; +%% +yy::parser::error (const location& l, const std::string& m) +{ + std::cerr << l << s << std::endl; +} +]]) + +AT_BISON_CHECK([-o input.cc input.yy], 0) + +AT_DATA([Doxyfile], +[# The PROJECT_NAME tag is a single word (or a sequence of words +# surrounded by quotes) that should identify the project. +PROJECT_NAME = "Bison C++ Parser" + +# The QUIET tag can be used to turn on/off the messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages +# that are generated by doxygen. Possible values are YES and NO. If +# left blank NO is used. +WARNINGS = YES +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then +# this flag will automatically be disabled. +WARN_IF_UNDOCUMENTED = YES +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings +# for potential errors in the documentation, such as not documenting +# some parameters in a documented function, or documenting parameters +# that don't exist or using markup commands wrongly. +WARN_IF_DOC_ERROR = YES +# The WARN_FORMAT tag determines the format of the warning messages +# that doxygen can produce. The string should contain the $file, +# $line, and $text tags, which will be replaced by the file and line +# number from which the warning originated and the warning text. +WARN_FORMAT = "$file:$line: $text" + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all +# entities in documentation are documented, even if no documentation +# was available. Private class members and static file members will +# be hidden unless the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set +# to YES +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a +# class will be included in the documentation. +EXTRACT_PRIVATE = AT_DOXYGEN_PRIVATE + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. +EXTRACT_STATIC = AT_DOXYGEN_PRIVATE +]) + +AT_CHECK([doxygen --version || exit 77], 0, ignore) +AT_CHECK([doxygen], 0, [], [ignore]) + +AT_CLEANUP + +m4_popdef([AT_DOXYGEN_PRIVATE]) +])# AT_CHECK_DOXYGEN + +AT_CHECK_DOXYGEN([Public]) +AT_CHECK_DOXYGEN([Private]) + +## ------------ ## +## Namespaces. ## +## ------------ ## + +# AT_CHECK_NAMESPACE(NAMESPACE-DECL, [COMPILE-ERROR]) +# --------------------------------------------------- +# See if Bison can handle %define namespace "NAMESPACE-DECL". If COMPILE-ERROR +# is specified, then Bison should accept the input, but compilation will fail, +# so don't check compilation. +m4_define([AT_CHECK_NAMESPACE], +[ + +AT_DATA_GRAMMAR([[input.y]], +[[%language "C++" +%defines +%define namespace "]$1[" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +]$1[::parser::error (const ]$1[::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + ]$1[::parser p; + return p.parse (); +} +]]) + +AT_BISON_CHECK([[-o input.cc input.y]]) + +m4_if([$#], [1], +[AT_COMPILE_CXX([[input]], [[input.cc]]) +AT_PARSER_CHECK([[./input]])]) + +]) + +AT_SETUP([[Relative namespace references]]) +AT_CHECK_NAMESPACE([[foo]]) +AT_CHECK_NAMESPACE([[foo::bar]]) +AT_CHECK_NAMESPACE([[foo::bar::baz]]) +AT_CLEANUP + +AT_SETUP([[Absolute namespace references]]) +AT_CHECK_NAMESPACE([[::foo]]) +AT_CHECK_NAMESPACE([[::foo::bar]]) +AT_CHECK_NAMESPACE([[::foo::bar::baz]]) +AT_CHECK_NAMESPACE([[ ::foo]]) +AT_CHECK_NAMESPACE([[ ::foo::bar]]) +AT_CHECK_NAMESPACE([[ ::foo::bar::baz]]) +AT_CLEANUP + +AT_SETUP([[Syntactically invalid namespace references]]) +AT_CHECK_NAMESPACE([[:foo:bar]], [[-]]) +AT_CHECK_NAMESPACE([[foo: :bar]], [[-]]) +# This one is interesting because `[3]' is encoded as `@<:@3@:>@', which +# contains single occurrences of `:'. +AT_CHECK_NAMESPACE([[foo[3]::bar::baz]], [[-]]) +AT_CHECK_NAMESPACE([[foo::bar,baz]], [[-]]) +AT_CHECK_NAMESPACE([[foo::bar::(baz]], [[-]]) +AT_CLEANUP diff --git a/tests/calc.at b/tests/calc.at new file mode 100644 index 0000000..5f11858 --- /dev/null +++ b/tests/calc.at @@ -0,0 +1,680 @@ +# Simple calculator. -*- Autotest -*- + +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 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 . + +## ---------------------------------------------------- ## +## Compile the grammar described in the documentation. ## +## ---------------------------------------------------- ## + + +# ------------------------- # +# Helping Autotest macros. # +# ------------------------- # + + +# _AT_DATA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES]) +# ----------------------------------------------- +# Produce `calc.y' and, if %defines was specified, `calc-lex.c' or +# `calc-lex.cc'. +# +# Don't call this macro directly, because it contains some occurrences +# of `$1' etc. which will be interpreted by m4. So you should call it +# with $1, $2, and $3 as arguments, which is what AT_DATA_CALC_Y does. +m4_define([_AT_DATA_CALC_Y], +[m4_if([$1$2$3], $[1]$[2]$[3], [], + [m4_fatal([$0: Invalid arguments: $@])])dnl +m4_pushdef([AT_CALC_LEX], +[[#include + +int ]AT_NAME_PREFIX[lex (]AT_LEX_FORMALS[); +static int get_char (]AT_LEX_FORMALS[); +static void unget_char (]AT_LEX_PRE_FORMALS[ int c); + +]AT_LOCATION_IF([ +static YYLTYPE last_yylloc; +])[ +static int +get_char (]AT_LEX_FORMALS[) +{ + int res = getc (input); + ]AT_USE_LEX_ARGS[; +]AT_LOCATION_IF([ + last_yylloc = AT_LOC; + if (res == '\n') + { + AT_LOC.last_line++; + AT_LOC.last_column = 1; + } + else + AT_LOC.last_column++; +])[ + return res; +} + +static void +unget_char (]AT_LEX_PRE_FORMALS[ int c) +{ + ]AT_USE_LEX_ARGS[; +]AT_LOCATION_IF([ + /* Wrong when C == `\n'. */ + AT_LOC = last_yylloc; +])[ + ungetc (c, input); +} + +static int +read_signed_integer (]AT_LEX_FORMALS[) +{ + int c = get_char (]AT_LEX_ARGS[); + int sign = 1; + int n = 0; + + ]AT_USE_LEX_ARGS[; + if (c == '-') + { + c = get_char (]AT_LEX_ARGS[); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (]AT_LEX_ARGS[); + } + + unget_char (]AT_LEX_PRE_ARGS[ c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +]AT_NAME_PREFIX[lex (]AT_LEX_FORMALS[) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; +]AT_LOCATION_IF([ + AT_LOC.last_column = 1; + AT_LOC.last_line = 1; +])[ + } + +]AT_LOCATION_IF([ + AT_LOC.first_column = AT_LOC.last_column; + AT_LOC.first_line = AT_LOC.last_line; +])[ + + /* Skip white space. */ + while ((c = get_char (]AT_LEX_ARGS[)) == ' ' || c == '\t') + { +]AT_LOCATION_IF( +[ AT_LOC.first_column = AT_LOC.last_column; + AT_LOC.first_line = AT_LOC.last_line; +])[ + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (]AT_LEX_PRE_ARGS[ c); + ]AT_VAL[.ival = read_signed_integer (]AT_LEX_ARGS[); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +]]) + +AT_DATA_GRAMMAR([calc.y], +[[/* Infix notation calculator--calc */ +]$4 +AT_SKEL_CC_IF( +[%define global_tokens_and_yystype])[ +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input;]AT_SKEL_CC_IF([[ +#ifndef YYLTYPE +# define YYLTYPE ]AT_NAME_PREFIX[::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column]])[ +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +]AT_SKEL_CC_IF(, +[/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ]) + AT_PARAM_IF([semantic_value *result, int *count, ]) + const char *s + );])[ +int yylex (]AT_LEX_FORMALS[); +} + +]AT_SKEL_CC_IF( +[/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} +])[ + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { ]AT_PARAM_IF([++*count; ++global_count;])[ } +; + +line: + '\n' +| exp '\n' { ]AT_PARAM_IF([*result = global_result = $1], [USE ($1)])[; } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +]AT_SKEL_CC_IF( +[/* A C++ error reporting function. */ +void +AT_NAME_PREFIX::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << AT_LOCATION_IF([l << ": " << ])m << std::endl; +} + +int +yyparse (AT_PARAM_IF([semantic_value *result, int *count])) +{ + AT_NAME_PREFIX::parser parser[]AT_PARAM_IF([ (result, count)]); +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} +], +[static void +yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ]) + AT_PARAM_IF([semantic_value *result, int *count, ]) + const char *s) +{ +AT_PARAM_IF([(void) result; (void) count;]) +AT_YYERROR_SEES_LOC_IF([ + fprintf (stderr, "%d.%d", + AT_LOC.first_line, AT_LOC.first_column); + if (AT_LOC.first_line != AT_LOC.last_line) + fprintf (stderr, "-%d.%d", + AT_LOC.last_line, AT_LOC.last_column - 1); + else if (AT_LOC.first_column != AT_LOC.last_column - 1) + fprintf (stderr, "-%d", + AT_LOC.last_column - 1); + fprintf (stderr, ": ");]) + fprintf (stderr, "%s\n", s); +}])[ + +]AT_DEFINES_IF(, [AT_CALC_LEX])[ + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + +]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug], +[ yydebug = 1;])])[ + status = yyparse (]AT_PARAM_IF([[&result, &count]])[); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +]]) +AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.c]AT_SKEL_CC_IF([[c]])], +[[#include "calc.h]AT_SKEL_CC_IF([[h]])[" + +]AT_CALC_LEX])]) +m4_popdef([AT_CALC_LEX]) +])# _AT_DATA_CALC_Y + + +# AT_DATA_CALC_Y([BISON-OPTIONS]) +# ------------------------------- +# Produce `calc.y' and, if %defines was specified, `calc-lex.c' or +# `calc-lex.cc'. +m4_define([AT_DATA_CALC_Y], +[_AT_DATA_CALC_Y($[1], $[2], $[3], [$1]) +]) + + + +# _AT_CHECK_CALC(BISON-OPTIONS, INPUT, [NUM-STDERR-LINES]) +# -------------------------------------------------------- +# Run `calc' on INPUT and expect no STDOUT nor STDERR. +# +# If BISON-OPTIONS contains `%debug' but not `%glr-parser', then +# +# NUM-STDERR-LINES is the number of expected lines on stderr. +# Currently this is ignored, though, since the output format is fluctuating. +# +# We don't count GLR's traces yet, since its traces are somewhat +# different from LALR's. +m4_define([_AT_CHECK_CALC], +[AT_DATA([[input]], +[[$2 +]]) +AT_PARSER_CHECK([./calc input], 0, [], [stderr]) +]) + + +# _AT_CHECK_CALC_ERROR(BISON-OPTIONS, EXIT-STATUS, INPUT, +# [NUM-STDERR-LINES], +# [VERBOSE-AND-LOCATED-ERROR-MESSAGE]) +# --------------------------------------------------------- +# Run `calc' on INPUT, and expect a `syntax error' message. +# +# If INPUT starts with a slash, it is used as absolute input file name, +# otherwise as contents. +# +# NUM-STDERR-LINES is the number of expected lines on stderr. +# Currently this is ignored, though, since the output format is fluctuating. +# +# If BISON-OPTIONS contains `%location', then make sure the ERROR-LOCATION +# is correctly output on stderr. +# +# If BISON-OPTIONS contains `%error-verbose', then make sure the +# IF-YYERROR-VERBOSE message is properly output after `syntax error, ' +# on STDERR. +# +# If BISON-OPTIONS contains `%debug' but not `%glr', then NUM-STDERR-LINES +# is the number of expected lines on stderr. +m4_define([_AT_CHECK_CALC_ERROR], +[m4_bmatch([$3], [^/], + [AT_PARSER_CHECK([./calc $3], $2, [], [stderr])], + [AT_DATA([[input]], +[[$3 +]]) +AT_PARSER_CHECK([./calc input], $2, [], [stderr])]) + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[[0-9$]]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +AT_DATA([[expout]], +[$5 +]) +# 3. If locations are not used, remove them. +AT_YYERROR_SEES_LOC_IF([], +[[sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout]]) +# 4. If error-verbose is not used, strip the`, unexpected....' part. +m4_bmatch([$1], [%error-verbose], [], +[[sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout]]) +# 5. Check +AT_CHECK([cat stderr], 0, [expout]) +]) + + +# AT_CHECK_CALC([BISON-OPTIONS, [EXPECTED-TO-FAIL]]) +# -------------------------------------------------- +# Start a testing chunk which compiles `calc' grammar with +# BISON-OPTIONS, and performs several tests over the parser. +# However, if EXPECTED-TO-FAIL is nonempty, this test is expected to fail. +m4_define([AT_CHECK_CALC], +[# We use integers to avoid dependencies upon the precision of doubles. +AT_SETUP([Calculator $1]) + +m4_ifval([$2], [AT_CHECK([exit 77])]) + +AT_BISON_OPTION_PUSHDEFS([$1]) + +AT_DATA_CALC_Y([$1]) +AT_FULL_COMPILE([calc], [AT_DEFINES_IF([[lex]])]) + +# Test the priorities. +_AT_CHECK_CALC([$1], +[1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64], + [842]) + +# Some syntax errors. +_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [15], + [1.3: syntax error, unexpected number]) +_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [20], + [1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!']) +_AT_CHECK_CALC_ERROR([$1], [1], [error], [5], + [1.1: syntax error, unexpected $undefined]) +_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [30], + [1.7: syntax error, unexpected '=']) +_AT_CHECK_CALC_ERROR([$1], [1], + [ ++1], + [20], + [2.1: syntax error, unexpected '+']) +# Exercise error messages with EOF: work on an empty file. +_AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4], + [1.1: syntax error, unexpected end of input]) + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +_AT_CHECK_CALC_ERROR([$1], [0], + [() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1], + [250], +[1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1]) + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [102], +[1.10: syntax error, unexpected number +calc: error: 2222 != 1]) +_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113], +[1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1]) + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +_AT_CHECK_CALC_ERROR([$1], [0], [(* *) + (*) + (*)], [113], +[1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!']) + +AT_BISON_OPTION_POPDEFS + +AT_CLEANUP +])# AT_CHECK_CALC + + + + +# ------------------------ # +# Simple LALR Calculator. # +# ------------------------ # + +AT_BANNER([[Simple LALR(1) Calculator.]]) + +# AT_CHECK_CALC_LALR([BISON-OPTIONS]) +# ----------------------------------- +# Start a testing chunk which compiles `calc' grammar with +# BISON-OPTIONS, and performs several tests over the parser. +m4_define([AT_CHECK_CALC_LALR], +[AT_CHECK_CALC($@)]) + +AT_CHECK_CALC_LALR() + +AT_CHECK_CALC_LALR([%defines]) +AT_CHECK_CALC_LALR([%locations]) +AT_CHECK_CALC_LALR([%name-prefix="calc"]) dnl test deprecated `=' +AT_CHECK_CALC_LALR([%verbose]) +AT_CHECK_CALC_LALR([%yacc]) +AT_CHECK_CALC_LALR([%error-verbose]) + +AT_CHECK_CALC_LALR([%define api.pure %locations]) +AT_CHECK_CALC_LALR([%define api.push_pull "both" %define api.pure %locations]) +AT_CHECK_CALC_LALR([%error-verbose %locations]) + +AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_LALR([%debug]) +AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%define api.push_pull "both" %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) + + +# ----------------------- # +# Simple GLR Calculator. # +# ----------------------- # + +AT_BANNER([[Simple GLR Calculator.]]) + +# AT_CHECK_CALC_GLR([BISON-OPTIONS]) +# ---------------------------------- +# Start a testing chunk which compiles `calc' grammar with +# BISON-OPTIONS and %glr-parser, and performs several tests over the parser. +m4_define([AT_CHECK_CALC_GLR], +[AT_CHECK_CALC([%glr-parser] $@)]) + + +AT_CHECK_CALC_GLR() + +AT_CHECK_CALC_GLR([%defines]) +AT_CHECK_CALC_GLR([%locations]) +AT_CHECK_CALC_GLR([%name-prefix "calc"]) +AT_CHECK_CALC_GLR([%verbose]) +AT_CHECK_CALC_GLR([%yacc]) +AT_CHECK_CALC_GLR([%error-verbose]) + +AT_CHECK_CALC_GLR([%define api.pure %locations]) +AT_CHECK_CALC_GLR([%error-verbose %locations]) + +AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_GLR([%debug]) +AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) + + +# ----------------------------- # +# Simple LALR1 C++ Calculator. # +# ----------------------------- # + +AT_BANNER([[Simple LALR(1) C++ Calculator.]]) + +# First let's try using %skeleton +AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations]) + +# AT_CHECK_CALC_LALR1_CC([BISON-OPTIONS]) +# --------------------------------------- +# Start a testing chunk which compiles `calc' grammar with +# the C++ skeleton, and performs several tests over the parser. +m4_define([AT_CHECK_CALC_LALR1_CC], +[AT_CHECK_CALC([%language "C++" %defines %locations] $@)]) + +AT_CHECK_CALC_LALR1_CC([]) +AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) + + + +# --------------------------- # +# Simple GLR C++ Calculator. # +# --------------------------- # + +AT_BANNER([[Simple GLR C++ Calculator.]]) + +# Again, we try also using %skeleton. +AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations]) + +# AT_CHECK_CALC_GLR_CC([BISON-OPTIONS]) +# ------------------------------------- +# Start a testing chunk which compiles `calc' grammar with +# the GLR C++ skeleton, and performs several tests over the parser. +m4_define([AT_CHECK_CALC_GLR_CC], +[AT_CHECK_CALC([%language "C++" %glr-parser %defines %locations] $@)]) + +AT_CHECK_CALC_GLR_CC([]) +AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_GLR_CC([%debug]) +AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc]) + +AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) diff --git a/tests/conflicts.at b/tests/conflicts.at new file mode 100644 index 0000000..866b944 --- /dev/null +++ b/tests/conflicts.at @@ -0,0 +1,977 @@ +# Exercising Bison on conflicts. -*- Autotest -*- + +# Copyright (C) 2002, 2003, 2004, 2005, 2007 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 . + +AT_BANNER([[Conflicts.]]) + + +## ---------------- ## +## S/R in initial. ## +## ---------------- ## + +# I once hacked Bison in such a way that it lost its reductions on the +# initial state (because it was confusing it with the last state). It +# took me a while to strip down my failures to this simple case. So +# make sure it finds the s/r conflict below. + +AT_SETUP([S/R in initial]) + +AT_DATA([[input.y]], +[[%expect 1 +%% +exp: e 'e'; +e: 'e' | /* Nothing. */; +]]) + +AT_BISON_CHECK([-o input.c input.y], 0, [], +[[input.y:4.9: warning: rule useless in parser due to conflicts: e: /* empty */ +]]) + +AT_CLEANUP + + +## ------------------- ## +## %nonassoc and eof. ## +## ------------------- ## + +AT_SETUP([%nonassoc and eof]) + +AT_DATA_GRAMMAR([input.y], +[[ +%{ +#include +#include +#include + +#define YYERROR_VERBOSE 1 +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +/* The current argument. */ +static const char *input; + +static int +yylex (void) +{ + static size_t toknum; + if (! (toknum <= strlen (input))) + abort (); + return input[toknum++]; +} + +%} + +%nonassoc '<' '>' + +%% +expr: expr '<' expr + | expr '>' expr + | '0' + ; +%% +int +main (int argc, const char *argv[]) +{ + input = argc <= 1 ? "" : argv[1]; + return yyparse (); +} +]]) + +# Specify the output files to avoid problems on different file systems. +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input]) + +AT_PARSER_CHECK([./input '0<0']) +# FIXME: This is an actual bug, but a new one, in the sense that +# no one has ever spotted it! The messages are *wrong*: there should +# be nothing there, it should be expected eof. +AT_PARSER_CHECK([./input '0<0<0'], [1], [], + [syntax error, unexpected '<', expecting '<' or '>' +]) + +AT_PARSER_CHECK([./input '0>0']) +AT_PARSER_CHECK([./input '0>0>0'], [1], [], + [syntax error, unexpected '>', expecting '<' or '>' +]) + +AT_PARSER_CHECK([./input '0<0>0'], [1], [], + [syntax error, unexpected '>', expecting '<' or '>' +]) + +AT_CLEANUP + + + +## ------------------------- ## +## Unresolved SR Conflicts. ## +## ------------------------- ## + +AT_SETUP([Unresolved SR Conflicts]) + +AT_KEYWORDS([report]) + +AT_DATA([input.y], +[[%token NUM OP +%% +exp: exp OP exp | NUM; +]]) + +AT_BISON_CHECK([-o input.c --report=all input.y], 0, [], +[input.y: conflicts: 1 shift/reduce +]) + +# Check the contents of the report. +AT_CHECK([cat input.output], [], +[[State 5 conflicts: 1 shift/reduce + + +Grammar + + 0 $accept: exp $end + + 1 exp: exp OP exp + 2 | NUM + + +Terminals, with rules where they appear + +$end (0) 0 +error (256) +NUM (258) 2 +OP (259) 1 + + +Nonterminals, with rules where they appear + +$accept (5) + on left: 0 +exp (6) + on left: 1 2, on right: 0 1 + + +state 0 + + 0 $accept: . exp $end + 1 exp: . exp OP exp + 2 | . NUM + + NUM shift, and go to state 1 + + exp go to state 2 + + +state 1 + + 2 exp: NUM . + + $default reduce using rule 2 (exp) + + +state 2 + + 0 $accept: exp . $end + 1 exp: exp . OP exp + + $end shift, and go to state 3 + OP shift, and go to state 4 + + +state 3 + + 0 $accept: exp $end . + + $default accept + + +state 4 + + 1 exp: . exp OP exp + 1 | exp OP . exp + 2 | . NUM + + NUM shift, and go to state 1 + + exp go to state 5 + + +state 5 + + 1 exp: exp . OP exp + 1 | exp OP exp . [$end, OP] + + OP shift, and go to state 4 + + OP [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) +]]) + +AT_CLEANUP + + + +## ----------------------- ## +## Resolved SR Conflicts. ## +## ----------------------- ## + +AT_SETUP([Resolved SR Conflicts]) + +AT_KEYWORDS([report]) + +AT_DATA([input.y], +[[%token NUM OP +%left OP +%% +exp: exp OP exp | NUM; +]]) + +AT_BISON_CHECK([-o input.c --report=all input.y]) + +# Check the contents of the report. +AT_CHECK([cat input.output], [], +[[Grammar + + 0 $accept: exp $end + + 1 exp: exp OP exp + 2 | NUM + + +Terminals, with rules where they appear + +$end (0) 0 +error (256) +NUM (258) 2 +OP (259) 1 + + +Nonterminals, with rules where they appear + +$accept (5) + on left: 0 +exp (6) + on left: 1 2, on right: 0 1 + + +state 0 + + 0 $accept: . exp $end + 1 exp: . exp OP exp + 2 | . NUM + + NUM shift, and go to state 1 + + exp go to state 2 + + +state 1 + + 2 exp: NUM . + + $default reduce using rule 2 (exp) + + +state 2 + + 0 $accept: exp . $end + 1 exp: exp . OP exp + + $end shift, and go to state 3 + OP shift, and go to state 4 + + +state 3 + + 0 $accept: exp $end . + + $default accept + + +state 4 + + 1 exp: . exp OP exp + 1 | exp OP . exp + 2 | . NUM + + NUM shift, and go to state 1 + + exp go to state 5 + + +state 5 + + 1 exp: exp . OP exp + 1 | exp OP exp . [$end, OP] + + $default reduce using rule 1 (exp) + + Conflict between rule 1 and token OP resolved as reduce (%left OP). +]]) + +AT_CLEANUP + + +## -------------------------------- ## +## Defaulted Conflicted Reduction. ## +## -------------------------------- ## + +# When there are RR conflicts, some rules are disabled. Usually it is +# simply displayed as: +# +# $end reduce using rule 3 (num) +# $end [reduce using rule 4 (id)] +# +# But when `reduce 3' is the default action, we'd produce: +# +# $end [reduce using rule 4 (id)] +# $default reduce using rule 3 (num) +# +# In this precise case (a reduction is masked by the default +# reduction), we make the `reduce 3' explicit: +# +# $end reduce using rule 3 (num) +# $end [reduce using rule 4 (id)] +# $default reduce using rule 3 (num) +# +# Maybe that's not the best display, but then, please propose something +# else. + +AT_SETUP([Defaulted Conflicted Reduction]) +AT_KEYWORDS([report]) + +AT_DATA([input.y], +[[%% +exp: num | id; +num: '0'; +id : '0'; +%% +]]) + +AT_BISON_CHECK([-o input.c --report=all input.y], 0, [], +[[input.y: conflicts: 1 reduce/reduce +input.y:4.6-8: warning: rule useless in parser due to conflicts: id: '0' +]]) + +# Check the contents of the report. +AT_CHECK([cat input.output], [], +[[Rules useless in parser due to conflicts + + 4 id: '0' + + +State 1 conflicts: 1 reduce/reduce + + +Grammar + + 0 $accept: exp $end + + 1 exp: num + 2 | id + + 3 num: '0' + + 4 id: '0' + + +Terminals, with rules where they appear + +$end (0) 0 +'0' (48) 3 4 +error (256) + + +Nonterminals, with rules where they appear + +$accept (4) + on left: 0 +exp (5) + on left: 1 2, on right: 0 +num (6) + on left: 3, on right: 1 +id (7) + on left: 4, on right: 2 + + +state 0 + + 0 $accept: . exp $end + 1 exp: . num + 2 | . id + 3 num: . '0' + 4 id: . '0' + + '0' shift, and go to state 1 + + exp go to state 2 + num go to state 3 + id go to state 4 + + +state 1 + + 3 num: '0' . [$end] + 4 id: '0' . [$end] + + $end reduce using rule 3 (num) + $end [reduce using rule 4 (id)] + $default reduce using rule 3 (num) + + +state 2 + + 0 $accept: exp . $end + + $end shift, and go to state 5 + + +state 3 + + 1 exp: num . + + $default reduce using rule 1 (exp) + + +state 4 + + 2 exp: id . + + $default reduce using rule 2 (exp) + + +state 5 + + 0 $accept: exp $end . + + $default accept +]]) + +AT_CLEANUP + + + + +## -------------------- ## +## %expect not enough. ## +## -------------------- ## + +AT_SETUP([%expect not enough]) + +AT_DATA([input.y], +[[%token NUM OP +%expect 0 +%% +exp: exp OP exp | NUM; +]]) + +AT_BISON_CHECK([-o input.c input.y], 1, [], +[input.y: conflicts: 1 shift/reduce +input.y: expected 0 shift/reduce conflicts +]) +AT_CLEANUP + + +## --------------- ## +## %expect right. ## +## --------------- ## + +AT_SETUP([%expect right]) + +AT_DATA([input.y], +[[%token NUM OP +%expect 1 +%% +exp: exp OP exp | NUM; +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_CLEANUP + + +## ------------------ ## +## %expect too much. ## +## ------------------ ## + +AT_SETUP([%expect too much]) + +AT_DATA([input.y], +[[%token NUM OP +%expect 2 +%% +exp: exp OP exp | NUM; +]]) + +AT_BISON_CHECK([-o input.c input.y], 1, [], +[input.y: conflicts: 1 shift/reduce +input.y: expected 2 shift/reduce conflicts +]) +AT_CLEANUP + + +## ------------------------------ ## +## %expect with reduce conflicts ## +## ------------------------------ ## + +AT_SETUP([%expect with reduce conflicts]) + +AT_DATA([input.y], +[[%expect 0 +%% +program: a 'a' | a a; +a: 'a'; +]]) + +AT_BISON_CHECK([-o input.c input.y], 1, [], +[input.y: conflicts: 1 reduce/reduce +input.y: expected 0 reduce/reduce conflicts +]) +AT_CLEANUP + + +## ------------------------------- ## +## %no-default-prec without %prec ## +## ------------------------------- ## + +AT_SETUP([%no-default-prec without %prec]) + +AT_DATA([[input.y]], +[[%left '+' +%left '*' + +%% + +%no-default-prec; + +e: e '+' e + | e '*' e + | '0' + ; +]]) + +AT_BISON_CHECK([-o input.c input.y], 0, [], +[[input.y: conflicts: 4 shift/reduce +]]) +AT_CLEANUP + + +## ---------------------------- ## +## %no-default-prec with %prec ## +## ---------------------------- ## + +AT_SETUP([%no-default-prec with %prec]) + +AT_DATA([[input.y]], +[[%left '+' +%left '*' + +%% + +%no-default-prec; + +e: e '+' e %prec '+' + | e '*' e %prec '*' + | '0' + ; +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_CLEANUP + + +## ---------------- ## +## %default-prec ## +## ---------------- ## + +AT_SETUP([%default-prec]) + +AT_DATA([[input.y]], +[[%left '+' +%left '*' + +%% + +%default-prec; + +e: e '+' e + | e '*' e + | '0' + ; +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_CLEANUP + + +## ---------------------------------------------- ## +## Unreachable States After Conflict Resolution. ## +## ---------------------------------------------- ## + +AT_SETUP([[Unreachable States After Conflict Resolution]]) + +# If conflict resolution makes states unreachable, remove those states, report +# rules that are then unused, and don't report conflicts in those states. Test +# what happens when a nonterminal becomes useless as a result of state removal +# since that causes lalr.o's goto map to be rewritten. + +AT_DATA([[input.y]], +[[%output "input.c" +%left 'a' + +%% + +start: resolved_conflict 'a' reported_conflicts 'a' ; + +/* S/R conflict resolved as reduce, so the state with item + * (resolved_conflict: 'a' . unreachable1) and all it transition successors are + * unreachable, and the associated production is useless. */ +resolved_conflict: + 'a' unreachable1 + | %prec 'a' + ; + +/* S/R conflict that need not be reported since it is unreachable because of + * the previous conflict resolution. Nonterminal unreachable1 and all its + * productions are useless. */ +unreachable1: + 'a' unreachable2 + | + ; + +/* Likewise for a R/R conflict and nonterminal unreachable2. */ +unreachable2: | ; + +/* Make sure remaining S/R and R/R conflicts are still reported correctly even + * when their states are renumbered due to state removal. */ +reported_conflicts: + 'a' + | 'a' + | + ; + +]]) + +AT_BISON_CHECK([[--report=all input.y]], 0, [], +[[input.y: conflicts: 1 shift/reduce, 1 reduce/reduce +input.y:12.5-20: warning: rule useless in parser due to conflicts: resolved_conflict: 'a' unreachable1 +input.y:20.5-20: warning: rule useless in parser due to conflicts: unreachable1: 'a' unreachable2 +input.y:21.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ +input.y:25.13: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ +input.y:25.16: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ +input.y:31.5-7: warning: rule useless in parser due to conflicts: reported_conflicts: 'a' +input.y:32.4: warning: rule useless in parser due to conflicts: reported_conflicts: /* empty */ +]]) + +AT_CHECK([[cat input.output]], 0, +[[Rules useless in parser due to conflicts + + 2 resolved_conflict: 'a' unreachable1 + + 4 unreachable1: 'a' unreachable2 + 5 | /* empty */ + + 6 unreachable2: /* empty */ + 7 | /* empty */ + + 9 reported_conflicts: 'a' + 10 | /* empty */ + + +State 4 conflicts: 1 shift/reduce +State 5 conflicts: 1 reduce/reduce + + +Grammar + + 0 $accept: start $end + + 1 start: resolved_conflict 'a' reported_conflicts 'a' + + 2 resolved_conflict: 'a' unreachable1 + 3 | /* empty */ + + 4 unreachable1: 'a' unreachable2 + 5 | /* empty */ + + 6 unreachable2: /* empty */ + 7 | /* empty */ + + 8 reported_conflicts: 'a' + 9 | 'a' + 10 | /* empty */ + + +Terminals, with rules where they appear + +$end (0) 0 +'a' (97) 1 2 4 8 9 +error (256) + + +Nonterminals, with rules where they appear + +$accept (4) + on left: 0 +start (5) + on left: 1, on right: 0 +resolved_conflict (6) + on left: 2 3, on right: 1 +unreachable1 (7) + on left: 4 5, on right: 2 +unreachable2 (8) + on left: 6 7, on right: 4 +reported_conflicts (9) + on left: 8 9 10, on right: 1 + + +state 0 + + 0 $accept: . start $end + 1 start: . resolved_conflict 'a' reported_conflicts 'a' + 2 resolved_conflict: . 'a' unreachable1 + 3 | . ['a'] + + $default reduce using rule 3 (resolved_conflict) + + start go to state 1 + resolved_conflict go to state 2 + + Conflict between rule 3 and token 'a' resolved as reduce (%left 'a'). + + +state 1 + + 0 $accept: start . $end + + $end shift, and go to state 3 + + +state 2 + + 1 start: resolved_conflict . 'a' reported_conflicts 'a' + + 'a' shift, and go to state 4 + + +state 3 + + 0 $accept: start $end . + + $default accept + + +state 4 + + 1 start: resolved_conflict 'a' . reported_conflicts 'a' + 8 reported_conflicts: . 'a' + 9 | . 'a' + 10 | . ['a'] + + 'a' shift, and go to state 5 + + 'a' [reduce using rule 10 (reported_conflicts)] + + reported_conflicts go to state 6 + + +state 5 + + 8 reported_conflicts: 'a' . ['a'] + 9 | 'a' . ['a'] + + 'a' reduce using rule 8 (reported_conflicts) + 'a' [reduce using rule 9 (reported_conflicts)] + $default reduce using rule 8 (reported_conflicts) + + +state 6 + + 1 start: resolved_conflict 'a' reported_conflicts . 'a' + + 'a' shift, and go to state 7 + + +state 7 + + 1 start: resolved_conflict 'a' reported_conflicts 'a' . + + $default reduce using rule 1 (start) +]]) + +AT_DATA([[input-keep.y]], +[[%define lr.keep_unreachable_states +]]) +AT_CHECK([[cat input.y >> input-keep.y]]) + +AT_BISON_CHECK([[input-keep.y]], 0, [], +[[input-keep.y: conflicts: 2 shift/reduce, 2 reduce/reduce +input-keep.y:22.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ +input-keep.y:26.16: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ +input-keep.y:32.5-7: warning: rule useless in parser due to conflicts: reported_conflicts: 'a' +input-keep.y:33.4: warning: rule useless in parser due to conflicts: reported_conflicts: /* empty */ +]]) + +AT_CLEANUP + + +## ------------------------------------------------------------ ## +## Solved conflicts report for multiple reductions in a state. ## +## ------------------------------------------------------------ ## + +AT_SETUP([[Solved conflicts report for multiple reductions in a state]]) + +# Used to lose earlier solved conflict messages even within a single S/R/R. + +AT_DATA([[input.y]], +[[%left 'a' +%right 'b' +%right 'c' +%right 'd' +%% +start: + 'a' + | empty_a 'a' + | 'b' + | empty_b 'b' + | 'c' + | empty_c1 'c' + | empty_c2 'c' + | empty_c3 'c' + ; +empty_a: %prec 'a' ; +empty_b: %prec 'b' ; +empty_c1: %prec 'c' ; +empty_c2: %prec 'c' ; +empty_c3: %prec 'd' ; +]]) +AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore]) +AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0, +[[state 0 + + 0 $accept: . start $end + 1 start: . 'a' + 2 | . empty_a 'a' + 3 | . 'b' + 4 | . empty_b 'b' + 5 | . 'c' + 6 | . empty_c1 'c' + 7 | . empty_c2 'c' + 8 | . empty_c3 'c' + 9 empty_a: . ['a'] + 10 empty_b: . [] + 11 empty_c1: . [] + 12 empty_c2: . [] + 13 empty_c3: . ['c'] + + 'b' shift, and go to state 1 + + 'c' reduce using rule 13 (empty_c3) + $default reduce using rule 9 (empty_a) + + start go to state 2 + empty_a go to state 3 + empty_b go to state 4 + empty_c1 go to state 5 + empty_c2 go to state 6 + empty_c3 go to state 7 + + Conflict between rule 9 and token 'a' resolved as reduce (%left 'a'). + Conflict between rule 10 and token 'b' resolved as shift (%right 'b'). + Conflict between rule 11 and token 'c' resolved as shift (%right 'c'). + Conflict between rule 12 and token 'c' resolved as shift (%right 'c'). + Conflict between rule 13 and token 'c' resolved as reduce ('c' < 'd'). + + +state 1 +]]) + +AT_CLEANUP + + +## ------------------------------------------------------------ ## +## %nonassoc error actions for multiple reductions in a state. ## +## ------------------------------------------------------------ ## + +# Used to abort when trying to resolve conflicts as %nonassoc error actions for +# multiple reductions in a state. + +# For a %nonassoc error action token, used to print the first remaining +# reduction on that token without brackets. + +AT_SETUP([[%nonassoc error actions for multiple reductions in a state]]) + +AT_DATA([[input.y]], +[[%nonassoc 'a' 'b' 'c' +%% +start: + 'a' + | empty_a 'a' + | 'b' + | empty_b 'b' + | 'c' + | empty_c1 'c' + | empty_c2 'c' + | empty_c3 'c' + ; +empty_a: %prec 'a' ; +empty_b: %prec 'b' ; +empty_c1: %prec 'c' ; +empty_c2: %prec 'c' ; +empty_c3: %prec 'c' ; +]]) + +AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore]) +AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0, +[[state 0 + + 0 $accept: . start $end + 1 start: . 'a' + 2 | . empty_a 'a' + 3 | . 'b' + 4 | . empty_b 'b' + 5 | . 'c' + 6 | . empty_c1 'c' + 7 | . empty_c2 'c' + 8 | . empty_c3 'c' + 9 empty_a: . [] + 10 empty_b: . [] + 11 empty_c1: . [] + 12 empty_c2: . ['c'] + 13 empty_c3: . ['c'] + + 'a' error (nonassociative) + 'b' error (nonassociative) + 'c' error (nonassociative) + + 'c' [reduce using rule 12 (empty_c2)] + 'c' [reduce using rule 13 (empty_c3)] + + start go to state 1 + empty_a go to state 2 + empty_b go to state 3 + empty_c1 go to state 4 + empty_c2 go to state 5 + empty_c3 go to state 6 + + Conflict between rule 9 and token 'a' resolved as an error (%nonassoc 'a'). + Conflict between rule 10 and token 'b' resolved as an error (%nonassoc 'b'). + Conflict between rule 11 and token 'c' resolved as an error (%nonassoc 'c'). + + +state 1 +]]) +AT_CLEANUP diff --git a/tests/cxx-type.at b/tests/cxx-type.at new file mode 100644 index 0000000..923dc23 --- /dev/null +++ b/tests/cxx-type.at @@ -0,0 +1,472 @@ +# Checking GLR Parsing. -*- Autotest -*- +# Copyright (C) 2002, 2003, 2004, 2005, 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 . + +AT_BANNER([[C++ Type Syntax (GLR).]]) + +# _AT_TEST_GLR_CXXTYPES(DECL, RESOLVE1, RESOLVE2) +# ----------------------------------------------- +# Store into types.y the calc program, with DECL inserted as a declaration, +# and with RESOLVE1 and RESOLVE2 as annotations on the conflicted rule for +# stmt. Then compile the result. +m4_define([_AT_TEST_GLR_CXXTYPES], +[ +AT_BISON_OPTION_PUSHDEFS([$1]) + +AT_DATA_GRAMMAR([types.y], +[[/* Simplified C++ Type and Expression Grammar. */ + +$1 + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * +]m4_bmatch([$2], [stmtMerge], +[ static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1);])[ + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output;]AT_LOCATION_IF([ + printf ("%d.%d-%d.%d: ", + @2.first_line, @2.first_column, + @2.last_line, @2.last_column);])[ + output = node_to_string (]$[2); + printf ("%s\n", output); + free (output); + free_node (]$[2); + } + ; + +stmt : expr ';' $2 { $$ = ]$[1; } + | decl $3 + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", ]$[3, ]$[1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", ]$[1, ]$[2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", ]$[1, + ]$[2, ]$[4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = ]$[2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + +]] +m4_bmatch([$2], [stmtMerge], +[[static YYSTYPE +stmtMerge (YYSTYPE x0, YYSTYPE x1) +{ + return new_nterm ("(%s,%s)", x0, x1, 0); +} +]]) +) + +AT_DATA([test-input], +[[ + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +]]) + +AT_BISON_CHECK([-o types.c types.y], 0, [], ignore) +AT_COMPILE([types]) +AT_BISON_OPTION_POPDEFS +]) + +m4_define([_AT_RESOLVED_GLR_OUTPUT], +[[[+(z,q) +(T,x) +(T,x,y) +=(x,y) ++((x,T),y) +(T,x) +(T,y,+(z,q)) + ++(z,q) +]]]) + +m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC], +[[[3.0-3.5: +(z,q) +5.0-5.3: (T,x) +7.0-7.7: (T,x,y) +9.0-9.5: =(x,y) +11.0-11.9: +((x,T),y) +13.0-13.5: (T,x) +15.0-15.13: (T,y,+(z,q)) +17.0-17.15: +19.0-19.5: +(z,q) +]]]) + +m4_define([_AT_AMBIG_GLR_OUTPUT], +[[[+(z,q) +(T,x) +(T,x,y) +=(x,y) ++((x,T),y) +((T,x),(x,T)) +((T,y,+(z,q)),=((y,T),+(z,q))) + ++(z,q) +]]]) + +m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC], +[[[3.0-3.5: +(z,q) +5.0-5.3: (T,x) +7.0-7.7: (T,x,y) +9.0-9.5: =(x,y) +11.0-11.9: +((x,T),y) +13.0-13.5: ((T,x),(x,T)) +15.0-15.13: ((T,y,+(z,q)),=((y,T),+(z,q))) +17.0-17.15: +19.0-19.5: +(z,q) +]]]) + +m4_define([_AT_GLR_STDERR], +[[[syntax error +]]]) + +m4_define([_AT_VERBOSE_GLR_STDERR], +[[[syntax error, unexpected ID, expecting '=' or '+' or ')' +]]]) + +## ---------------------------------------------------- ## +## Compile the grammar described in the documentation. ## +## ---------------------------------------------------- ## + +AT_SETUP([GLR: Resolve ambiguity, impure, no locations]) +_AT_TEST_GLR_CXXTYPES([], + [%dprec 1], [%dprec 2]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) +AT_CLEANUP + +AT_SETUP([GLR: Resolve ambiguity, impure, locations]) +_AT_TEST_GLR_CXXTYPES([%locations],[%dprec 1],[%dprec 2]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) +AT_CLEANUP + +AT_SETUP([GLR: Resolve ambiguity, pure, no locations]) +_AT_TEST_GLR_CXXTYPES([%define api.pure], + [%dprec 1], [%dprec 2]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) +AT_CLEANUP + +AT_SETUP([GLR: Resolve ambiguity, pure, locations]) +_AT_TEST_GLR_CXXTYPES([%define api.pure %locations], + [%dprec 1], [%dprec 2]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) +AT_CLEANUP + +AT_SETUP([GLR: Merge conflicting parses, impure, no locations]) +_AT_TEST_GLR_CXXTYPES([], + [%merge ], [%merge ]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) +AT_CLEANUP + +AT_SETUP([GLR: Merge conflicting parses, impure, locations]) +_AT_TEST_GLR_CXXTYPES([%locations], + [%merge ], [%merge ]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) +AT_CLEANUP + +AT_SETUP([GLR: Merge conflicting parses, pure, no locations]) +_AT_TEST_GLR_CXXTYPES([%define api.pure], + [%merge ], [%merge ]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) +AT_CLEANUP +AT_SETUP([GLR: Merge conflicting parses, pure, locations]) +_AT_TEST_GLR_CXXTYPES([%define api.pure %locations], + [%merge ],[%merge ]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) +AT_CLEANUP + +AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations]) +_AT_TEST_GLR_CXXTYPES([%error-verbose], + [%merge ], [%merge ]) +AT_PARSER_CHECK([[./types test-input]], 0, + _AT_AMBIG_GLR_OUTPUT, _AT_VERBOSE_GLR_STDERR) +AT_CLEANUP diff --git a/tests/existing.at b/tests/existing.at new file mode 100644 index 0000000..ba2c40c --- /dev/null +++ b/tests/existing.at @@ -0,0 +1,1525 @@ +# Exercising Bison on actual grammars. -*- Autotest -*- + +# Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005, +# 2007 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 . + +AT_BANNER([[Existing Grammars.]]) +## ----------------- ## +## GNU AWK Grammar. ## +## ----------------- ## + +AT_SETUP([GNU AWK Grammar]) + +# We have been careful to strip all the actions excepts the +# mid-rule actions. We rely on %expect to check that there are +# indeed 65 SR conflicts. +# +# Bison was once wrong, due to an incorrect computation of nullable. +# It reported 485 SR conflicts! + +AT_DATA([[input.y]], +[[%expect 65 + +%token FUNC_CALL NAME REGEXP +%token ERROR +%token YNUMBER YSTRING +%token RELOP APPEND_OP +%token ASSIGNOP MATCHOP NEWLINE CONCAT_OP +%token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE +%token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE +%token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION +%token LEX_GETLINE LEX_NEXTFILE +%token LEX_IN +%token LEX_AND LEX_OR INCREMENT DECREMENT +%token LEX_BUILTIN LEX_LENGTH + +/* Lowest to highest */ +%right ASSIGNOP +%right '?' ':' +%left LEX_OR +%left LEX_AND +%left LEX_GETLINE +%nonassoc LEX_IN +%left FUNC_CALL LEX_BUILTIN LEX_LENGTH +%nonassoc ',' +%nonassoc MATCHOP +%nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO +%left CONCAT_OP +%left YSTRING YNUMBER +%left '+' '-' +%left '*' '/' '%' +%right '!' UNARY +%right '^' +%left INCREMENT DECREMENT +%left '$' +%left '(' ')' +%% + +start + : opt_nls program opt_nls + ; + +program + : rule + | program rule + | error + | program error + | /* empty */ + ; + +rule + : LEX_BEGIN {} action + | LEX_END {} action + | LEX_BEGIN statement_term + | LEX_END statement_term + | pattern action + | action + | pattern statement_term + | function_prologue function_body + ; + +func_name + : NAME + | FUNC_CALL + | lex_builtin + ; + +lex_builtin + : LEX_BUILTIN + | LEX_LENGTH + ; + +function_prologue + : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls + ; + +function_body + : l_brace statements r_brace opt_semi opt_nls + | l_brace r_brace opt_semi opt_nls + ; + +pattern + : exp + | exp ',' exp + ; + +regexp + /* + * In this rule, want_regexp tells yylex that the next thing + * is a regexp so it should read up to the closing slash. + */ + : '/' {} REGEXP '/' + ; + +action + : l_brace statements r_brace opt_semi opt_nls + | l_brace r_brace opt_semi opt_nls + ; + +statements + : statement + | statements statement + | error + | statements error + ; + +statement_term + : nls + | semi opt_nls + ; + +statement + : semi opt_nls + | l_brace r_brace + | l_brace statements r_brace + | if_statement + | LEX_WHILE '(' exp r_paren opt_nls statement + | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls + | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement + | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement + | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement + | LEX_BREAK statement_term + | LEX_CONTINUE statement_term + | print '(' expression_list r_paren output_redir statement_term + | print opt_rexpression_list output_redir statement_term + | LEX_NEXT statement_term + | LEX_NEXTFILE statement_term + | LEX_EXIT opt_exp statement_term + | LEX_RETURN {} opt_exp statement_term + | LEX_DELETE NAME '[' expression_list ']' statement_term + | LEX_DELETE NAME statement_term + | exp statement_term + ; + +print + : LEX_PRINT + | LEX_PRINTF + ; + +if_statement + : LEX_IF '(' exp r_paren opt_nls statement + | LEX_IF '(' exp r_paren opt_nls statement + LEX_ELSE opt_nls statement + ; + +nls + : NEWLINE + | nls NEWLINE + ; + +opt_nls + : /* empty */ + | nls + ; + +input_redir + : /* empty */ + | '<' simp_exp + ; + +output_redir + : /* empty */ + | '>' exp + | APPEND_OP exp + | '|' exp + | TWOWAYIO exp + ; + +opt_param_list + : /* empty */ + | param_list + ; + +param_list + : NAME + | param_list comma NAME + | error + | param_list error + | param_list comma error + ; + +/* optional expression, as in for loop */ +opt_exp + : /* empty */ + | exp + ; + +opt_rexpression_list + : /* empty */ + | rexpression_list + ; + +rexpression_list + : rexp + | rexpression_list comma rexp + | error + | rexpression_list error + | rexpression_list error rexp + | rexpression_list comma error + ; + +opt_expression_list + : /* empty */ + | expression_list + ; + +expression_list + : exp + | expression_list comma exp + | error + | expression_list error + | expression_list error exp + | expression_list comma error + ; + +/* Expressions, not including the comma operator. */ +exp : variable ASSIGNOP {} exp + | '(' expression_list r_paren LEX_IN NAME + | exp '|' LEX_GETLINE opt_variable + | exp TWOWAYIO LEX_GETLINE opt_variable + | LEX_GETLINE opt_variable input_redir + | exp LEX_AND exp + | exp LEX_OR exp + | exp MATCHOP exp + | regexp + | '!' regexp %prec UNARY + | exp LEX_IN NAME + | exp RELOP exp + | exp '<' exp + | exp '>' exp + | exp '?' exp ':' exp + | simp_exp + | exp simp_exp %prec CONCAT_OP + ; + +rexp + : variable ASSIGNOP {} rexp + | rexp LEX_AND rexp + | rexp LEX_OR rexp + | LEX_GETLINE opt_variable input_redir + | regexp + | '!' regexp %prec UNARY + | rexp MATCHOP rexp + | rexp LEX_IN NAME + | rexp RELOP rexp + | rexp '?' rexp ':' rexp + | simp_exp + | rexp simp_exp %prec CONCAT_OP + ; + +simp_exp + : non_post_simp_exp + /* Binary operators in order of decreasing precedence. */ + | simp_exp '^' simp_exp + | simp_exp '*' simp_exp + | simp_exp '/' simp_exp + | simp_exp '%' simp_exp + | simp_exp '+' simp_exp + | simp_exp '-' simp_exp + | variable INCREMENT + | variable DECREMENT + ; + +non_post_simp_exp + : '!' simp_exp %prec UNARY + | '(' exp r_paren + | LEX_BUILTIN + '(' opt_expression_list r_paren + | LEX_LENGTH '(' opt_expression_list r_paren + | LEX_LENGTH + | FUNC_CALL '(' opt_expression_list r_paren + | variable + | INCREMENT variable + | DECREMENT variable + | YNUMBER + | YSTRING + | '-' simp_exp %prec UNARY + | '+' simp_exp %prec UNARY + ; + +opt_variable + : /* empty */ + | variable + ; + +variable + : NAME + | NAME '[' expression_list ']' + | '$' non_post_simp_exp + ; + +l_brace + : '{' opt_nls + ; + +r_brace + : '}' opt_nls + ; + +r_paren + : ')' + ; + +opt_semi + : /* empty */ + | semi + ; + +semi + : ';' + ; + +comma : ',' opt_nls + ; + +%% +]]) + +# Pass plenty of options, to exercise plenty of code, even if we +# don't actually check the output. But SEGV is watching us, and +# so might do dmalloc. +AT_BISON_CHECK([[--verbose --defines input.y]]) + +AT_CLEANUP + +## ----------------- ## +## GNU Cim Grammar. ## +## ----------------- ## + +AT_SETUP([GNU Cim Grammar]) + +# GNU Cim, the GNU Simula 87 Compiler. + +# Bison was once wrong, due to an incorrect computation of the RR conflicts. +# It reported 80 SR && 99 RR conflicts instead of 78/10!!! + +AT_DATA([[input.y]], +[[%union {} + +%token + HACTIVATE HAFTER /*HAND*/ HARRAY HAT + HBEFORE HBEGIN HBOOLEAN + HCHARACTER HCLASS /*HCOMMENT*/ HCONC + HDELAY HDO + HELSE HEND HEQ /*HEQV*/ HEXTERNAL + HFOR + HGE HGO HGOTO HGT + HHIDDEN + HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS + HLABEL HLE HLONG HLT + HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT + /*HOR*/ HOTHERWISE + HPRIOR HPROCEDURE HPROTECTED + HQUA + HREACTIVATE HREAL HREF + HSHORT HSTEP HSWITCH + HTEXT HTHEN HTHIS HTO + HUNTIL + HVALUE HVAR HVIRTUAL + HWHEN HWHILE + + HASSIGNVALUE HASSIGNREF + /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR + HBEGPAR HENDPAR + HEQR HNER + HADD HSUB HMUL HDIV HINTDIV HEXP + HDOTDOTDOT + +%token HIDENTIFIER +%token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST +%token HREALKONST +%token HTEXTKONST + + +%right HASSIGN +%left HORELSE +%left HANDTHEN +%left HEQV +%left HIMP +%left HOR +%left HAND + +%left HNOT + +%left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR + +%left HCONC + +%left HTERMOPERATOR +%left UNEAR +%left HFACTOROPERATOR +%left HPRIMARYOPERATOR + +%left HQUA + +%left HDOT + +%start MAIN_MODULE +%% +/* GRAMATIKK FOR PROGRAM MODULES */ +MAIN_MODULE : {} + MODULS + | error HSTATEMENTSEPARATOR MBEE_DECLSTMS + ; +EXT_DECLARATION : HEXTERNAL + MBEE_TYPE + HPROCEDURE + {} + EXT_LIST + | + HEXTERNAL + HIDENTIFIER + HPROCEDURE + {} + HIDENTIFIER {} + EXTERNAL_KIND_ITEM + | HEXTERNAL + HCLASS + {} + EXT_LIST + + ; +EXTERNAL_KIND_ITEM: EXT_IDENT + HOBJRELOPERATOR + {} + MBEE_TYPE HPROCEDURE + HIDENTIFIER + {} + HEADING EMPTY_BLOCK + {} +/* | + EXT_IDENT + {} + MBEE_REST_EXT_LIST + ; +MBEE_REST_EXT_LIST: /* EMPTY + | HPAREXPSEPARATOR EXT_KIND_LIST + ; +EXT_KIND_LIST : EXT_KIND_ITEM + | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM + ; +EXT_KIND_ITEM : HIDENTIFIER + EXT_IDENT + {}*/ + ; +EMPTY_BLOCK : /*EMPT*/ + | HBEGIN HEND + ; +EXT_LIST : EXT_ITEM + | EXT_LIST HPAREXPSEPARATOR EXT_ITEM + ; +EXT_ITEM : HIDENTIFIER + EXT_IDENT + ; +EXT_IDENT : /* EMPTY */ + | HVALRELOPERATOR {} + HTEXTKONST + ; +/* GRAMATIKK FOR TYPER */ +NO_TYPE : /*EMPT*/ + ; +MBEE_TYPE : NO_TYPE + | TYPE + ; +TYPE : HREF HBEGPAR + HIDENTIFIER + {} + HENDPAR + | HTEXT + | HBOOLEAN + | HCHARACTER + | HSHORT HINTEGER + | HINTEGER + | HREAL + | HLONG HREAL + ; + +/* GRAMATIKK FOR DEL AV SETNINGER */ +MBEE_ELSE_PART : /*EMPT*/ +/* | HELSE + HIF + EXPRESSION + HTHEN {} + BLOCK {} + MBEE_ELSE_PART {}*/ + | HELSE {} + BLOCK + ; +FOR_LIST : FOR_LIST_ELEMENT + | FOR_LIST_ELEMENT + HPAREXPSEPARATOR + FOR_LIST + ; +FOR_LIST_ELEMENT: EXPRESSION + MBEE_F_L_EL_R_PT + ; +MBEE_F_L_EL_R_PT: /*EMPT*/ + | HWHILE + EXPRESSION + | HSTEP + EXPRESSION + HUNTIL + EXPRESSION + ; +GOTO : HGO + HTO + | HGOTO + ; +CONN_STATE_R_PT : WHEN_CLAUSE_LIST + | HDO {} + BLOCK + ; +WHEN_CLAUSE_LIST: HWHEN + HIDENTIFIER + HDO {} + BLOCK + | WHEN_CLAUSE_LIST + HWHEN + HIDENTIFIER + HDO {} + BLOCK + ; +MBEE_OTWI_CLAUS : /*EMPT*/ + | HOTHERWISE {} + + BLOCK + ; +ACTIVATOR : HACTIVATE + | HREACTIVATE + ; +SCHEDULE : /*EMPT*/ + | ATDELAY EXPRESSION {} + PRIOR + | BEFOREAFTER {} + EXPRESSION + ; +ATDELAY : HAT + | HDELAY + ; +BEFOREAFTER : HBEFORE + | HAFTER + ; +PRIOR : /*EMPT*/ + | HPRIOR + ; +/* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */ +MODULSTATEMENT : HWHILE + EXPRESSION + HDO {} + BLOCK + | HIF + EXPRESSION + HTHEN {} + BLOCK {} + MBEE_ELSE_PART + | HFOR + HIDENTIFIER + HASSIGN {} + FOR_LIST + HDO {} + BLOCK + | GOTO + EXPRESSION + | HINSPECT + EXPRESSION {} + CONN_STATE_R_PT + {} + MBEE_OTWI_CLAUS + | HINNER + | HIDENTIFIER + HLABELSEPARATOR + {} + DECLSTATEMENT + | EXPRESSION_SIMP + HBEGIN + {} + IMPORT_SPEC_MODULE + {} + MBEE_DECLSTMS + HEND + | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR + MBEE_DECLSTMS HEND + | EXPRESSION_SIMP HBEGIN error HEND + | EXPRESSION_SIMP + | ACTIVATOR EXPRESSION SCHEDULE + | HBEGIN + {} + MBEE_DECLSTMS + HEND + | MBEE_TYPE HPROCEDURE + HIDENTIFIER + {} + HEADING BLOCK + | HIDENTIFIER + HCLASS + NO_TYPE + {} + IMPORT_SPEC_MODULE + HIDENTIFIER + {} + HEADING + BLOCK + | HCLASS + NO_TYPE + HIDENTIFIER + {} + HEADING + BLOCK + | EXT_DECLARATION + | /*EMPT*/ + ; +IMPORT_SPEC_MODULE: + ; +DECLSTATEMENT : MODULSTATEMENT + | TYPE + HIDENTIFIER + MBEE_CONSTANT + HPAREXPSEPARATOR + {} + IDENTIFIER_LISTC + | TYPE + HIDENTIFIER + MBEE_CONSTANT + | MBEE_TYPE + HARRAY {} + ARR_SEGMENT_LIST + | HSWITCH + HIDENTIFIER + HASSIGN {} + SWITCH_LIST + ; +BLOCK : DECLSTATEMENT + | HBEGIN MBEE_DECLSTMS HEND + | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND + | HBEGIN error HEND + ; +MBEE_DECLSTMS : MBEE_DECLSTMSU + ; +MBEE_DECLSTMSU : DECLSTATEMENT + | MBEE_DECLSTMSU + HSTATEMENTSEPARATOR + DECLSTATEMENT + ; +MODULS : MODULSTATEMENT + | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT + ; +/* GRAMATIKK FOR DEL AV DEKLARASJONER */ +ARR_SEGMENT_LIST: ARR_SEGMENT + | ARR_SEGMENT_LIST + HPAREXPSEPARATOR + ARR_SEGMENT + ; +ARR_SEGMENT : ARRAY_SEGMENT + HBEGPAR + BAUND_PAIR_LIST HENDPAR + ; +ARRAY_SEGMENT : ARRAY_SEGMENT_EL {} + + | ARRAY_SEGMENT_EL + HPAREXPSEPARATOR + ARRAY_SEGMENT + ; +ARRAY_SEGMENT_EL: HIDENTIFIER + ; +BAUND_PAIR_LIST : BAUND_PAIR + | BAUND_PAIR + HPAREXPSEPARATOR + BAUND_PAIR_LIST + ; +BAUND_PAIR : EXPRESSION + HLABELSEPARATOR + EXPRESSION + ; +SWITCH_LIST : EXPRESSION + | EXPRESSION + HPAREXPSEPARATOR + SWITCH_LIST + ; +HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {} + MBEE_MODE_PART {} + MBEE_SPEC_PART {} + MBEE_PROT_PART {} + MBEE_VIRT_PART + ; +MBEE_FMAL_PAR_P : /*EMPT*/ + | FMAL_PAR_PART + ; +FMAL_PAR_PART : HBEGPAR NO_TYPE + MBEE_LISTV HENDPAR + ; +MBEE_LISTV : /*EMPT*/ + | LISTV + ; +LISTV : HIDENTIFIER + | FPP_CATEG HDOTDOTDOT + | HIDENTIFIER {} + HPAREXPSEPARATOR LISTV + | FPP_SPEC + | FPP_SPEC + HPAREXPSEPARATOR LISTV + ; +FPP_HEADING : HBEGPAR NO_TYPE + FPP_MBEE_LISTV HENDPAR + ; +FPP_MBEE_LISTV : /*EMPT*/ + | FPP_LISTV + ; +FPP_LISTV : FPP_CATEG HDOTDOTDOT + | FPP_SPEC + | FPP_SPEC + HPAREXPSEPARATOR LISTV + ; +FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER + | FPP_CATEG FPP_PROC_DECL_IN_SPEC + ; +FPP_CATEG : HNAME HLABELSEPARATOR + | HVALUE HLABELSEPARATOR + | HVAR HLABELSEPARATOR + | /*EMPT*/ + ; +FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE + HIDENTIFIER + {} + FPP_HEADING {} { /* Yes, two "final" actions. */ } + ; +IDENTIFIER_LISTV: HIDENTIFIER + | HDOTDOTDOT + | HIDENTIFIER {} + HPAREXPSEPARATOR IDENTIFIER_LISTV + ; +MBEE_MODE_PART : /*EMPT*/ + | MODE_PART + ; +MODE_PART : NAME_PART + | VALUE_PART + | VAR_PART + | NAME_PART VALUE_PART + | VALUE_PART NAME_PART + | NAME_PART VAR_PART + | VAR_PART NAME_PART + | VALUE_PART VAR_PART + | VAR_PART VALUE_PART + | VAR_PART NAME_PART VALUE_PART + | NAME_PART VAR_PART VALUE_PART + | NAME_PART VALUE_PART VAR_PART + | VAR_PART VALUE_PART NAME_PART + | VALUE_PART VAR_PART NAME_PART + | VALUE_PART NAME_PART VAR_PART + ; +NAME_PART : HNAME {} + IDENTIFIER_LISTV + HSTATEMENTSEPARATOR + ; +VAR_PART : HVAR {} + IDENTIFIER_LISTV + HSTATEMENTSEPARATOR + ; +VALUE_PART : HVALUE {} + IDENTIFIER_LISTV HSTATEMENTSEPARATOR + ; +MBEE_SPEC_PART : /*EMPT*/ + | SPEC_PART + ; +SPEC_PART : ONE_SPEC + | SPEC_PART ONE_SPEC + ; +ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR + | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR + {} + PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR + | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR + | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR + | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR + IDENTIFIER_LIST HSTATEMENTSEPARATOR + ; +SPECIFIER : TYPE + | MBEE_TYPE + HARRAY + | HLABEL + | HSWITCH + ; +PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE + HIDENTIFIER + {} + HEADING + {} + MBEE_BEGIN_END + ; +MBEE_BEGIN_END : /* EMPTY */ + | HBEGIN HEND + ; +MBEE_PROT_PART : /*EMPT*/ + | PROTECTION_PART + ; +PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST + HSTATEMENTSEPARATOR + | PROTECTION_PART PROT_SPECIFIER + IDENTIFIER_LIST HSTATEMENTSEPARATOR + ; +PROT_SPECIFIER : HHIDDEN + | HPROTECTED + | HHIDDEN + HPROTECTED + | HPROTECTED + HHIDDEN + ; +MBEE_VIRT_PART : /*EMPT*/ + | VIRTUAL_PART + ; +VIRTUAL_PART : HVIRTUAL + HLABELSEPARATOR + MBEE_SPEC_PART + ; +IDENTIFIER_LIST : HIDENTIFIER + | IDENTIFIER_LIST HPAREXPSEPARATOR + HIDENTIFIER + ; +IDENTIFIER_LISTC: HIDENTIFIER + MBEE_CONSTANT + | IDENTIFIER_LISTC HPAREXPSEPARATOR + HIDENTIFIER + MBEE_CONSTANT + ; +MBEE_CONSTANT : /* EMPTY */ + | HVALRELOPERATOR + {} + EXPRESSION + ; + +/* GRAMATIKK FOR UTTRYKK */ +EXPRESSION : EXPRESSION_SIMP + | HIF + EXPRESSION + HTHEN + EXPRESSION + HELSE + EXPRESSION + ; +EXPRESSION_SIMP : EXPRESSION_SIMP + HASSIGN + EXPRESSION + | + + EXPRESSION_SIMP + HCONC + EXPRESSION_SIMP + | EXPRESSION_SIMP HOR + HELSE + EXPRESSION_SIMP + %prec HORELSE + | EXPRESSION_SIMP HAND + HTHEN + EXPRESSION_SIMP + %prec HANDTHEN + | EXPRESSION_SIMP + HEQV EXPRESSION_SIMP + | EXPRESSION_SIMP + HIMP EXPRESSION_SIMP + | EXPRESSION_SIMP + HOR EXPRESSION_SIMP + | EXPRESSION_SIMP + HAND EXPRESSION_SIMP + | HNOT EXPRESSION_SIMP + | EXPRESSION_SIMP + HVALRELOPERATOR + EXPRESSION_SIMP + | EXPRESSION_SIMP + HREFRELOPERATOR + EXPRESSION_SIMP + | EXPRESSION_SIMP + HOBJRELOPERATOR + EXPRESSION_SIMP + | HTERMOPERATOR + EXPRESSION_SIMP %prec UNEAR + | EXPRESSION_SIMP + HTERMOPERATOR + EXPRESSION_SIMP + | EXPRESSION_SIMP + HFACTOROPERATOR + EXPRESSION_SIMP + | EXPRESSION_SIMP + HPRIMARYOPERATOR + EXPRESSION_SIMP + | HBEGPAR + EXPRESSION HENDPAR + | HTEXTKONST + | HCHARACTERKONST + | HREALKONST + | HINTEGERKONST + | HBOOLEANKONST + | HNONE + | HIDENTIFIER + {} + MBEE_ARG_R_PT + | HTHIS HIDENTIFIER + | HNEW + HIDENTIFIER + ARG_R_PT + | EXPRESSION_SIMP + HDOT + EXPRESSION_SIMP + | EXPRESSION_SIMP + HQUA HIDENTIFIER + ; +ARG_R_PT : /*EMPTY*/ + | HBEGPAR + ARGUMENT_LIST HENDPAR + ; +MBEE_ARG_R_PT : /*EMPTY*/ + | HBEGPAR + ARGUMENT_LIST HENDPAR + ; +ARGUMENT_LIST : EXPRESSION + | EXPRESSION + HPAREXPSEPARATOR + ARGUMENT_LIST + ; +%% +]]) + +# Pass plenty of options, to exercise plenty of code, even if we +# don't actually check the output. But SEGV is watching us, and +# so might do dmalloc. +AT_BISON_CHECK([[--verbose --defines input.y]], 0, [], +[[input.y: conflicts: 78 shift/reduce, 10 reduce/reduce +]]) + +AT_CHECK([[grep '^State.*conflicts:' input.output]], 0, +[[State 64 conflicts: 14 shift/reduce +State 164 conflicts: 1 shift/reduce +State 201 conflicts: 33 shift/reduce, 4 reduce/reduce +State 206 conflicts: 1 shift/reduce +State 240 conflicts: 1 shift/reduce +State 335 conflicts: 9 shift/reduce, 2 reduce/reduce +State 356 conflicts: 1 shift/reduce +State 360 conflicts: 9 shift/reduce, 2 reduce/reduce +State 427 conflicts: 9 shift/reduce, 2 reduce/reduce +]]) + +AT_CLEANUP + +## ----------------- ## +## GNU pic Grammar. ## +## ----------------- ## + +AT_SETUP([GNU pic Grammar]) + +# GNU pic, part of groff. + +# Bison once reported shift/reduce conflicts that it shouldn't have. + +AT_DATA([[input.y]], +[[%union {} + +%token LABEL +%token VARIABLE +%token NUMBER +%token TEXT +%token COMMAND_LINE +%token DELIMITED +%token ORDINAL +%token TH +%token LEFT_ARROW_HEAD +%token RIGHT_ARROW_HEAD +%token DOUBLE_ARROW_HEAD +%token LAST +%token UP +%token DOWN +%token LEFT +%token RIGHT +%token BOX +%token CIRCLE +%token ELLIPSE +%token ARC +%token LINE +%token ARROW +%token MOVE +%token SPLINE +%token HEIGHT +%token RADIUS +%token WIDTH +%token DIAMETER +%token FROM +%token TO +%token AT +%token WITH +%token BY +%token THEN +%token SOLID +%token DOTTED +%token DASHED +%token CHOP +%token SAME +%token INVISIBLE +%token LJUST +%token RJUST +%token ABOVE +%token BELOW +%token OF +%token THE +%token WAY +%token BETWEEN +%token AND +%token HERE +%token DOT_N +%token DOT_E +%token DOT_W +%token DOT_S +%token DOT_NE +%token DOT_SE +%token DOT_NW +%token DOT_SW +%token DOT_C +%token DOT_START +%token DOT_END +%token DOT_X +%token DOT_Y +%token DOT_HT +%token DOT_WID +%token DOT_RAD +%token SIN +%token COS +%token ATAN2 +%token LOG +%token EXP +%token SQRT +%token K_MAX +%token K_MIN +%token INT +%token RAND +%token SRAND +%token COPY +%token THRU +%token TOP +%token BOTTOM +%token UPPER +%token LOWER +%token SH +%token PRINT +%token CW +%token CCW +%token FOR +%token DO +%token IF +%token ELSE +%token ANDAND +%token OROR +%token NOTEQUAL +%token EQUALEQUAL +%token LESSEQUAL +%token GREATEREQUAL +%token LEFT_CORNER +%token RIGHT_CORNER +%token NORTH +%token SOUTH +%token EAST +%token WEST +%token CENTER +%token END +%token START +%token RESET +%token UNTIL +%token PLOT +%token THICKNESS +%token FILL +%token COLORED +%token OUTLINED +%token SHADED +%token ALIGNED +%token SPRINTF +%token COMMAND + +%left '.' + +/* this ensures that plot 17 "%g" parses as (plot 17 "%g") */ +%left PLOT +%left TEXT SPRINTF + +/* give text adjustments higher precedence than TEXT, so that +box "foo" above ljust == box ("foo" above ljust) +*/ + +%left LJUST RJUST ABOVE BELOW + +%left LEFT RIGHT +/* Give attributes that take an optional expression a higher +precedence than left and right, so that eg `line chop left' +parses properly. */ +%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED +%left LABEL + +%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST +%left ORDINAL HERE '`' + +%left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */ + +/* these need to be lower than '-' */ +%left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS + +/* these must have higher precedence than CHOP so that `label %prec CHOP' +works */ +%left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C +%left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER +%left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END + +%left ',' +%left OROR +%left ANDAND +%left EQUALEQUAL NOTEQUAL +%left '<' '>' LESSEQUAL GREATEREQUAL + +%left BETWEEN OF +%left AND + +%left '+' '-' +%left '*' '/' '%' +%right '!' +%right '^' + +%% + +top: + optional_separator + | element_list + ; + +element_list: + optional_separator middle_element_list optional_separator + ; + +middle_element_list: + element + | middle_element_list separator element + ; + +optional_separator: + /* empty */ + | separator + ; + +separator: + ';' + | separator ';' + ; + +placeless_element: + VARIABLE '=' any_expr + | VARIABLE ':' '=' any_expr + | UP + | DOWN + | LEFT + | RIGHT + | COMMAND_LINE + | COMMAND print_args + | PRINT print_args + | SH + {} + DELIMITED + | COPY TEXT + | COPY TEXT THRU + {} + DELIMITED + {} + until + | COPY THRU + {} + DELIMITED + {} + until + | FOR VARIABLE '=' expr TO expr optional_by DO + {} + DELIMITED + | simple_if + | simple_if ELSE + {} + DELIMITED + | reset_variables + | RESET + ; + +reset_variables: + RESET VARIABLE + | reset_variables VARIABLE + | reset_variables ',' VARIABLE + ; + +print_args: + print_arg + | print_args print_arg + ; + +print_arg: + expr %prec ',' + | text + | position %prec ',' + ; + +simple_if: + IF any_expr THEN + {} + DELIMITED + ; + +until: + /* empty */ + | UNTIL TEXT + ; + +any_expr: + expr + | text_expr + ; + +text_expr: + text EQUALEQUAL text + | text NOTEQUAL text + | text_expr ANDAND text_expr + | text_expr ANDAND expr + | expr ANDAND text_expr + | text_expr OROR text_expr + | text_expr OROR expr + | expr OROR text_expr + | '!' text_expr + ; + +optional_by: + /* empty */ + | BY expr + | BY '*' expr + ; + +element: + object_spec + | LABEL ':' optional_separator element + | LABEL ':' optional_separator position_not_place + | LABEL ':' optional_separator place + | '{' {} element_list '}' + {} + optional_element + | placeless_element + ; + +optional_element: + /* empty */ + | element + ; + +object_spec: + BOX + | CIRCLE + | ELLIPSE + | ARC + | LINE + | ARROW + | MOVE + | SPLINE + | text %prec TEXT + | PLOT expr + | PLOT expr text + | '[' + {} + element_list ']' + | object_spec HEIGHT expr + | object_spec RADIUS expr + | object_spec WIDTH expr + | object_spec DIAMETER expr + | object_spec expr %prec HEIGHT + | object_spec UP + | object_spec UP expr + | object_spec DOWN + | object_spec DOWN expr + | object_spec RIGHT + | object_spec RIGHT expr + | object_spec LEFT + | object_spec LEFT expr + | object_spec FROM position + | object_spec TO position + | object_spec AT position + | object_spec WITH path + | object_spec WITH position %prec ',' + | object_spec BY expr_pair + | object_spec THEN + | object_spec SOLID + | object_spec DOTTED + | object_spec DOTTED expr + | object_spec DASHED + | object_spec DASHED expr + | object_spec FILL + | object_spec FILL expr + | object_spec SHADED text + | object_spec COLORED text + | object_spec OUTLINED text + | object_spec CHOP + | object_spec CHOP expr + | object_spec SAME + | object_spec INVISIBLE + | object_spec LEFT_ARROW_HEAD + | object_spec RIGHT_ARROW_HEAD + | object_spec DOUBLE_ARROW_HEAD + | object_spec CW + | object_spec CCW + | object_spec text %prec TEXT + | object_spec LJUST + | object_spec RJUST + | object_spec ABOVE + | object_spec BELOW + | object_spec THICKNESS expr + | object_spec ALIGNED + ; + +text: + TEXT + | SPRINTF '(' TEXT sprintf_args ')' + ; + +sprintf_args: + /* empty */ + | sprintf_args ',' expr + ; + +position: + position_not_place + | place + ; + +position_not_place: + expr_pair + | position '+' expr_pair + | position '-' expr_pair + | '(' position ',' position ')' + | expr between position AND position + | expr '<' position ',' position '>' + ; + +between: + BETWEEN + | OF THE WAY BETWEEN + ; + +expr_pair: + expr ',' expr + | '(' expr_pair ')' + ; + +place: + /* line at A left == line (at A) left */ + label %prec CHOP + | label corner + | corner label + | corner OF label + | HERE + ; + +label: + LABEL + | nth_primitive + | label '.' LABEL + ; + +ordinal: + ORDINAL + | '`' any_expr TH + ; + +optional_ordinal_last: + LAST + | ordinal LAST + ; + +nth_primitive: + ordinal object_type + | optional_ordinal_last object_type + ; + +object_type: + BOX + | CIRCLE + | ELLIPSE + | ARC + | LINE + | ARROW + | SPLINE + | '[' ']' + | TEXT + ; + +label_path: + '.' LABEL + | label_path '.' LABEL + ; + +relative_path: + corner %prec CHOP + /* give this a lower precedence than LEFT and RIGHT so that + [A: box] with .A left == [A: box] with (.A left) */ + | label_path %prec TEXT + | label_path corner + ; + +path: + relative_path + | '(' relative_path ',' relative_path ')' + {} + /* The rest of these rules are a compatibility sop. */ + | ORDINAL LAST object_type relative_path + | LAST object_type relative_path + | ORDINAL object_type relative_path + | LABEL relative_path + ; + +corner: + DOT_N + | DOT_E + | DOT_W + | DOT_S + | DOT_NE + | DOT_SE + | DOT_NW + | DOT_SW + | DOT_C + | DOT_START + | DOT_END + | TOP + | BOTTOM + | LEFT + | RIGHT + | UPPER LEFT + | LOWER LEFT + | UPPER RIGHT + | LOWER RIGHT + | LEFT_CORNER + | RIGHT_CORNER + | UPPER LEFT_CORNER + | LOWER LEFT_CORNER + | UPPER RIGHT_CORNER + | LOWER RIGHT_CORNER + | NORTH + | SOUTH + | EAST + | WEST + | CENTER + | START + | END + ; + +expr: + VARIABLE + | NUMBER + | place DOT_X + | place DOT_Y + | place DOT_HT + | place DOT_WID + | place DOT_RAD + | expr '+' expr + | expr '-' expr + | expr '*' expr + | expr '/' expr + | expr '%' expr + | expr '^' expr + | '-' expr %prec '!' + | '(' any_expr ')' + | SIN '(' any_expr ')' + | COS '(' any_expr ')' + | ATAN2 '(' any_expr ',' any_expr ')' + | LOG '(' any_expr ')' + | EXP '(' any_expr ')' + | SQRT '(' any_expr ')' + | K_MAX '(' any_expr ',' any_expr ')' + | K_MIN '(' any_expr ',' any_expr ')' + | INT '(' any_expr ')' + | RAND '(' any_expr ')' + | RAND '(' ')' + | SRAND '(' any_expr ')' + | expr '<' expr + | expr LESSEQUAL expr + | expr '>' expr + | expr GREATEREQUAL expr + | expr EQUALEQUAL expr + | expr NOTEQUAL expr + | expr ANDAND expr + | expr OROR expr + | '!' expr + ; +]]) + +# Pass plenty of options, to exercise plenty of code, even if we +# don't actually check the output. But SEGV is watching us, and +# so might do dmalloc. +AT_BISON_CHECK([[--verbose --defines input.y]], 0, [], +[[input.y:453.11-48: warning: rule useless in parser due to conflicts: path: ORDINAL LAST object_type relative_path +]]) + +AT_CLEANUP diff --git a/tests/glr-regression.at b/tests/glr-regression.at new file mode 100644 index 0000000..2f71926 --- /dev/null +++ b/tests/glr-regression.at @@ -0,0 +1,1788 @@ +# Checking GLR Parsing: Regression Tests -*- Autotest -*- +# Copyright (C) 2002, 2003, 2005, 2006, 2007 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 . + +AT_BANNER([[GLR Regression Tests]]) + +## --------------------------- ## +## Badly Collapsed GLR States. ## +## --------------------------- ## + +AT_SETUP([Badly Collapsed GLR States]) + +AT_DATA_GRAMMAR([glr-regr1.y], +[[/* Regression Test: Improper state compression */ +/* Reported by Scott McPeak */ + +%{ +#include +#include + +#define YYSTYPE int +static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1); +int yylex (void); +void yyerror (char const *msg); +%} + + +%glr-parser + + +/* -------- productions ------ */ +%% + +StartSymbol: E { $$=0; } %merge + ; + +E: E 'P' E { $$=1; printf("E -> E 'P' E\n"); } %merge + | 'B' { $$=2; printf("E -> 'B'\n"); } %merge + ; + + + +/* ---------- C code ----------- */ +%% + +static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1) +{ + (void) x0; + (void) x1; + printf ("\n"); + return 0; +} + +int +main (void) +{ + return yyparse (); +} + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + + +int +yylex (void) +{ + for (;;) + { + int ch; + if (feof (stdin)) + abort (); + ch = getchar (); + if (ch == EOF) + return 0; + else if (ch == 'B' || ch == 'P') + return ch; + } +} +]]) + +AT_BISON_CHECK([[-o glr-regr1.c glr-regr1.y]], 0, [], +[glr-regr1.y: conflicts: 1 shift/reduce +]) +AT_COMPILE([glr-regr1]) +AT_PARSER_CHECK([[echo BPBPB | ./glr-regr1]], 0, +[[E -> 'B' +E -> 'B' +E -> E 'P' E +E -> 'B' +E -> E 'P' E +E -> 'B' +E -> E 'P' E +E -> E 'P' E + +]], []) + +AT_CLEANUP + +## ------------------------------------------------------------ ## +## Improper handling of embedded actions and $-N in GLR parsers ## +## ------------------------------------------------------------ ## + +AT_SETUP([Improper handling of embedded actions and dollar(-N) in GLR parsers]) + +AT_DATA_GRAMMAR([glr-regr2a.y], +[[/* Regression Test: Improper handling of embedded actions and $-N */ +/* Reported by S. Eken */ + +%{ + #define YYSTYPE char * + + #include + #include + #include + #include + int yylex (void); + void yyerror (char const *); +%} + +%glr-parser + +%% + +command: + 's' var 't' + { printf ("Variable: '%s'\n", $2); } + 'v' 'x' 'q' + { free ($2); } + | 's' var_list 't' 'e' + { printf ("Varlist: '%s'\n", $2); free ($2); } + | 's' var 't' var_printer 'x' + { free ($2); } + ; + +var: + 'V' + { $$ = $1; } + ; + +var_list: + var + { $$ = $1; } + | var ',' var_list + { + char *s = (char *) realloc ($1, strlen ($1) + 1 + strlen ($3) + 1); + strcat (s, ","); + strcat (s, $3); + free ($3); + $$ = s; + } + ; + +var_printer: 'v' + { printf ("Variable: '%s'\n", $-1); } + +%% + +FILE *input; + +int +yylex (void) +{ + char buf[50]; + char *s; + if (feof (stdin)) + abort (); + switch (fscanf (input, " %1[a-z,]", buf)) { + case 1: + return buf[0]; + case EOF: + return 0; + default: + break; + } + if (fscanf (input, "%49s", buf) != 1) + return 0; + if (sizeof buf - 1 <= strlen (buf)) + abort (); + s = (char *) malloc (strlen (buf) + 1); + strcpy (s, buf); + yylval = s; + return 'V'; +} + +void +yyerror (char const *s) +{ printf ("%s\n", s); +} + +int +main (int argc, char **argv) +{ + input = stdin; + if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; + return yyparse (); +} +]]) + +AT_BISON_CHECK([[-o glr-regr2a.c glr-regr2a.y]], 0, [], +[glr-regr2a.y: conflicts: 2 shift/reduce +]) +AT_COMPILE([glr-regr2a]) + +AT_PARSER_CHECK([[echo s VARIABLE_1 t v x q | ./glr-regr2a]], 0, +[[Variable: 'VARIABLE_1' +]], []) +AT_PARSER_CHECK([[echo s VARIABLE_1 , ANOTHER_VARIABLE_2 t e | ./glr-regr2a]], +0, +[[Varlist: 'VARIABLE_1,ANOTHER_VARIABLE_2' +]]) +AT_PARSER_CHECK([[echo s VARIABLE_3 t v x | ./glr-regr2a]], 0, +[[Variable: 'VARIABLE_3' +]], []) + + +AT_CLEANUP + +## ------------------------------------------------------------ ## +## Improper merging of GLR delayed action sets ## +## ------------------------------------------------------------ ## + +AT_SETUP([Improper merging of GLR delayed action sets]) + +AT_DATA_GRAMMAR([glr-regr3.y], +[[/* Regression Test: Improper merging of GLR delayed action sets. */ +/* Reported by M. Rosien */ + +%{ +#include +#include +#include + +static int MergeRule (int x0, int x1); +static void yyerror (char const * s); +int yylex (void); + +#define RULE(x) (1 << (x)) + +%} + +%glr-parser + +%token BAD_CHAR +%token P1 P2 T1 T2 T3 T4 O1 O2 + +%% + +S : P1 T4 O2 NT6 P2 { printf ("Result: %x\n", $4); } +; + +NT1 : P1 T1 O1 T2 P2 { $$ = RULE(2); } %merge +; + +NT2 : NT1 { $$ = RULE(3); } %merge + | P1 NT1 O1 T3 P2 { $$ = RULE(4); } %merge +; + +NT3 : T3 { $$ = RULE(5); } %merge + | P1 NT1 O1 T3 P2 { $$ = RULE(6); } %merge +; + +NT4 : NT3 { $$ = RULE(7); } %merge + | NT2 { $$ = RULE(8); } %merge + | P1 NT2 O1 NT3 P2 { $$ = RULE(9); } %merge +; + +NT5 : NT4 { $$ = RULE(10); } %merge +; + +NT6 : P1 NT1 O1 T3 P2 { $$ = RULE(11) | $2; } %merge + | NT5 { $$ = RULE(12) | $1; } %merge +; + +%% + +static int MergeRule (int x0, int x1) { + return x0 | x1; +} + +static void yyerror(char const * s) { + fprintf(stderr,"error: %s\n",s); +} + +FILE *input = NULL; + +int P[] = { P1, P2 }; +int O[] = { O1, O2 }; +int T[] = { T1, T2, T3, T4 }; + +int yylex (void) +{ + char inp[3]; + if (feof (stdin)) + abort (); + if (fscanf (input, "%2s", inp) == EOF) + return 0; + switch (inp[0]) + { + case 'p': return P[inp[1] - '1']; + case 't': return T[inp[1] - '1']; + case 'o': return O[inp[1] - '1']; + } + return BAD_CHAR; +} + +int main(int argc, char* argv[]) { + input = stdin; + if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; + return yyparse (); +} +]]) + +AT_BISON_CHECK([[-o glr-regr3.c glr-regr3.y]], 0, [], +[glr-regr3.y: conflicts: 1 shift/reduce, 1 reduce/reduce +]) +AT_COMPILE([glr-regr3]) + +AT_PARSER_CHECK([[echo p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 | ./glr-regr3]], +0, +[[Result: 1c04 +]], []) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Duplicate representation of merged trees. See ## +## . ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Duplicate representation of merged trees]) + +AT_DATA_GRAMMAR([glr-regr4.y], +[[ +%union { char *ptr; } +%type S A A1 A2 B +%glr-parser + +%{ + #include + #include + #include + static char *merge (YYSTYPE, YYSTYPE); + static char *make_value (char const *, char const *); + static void yyerror (char const *); + static int yylex (void); + static char *ptrs[100]; + static char **ptrs_next = ptrs; +%} + +%% + +tree: S { printf ("%s\n", $1); } ; + +S: + A %merge { $$ = make_value ("S", $1); } + | B %merge { $$ = make_value ("S", $1); } + ; + +A: + A1 %merge { $$ = make_value ("A", $1); } + | A2 %merge { $$ = make_value ("A", $1); } + ; + +A1: 'a' { $$ = make_value ("A1", "'a'"); } ; +A2: 'a' { $$ = make_value ("A2", "'a'"); } ; +B: 'a' { $$ = make_value ("B", "'a'"); } ; + +%% + +static int +yylex (void) +{ + static char const input[] = "a"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +int +main (void) +{ + int status = yyparse (); + while (ptrs_next != ptrs) + free (*--ptrs_next); + return status; +} + +static char * +make_value (char const *parent, char const *child) +{ + char const format[] = "%s <- %s"; + char *value = *ptrs_next++ = + (char *) malloc (strlen (parent) + strlen (child) + sizeof format); + sprintf (value, format, parent, child); + return value; +} + +static char * +merge (YYSTYPE s1, YYSTYPE s2) +{ + char const format[] = "merge{ %s and %s }"; + char *value = *ptrs_next++ = + (char *) malloc (strlen (s1.ptr) + strlen (s2.ptr) + sizeof format); + sprintf (value, format, s1.ptr, s2.ptr); + return value; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} +]]) + +AT_BISON_CHECK([[-o glr-regr4.c glr-regr4.y]], 0, [], +[glr-regr4.y: conflicts: 1 reduce/reduce +]) +AT_COMPILE([glr-regr4]) + +AT_PARSER_CHECK([[./glr-regr4]], 0, +[[merge{ S <- merge{ A <- A1 <- 'a' and A <- A2 <- 'a' } and S <- B <- 'a' } +]], []) + +AT_CLEANUP + + +## -------------------------------------------------------------------------- ## +## User destructor for unresolved GLR semantic value. See ## +## . ## +## -------------------------------------------------------------------------- ## + +AT_SETUP([User destructor for unresolved GLR semantic value]) + +AT_DATA_GRAMMAR([glr-regr5.y], +[[ +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); + enum { MAGIC_VALUE = -1057808125 }; /* originally chosen at random */ +%} + +%glr-parser +%union { int value; } +%type start + +%destructor { + if ($$ != MAGIC_VALUE) + { + fprintf (stderr, "Bad destructor call.\n"); + exit (EXIT_FAILURE); + } +} start + +%% + +start: + 'a' { $$ = MAGIC_VALUE; } + | 'a' { $$ = MAGIC_VALUE; } + ; + +%% + +static int +yylex (void) +{ + static char const input[] = "a"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse () != 1; +} +]]) + +AT_BISON_CHECK([[-o glr-regr5.c glr-regr5.y]], 0, [], +[glr-regr5.y: conflicts: 1 reduce/reduce +]) +AT_COMPILE([glr-regr5]) + +AT_PARSER_CHECK([[./glr-regr5]], 0, [], +[syntax is ambiguous +]) + +AT_CLEANUP + + +## -------------------------------------------------------------------------- ## +## User destructor after an error during a split parse. See ## +## . ## +## -------------------------------------------------------------------------- ## + +AT_SETUP([User destructor after an error during a split parse]) + +AT_DATA_GRAMMAR([glr-regr6.y], +[[ +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); +%} + +%glr-parser +%union { int value; } +%type 'a' + +%destructor { + printf ("Destructor called.\n"); +} 'a' + +%% + +start: 'a' | 'a' ; + +%% + +static int +yylex (void) +{ + static char const input[] = "a"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse () != 1; +} +]]) + +AT_BISON_CHECK([[-o glr-regr6.c glr-regr6.y]], 0, [], +[glr-regr6.y: conflicts: 1 reduce/reduce +]) +AT_COMPILE([glr-regr6]) + +AT_PARSER_CHECK([[./glr-regr6]], 0, +[Destructor called. +], +[syntax is ambiguous +]) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Duplicated user destructor for lookahead. See ## +## . ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Duplicated user destructor for lookahead]) + +AT_DATA_GRAMMAR([glr-regr7.y], +[[ +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); + #define YYSTACKEXPANDABLE 0 + typedef struct count_node { + int count; + struct count_node *prev; + } count_node; + static count_node *tail; +%} + +%glr-parser +%union { count_node *node; } +%type 'a' + +%destructor { + if ($$->count++) + fprintf (stderr, "Destructor called on same value twice.\n"); +} 'a' + +%% + +start: + stack1 start + | stack2 start + | /* empty */ + ; +stack1: 'a' ; +stack2: 'a' ; + +%% + +static int +yylex (void) +{ + yylval.node = (count_node*) malloc (sizeof *yylval.node); + if (!yylval.node) + { + fprintf (stderr, "Test inconclusive.\n"); + exit (EXIT_FAILURE); + } + yylval.node->count = 0; + yylval.node->prev = tail; + tail = yylval.node; + return 'a'; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + int status = yyparse (); + while (tail) + { + count_node *prev = tail->prev; + free (tail); + tail = prev; + } + return status; +} +]]) + +AT_BISON_CHECK([[-o glr-regr7.c glr-regr7.y]], 0, [], +[glr-regr7.y: conflicts: 2 reduce/reduce +]) +AT_COMPILE([glr-regr7]) + +AT_PARSER_CHECK([[./glr-regr7]], 2, [], +[memory exhausted +]) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Incorrect default location for empty right-hand sides. Adapted from bug ## +## report by Claudia Hermann. ## +## See http://lists.gnu.org/archive/html/bug-bison/2005-10/msg00069.html and ## +## http://lists.gnu.org/archive/html/bug-bison/2005-10/msg00072.html ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Incorrectly initialized location for empty right-hand side in GLR]) + +AT_DATA_GRAMMAR([glr-regr8.y], +[[ +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); + static void yyerror (char const *msg); +%} + +%token T_CONSTANT +%token T_PORT +%token T_SIGNAL + +%glr-parser + +%% + + +PortClause : T_PORT InterfaceDeclaration T_PORT + { printf("%d/%d - %d/%d - %d/%d\n", + @1.first_column, @1.last_column, + @2.first_column, @2.last_column, + @3.first_column, @3.last_column); } + ; + +InterfaceDeclaration : OptConstantWord %dprec 1 + | OptSignalWord %dprec 2 + ; + +OptConstantWord : /* empty */ + | T_CONSTANT + ; + +OptSignalWord : /* empty */ + { printf("empty: %d/%d\n", @$.first_column, @$.last_column); } + | T_SIGNAL + ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int lexIndex; + +int yylex (void) +{ + lexIndex += 1; + switch (lexIndex) + { + default: + abort (); + case 1: + yylloc.first_column = 1; + yylloc.last_column = 9; + return T_PORT; + case 2: + yylloc.first_column = 13; + yylloc.last_column = 17; + return T_PORT; + case 3: + return 0; + } +} + +int +main (void) +{ + yyparse(); + return 0; +} +]]) + +AT_BISON_CHECK([[-o glr-regr8.c glr-regr8.y]], 0, [], +[glr-regr8.y: conflicts: 1 reduce/reduce +]) +AT_COMPILE([glr-regr8]) + +AT_PARSER_CHECK([[./glr-regr8]], 0, +[empty: 9/9 +1/9 - 9/9 - 13/17 +], +[]) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## No users destructors if stack 0 deleted. See ## +## . ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([No users destructors if stack 0 deleted]) + +AT_DATA_GRAMMAR([glr-regr9.y], +[[ +%{ +# include +# include + static void yyerror (char const *); + static int yylex (void); +# define YYSTACKEXPANDABLE 0 + static int tokens = 0; + static int destructors = 0; +# define USE(Var) +%} + +%glr-parser +%union { int dummy; } +%type 'a' + +%destructor { + destructors += 1; +} 'a' + +%% + +start: + ambig0 'a' { destructors += 2; USE ($2); } + | ambig1 start { destructors += 1; } + | ambig2 start { destructors += 1; } + ; + +ambig0: 'a' ; +ambig1: 'a' ; +ambig2: 'a' ; + +%% + +static int +yylex (void) +{ + tokens += 1; + return 'a'; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + int exit_status; + exit_status = yyparse (); + if (tokens != destructors) + { + fprintf (stderr, "Tokens = %d, Destructors = %d\n", tokens, destructors); + return 1; + } + return !exit_status; +} +]]) + +AT_BISON_CHECK([[-o glr-regr9.c glr-regr9.y]], 0, [], +[glr-regr9.y: conflicts: 1 reduce/reduce +]) +AT_COMPILE([glr-regr9]) + +AT_PARSER_CHECK([[./glr-regr9]], 0, [], +[memory exhausted +]) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Corrupted semantic options if user action cuts parse. ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Corrupted semantic options if user action cuts parse]) + +AT_DATA_GRAMMAR([glr-regr10.y], +[[ +%{ +# include +# include + static void yyerror (char const *); + static int yylex (void); + #define GARBAGE_SIZE 50 + static char garbage[GARBAGE_SIZE]; +%} + +%glr-parser +%union { char *ptr; } +%type start + +%% + +start: + %dprec 2 { $$ = garbage; YYACCEPT; } + | %dprec 1 { $$ = garbage; YYACCEPT; } + ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return 0; +} + +int +main (void) +{ + int i; + for (i = 0; i < GARBAGE_SIZE; i+=1) + garbage[i] = 108; + return yyparse (); +} +]]) + +AT_BISON_CHECK([[-o glr-regr10.c glr-regr10.y]], 0, [], +[glr-regr10.y: conflicts: 1 reduce/reduce +]) +AT_COMPILE([glr-regr10]) + +AT_PARSER_CHECK([[./glr-regr10]], 0, [], []) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Undesirable destructors if user action cuts parse. ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Undesirable destructors if user action cuts parse]) + +AT_DATA_GRAMMAR([glr-regr11.y], +[[ +%{ +# include + static void yyerror (char const *); + static int yylex (void); + static int destructors = 0; +# define USE(val) +%} + +%glr-parser +%union { int dummy; } +%type 'a' +%destructor { destructors += 1; } 'a' + +%% + +start: + 'a' %dprec 2 { USE ($1); destructors += 1; YYACCEPT; } + | 'a' %dprec 1 { USE ($1); destructors += 1; YYACCEPT; } + ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static char const input[] = "a"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +int +main (void) +{ + int exit_status = yyparse (); + if (destructors != 1) + { + fprintf (stderr, "Destructor calls: %d\n", destructors); + return 1; + } + return exit_status; +} +]]) + +AT_BISON_CHECK([[-o glr-regr11.c glr-regr11.y]], 0, [], +[glr-regr11.y: conflicts: 1 reduce/reduce +]) +AT_COMPILE([glr-regr11]) + +AT_PARSER_CHECK([[./glr-regr11]], 0, [], []) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Leaked semantic values if user action cuts parse. ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Leaked semantic values if user action cuts parse]) + +AT_DATA_GRAMMAR([glr-regr12.y], +[[ +%glr-parser +%union { int dummy; } +%token PARENT_RHS_AFTER +%type parent_rhs_before merged PARENT_RHS_AFTER +%destructor { parent_rhs_before_value = 0; } parent_rhs_before +%destructor { merged_value = 0; } merged +%destructor { parent_rhs_after_value = 0; } PARENT_RHS_AFTER + +%{ +# include + static int merge (YYSTYPE, YYSTYPE); + static void yyerror (char const *); + static int yylex (void); + static int parent_rhs_before_value = 0; + static int merged_value = 0; + static int parent_rhs_after_value = 0; +# define USE(val) +%} + +%% + +start: + alt1 %dprec 1 + | alt2 %dprec 2 + ; + +alt1: + PARENT_RHS_AFTER { + USE ($1); + parent_rhs_after_value = 0; + } + ; + +alt2: + parent_rhs_before merged PARENT_RHS_AFTER { + USE (($1, $2, $3)); + parent_rhs_before_value = 0; + merged_value = 0; + parent_rhs_after_value = 0; + } + ; + +parent_rhs_before: + { + USE ($$); + parent_rhs_before_value = 1; + } + ; + +merged: + %merge { + USE ($$); + merged_value = 1; + } + | cut %merge { + USE ($$); + merged_value = 1; + } + ; + +cut: { YYACCEPT; } ; + +%% + +static int +merge (YYSTYPE s1, YYSTYPE s2) +{ + /* Not invoked. */ + char dummy = s1.dummy + s2.dummy; + return dummy; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static int const input[] = { PARENT_RHS_AFTER, 0 }; + static size_t toknum; + if (! (toknum < sizeof input / sizeof *input)) + abort (); + if (input[toknum] == PARENT_RHS_AFTER) + parent_rhs_after_value = 1; + return input[toknum++]; +} + +int +main (void) +{ + int exit_status = yyparse (); + if (parent_rhs_before_value) + { + fprintf (stderr, "`parent_rhs_before' destructor not called.\n"); + exit_status = 1; + } + if (merged_value) + { + fprintf (stderr, "`merged' destructor not called.\n"); + exit_status = 1; + } + if (parent_rhs_after_value) + { + fprintf (stderr, "`PARENT_RHS_AFTER' destructor not called.\n"); + exit_status = 1; + } + return exit_status; +} +]]) + +AT_BISON_CHECK([[-o glr-regr12.c glr-regr12.y]], 0, [], +[glr-regr12.y: conflicts: 1 shift/reduce, 1 reduce/reduce +]) +AT_COMPILE([glr-regr12]) + +AT_PARSER_CHECK([[./glr-regr12]], 0, [], []) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Incorrect lookahead during deterministic GLR. See ## +## and ## +## . ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Incorrect lookahead during deterministic GLR]) + +AT_DATA_GRAMMAR([glr-regr13.y], +[[ +/* Tests: + - Defaulted state with initial yychar: yychar == YYEMPTY. + - Nondefaulted state: yychar != YYEMPTY. + - Defaulted state after lookahead: yychar != YYEMPTY. + - Defaulted state after shift: yychar == YYEMPTY. + - User action changing the lookahead. */ + +%{ + #include + static void yyerror (char const *); + static int yylex (void); + static void print_lookahead (char const *); + #define USE(value) +%} + +%union { char value; } +%type 'a' 'b' +%glr-parser +%locations + +%% + +start: + defstate_init defstate_shift 'b' change_lookahead 'a' { + USE ($3); + print_lookahead ("start <- defstate_init defstate_shift 'b'"); + } + ; +defstate_init: + { + print_lookahead ("defstate_init <- empty string"); + } + ; +defstate_shift: + nondefstate defstate_look 'a' { + USE ($3); + print_lookahead ("defstate_shift <- nondefstate defstate_look 'a'"); + } + ; +defstate_look: + { + print_lookahead ("defstate_look <- empty string"); + } + ; +nondefstate: + { + print_lookahead ("nondefstate <- empty string"); + } + | 'b' { + USE ($1); + print_lookahead ("nondefstate <- 'b'"); + } + ; +change_lookahead: + { + yychar = 'a'; + } + ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static char const input[] = "ab"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = toknum + 1; + yylval.value = input[toknum] + 'A' - 'a'; + return input[toknum++]; +} + +static void +print_lookahead (char const *reduction) +{ + printf ("%s:\n yychar=", reduction); + if (yychar == YYEMPTY) + printf ("YYEMPTY"); + else if (yychar == YYEOF) + printf ("YYEOF"); + else + { + printf ("'%c', yylval='", yychar); + if (yylval.value > ' ') + printf ("%c", yylval.value); + printf ("', yylloc=(%d,%d),(%d,%d)", + yylloc.first_line, yylloc.first_column, + yylloc.last_line, yylloc.last_column); + } + printf ("\n"); +} + +int +main (void) +{ + yychar = '#'; /* Not a token in the grammar. */ + yylval.value = '!'; + return yyparse (); +} +]]) + +AT_BISON_CHECK([[-o glr-regr13.c glr-regr13.y]], 0, [], []) +AT_COMPILE([glr-regr13]) + +AT_PARSER_CHECK([[./glr-regr13]], 0, +[defstate_init <- empty string: + yychar=YYEMPTY +nondefstate <- empty string: + yychar='a', yylval='A', yylloc=(1,1),(1,1) +defstate_look <- empty string: + yychar='a', yylval='A', yylloc=(1,1),(1,1) +defstate_shift <- nondefstate defstate_look 'a': + yychar=YYEMPTY +start <- defstate_init defstate_shift 'b': + yychar=YYEMPTY +], []) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Incorrect lookahead during nondeterministic GLR. ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Incorrect lookahead during nondeterministic GLR]) + +AT_DATA_GRAMMAR([glr-regr14.y], +[[ +/* Tests: + - Conflicting actions (split-off parse, which copies lookahead need, + which is necessarily yytrue) and nonconflicting actions (non-split-off + parse) for nondefaulted state: yychar != YYEMPTY. + - Merged deferred actions (lookahead need and RHS from different stack + than the target state) and nonmerged deferred actions (same stack). + - Defaulted state after lookahead: yychar != YYEMPTY. + - Defaulted state after shift: yychar == YYEMPTY. + - yychar != YYEMPTY but lookahead need is yyfalse (a previous stack has + seen the lookahead but current stack has not). + - Exceeding stack capacity (stack explosion), and thus reallocating + lookahead need array. + Note that it does not seem possible to see the initial yychar value during + nondeterministic operation since: + - In order to preserve the initial yychar, only defaulted states may be + entered. + - If only defaulted states are entered, there are no conflicts, so + nondeterministic operation does not start. */ + +%union { char value; } + +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); + static void print_lookahead (char const *); + static char merge (union YYSTYPE, union YYSTYPE); + #define USE(value) +%} + +%type 'a' 'b' 'c' 'd' stack_explosion +%glr-parser +%locations + +%% + +start: + merge 'c' stack_explosion { + USE ($2); USE ($3); + print_lookahead ("start <- merge 'c' stack_explosion"); + } + ; + +/* When merging the 2 deferred actions, the lookahead needs are different. */ +merge: + nonconflict1 'a' 'b' nonconflict2 %dprec 1 { + USE ($2); USE ($3); + print_lookahead ("merge <- nonconflict1 'a' 'b' nonconflict2"); + } + | conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2 { + USE ($3); USE ($5); + print_lookahead ("merge <- conflict defstate_look 'a' nonconflict2 'b'" + " defstate_shift"); + } + ; + +nonconflict1: + { + print_lookahead ("nonconflict1 <- empty string"); + } + ; +nonconflict2: + { + print_lookahead ("nonconflict2 <- empty string"); + } + | 'a' { + USE ($1); + print_lookahead ("nonconflict2 <- 'a'"); + } + ; +conflict: + { + print_lookahead ("conflict <- empty string"); + } + ; +defstate_look: + { + print_lookahead ("defstate_look <- empty string"); + } + ; + +/* yychar != YYEMPTY but lookahead need is yyfalse. */ +defstate_shift: + { + print_lookahead ("defstate_shift <- empty string"); + } + ; + +stack_explosion: + { $$ = '\0'; } + | alt1 stack_explosion %merge { $$ = $2; } + | alt2 stack_explosion %merge { $$ = $2; } + | alt3 stack_explosion %merge { $$ = $2; } + ; +alt1: + 'd' no_look { + USE ($1); + if (yychar != 'd' && yychar != YYEOF) + { + fprintf (stderr, "Incorrect lookahead during stack explosion.\n"); + } + } + ; +alt2: + 'd' no_look { + USE ($1); + if (yychar != 'd' && yychar != YYEOF) + { + fprintf (stderr, "Incorrect lookahead during stack explosion.\n"); + } + } + ; +alt3: + 'd' no_look { + USE ($1); + if (yychar != 'd' && yychar != YYEOF) + { + fprintf (stderr, "Incorrect lookahead during stack explosion.\n"); + } + } + ; +no_look: + { + if (yychar != YYEMPTY) + { + fprintf (stderr, + "Found lookahead where shouldn't during stack explosion.\n"); + } + } + ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static char const input[] = "abcdddd"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = toknum + 1; + yylval.value = input[toknum] + 'A' - 'a'; + return input[toknum++]; +} + +static void +print_lookahead (char const *reduction) +{ + printf ("%s:\n yychar=", reduction); + if (yychar == YYEMPTY) + printf ("YYEMPTY"); + else if (yychar == YYEOF) + printf ("YYEOF"); + else + { + printf ("'%c', yylval='", yychar); + if (yylval.value > ' ') + printf ("%c", yylval.value); + printf ("', yylloc=(%d,%d),(%d,%d)", + yylloc.first_line, yylloc.first_column, + yylloc.last_line, yylloc.last_column); + } + printf ("\n"); +} + +static char +merge (union YYSTYPE s1, union YYSTYPE s2) +{ + char dummy = s1.value + s2.value; + return dummy; +} + +int +main (void) +{ + yychar = '#'; /* Not a token in the grammar. */ + yylval.value = '!'; + return yyparse (); +} +]]) + +AT_BISON_CHECK([[-o glr-regr14.c glr-regr14.y]], 0, [], +[glr-regr14.y: conflicts: 3 reduce/reduce +]) +AT_COMPILE([glr-regr14]) + +AT_PARSER_CHECK([[./glr-regr14]], 0, +[conflict <- empty string: + yychar='a', yylval='A', yylloc=(1,1),(1,1) +defstate_look <- empty string: + yychar='a', yylval='A', yylloc=(1,1),(1,1) +nonconflict2 <- empty string: + yychar='b', yylval='B', yylloc=(1,2),(1,2) +defstate_shift <- empty string: + yychar=YYEMPTY +merge <- conflict defstate_look 'a' nonconflict2 'b' defstate_shift: + yychar=YYEMPTY +start <- merge 'c' stack_explosion: + yychar=YYEOF +], []) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Leaked semantic values when reporting ambiguity. ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Leaked semantic values when reporting ambiguity]) + +AT_DATA_GRAMMAR([glr-regr15.y], +[[ +%glr-parser +%destructor { parent_rhs_before_value = 0; } parent_rhs_before + +%{ +# include + static void yyerror (char const *); + static int yylex (void); + static int parent_rhs_before_value = 0; +# define USE(val) +%} + +%% + +start: + alt1 %dprec 1 + | alt2 %dprec 2 + ; + +/* This stack must be merged into the other stacks *last* (added at the + beginning of the semantic options list) so that yyparse will choose to clean + it up rather than the tree for which some semantic actions have been + performed. Thus, if yyreportAmbiguity longjmp's to yyparse, the values from + those other trees are not cleaned up. */ +alt1: ; + +alt2: + parent_rhs_before ambiguity { + USE ($1); + parent_rhs_before_value = 0; + } + ; + +parent_rhs_before: + { + USE ($$); + parent_rhs_before_value = 1; + } + ; + +ambiguity: ambiguity1 | ambiguity2 ; +ambiguity1: ; +ambiguity2: ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return 0; +} + +int +main (void) +{ + int exit_status = yyparse () != 1; + if (parent_rhs_before_value) + { + fprintf (stderr, "`parent_rhs_before' destructor not called.\n"); + exit_status = 1; + } + return exit_status; +} +]]) + +AT_BISON_CHECK([[-o glr-regr15.c glr-regr15.y]], 0, [], +[glr-regr15.y: conflicts: 2 reduce/reduce +]) +AT_COMPILE([glr-regr15]) + +AT_PARSER_CHECK([[./glr-regr15]], 0, [], +[syntax is ambiguous +]) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Leaked lookahead after nondeterministic parse syntax error. ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Leaked lookahead after nondeterministic parse syntax error]) +AT_DATA_GRAMMAR([glr-regr16.y], +[[ +%glr-parser +%destructor { lookahead_value = 0; } 'b' + +%{ +# include + static void yyerror (char const *); + static int yylex (void); + static int lookahead_value = 0; +# define USE(val) +%} + +%% + +start: alt1 'a' | alt2 'a' ; +alt1: ; +alt2: ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static char const input[] = "ab"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + if (input[toknum] == 'b') + lookahead_value = 1; + return input[toknum++]; +} + +int +main (void) +{ + int exit_status = yyparse () != 1; + if (lookahead_value) + { + fprintf (stderr, "Lookahead destructor not called.\n"); + exit_status = 1; + } + return exit_status; +} +]]) + +AT_BISON_CHECK([[-o glr-regr16.c glr-regr16.y]], 0, [], +[glr-regr16.y: conflicts: 1 reduce/reduce +]) +AT_COMPILE([glr-regr16]) + +AT_PARSER_CHECK([[./glr-regr16]], 0, [], +[syntax error +]) + +AT_CLEANUP + + +## ------------------------------------------------------------------------- ## +## Uninitialized location when reporting ambiguity. ## +## ------------------------------------------------------------------------- ## + +AT_SETUP([Uninitialized location when reporting ambiguity]) +AT_DATA_GRAMMAR([glr-regr17.y], +[[ +%glr-parser +%locations +%define api.pure +%error-verbose + +%union { int dummy; } + +%{ + static void yyerror (YYLTYPE *, char const *); + static int yylex (YYSTYPE *, YYLTYPE *); +%} + +%initial-action { + @$.first_line = 1; + @$.first_column = 1; + @$.last_line = 1; + @$.last_column = 1; +} + +%% + +/* Tests the case of an empty RHS that has inherited the location of the + previous nonterminal, which is unresolved. That location is reported as the + last position of the ambiguity. */ +start: ambig1 empty1 | ambig2 empty2 ; + +/* Tests multiple levels of yyresolveLocations recursion. */ +ambig1: sub_ambig1 | sub_ambig2 ; +ambig2: sub_ambig1 | sub_ambig2 ; + +/* Tests the case of a non-empty RHS as well as the case of an empty RHS that + has inherited the initial location. The empty RHS's location is reported as + the first position in the ambiguity. */ +sub_ambig1: empty1 'a' 'b' ; +sub_ambig2: empty2 'a' 'b' ; +empty1: ; +empty2: ; + +%% + +static void +yyerror (YYLTYPE *locp, char const *msg) +{ + fprintf (stderr, "Error at %d.%d-%d.%d: %s.\n", locp->first_line, + locp->first_column, locp->last_line, locp->last_column, msg); +} + +static int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static char const input[] = "ab"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + lvalp->dummy = 0; + llocp->first_line = llocp->last_line = 2; + llocp->first_column = toknum + 1; + llocp->last_column = llocp->first_column + 1; + return input[toknum++]; +} + +int +main (void) +{ + return yyparse () != 1; +} +]]) + +AT_BISON_CHECK([[-o glr-regr17.c glr-regr17.y]], 0, [], +[glr-regr17.y: conflicts: 3 reduce/reduce +]) +AT_COMPILE([glr-regr17]) + +AT_PARSER_CHECK([[./glr-regr17]], 0, [], +[Error at 1.1-2.3: syntax is ambiguous. +]) + +AT_CLEANUP + + +## -------------------------------------------------------------## +## Missed %merge type warnings when LHS type is declared later. ## +## -------------------------------------------------------------## + +AT_SETUP([Missed %merge type warnings when LHS type is declared later]) +AT_DATA_GRAMMAR([glr-regr18.y], +[[%glr-parser + +%{ + #include + static void yyerror (char const *); + static int yylex (); +%} + +%union { + int type1; + int type2; + int type3; +} + +%% + +sym1: sym2 %merge { $$ = $1; } ; +sym2: sym3 %merge { $$ = $1; } ; +sym3: %merge { $$ = 0; } ; + +%type sym1; +%type sym2; +%type sym3; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex () +{ + static int called; + if (called++) + abort (); + return 0; +} + +int +main (void) +{ + return yyparse (); +} +]]) + +AT_BISON_CHECK([[-o glr-regr18.c glr-regr18.y]], 1, [], +[glr-regr18.y:26.18-24: result type clash on merge function `merge': != +glr-regr18.y:25.18-24: previous declaration +glr-regr18.y:27.13-19: result type clash on merge function `merge': != +glr-regr18.y:26.18-24: previous declaration +]) + +AT_CLEANUP diff --git a/tests/headers.at b/tests/headers.at new file mode 100644 index 0000000..8d70b35 --- /dev/null +++ b/tests/headers.at @@ -0,0 +1,135 @@ +# Bison Parser Headers. -*- Autotest -*- +# Copyright (C) 2001, 2002, 2006, 2007 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 . + +AT_BANNER([[Parser Headers.]]) + + +## ---------------------- ## +## %union and --defines. ## +## ---------------------- ## + + +AT_SETUP([%union and --defines]) + +AT_DATA([input.y], +[%union +{ + int integer; + char *string ; +} +%% +exp: {}; +]) + +AT_BISON_CHECK([--defines input.y]) + +AT_CLEANUP + + + +## --------------------- ## +## Invalid CPP headers. ## +## --------------------- ## + +# AT_TEST_CPP_GUARD_H([INPUT-FILE-BASE) +# ------------------------------------- +m4_define([AT_TEST_CPP_GUARD_H], +[AT_SETUP([Invalid CPP guards: $1]) + +# Possibly create inner directories. +dirname=`AS_DIRNAME([$1])` +AS_MKDIR_P([$dirname]) + +AT_DATA_GRAMMAR([$1.y], +[%{ +#include <$1.h> +void yyerror (const char *); +int yylex (void); +%} +%% +dummy:; +%% +#include <$1.h> +]) + +AT_BISON_CHECK([--defines=$1.h --output=y.tab.c $1.y]) + +AT_COMPILE([y.tab.o], [-I. -c y.tab.c]) + +AT_CLEANUP +]) + +AT_TEST_CPP_GUARD_H([input/input]) +AT_TEST_CPP_GUARD_H([9foo]) + + + +## ---------------- ## +## export YYLTYPE. ## +## ---------------- ## + + +AT_SETUP([export YYLTYPE]) + +AT_DATA_GRAMMAR([input.y], +[%locations + +%name-prefix "my_" +%{ +#include +#include + +static int +my_lex (void) +{ + return EOF; +} + +static void +my_error (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +%} +%% +exp:; +]) + +AT_BISON_CHECK([--defines -o input.c input.y]) + +# YYLTYPE should be defined, and MY_LLOC declared. +AT_DATA([caller.c], +[[#include "input.h" +YYLTYPE *my_llocp = &my_lloc; + +int my_parse (void); + +int +main (void) +{ + return my_parse (); +} +]]) + +# Link and execute, just to make sure everything is fine (and in +# particular, that MY_LLOC is indeed defined somewhere). +AT_COMPILE([caller.o], [-c caller.c]) +AT_COMPILE([input.o], [-c input.c]) +AT_COMPILE([caller], [caller.o input.o]) +AT_PARSER_CHECK([./caller]) + +AT_CLEANUP diff --git a/tests/input.at b/tests/input.at new file mode 100644 index 0000000..8bf61fa --- /dev/null +++ b/tests/input.at @@ -0,0 +1,942 @@ +# Checking the Bison scanner. -*- Autotest -*- +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 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 . + +AT_BANNER([[Input Processing.]]) + +# Mostly test that we are robust to mistakes. + + +## ------------ ## +## Invalid $n. ## +## ------------ ## + +AT_SETUP([Invalid $n and @n]) + +AT_DATA([input.y], +[[%% +exp: { $$ = $1 ; }; +exp: { @$ = @1 ; }; +]]) + +AT_BISON_CHECK([input.y], [1], [], +[[input.y:2.13-14: integer out of range: `$1' +input.y:3.13-14: integer out of range: `@1' +]]) + +AT_CLEANUP + + +## -------------- ## +## Type Clashes. ## +## -------------- ## + +AT_SETUP([Type Clashes]) + +AT_DATA([input.y], +[[%union { int bar; } +%token foo +%type exp +%% +exp: foo { $$; } foo { $2; } foo + | foo + | /* Empty. */ + ; +]]) + +AT_BISON_CHECK([input.y], [1], [], +[[input.y:5.12-13: $$ for the midrule at $2 of `exp' has no declared type +input.y:5.24-25: $2 of `exp' has no declared type +input.y:5.6-32: warning: type clash on default action: != <> +input.y:6.6-8: warning: type clash on default action: != <> +input.y:7.5: warning: empty rule for typed nonterminal, and no action +]]) + +AT_CLEANUP + + +# _AT_UNUSED_VALUES_DECLARATIONS() +# -------------------------------------------- +# Generate the token, type, and destructor +# declarations for the unused values tests. + +m4_define([_AT_UNUSED_VALUES_DECLARATIONS], +[[[%token INT; +%type a b c d e f g h i j k l; +%destructor { destroy ($$); } INT a b c d e f g h i j k l;]]]) + + +# AT_CHECK_UNUSED_VALUES(DECLARATIONS_AFTER, CHECK_MIDRULE_VALUES) +# ------------------------------------------------------------------ +# Generate a grammar to test unused values, +# compile it, run it. If DECLARATIONS_AFTER +# is set, then the token, type, and destructor +# declarations are generated after the rules +# rather than before. If CHECK_MIDRULE_VALUES +# is set, then --warnings=midrule-values is +# set. + +m4_define([AT_CHECK_UNUSED_VALUES], +[AT_DATA([input.y], +m4_ifval($1, [ + + +], [_AT_UNUSED_VALUES_DECLARATIONS +])[[%% +start: + 'a' a { $]2[ } | 'b' b { $]2[ } | 'c' c { $]2[ } | 'd' d { $]2[ } | 'e' e { $]2[ } +| 'f' f { $]2[ } | 'g' g { $]2[ } | 'h' h { $]2[ } | 'i' i { $]2[ } | 'j' j { $]2[ } +| 'k' k { $]2[ } | 'l' l { $]2[ } +; + +a: INT | INT { } INT { } INT { }; +b: INT | /* empty */; +c: INT | INT { $]1[ } INT { $2 } INT { $4 }; +d: INT | INT { } INT { $]1[ } INT { $2 }; +e: INT | INT { } INT { } INT { $]1[ }; +f: INT | INT { } INT { } INT { $]$[ = $]1[ + $]3[ + $]5[; }; +g: INT | INT { $$; } INT { $$; } INT { }; +h: INT | INT { $$; } INT { $$ = $2; } INT { }; +i: INT | INT INT { } { $]$[ = $]1[ + $]2[; }; +j: INT | INT INT { $$ = 1; } { $]$[ = $]1[ + $]2[; }; +k: INT | INT INT { $$; } { $$ = $3; } { }; +l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; };]]m4_ifval($1, [ +_AT_UNUSED_VALUES_DECLARATIONS]) +) + +AT_BISON_CHECK(m4_ifval($2, [ --warnings=midrule-values ])[ input.y], [0], [], +[[input.y:11.10-32: warning: unset value: $]$[ +input.y:11.10-32: warning: unused value: $]1[ +input.y:11.10-32: warning: unused value: $]3[ +input.y:11.10-32: warning: unused value: $]5[ +input.y:12.9: warning: empty rule for typed nonterminal, and no action +]]m4_ifval($2, [[[input.y:13.14-19: warning: unset value: $$ +input.y:13.25-39: warning: unset value: $$ +]]])[[input.y:13.10-59: warning: unset value: $]$[ +input.y:13.10-59: warning: unused value: $]3[ +input.y:13.10-59: warning: unused value: $]5[ +]]m4_ifval($2, [[[input.y:14.14-16: warning: unset value: $$ +]]])[[input.y:14.10-47: warning: unset value: $]$[ +input.y:14.10-47: warning: unused value: $]3[ +input.y:14.10-47: warning: unused value: $]5[ +input.y:15.10-36: warning: unset value: $]$[ +input.y:15.10-36: warning: unused value: $]3[ +input.y:15.10-36: warning: unused value: $]5[ +input.y:17.10-58: warning: unset value: $]$[ +input.y:17.10-58: warning: unused value: $]1[ +]]m4_ifval($2, [[[input.y:17.10-58: warning: unused value: $]2[ +]]])[[input.y:17.10-58: warning: unused value: $]3[ +]]m4_ifval($2, [[[input.y:17.10-58: warning: unused value: $]4[ +]]])[[input.y:17.10-58: warning: unused value: $]5[ +input.y:18.10-72: warning: unset value: $]$[ +input.y:18.10-72: warning: unused value: $]1[ +input.y:18.10-72: warning: unused value: $]3[ +]]m4_ifval($2, [[[input.y:18.10-72: warning: unused value: $]4[ +]]])[[input.y:18.10-72: warning: unused value: $]5[ +]]m4_ifval($2, [[[input.y:20.10-55: warning: unused value: $]3[ +]]])[[input.y:21.10-68: warning: unset value: $]$[ +input.y:21.10-68: warning: unused value: $]1[ +input.y:21.10-68: warning: unused value: $]2[ +]]m4_ifval($2, [[[input.y:21.10-68: warning: unused value: $]4[ +]]]))]) + + +## --------------- ## +## Unused values. ## +## --------------- ## + +AT_SETUP([Unused values]) +AT_CHECK_UNUSED_VALUES +AT_CHECK_UNUSED_VALUES(, [1]) +AT_CLEANUP + + +## ------------------------------------------ ## +## Unused values before symbol declarations. ## +## ------------------------------------------ ## + +AT_SETUP([Unused values before symbol declarations]) +AT_CHECK_UNUSED_VALUES([1]) +AT_CHECK_UNUSED_VALUES([1], [1]) +AT_CLEANUP + + +## --------------------------------------------- ## +## Default %printer and %destructor redeclared. ## +## --------------------------------------------- ## + +AT_SETUP([Default %printer and %destructor redeclared]) + +AT_DATA([[input.y]], +[[%destructor { destroy ($$); } <*> <*> +%printer { destroy ($$); } <*> <*> + +%destructor { destroy ($$); } <*> +%printer { destroy ($$); } <*> + +%destructor { destroy ($$); } <> <> +%printer { destroy ($$); } <> <> + +%destructor { destroy ($$); } <> +%printer { destroy ($$); } <> + +%% + +start: ; + +%destructor { destroy ($$); } <*>; +%printer { destroy ($$); } <*>; + +%destructor { destroy ($$); } <>; +%printer { destroy ($$); } <>; +]]) + +AT_BISON_CHECK([input.y], [1], [], +[[input.y:1.13-29: redeclaration for default tagged %destructor +input.y:1.13-29: previous declaration +input.y:2.10-26: redeclaration for default tagged %printer +input.y:2.10-26: previous declaration +input.y:4.13-29: redeclaration for default tagged %destructor +input.y:1.13-29: previous declaration +input.y:5.10-26: redeclaration for default tagged %printer +input.y:2.10-26: previous declaration +input.y:7.13-29: redeclaration for default tagless %destructor +input.y:7.13-29: previous declaration +input.y:8.10-26: redeclaration for default tagless %printer +input.y:8.10-26: previous declaration +input.y:10.13-29: redeclaration for default tagless %destructor +input.y:7.13-29: previous declaration +input.y:11.10-26: redeclaration for default tagless %printer +input.y:8.10-26: previous declaration +input.y:17.13-29: redeclaration for default tagged %destructor +input.y:4.13-29: previous declaration +input.y:18.10-26: redeclaration for default tagged %printer +input.y:5.10-26: previous declaration +input.y:20.13-29: redeclaration for default tagless %destructor +input.y:10.13-29: previous declaration +input.y:21.10-26: redeclaration for default tagless %printer +input.y:11.10-26: previous declaration +]]) + +AT_CLEANUP + + +## ---------------------------------------------- ## +## Per-type %printer and %destructor redeclared. ## +## ---------------------------------------------- ## + +AT_SETUP([Per-type %printer and %destructor redeclared]) + +AT_DATA([[input.y]], +[[%destructor { destroy ($$); } +%printer { destroy ($$); } + +%destructor { destroy ($$); } +%printer { destroy ($$); } + +%% + +start: ; + +%destructor { destroy ($$); } ; +%printer { destroy ($$); } ; +]]) + +AT_BISON_CHECK([input.y], [1], [], +[[input.y:4.13-29: %destructor redeclaration for +input.y:1.13-29: previous declaration +input.y:4.13-29: %destructor redeclaration for +input.y:4.13-29: previous declaration +input.y:5.10-26: %printer redeclaration for +input.y:2.10-26: previous declaration +input.y:5.10-26: %printer redeclaration for +input.y:5.10-26: previous declaration +input.y:11.13-29: %destructor redeclaration for +input.y:4.13-29: previous declaration +input.y:11.13-29: %destructor redeclaration for +input.y:1.13-29: previous declaration +input.y:12.10-26: %printer redeclaration for +input.y:2.10-26: previous declaration +input.y:12.10-26: %printer redeclaration for +input.y:5.10-26: previous declaration +]]) + +AT_CLEANUP + + +## ---------------------------------------- ## +## Unused values with default %destructor. ## +## ---------------------------------------- ## + +AT_SETUP([Unused values with default %destructor]) + +AT_DATA([[input.y]], +[[%destructor { destroy ($$); } <> +%type tagged + +%% + +start: end end tagged tagged { $1; $3; } ; +end: { } ; +tagged: { } ; +]]) + +AT_BISON_CHECK([input.y], [0], [], +[[input.y:6.8-45: warning: unset value: $$ +input.y:6.8-45: warning: unused value: $2 +input.y:7.6-8: warning: unset value: $$ +]]) + +AT_DATA([[input.y]], +[[%destructor { destroy ($$); } <*> +%type tagged + +%% + +start: end end tagged tagged { $1; $3; } ; +end: { } ; +tagged: { } ; +]]) + +AT_BISON_CHECK([input.y], [0], [], +[[input.y:6.8-45: warning: unused value: $4 +input.y:8.9-11: warning: unset value: $$ +]]) + +AT_CLEANUP + + +## ----------------------------------------- ## +## Unused values with per-type %destructor. ## +## ----------------------------------------- ## + +AT_SETUP([Unused values with per-type %destructor]) + +AT_DATA([[input.y]], +[[%destructor { destroy ($$); } +%type start end + +%% + +start: end end { $1; } ; +end: { } ; +]]) + +AT_BISON_CHECK([input.y], [0], [], +[[input.y:6.8-22: warning: unset value: $$ +input.y:6.8-22: warning: unused value: $2 +input.y:7.6-8: warning: unset value: $$ +]]) + +AT_CLEANUP + + +## ---------------------- ## +## Incompatible Aliases. ## +## ---------------------- ## + +AT_SETUP([Incompatible Aliases]) + +AT_DATA([input.y], +[[%token foo "foo" + +%type foo +%printer {bar} foo +%destructor {bar} foo +%left foo + +%type "foo" +%printer {baz} "foo" +%destructor {baz} "foo" +%left "foo" + +%% +exp: foo; +]]) + +AT_BISON_CHECK([input.y], [1], [], +[[input.y:8.7-11: %type redeclaration for foo +input.y:3.7-11: previous declaration +input.y:10.13-17: %destructor redeclaration for foo +input.y:5.13-17: previous declaration +input.y:9.10-14: %printer redeclaration for foo +input.y:4.10-14: previous declaration +input.y:11.1-5: %left redeclaration for foo +input.y:6.1-5: previous declaration +]]) + +AT_CLEANUP + + + +## ----------------------- ## +## Torturing the Scanner. ## +## ----------------------- ## + +# Be sure to compile and run, so that the C compiler checks what +# we do. + +AT_SETUP([Torturing the Scanner]) + + +AT_DATA([input.y], []) +AT_BISON_CHECK([input.y], [1], [], +[[input.y:1.1: syntax error, unexpected end of file +]]) + + +AT_DATA([input.y], +[{} +]) +AT_BISON_CHECK([input.y], [1], [], +[[input.y:1.1-2: syntax error, unexpected {...} +]]) + + +AT_DATA_GRAMMAR([input.y], +[[%{ +/* This is seen in GCC: a %{ and %} in middle of a comment. */ +const char *foo = "So %{ and %} can be here too."; + +#if 0 +/* These examples test Bison while not stressing C compilers too much. + Many C compilers mishandle backslash-newlines, so this part of the + test is inside "#if 0". The comment and string are written so that + the "#endif" will be seen regardless of the C compiler bugs that we + know about, namely: + + HP C (as of late 2002) mishandles *\[newline]\[newline]/ within a + comment. + + The Apple Darwin compiler (as of late 2002) mishandles + \\[newline]' within a character constant. + + */ + +/\ +* A comment with backslash-newlines in it. %} *\ +\ +/ +/* { Close the above comment, if the C compiler mishandled it. */ + +char str[] = "\\ +" A string with backslash-newlines in it %{ %} \\ +\ +""; + +char apostrophe = '\''; +#endif + +#include +#include +%} +/* %{ and %} can be here too. */ + +%{ +/* Exercise pre-prologue dependency to %union. */ +typedef int value; +%} + +/* Exercise M4 quoting: '@:>@@:>@', 0. */ + +/* Also exercise %union. */ +%union +{ + value ival; /* A comment to exercise an old bug. */ +}; + + +/* Exercise post-prologue dependency to %union. */ +%{ +static YYSTYPE value_as_yystype (value val); + +/* Exercise quotes in declarations. */ +char quote[] = "@:>@@:>@,"; +%} + +%{ +static void yyerror (const char *s); +static int yylex (void); +%} + +%type '@<:@' + +/* Exercise quotes in strings. */ +%token FAKE "fake @<:@@:>@ \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c ??!??'??(??)??-??/?? \x1\1" + +%% +/* Exercise M4 quoting: '@:>@@:>@', @<:@, 1. */ +exp: '@<:@' '\1' two '$' '@' '{' oline output.or.oline.opt + { + /* Exercise quotes in braces. */ + char tmp[] = "@<:@%c@:>@,\n"; + printf (tmp, $1); + } +; + +two: '\x000000000000000000000000000000000000000000000000000000000000000000002'; +oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_'; +output.or.oline.opt: ;|oline;;|output;;; +output: '#' 'o' 'u' 't' 'p' 'u' 't' ' '; +%% +/* Exercise M4 quoting: '@:>@@:>@', @<:@, 2. */ + +static YYSTYPE +value_as_yystype (value val) +{ + YYSTYPE res; + res.ival = val; + return res; +} + +static int +yylex (void) +{ + static char const input[] = "@<:@\1\2$@{@oline@__@&t@oline__\ +#output "; /* " + */ + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylval = value_as_yystype (input[toknum]); + return input[toknum++]; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} +]]) + +# Pacify Emacs'font-lock-mode: " + +AT_DATA([main.c], +[[typedef int value; +#include "input.h" + +int yyparse (void); + +int +main (void) +{ + return yyparse (); +} +]]) + +AT_BISON_CHECK([-d -v -o input.c input.y]) +AT_COMPILE([input.o], [-c input.c]) +AT_COMPILE([main.o], [-c main.c]) +AT_COMPILE([input], [input.o main.o]) +AT_PARSER_CHECK([./input], 0, +[[[@<:@], +]]) + +AT_CLEANUP + + +## ---------------------- ## +## Typed symbol aliases. ## +## ---------------------- ## + +AT_SETUP([Typed symbol aliases]) + +# Bison 2.0 broke typed symbol aliases - ensure they work. + +AT_DATA_GRAMMAR([input.y], +[[%union +{ + int val; +}; +%token MY_TOKEN "MY TOKEN" +%type exp +%% +exp: "MY TOKEN"; +%% +]]) + +AT_BISON_CHECK([-o input.c input.y]) + +AT_CLEANUP + + +## --------- ## +## Require. ## +## --------- ## + +m4_define([AT_CHECK_REQUIRE], +[AT_SETUP([Require $1]) +AT_DATA_GRAMMAR([input.y], +[[%require "$1"; +%% +empty_file:; +]]) +AT_BISON_CHECK([-o input.c input.y], $2, [], ignore) +AT_CLEANUP +]) + +AT_CHECK_REQUIRE(1.0, 0) +AT_CHECK_REQUIRE(AT_PACKAGE_VERSION, 0) +## FIXME: Some day augment this version number. +AT_CHECK_REQUIRE(100.0, 63) + + +## ------------------------------------- ## +## String aliases for character tokens. ## +## ------------------------------------- ## + +AT_SETUP([String aliases for character tokens]) + +# Bison once thought a character token and its alias were different symbols +# with the same user token number. + +AT_DATA_GRAMMAR([input.y], +[[%token 'a' "a" +%% +start: 'a'; +%% +]]) + +AT_BISON_CHECK([-o input.c input.y]) + +AT_CLEANUP + + +## --------------------- ## +## Unclosed constructs. ## +## --------------------- ## + +AT_SETUP([Unclosed constructs]) + +# Bison's scan-gram.l once forgot to STRING_FINISH some unclosed constructs, so +# they were prepended to whatever it STRING_GROW'ed next. It also threw them +# away rather than returning them to the parser. The effect was confusing +# subsequent error messages. + +AT_DATA([input.y], +[[%token A "a +%token B "b" +%token AB "ab" // Used to complain that "ab" was already used. +%token C '1 +%token TWO "2" +%token TICK_TWELVE "'12" // Used to complain that "'12" was already used. + +%% + +start: ; + +// Used to report a syntax error because it didn't see any kind of symbol +// identifier. +%type 'a +; +%type "a +; +// Used to report a syntax error because it didn't see braced code. +%destructor { free ($$) +]]) + +AT_BISON_CHECK([-o input.c input.y], 1, [], +[[input.y:1.10-2.0: missing `"' at end of line +input.y:4.10-5.0: missing `'' at end of line +input.y:14.11-15.0: missing `'' at end of line +input.y:16.11-17.0: missing `"' at end of line +input.y:19.13-20.0: missing `}' at end of file +input.y:20.1: syntax error, unexpected end of file +]]) + +AT_CLEANUP + + +## ------------------------- ## +## %start after first rule. ## +## ------------------------- ## + +AT_SETUP([%start after first rule]) + +# Bison once complained that a %start after the first rule was a redeclaration +# of the start symbol. + +AT_DATA([input.y], +[[%% +false_start: ; +start: false_start ; +%start start; +]]) + +AT_BISON_CHECK([-o input.c input.y]) + +AT_CLEANUP + + +## --------------------- ## +## %prec takes a token. ## +## --------------------- ## + +AT_SETUP([%prec takes a token]) + +# Bison once allowed %prec sym where sym was a nonterminal. + +AT_DATA([input.y], +[[%% +start: PREC %prec PREC ; +PREC: ; +]]) + +AT_BISON_CHECK([input.y], [1], [], +[[input.y:3.1-4: rule given for PREC, which is a token +]]) + +AT_CLEANUP + + +## -------------------------------- ## +## Reject unused %code qualifiers. ## +## -------------------------------- ## + +AT_SETUP([Reject unused %code qualifiers]) + +AT_DATA([input-c.y], +[[%code q {} +%code bad {} +%code bad {} +%code format {} +%% +start: ; +]]) +AT_BISON_CHECK([[input-c.y]], [0], [], +[[input-c.y:1.7: warning: %code qualifier `q' is not used +input-c.y:2.7-9: warning: %code qualifier `bad' is not used +input-c.y:3.7-9: warning: %code qualifier `bad' is not used +input-c.y:4.7-12: warning: %code qualifier `format' is not used +]]) + +AT_DATA([input-c-glr.y], +[[%code q {} +%code bad {} + %code bad {} +%% +start: ; +]]) +AT_BISON_CHECK([[input-c-glr.y]], [0], [], +[[input-c-glr.y:1.7: warning: %code qualifier `q' is not used +input-c-glr.y:2.7-9: warning: %code qualifier `bad' is not used +input-c-glr.y:3.8-10: warning: %code qualifier `bad' is not used +]]) + +AT_DATA([input-c++.y], +[[%code q {} +%code bad {} + %code q {} +%% +start: ; +]]) +AT_BISON_CHECK([[input-c++.y]], [0], [], +[[input-c++.y:1.7: warning: %code qualifier `q' is not used +input-c++.y:2.7-9: warning: %code qualifier `bad' is not used +input-c++.y:3.8: warning: %code qualifier `q' is not used +]]) + +AT_DATA([input-c++-glr.y], +[[%code bad {} +%code q {} +%code q {} +%% +start: ; +]]) +AT_BISON_CHECK([[input-c++-glr.y]], [0], [], +[[input-c++-glr.y:1.7-9: warning: %code qualifier `bad' is not used +input-c++-glr.y:2.7: warning: %code qualifier `q' is not used +input-c++-glr.y:3.7: warning: %code qualifier `q' is not used +]]) + +AT_DATA([special-char-@@.y], +[[%code bad {} +%code q {} +%code q {} +%% +start: ; +]]) +AT_BISON_CHECK([[special-char-@@.y]], [0], [], +[[special-char-@@.y:1.7-9: warning: %code qualifier `bad' is not used +special-char-@@.y:2.7: warning: %code qualifier `q' is not used +special-char-@@.y:3.7: warning: %code qualifier `q' is not used +]]) + +AT_DATA([special-char-@:>@.y], +[[%code bad {} +%code q {} +%code q {} +%% +start: ; +]]) +AT_BISON_CHECK([[special-char-@:>@.y]], [0], [], +[[special-char-@:>@.y:1.7-9: warning: %code qualifier `bad' is not used +special-char-@:>@.y:2.7: warning: %code qualifier `q' is not used +special-char-@:>@.y:3.7: warning: %code qualifier `q' is not used +]]) + +AT_CLEANUP + + +## ---------------- ## +## %define errors. ## +## ---------------- ## + +AT_SETUP([%define errors]) + +AT_DATA([input.y], +[[%define var "value1" +%define var "value1" + %define var "value2" +%define special1 "@:>@" +%define special2 "@<:@" +%% +start: ; +]]) + +AT_BISON_CHECK([[input.y]], [0], [], +[[input.y:2.9-11: warning: %define variable `var' redefined +input.y:1.9-11: warning: previous definition +input.y:3.10-12: warning: %define variable `var' redefined +input.y:2.9-11: warning: previous definition +input.y:1.9-11: warning: %define variable `var' is not used +input.y:2.9-11: warning: %define variable `var' is not used +input.y:3.10-12: warning: %define variable `var' is not used +input.y:4.9-16: warning: %define variable `special1' is not used +input.y:5.9-16: warning: %define variable `special2' is not used +]]) + +AT_CLEANUP + +## --------------------------- ## +## %define Boolean variables. ## +## --------------------------- ## + +AT_SETUP([[%define Boolean variables]]) + +AT_DATA([Input.y], +[[%language "Java" +%define public "maybe" +%define parser_class_name "Input" +%% +start: ; +]]) + +AT_BISON_CHECK([[Input.y]], [1], [], +[[Input.y:2.9-14: invalid value for %define Boolean variable `public' +]]) + +AT_CLEANUP + +## ------------------------ ## +## %define enum variables. ## +## ------------------------ ## + +AT_SETUP([[%define enum variables]]) + +AT_DATA([[input.y]], +[[%define api.push_pull "neither" +%% +start: ; +]]) + +AT_BISON_CHECK([[input.y]], [1], [], +[[input.y:1.9-21: invalid value for %define variable `api.push_pull': `neither' +]]) + +AT_CLEANUP + +## ------------------------- ## +## Unused %define api.pure. ## +## ------------------------- ## + +AT_SETUP([[Unused %define api.pure]]) + +# AT_CHECK_API_PURE(DECLS, VALUE) +# ------------------------------- +# Make sure Bison reports that `%define api.pure VALUE' is unused when DECLS +# are specified. +m4_define([AT_CHECK_API_PURE], +[ +AT_DATA([[input.y]], +[[%define api.pure ]$2[ +]$1[ +%% +start: ; +]]) + +AT_BISON_CHECK([[input.y]], [0], [], +[[input.y:1.9-16: warning: %define variable `api.pure' is not used +]]) +]) + +AT_CHECK_API_PURE([[%language "c++" %defines]], [[]]) +AT_CHECK_API_PURE([[%language "c++" %defines]], [["false"]]) +AT_CHECK_API_PURE([[%language "c++" %defines %glr-parser]], [[""]]) +AT_CHECK_API_PURE([[%language "c++" %defines %glr-parser]], [["false"]]) +AT_CHECK_API_PURE([[%language "java"]], [["true"]]) +AT_CHECK_API_PURE([[%language "java"]], [["false"]]) + +AT_CLEANUP + +## -------------------------------- ## +## C++ namespace reference errors. ## +## -------------------------------- ## + +AT_SETUP([[C++ namespace reference errors]]) + +# AT_CHECK_NAMESPACE_ERROR(NAMESPACE-DECL, ERROR, [ERROR], ...) +# ------------------------------------------------------------- +# Make sure Bison reports all ERROR's for %define namespace "NAMESPACE-DECL". +m4_define([AT_CHECK_NAMESPACE_ERROR], +[ +AT_DATA([[input.y]], +[[%language "C++" +%defines +%define namespace "]$1[" +%% +start: ; +]]) + +AT_BISON_CHECK([[input.y]], [1], [], +[m4_foreach([b4_arg], m4_dquote(m4_shift($@)), +[[input.y:3.9-17: ]b4_arg[ +]])]) +]) + +AT_CHECK_NAMESPACE_ERROR([[]], + [[namespace reference is empty]]) +AT_CHECK_NAMESPACE_ERROR([[ ]], + [[namespace reference is empty]]) +AT_CHECK_NAMESPACE_ERROR([[foo::::bar]], + [[namespace reference has consecutive "::"]]) +AT_CHECK_NAMESPACE_ERROR([[foo:: ::bar]], + [[namespace reference has consecutive "::"]]) +AT_CHECK_NAMESPACE_ERROR([[::::bar]], + [[namespace reference has consecutive "::"]]) +AT_CHECK_NAMESPACE_ERROR([[:: ::bar]], + [[namespace reference has consecutive "::"]]) +AT_CHECK_NAMESPACE_ERROR([[foo::bar:: ::]], + [[namespace reference has consecutive "::"]], + [[namespace reference has a trailing "::"]]) +AT_CHECK_NAMESPACE_ERROR([[foo::bar::]], + [[namespace reference has a trailing "::"]]) +AT_CHECK_NAMESPACE_ERROR([[foo::bar:: ]], + [[namespace reference has a trailing "::"]]) +AT_CHECK_NAMESPACE_ERROR([[::]], + [[namespace reference has a trailing "::"]]) + +AT_CLEANUP diff --git a/tests/java.at b/tests/java.at new file mode 100644 index 0000000..a3e1a0e --- /dev/null +++ b/tests/java.at @@ -0,0 +1,766 @@ +# Java tests for simple calculator. -*- Autotest -*- + +# Copyright (C) 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 . + +AT_BANNER([[Java Calculator.]]) + + +# ------------------------- # +# Helping Autotest macros. # +# ------------------------- # + + +# _AT_DATA_JAVA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES]) +# ---------------------------------------------------------------------- +# Produce `calc.y'. Don't call this macro directly, because it contains +# some occurrences of `$1' etc. which will be interpreted by m4. So +# you should call it with $1, $2, and $3 as arguments, which is what +# AT_DATA_JAVA_CALC_Y does. +m4_define([_AT_DATA_JAVA_CALC_Y], +[m4_if([$1$2$3], $[1]$[2]$[3], [], + [m4_fatal([$0: Invalid arguments: $@])])dnl +AT_DATA([Calc.y], +[[/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + +]$4[ + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + +]AT_LEXPARAM_IF([[ +%code lexer { +]], +[[ +%% +class CalcLexer implements Calc.Lexer { +]])[ + StreamTokenizer st; + + public ]AT_LEXPARAM_IF([[YYLexer]], [[CalcLexer]]) (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + +AT_LOCATION_IF([[ + Position yystartpos; + Position yyendpos = new Position (1); + + public Position getStartPos() { + return yystartpos; + } + + public Position getEndPos() { + return yyendpos; + } + + public void yyerror (Calc.Location l, String s) + { + if (l == null) + System.err.println (s); + else + System.err.println (l.begin + ": " + s); + } +]], [[ + public void yyerror (String s) + { + System.err.println (s); + } +]])[ + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + ]AT_LOCATION_IF([[yystartpos = yyendpos;]])[ + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + ]AT_LOCATION_IF([[yyendpos = new Position (yyendpos.lineno () + 1);]])[ + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + +]AT_LEXPARAM_IF([[ +}; +%%]], [[ +}]]) + +[ +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +]]) +])# _AT_DATA_JAVA_CALC_Y + + +# AT_DATA_CALC_Y([BISON-OPTIONS]) +# ------------------------------------------------- +# Produce `calc.y'. +m4_define([AT_DATA_JAVA_CALC_Y], +[_AT_DATA_JAVA_CALC_Y($[1], $[2], $[3], [$1]) +]) + + + +# AT_JAVA_COMPILE(SOURCE) +# ----------------------- +# Compile SOURCES into Java class files. Skip the test if java or javac is +# not installed. +m4_define([AT_JAVA_COMPILE], +[AT_CHECK([test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77]) +AT_CHECK([$SHELL ../../../javacomp.sh $1], + 0, [ignore], [ignore])]) + + +# AT_JAVA_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE]) +# ----------------------------------------------------------------- +m4_define([AT_JAVA_PARSER_CHECK], +[AT_CHECK([$5 $SHELL ../../../javaexec.sh $1], [$2], [$3], [$4])]) + + +# _AT_CHECK_JAVA_CALC_ERROR(BISON-OPTIONS, INPUT, +# [VERBOSE-AND-LOCATED-ERROR-MESSAGE]) +# --------------------------------------------------------- +# Run `calc' on INPUT, and expect a `syntax error' message. +# +# If INPUT starts with a slash, it is used as absolute input file name, +# otherwise as contents. +# +# The VERBOSE-AND-LOCATED-ERROR-MESSAGE is stripped of locations +# and expected tokens if necessary, and compared with the output. +m4_define([_AT_CHECK_JAVA_CALC_ERROR], +[m4_bmatch([$2], [^/], + [AT_JAVA_PARSER_CHECK([Calc < $2], 0, [], [stderr])], + [AT_DATA([[input]], +[[$2 +]]) +AT_JAVA_PARSER_CHECK([Calc < input], 0, [], [stderr])]) + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +AT_DATA([[expout]], +[$3 +]) +# 2. If locations are not used, remove them. +AT_YYERROR_SEES_LOC_IF([], +[[sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout]]) +# 3. If error-verbose is not used, strip the`, unexpected....' part. +m4_bmatch([$1], [%error-verbose], [], +[[sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout]]) +# 4. Check +AT_CHECK([cat stderr], 0, [expout]) +]) + +# _AT_CHECK_JAVA_CALC([BISON-DIRECTIVES], [BISON-CODE]) +# ----------------------------------------------------------------------- +# Start a testing chunk which compiles `calc' grammar with +# BISON-DIRECTIVES, and performs several tests over the parser. +m4_define([_AT_CHECK_JAVA_CALC], +[# We use integers to avoid dependencies upon the precision of doubles. +AT_SETUP([Calculator $1]) + +AT_BISON_OPTION_PUSHDEFS([$1]) + +AT_DATA_JAVA_CALC_Y([$1 +%code { +$2 +}]) + +AT_BISON_CHECK([-o Calc.java Calc.y]) +AT_JAVA_COMPILE([Calc.java]) + +# Test the priorities. +AT_DATA([[input]], +[[1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +]]) +AT_JAVA_PARSER_CHECK([Calc < input], 0, [], [stderr]) + + +# Some syntax errors. +_AT_CHECK_JAVA_CALC_ERROR([$1], [0 0], + [1: syntax error, unexpected number]) +_AT_CHECK_JAVA_CALC_ERROR([$1], [1//2], + [1: syntax error, unexpected '/', expecting number or '-' or '(' or '!']) +_AT_CHECK_JAVA_CALC_ERROR([$1], [error], + [1: syntax error, unexpected $undefined]) +_AT_CHECK_JAVA_CALC_ERROR([$1], [1 = 2 = 3], + [1: syntax error, unexpected '=']) +_AT_CHECK_JAVA_CALC_ERROR([$1], [ ++1], + [2: syntax error, unexpected '+']) +# Exercise error messages with EOF: work on an empty file. +_AT_CHECK_JAVA_CALC_ERROR([$1], [/dev/null], + [1: syntax error, unexpected end of input]) + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +_AT_CHECK_JAVA_CALC_ERROR([$1], + [() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1], +[1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1]) + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +_AT_CHECK_JAVA_CALC_ERROR([$1], [(!) + (0 0) = 1], +[1: syntax error, unexpected number +calc: error: 2222 != 1]) +_AT_CHECK_JAVA_CALC_ERROR([$1], [(- *) + (0 0) = 1], +[1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1]) +AT_BISON_OPTION_POPDEFS + +AT_CLEANUP +])# _AT_CHECK_JAVA_CALC + + +# AT_CHECK_JAVA_CALC([BISON-DIRECTIVES]) +# -------------------------------------------------------- +# Start a testing chunk which compiles `calc' grammar with +# BISON-DIRECTIVES, and performs several tests over the parser. +# Run the test with and without %error-verbose. +m4_define([AT_CHECK_JAVA_CALC], +[_AT_CHECK_JAVA_CALC([$1], [$2]) +_AT_CHECK_JAVA_CALC([%error-verbose $1], [$2]) +_AT_CHECK_JAVA_CALC([%locations $1], [$2]) +_AT_CHECK_JAVA_CALC([%error-verbose %locations $1], [$2]) +])# AT_CHECK_JAVA_CALC + + +# ------------------------ # +# Simple LALR Calculator. # +# ------------------------ # + +AT_CHECK_JAVA_CALC([], [[ + public static void main (String args[]) throws IOException + { + CalcLexer l = new CalcLexer (System.in); + Calc p = new Calc (l); + p.parse (); + } +]]) + +AT_CHECK_JAVA_CALC([%lex-param { InputStream is } ], [[ + public static void main (String args[]) throws IOException + { + new Calc (System.in).parse (); + } +]]) + + + +# -----------------# +# Java Directives. # +# -----------------# + +AT_BANNER([Java Parameters.]) + + +# AT_CHECK_JAVA_MINIMAL([DIRECTIVES], [PARSER_ACTION], [POSITION_CLASS]) +# ---------------------------------------------------------------------- +# Check that a mininal parser with DIRECTIVES compiles in Java. +# Put the Java code in YYParser.java. +m4_define([AT_CHECK_JAVA_MINIMAL], +[ +AT_DATA([[YYParser.y]], [ +%language "Java" +%locations +%debug +%error-verbose +%token-table +$1 +%% +start: "end" {$2}; +%% +class m4_default([$3], [Position]) {} +]) +AT_BISON_CHECK([[YYParser.y]]) +AT_CHECK([[grep -q '[mb]4_' YYParser.y]], [1]) +AT_JAVA_COMPILE([[YYParser.java]]) +]) + + +# AT_CHECK_JAVA_MINIMAL_W_LEXER([1:DIRECTIVES], [2:LEX_THROWS], +# [3:YYLEX_ACTION], [4:LEXER_BODY], [5:PARSER_ACTION], [6:STYPE], +# [7:POSITION_TYPE], [8:LOCATION_TYPE]) +# --------------------------------------------------------------------- +# Check that a mininal parser with DIRECTIVES and a "%code lexer". +# YYLEX is the body of yylex () which throws LEX_THROW. +# compiles in Java. +m4_define([AT_CHECK_JAVA_MINIMAL_W_LEXER], +[AT_CHECK_JAVA_MINIMAL([$1 + +%code lexer +{ + m4_default([$6], [Object]) yylval; + public m4_default([$6], [Object]) getLVal() { return yylval; } + + public m4_default([$7], [Position]) getStartPos() { return null; } + public m4_default([$7], [Position]) getEndPos() { return null; } + + public void yyerror (m4_default([$8], [Location]) loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex ()$2 + { + $3 + } + + $4 +}], [$5], [$7])]) + + +# AT_CHECK_JAVA_GREP([LINE], [COUNT=1]) +# ------------------------------------- +# Check that YYParser.java contains exactly COUNT lines matching ^LINE$ +# with grep. +m4_define([AT_CHECK_JAVA_GREP], + [AT_CHECK([grep -c '^$1$' YYParser.java], [], [m4_default([$2], [1]) +]) +]) + + +# ----------------------------------- # +# Java parser class and package names # +# ----------------------------------- # + +AT_SETUP([Java parser class and package names]) + +AT_CHECK_JAVA_MINIMAL([]) +AT_CHECK_JAVA_GREP([[class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[%name-prefix "Prefix"]]) +AT_CHECK_JAVA_GREP([[class PrefixParser]]) + +AT_CHECK_JAVA_MINIMAL([[%define parser_class_name "ParserClassName"]]) +AT_CHECK_JAVA_GREP([[class ParserClassName]]) + +AT_CHECK_JAVA_MINIMAL([[%define package "user_java_package"]]) +AT_CHECK_JAVA_GREP([[package user_java_package;]]) + +AT_CLEANUP + + +# --------------------------- # +# Java parser class modifiers # +# --------------------------- # + +AT_SETUP([Java parser class modifiers]) + +AT_CHECK_JAVA_MINIMAL([[%define abstract]]) +AT_CHECK_JAVA_GREP([[abstract class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[%define final]]) +AT_CHECK_JAVA_GREP([[final class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[%define strictfp]]) +AT_CHECK_JAVA_GREP([[strictfp class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[ +%define abstract +%define strictfp]]) +AT_CHECK_JAVA_GREP([[abstract strictfp class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[ +%define final +%define strictfp]]) +AT_CHECK_JAVA_GREP([[final strictfp class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[%define public]]) +AT_CHECK_JAVA_GREP([[public class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[ +%define public +%define abstract]]) +AT_CHECK_JAVA_GREP([[public abstract class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[ +%define public +%define final]]) +AT_CHECK_JAVA_GREP([[public final class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[ +%define public +%define strictfp]]) +AT_CHECK_JAVA_GREP([[public strictfp class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[ +%define public +%define abstract +%define strictfp]]) +AT_CHECK_JAVA_GREP([[public abstract strictfp class YYParser]]) + +AT_CHECK_JAVA_MINIMAL([[ +%define public +%define final +%define strictfp]]) +AT_CHECK_JAVA_GREP([[public final strictfp class YYParser]]) + +AT_CLEANUP + + +# ---------------------------------------- # +# Java parser class extends and implements # +# ---------------------------------------- # + +AT_SETUP([Java parser class extends and implements]) + +AT_CHECK_JAVA_MINIMAL([[%define extends "Thread"]]) +AT_CHECK_JAVA_GREP([[class YYParser extends Thread]]) + +AT_CHECK_JAVA_MINIMAL([[%define implements "Cloneable"]]) +AT_CHECK_JAVA_GREP([[class YYParser implements Cloneable]]) + +AT_CHECK_JAVA_MINIMAL([[ +%define extends "Thread" +%define implements "Cloneable"]]) +AT_CHECK_JAVA_GREP([[class YYParser extends Thread implements Cloneable]]) + +AT_CLEANUP + + +# -------------------------------- # +# Java %parse-param and %lex-param # +# -------------------------------- # + +AT_SETUP([Java %parse-param and %lex-param]) + +AT_CHECK_JAVA_MINIMAL([]) +AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer) {]]) + +AT_CHECK_JAVA_MINIMAL([[%parse-param {int parse_param1}]]) +AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]]) +AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer, *int parse_param1) {]]) +AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]]) + +AT_CHECK_JAVA_MINIMAL([[ +%parse-param {int parse_param1} +%parse-param {long parse_param2}]]) +AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]]) +AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]]) +AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]]) +AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]]) +AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]]) + +AT_CHECK_JAVA_MINIMAL_W_LEXER([], [], [[return EOF;]]) +AT_CHECK_JAVA_GREP([[ *public YYParser () {]]) +AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer) {]]) + +AT_CHECK_JAVA_MINIMAL_W_LEXER([[%parse-param {int parse_param1}]], + [], [[return EOF;]]) +AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]]) +AT_CHECK_JAVA_GREP([[ *public YYParser (int parse_param1) {]]) +AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1) {]]) +AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2]) + +AT_CHECK_JAVA_MINIMAL_W_LEXER([[ +%parse-param {int parse_param1} +%parse-param {long parse_param2}]], + [], [[return EOF;]]) +AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]]) +AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]]) +AT_CHECK_JAVA_GREP([[ *public YYParser (int parse_param1, *long parse_param2) {]]) +AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]]) +AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2]) +AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]], [2]) + +AT_CHECK_JAVA_MINIMAL_W_LEXER([[%lex-param {char lex_param1}]], + [], [[return EOF;]], [[YYLexer (char lex_param1) {}]]) +AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1) {]]) +AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1);]]) + +AT_CHECK_JAVA_MINIMAL_W_LEXER([[ +%lex-param {char lex_param1} +%lex-param {short lex_param2}]], + [], [[return EOF;]], [[YYLexer (char lex_param1, short lex_param2) {}]]) +AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1, *short lex_param2) {]]) +AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1, *lex_param2);]]) + +AT_CHECK_JAVA_MINIMAL_W_LEXER([[ +%parse-param {int parse_param1} +%parse-param {long parse_param2} +%lex-param {char lex_param1} +%lex-param {short lex_param2}]], + [], [[return EOF;]], [[YYLexer (char lex_param1, short lex_param2) {}]]) +AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]]) +AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]]) +AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) {]]) +AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1, *lex_param2);]]) +AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]]) +AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2]) +AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]], [2]) + +AT_CLEANUP + + +# ------------------------- # +# Java throw specifications # +# ------------------------- # + +AT_SETUP([Java throws specifications]) + +# %define throws - 0 1 2 +# %define lex-throws - 0 1 2 +# %code lexer 0 1 + +m4_define([AT_JT_lex_throws_define], [m4_case(AT_JT_lex_throws, + -1, [], + 0, [[%define lex_throws ""]], + 1, [[%define lex_throws "InterruptedException"]], + 2, [[%define lex_throws "InterruptedException, IllegalAccessException"]])]) + +m4_define([AT_JT_yylex_throws], [m4_case(AT_JT_lex_throws, + -1, [[ throws java.io.IOException]], + 0, [], + 1, [[ throws InterruptedException]], + 2, [[ throws InterruptedException, IllegalAccessException]])]) + +m4_define([AT_JT_yylex_action], [m4_case(AT_JT_lex_throws, + -1, [[throw new java.io.IOException();]], + 0, [[return EOF;]], + 1, [[throw new InterruptedException();]], + 2, [[throw new IllegalAccessException();]])]) + + +m4_define([AT_JT_throws_define], [m4_case(AT_JT_throws, + -1, [], + 0, [[%define throws ""]], + 1, [[%define throws "ClassNotFoundException"]], + 2, [[%define throws "ClassNotFoundException, InstantiationException"]])]) + +m4_define([AT_JT_yyaction_throws], [m4_case(AT_JT_throws, + -1, [], + 0, [], + 1, [[ throws ClassNotFoundException]], + 2, [[ throws ClassNotFoundException, InstantiationException]])]) + +m4_define([AT_JT_parse_throws_2], [m4_case(AT_JT_throws, + -1, [], + 0, [], + 1, [[, ClassNotFoundException]], + 2, [[, ClassNotFoundException, InstantiationException]])]) + +m4_define([AT_JT_parse_throws], + [m4_if(m4_quote(AT_JT_yylex_throws), [], + [AT_JT_yyaction_throws], + [AT_JT_yylex_throws[]AT_JT_parse_throws_2])]) + +m4_define([AT_JT_initial_action], [m4_case(AT_JT_throws, + -1, [], + 0, [], + 1, [[%initial-action {if (true) throw new ClassNotFoundException();}]], + 2, [[%initial-action {if (true) throw new InstantiationException();}]])]) + +m4_define([AT_JT_parse_action], [m4_case(AT_JT_throws, + -1, [], + 0, [], + 1, [[throw new ClassNotFoundException();]], + 2, [[throw new ClassNotFoundException();]])]) + +m4_for([AT_JT_lexer], 0, 1, 1, + [m4_for([AT_JT_lex_throws], -1, 2, 1, + [m4_for([AT_JT_throws], -1, 2, 1, + [m4_if(AT_JT_lexer, 0, + [AT_CHECK_JAVA_MINIMAL([ +AT_JT_throws_define +AT_JT_lex_throws_define +AT_JT_initial_action], +[AT_JT_parse_action])], + [AT_CHECK_JAVA_MINIMAL_W_LEXER([ +AT_JT_throws_define +AT_JT_lex_throws_define +AT_JT_initial_action], +[AT_JT_yylex_throws], +[AT_JT_yylex_action], +[], +[AT_JT_parse_action])]) +AT_CHECK_JAVA_GREP([[ *int yylex ()]AT_JT_yylex_throws *[;]]) +AT_CHECK_JAVA_GREP([[ *private int yyaction ([^)]*)]AT_JT_yyaction_throws[ *]]) +AT_CHECK_JAVA_GREP([[ *public boolean parse ()]AT_JT_parse_throws[ *]]) +])])]) + +AT_CLEANUP + + +# --------------------------------------------- # +# Java stype, position_class and location_class # +# --------------------------------------------- # + +AT_SETUP([Java stype, position_class and location_class]) + +AT_CHECK_JAVA_MINIMAL([[ +%define stype "java.awt.Color" +%type start; +%define location_type "MyLoc" +%define position_type "MyPos" +%code { class MyPos {} }]], [[$$ = $1;]], [[MyPos]]) +AT_CHECK([[grep -q 'java.awt.Color' YYParser.java]]) +AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Position']], [1]) +AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Location']], [1]) + +AT_CHECK_JAVA_MINIMAL_W_LEXER([[ +%define stype "java.awt.Color" +%type start; +%define location_type "MyLoc" +%define position_type "MyPos" +%code { class MyPos {} }]], [], [[return EOF;]], [], +[[$$ = $1;]], +[[java.awt.Color]], [[MyPos]], [[MyLoc]]) +AT_CHECK([[grep -q 'java.awt.Color' YYParser.java]]) +AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Position']], [1]) +AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Location']], [1]) + +AT_CLEANUP diff --git a/tests/local.at b/tests/local.at new file mode 100644 index 0000000..01adaf5 --- /dev/null +++ b/tests/local.at @@ -0,0 +1,325 @@ +# Process this -*- Autotest -*- file with autom4te. + +# Macros for the GNU Bison Test suite. +# Copyright (C) 2003, 2004, 2005, 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 . + +# We want a recent Autotest. +m4_version_prereq([2.58]) + + +## ------------------------------- ## +## Macros decoding Bison options. ## +## ------------------------------- ## + + +# AT_BISON_OPTION_PUSHDEFS([BISON-OPTIONS]) +# ----------------------------------------- +m4_define([AT_BISON_OPTION_PUSHDEFS], +[_AT_BISON_OPTION_PUSHDEFS($[1], $[2], [$1])]) + + +# _AT_BISON_OPTION_PUSHDEFS($1, $2, [BISON-OPTIONS]) +# -------------------------------------------------- +# This macro works around the impossibility to define macros +# inside macros, because issuing `[$1]' is not possible in M4 :(. +# This sucks hard, GNU M4 should really provide M5 like $$1. +m4_define([_AT_BISON_OPTION_PUSHDEFS], +[m4_if([$1$2], $[1]$[2], [], + [m4_fatal([$0: Invalid arguments: $@])])dnl +m4_pushdef([AT_DEFINES_IF], +[m4_bmatch([$3], [%defines], [$1], [$2])]) +m4_pushdef([AT_SKEL_CC_IF], +[m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1], [$2])]) +m4_pushdef([AT_GLR_IF], +[m4_bmatch([$3], [%glr-parser\|%skeleton "glr\.], [$1], [$2])]) +m4_pushdef([AT_LALR1_CC_IF], +[AT_SKEL_CC_IF([AT_GLR_IF([$2], [$1])], [$2])]) +m4_pushdef([AT_GLR_CC_IF], +[AT_SKEL_CC_IF([AT_GLR_IF([$1], [$2])], [$2])]) +# Using yacc.c? +m4_pushdef([AT_YACC_IF], +[m4_bmatch([$3], [%language\|%glr-parser\|%skeleton], [$2], [$1])]) +m4_pushdef([AT_LEXPARAM_IF], +[m4_bmatch([$3], [%lex-param], [$1], [$2])]) +m4_pushdef([AT_PARAM_IF], +[m4_bmatch([$3], [%parse-param], [$1], [$2])]) +m4_pushdef([AT_LOCATION_IF], +[m4_bmatch([$3], [%locations], [$1], [$2])]) +m4_pushdef([AT_PURE_IF], +[m4_bmatch([$3], [%define *api\.pure\|%pure-parser], + [m4_bmatch([$3], [%define *api\.pure *"false"], [$2], [$1])], + [$2])]) +m4_pushdef([AT_PURE_AND_LOC_IF], +[m4_bmatch([$3], [%locations], [AT_PURE_IF($@)], [$2])]) +m4_pushdef([AT_GLR_OR_PARAM_IF], +[m4_bmatch([$3], [%glr-parser\|%parse-param], [$1], [$2])]) +m4_pushdef([AT_NAME_PREFIX], +[m4_bmatch([$3], [%name-prefix ".*"], + [m4_bregexp([$3], [name-prefix "\([^"]*\)"], [\1])], + [yy])]) +# yyerror receives the location if %location & %pure & (%glr or %parse-param). +m4_pushdef([AT_YYERROR_ARG_LOC_IF], +[AT_GLR_OR_PARAM_IF([AT_PURE_AND_LOC_IF([$1], [$2])], + [$2])]) +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. +m4_pushdef([AT_YYERROR_SEES_LOC_IF], +[AT_LOCATION_IF([AT_YACC_IF([AT_PURE_IF([AT_PARAM_IF([$1], [$2])], + [$1])], + [$1])], + [$2])]) + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. +m4_pushdef([AT_PURE_LEX_IF], +[AT_PURE_IF([$1], + [AT_SKEL_CC_IF([$1], [$2])])]) + +AT_PURE_LEX_IF( +[m4_pushdef([AT_LOC], [(*llocp)]) + m4_pushdef([AT_VAL], [(*lvalp)]) + m4_pushdef([AT_LEX_FORMALS], + [YYSTYPE *lvalp[]AT_LOCATION_IF([, YYLTYPE *llocp])]) + m4_pushdef([AT_LEX_ARGS], + [lvalp[]AT_LOCATION_IF([, llocp])]) + m4_pushdef([AT_USE_LEX_ARGS], + [(void) lvalp;AT_LOCATION_IF([(void) llocp])]) + m4_pushdef([AT_LEX_PRE_FORMALS], + [AT_LEX_FORMALS, ]) + m4_pushdef([AT_LEX_PRE_ARGS], + [AT_LEX_ARGS, ]) +], +[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]]) + m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]]) + m4_pushdef([AT_LEX_FORMALS], [void]) + m4_pushdef([AT_LEX_ARGS], []) + m4_pushdef([AT_USE_LEX_ARGS], []) + m4_pushdef([AT_LEX_PRE_FORMALS], []) + m4_pushdef([AT_LEX_PRE_ARGS], []) +]) +])# _AT_BISON_OPTION_PUSHDEFS + + +# AT_BISON_OPTION_POPDEFS +# ----------------------- +m4_define([AT_BISON_OPTION_POPDEFS], +[m4_popdef([AT_LEX_PRE_ARGS]) +m4_popdef([AT_LEX_PRE_FORMALS]) +m4_popdef([AT_USE_LEX_ARGS]) +m4_popdef([AT_LEX_ARGS]) +m4_popdef([AT_LEX_FORMALS]) +m4_popdef([AT_VAL]) +m4_popdef([AT_LOC]) +m4_popdef([AT_PURE_LEX_IF]) +m4_popdef([AT_YYERROR_SEES_LOC_IF]) +m4_popdef([AT_YYERROR_ARG_LOC_IF]) +m4_popdef([AT_NAME_PREFIX]) +m4_popdef([AT_GLR_OR_PARAM_IF]) +m4_popdef([AT_PURE_AND_LOC_IF]) +m4_popdef([AT_LOCATION_IF]) +m4_popdef([AT_PARAM_IF]) +m4_popdef([AT_LEXPARAM_IF]) +m4_popdef([AT_YACC_IF]) +m4_popdef([AT_GLR_IF]) +m4_popdef([AT_SKEL_CC_IF]) +m4_popdef([AT_GLR_CC_IF]) +m4_popdef([AT_LALR1_CC_IF]) +m4_popdef([AT_DEFINES_IF]) +])# AT_BISON_OPTION_POPDEFS + + + +## -------------------------- ## +## Generating Grammar Files. ## +## -------------------------- ## + +# AT_DATA_SOURCE_PROLOGUE +# ------------------------ +# The prologue that should be included in any source code that is +# meant to be compiled. +m4_define([AT_DATA_SOURCE_PROLOGUE], +[[#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +]]) + +# AT_DATA_GRAMMAR_PROLOGUE +# ------------------------ +# The prologue that should be included in any grammar which parser is +# meant to be compiled. +m4_define([AT_DATA_GRAMMAR_PROLOGUE], +[[%code top { +]AT_DATA_SOURCE_PROLOGUE[]dnl +[} +]]) + +# AT_DATA_SOURCE(NAME, CONTENT) +# ----------------------------- +# Generate the file NAME, which CONTENT is preceded by +# AT_DATA_SOURCE_PROLOGUE. +m4_define([AT_DATA_SOURCE], +[AT_DATA([$1], +[AT_DATA_SOURCE_PROLOGUE +$2]) +]) + +# AT_DATA_GRAMMAR(NAME, CONTENT) +# ------------------------------ +# Generate the file NAME, which CONTENT is preceded by +# AT_DATA_GRAMMAR_PROLOGUE. +m4_define([AT_DATA_GRAMMAR], +[AT_DATA([$1], +[AT_DATA_GRAMMAR_PROLOGUE +$2]) +]) + +# AT_BISON_CHECK(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# ------------------------------------------------- +# Check Bison by invoking `bison BISON_ARGS'. OTHER_AT_CHECK_ARGS are the +# usual remaining arguments to AT_CHECK: STATUS, STDOUT, etc. +# +# This macro or AT_BISON_CHECK_NO_XML should always be used whenever invoking +# Bison in the test suite. For now it ensures that: +# +# 1. Valgrind doesn't report reachable memory when Bison is expected to have +# a non-zero exit status since Bison doesn't always try to free all memory +# in that case. +# +# 2. In the case of maintainer-xml-check, XML/XSLT output is compared with +# --graph and --report=all output for every working grammar. +m4_define([AT_BISON_CHECK], +[m4_if(m4_quote($2), [0], [AT_BISON_CHECK_XML($@)], + m4_quote($2), [], [AT_BISON_CHECK_XML($@)]) +AT_BISON_CHECK_NO_XML($@)]) + +# AT_BISON_CHECK_NO_XML(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# -------------------------------------------------------- +# Same as AT_BISON_CHECK except don't perform XML/XSLT checks. This is useful +# when a tortured grammar's XML is known to be too large for xsltproc to +# handle. +m4_define([AT_BISON_CHECK_NO_XML], +[AT_CHECK(m4_if(m4_quote($2), [0], [], m4_quote($2), [], [], + [AT_QUELL_VALGRIND ])[[bison ]]$@)]) + +# AT_BISON_CHECK_XML(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# ----------------------------------------------------- +# Run AT_BISON_CHECK's XML/XSLT checks if $BISON_TEST_XML=1 and $XSLTPROC is +# defined. It doesn't make sense to invoke this macro if Bison is expected to +# have a non-zero exit status. +m4_define([AT_BISON_CHECK_XML], +[[if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests] + m4_pushdef([AT_BISON_ARGS], + [m4_bpatsubsts([[$1]], + [--report(-file)?=[^][ ]*], [], + [--graph=[^][ ]*], [], + [--xml=[^][ ]*], [])])dnl + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + AT_CHECK([[bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot ]]AT_BISON_ARGS, + [[0]], [ignore], [ignore]) + AT_CHECK([[bison --xml=xml-tests/test.xml ]]AT_BISON_ARGS, + [[0]], [ignore], [ignore]) + m4_popdef([AT_BISON_ARGS])dnl + [cp xml-tests/test.output expout] + AT_CHECK([[$XSLTPROC \ + `]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml]], [[0]], [expout]) + [cp xml-tests/test.dot expout] + AT_CHECK([[$XSLTPROC \ + `]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml]], [[0]], [expout]) + [rm -rf xml-tests expout +fi]]) + +# AT_QUELL_VALGRIND +# ----------------- +# Put this before a Bison invocation to keep Valgrind from complaining about +# reachable memory. +# +# Do not quote invocations of this macro within the first argument of AT_CHECK. +# The triple quoting below will cause test cases to fail if you do. If you do +# so anyway but also decrease the quoting below to avoid that problem, AT_CHECK +# will then fail to shell-escape its contents when attempting to print them. +# The testsuite verbose output, at least, will be incorrect, but nothing may +# fail to make sure you notice. +m4_define([AT_QUELL_VALGRIND], +[[[VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS;]]]) + +## ------------------------ ## +## Compiling C, C++ Files. ## +## ------------------------ ## + + +# AT_COMPILE(OUTPUT, [SOURCES = OUTPUT.c]) +# ---------------------------------------- +# Compile SOURCES into OUTPUT. If OUTPUT does not contain '.', +# assume that we are linking too; this is a hack. +m4_define([AT_COMPILE], +[AT_CHECK([$CC $CFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.c])[]m4_bmatch([$1], [[.]], [], [ $LIBS])], + 0, [ignore], [ignore])]) + +# AT_COMPILE_CXX(OUTPUT, [SOURCES = OUTPUT.cc]) +# -------------------------------------------- +# Compile SOURCES into OUTPUT. If OUTPUT does not contain '.', +# assume that we are linking too; this is a hack. +# If the C++ compiler does not work, ignore the test. +m4_define([AT_COMPILE_CXX], +[AT_KEYWORDS(c++) +AT_CHECK([$BISON_CXX_WORKS], 0, ignore, ignore) +AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.cc])[]m4_bmatch([$1], [[.]], [], [ $LIBS])], + 0, [ignore], [ignore])]) + + +# AT_FULL_COMPILE(OUTPUT, [OTHER]) +# -------------------------------- +# Compile OUTPUT.y to OUTPUT.c or OUTPUT.cc, and compile it to OUTPUT. +# If OTHER is specified, compile OUTPUT-OTHER.c or OUTPUT-OTHER.cc to OUTPUT +# along with it. +# Relies on AT_SKEL_CC_IF. +m4_define([AT_FULL_COMPILE], +[AT_SKEL_CC_IF( + [AT_BISON_CHECK([-o $1.cc $1.y]) + AT_COMPILE_CXX([$1]m4_ifval($2, [, [$1.cc $1-$2.cc]]))], + [AT_BISON_CHECK([-o $1.c $1.y]) + AT_COMPILE([$1]m4_ifval($2, [, [$1.c $1-$2.c]]))]) +]) + + +## ---------------------------- ## +## Running a generated parser. ## +## ---------------------------- ## + +# AT_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE]) +# ------------------------------------------------------------ +# So that we can run `./testsuite PREPARSER='valgrind -q' for instance. +m4_define([AT_PARSER_CHECK], +[AT_CHECK([$5 $PREPARSER $1], [$2], [$3], [$4])]) + + + + +## ----------------------- ## +## Launch the test suite. ## +## ----------------------- ## + +AT_INIT + +AT_TESTED([bison]) diff --git a/tests/output.at b/tests/output.at new file mode 100644 index 0000000..ce0a2b2 --- /dev/null +++ b/tests/output.at @@ -0,0 +1,214 @@ +# Checking the output filenames. -*- Autotest -*- +# Copyright (C) 2000, 2001, 2002, 2005, 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 . + +AT_BANNER([[Output file names.]]) + + +# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [SHELLIO], +# [ADDITIONAL-TESTS]) +# ----------------------------------------------------------------------------- +m4_define([AT_CHECK_OUTPUT], +[AT_SETUP([[Output files: $2 $3 $5]]) +for file in $1 $4; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +AT_DATA([$1], +[[$2 +%% +foo: {}; +]]) + +AT_BISON_CHECK([$3 $1 $5], 0) +AT_CHECK([ls $4], [], [ignore]) +$6 +AT_CLEANUP +]) + +AT_CHECK_OUTPUT([foo.y], [], [-dv], + [foo.output foo.tab.c foo.tab.h]) +AT_CHECK_OUTPUT([foo.y], [], [-dv], + [foo.output foo.tab.c foo.tab.h], + [>&-]) +AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c], + [foo.c foo.h foo.output]) +AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.tab.c], + [foo.output foo.tab.c foo.tab.h]) +AT_CHECK_OUTPUT([foo.y], [], [-dv -y], + [y.output y.tab.c y.tab.h]) +AT_CHECK_OUTPUT([foo.y], [], [-dv -b bar], + [bar.output bar.tab.c bar.tab.h]) +AT_CHECK_OUTPUT([foo.y], [], [-dv -g -o foo.c], + [foo.c foo.dot foo.h foo.output]) + + +AT_CHECK_OUTPUT([foo.y], [%defines %verbose], [], + [foo.output foo.tab.c foo.tab.h]) +AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[], + [y.output y.tab.c y.tab.h]) + +AT_CHECK_OUTPUT([foo.yy], [%defines %verbose %yacc],[], + [y.output y.tab.c y.tab.h]) + +# Exercise %output and %file-prefix including deprecated `=' +AT_CHECK_OUTPUT([foo.y], [%file-prefix "bar" %defines %verbose], [], + [bar.output bar.tab.c bar.tab.h]) +AT_CHECK_OUTPUT([foo.y], [%output="bar.c" %defines %verbose %yacc],[], + [bar.output bar.c bar.h]) +AT_CHECK_OUTPUT([foo.y], + [%file-prefix="baz" %output "bar.c" %defines %verbose %yacc], + [], + [bar.output bar.c bar.h]) + + +# Check priorities of extension control. +AT_CHECK_OUTPUT([foo.yy], [%defines %verbose], [], + [foo.output foo.tab.cc foo.tab.hh]) + +AT_CHECK_OUTPUT([foo.yy], [%defines %verbose ], [-o foo.c], + [foo.c foo.h foo.output]) + +AT_CHECK_OUTPUT([foo.yy], [], + [--defines=foo.hpp -o foo.c++], + [foo.c++ foo.hpp]) + +AT_CHECK_OUTPUT([foo.yy], [%defines "foo.hpp"], + [-o foo.c++], + [foo.c++ foo.hpp]) + +AT_CHECK_OUTPUT([foo.yy], [], + [-o foo.c++ --graph=foo.gph], + [foo.c++ foo.gph]) + + +## ------------ ## +## C++ output. ## +## ------------ ## + +m4_define([AT_CHECK_NO_SUBDIR_PART], +[# Also make sure that the includes do not refer to the subdirectory. +AT_CHECK([grep 'include .subdir/' $1.cc], 1, []) +AT_CHECK([grep 'include .subdir/' $1.hh], 1, []) +]) + +AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [], + [foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh]) + +AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [], + [foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh], + [], [AT_CHECK_NO_SUBDIR_PART([foo.tab])]) + +AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose], + [-o subdir/foo.cc], + [subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh], + [], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])]) + +AT_CHECK_OUTPUT([gram_dir/foo.yy], + [%skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo"], + [], + [output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/location.hh output_dir/stack.hh output_dir/position.hh]) + + +# AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR, +# [EXIT-STATUS]) +# ------------------------------------------------------------------ +m4_define([AT_CHECK_CONFLICTING_OUTPUT], +[AT_SETUP([Conflicting output files: $2 $3]) +case "$1" in + */*) mkdir `echo "$1" | sed 's,/.*,,'`;; +esac +AT_DATA([$1], +[[$2 +%% +foo: {}; +]]) + +AT_BISON_CHECK([$3 $1], $5, [], [$4]) +AT_CLEANUP +]) + +AT_CHECK_CONFLICTING_OUTPUT([foo.y], +[], [--graph="foo.tab.c"], +[foo.y: warning: conflicting outputs to file `foo.tab.c' +]) + +AT_CHECK_CONFLICTING_OUTPUT([foo.y], +[%defines "foo.output"], [-v], +[foo.y: warning: conflicting outputs to file `foo.output' +]) + +AT_CHECK_CONFLICTING_OUTPUT([foo.y], +[%skeleton "lalr1.cc" %defines], [--graph="location.hh"], +[foo.y: warning: conflicting outputs to file `location.hh' +]) + +AT_CHECK_CONFLICTING_OUTPUT([foo.y], [], [-o foo.y], +[foo.y: fatal error: refusing to overwrite the input file `foo.y' +], 1) + + +# AT_CHECK_OUTPUT_FILE_NAME(FILE-NAME-PREFIX, [ADDITIONAL-TESTS]) +# ----------------------------------------------------------------------------- +m4_define([AT_CHECK_OUTPUT_FILE_NAME], +[AT_SETUP([Output file name: $1]) + +AT_DATA_GRAMMAR([glr.y], +[[%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +]]) +AT_BISON_CHECK([-o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" glr.y]) +AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore]) +AT_COMPILE([glr.o], [-c "AS_ESCAPE([$1.c])"]) +$2 + +AT_DATA_GRAMMAR([cxx.y], +[[%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +]]) +AT_BISON_CHECK([-o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" cxx.y]) +AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore]) +AT_COMPILE_CXX([cxx.o], [-c "AS_ESCAPE([$1.c])"]) +$2 + +AT_CLEANUP +]) + +# Notice that the header file name here cannot contain +# `"' since FILENAME in `#include "FILENAME"' cannot. +AT_CHECK_OUTPUT_FILE_NAME([[`~!@#$%^&*()-=_+{}[]|\:;<>, .']]) +dnl Work around a bug in m4_expand that broke AT_SETUP in autoconf 2.62, +dnl by using the definition from 2.63. +m4_version_prereq([2.63], [], +[m4_define([m4_expand], [_$0(-=<{($1)}>=-)]) +m4_define([_m4_expand], +[m4_changequote([-=<{(], [)}>=-])$1m4_changequote([, ])])]) +AT_CHECK_OUTPUT_FILE_NAME([[(]]) +AT_CHECK_OUTPUT_FILE_NAME([[)]]) +AT_CHECK_OUTPUT_FILE_NAME([[#]]) +AT_CHECK_OUTPUT_FILE_NAME([[@@]]) +AT_CHECK_OUTPUT_FILE_NAME([[@{]]) +AT_CHECK_OUTPUT_FILE_NAME([[@}]]) +AT_CHECK_OUTPUT_FILE_NAME([[@<:@]]) +AT_CHECK_OUTPUT_FILE_NAME([[@:>@]]) diff --git a/tests/package.m4 b/tests/package.m4 new file mode 100644 index 0000000..7cefe89 --- /dev/null +++ b/tests/package.m4 @@ -0,0 +1,6 @@ +# Signature of the current package. +m4_define([AT_PACKAGE_NAME], [GNU Bison]) +m4_define([AT_PACKAGE_TARNAME], [bison]) +m4_define([AT_PACKAGE_VERSION], [2.4.1]) +m4_define([AT_PACKAGE_STRING], [GNU Bison 2.4.1]) +m4_define([AT_PACKAGE_BUGREPORT], [bug-bison@gnu.org]) diff --git a/tests/push.at b/tests/push.at new file mode 100644 index 0000000..70c1fdc --- /dev/null +++ b/tests/push.at @@ -0,0 +1,168 @@ +# Checking Push Parsing. -*- Autotest -*- +# Copyright (C) 2007 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 . + +AT_BANNER([[Push Parsing Tests]]) + +## ---------------------------------------------- ## +## Push Parsing: Memory Leak for Early Deletion. ## +## ---------------------------------------------- ## + +AT_SETUP([[Push Parsing: Memory Leak for Early Deletion]]) + +# Requires Valgrind. + +AT_DATA_GRAMMAR([[input.y]], +[[ +%{ + #include + #include + #define YYINITDEPTH 1 + void yyerror (char const *msg); +%} + +%define api.pure %define api.push_pull "push" + +%% + +start: 'a' 'b' 'c' ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yypstate *ps; + + /* Make sure we don't try to free ps->yyss in this case. */ + ps = yypstate_new (); + yypstate_delete (ps); + + /* yypstate_delete used to leak ps->yyss if the stack was reallocated but the + parse did not return on success, syntax error, or memory exhaustion. */ + ps = yypstate_new (); + assert (yypush_parse (ps, 'a', NULL) == YYPUSH_MORE); + yypstate_delete (ps); + + ps = yypstate_new (); + assert (yypush_parse (ps, 'a', NULL) == YYPUSH_MORE); + assert (yypush_parse (ps, 'b', NULL) == YYPUSH_MORE); + yypstate_delete (ps); + + return 0; +} +]]) + +AT_BISON_CHECK([[-o input.c input.y]]) +AT_COMPILE([[input]]) +AT_PARSER_CHECK([[./input]]) + +AT_CLEANUP + +## ----------------------------------------- ## +## Push Parsing: Multiple impure instances. ## +## ----------------------------------------- ## + +AT_SETUP([[Push Parsing: Multiple impure instances]]) + +m4_pushdef([AT_MULTIPLE_IMPURE_INSTANCES_CHECK], [ +AT_DATA_GRAMMAR([[input.y]], +[[ +%{ + #include + #include + void yyerror (char const *msg); + int yylex (void); +%} + +%define api.push_pull "]$1[" + +%% + +start: ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +yylex (void) +{ + return 0; +} + +int +main (void) +{ + yypstate *ps; + int i; + + for (i = 0; i < 2; ++i) + { + ps = yypstate_new (); + assert (ps); + assert (yypstate_new () == NULL); + ]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[; + yychar = 0; + assert (yypush_parse (ps) == 0); + assert (yypstate_new () == NULL); + ]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[; + yypstate_delete (ps); + } + + return 0; +} +]]) + +AT_BISON_CHECK([[-o input.c input.y]]) +AT_COMPILE([[input]]) +AT_PARSER_CHECK([[./input]]) +]) + +AT_MULTIPLE_IMPURE_INSTANCES_CHECK([[both]]) +AT_MULTIPLE_IMPURE_INSTANCES_CHECK([[push]]) + +m4_popdef([AT_MULTIPLE_IMPURE_INSTANCES_CHECK]) + +AT_CLEANUP + +## ------------------------------------- ## +## Push Parsing: Unsupported Skeletons. ## +## ------------------------------------- ## + +AT_SETUP([[Push Parsing: Unsupported Skeletons]]) + +AT_DATA([[input.y]], +[[%glr-parser +%define api.push_pull "push" +%% +start: ; +]]) + +AT_BISON_CHECK([[input.y]], [0], [], +[[input.y:2.9-21: warning: %define variable `api.push_pull' is not used +]]) + +AT_CLEANUP diff --git a/tests/reduce.at b/tests/reduce.at new file mode 100644 index 0000000..5fe650a --- /dev/null +++ b/tests/reduce.at @@ -0,0 +1,357 @@ +# Exercising Bison Grammar Reduction. -*- Autotest -*- +# Copyright (C) 2001, 2002, 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 . + +AT_BANNER([[Grammar Reduction.]]) + + +## ------------------- ## +## Useless Terminals. ## +## ------------------- ## + +AT_SETUP([Useless Terminals]) + +AT_DATA([[input.y]], +[[%verbose +%output "input.c" + +%token useless1 +%token useless2 +%token useless3 +%token useless4 +%token useless5 +%token useless6 +%token useless7 +%token useless8 +%token useless9 + +%token useful +%% +exp: useful; +]]) + +AT_BISON_CHECK([[input.y]]) + +AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, +[[Terminals unused in grammar + useless1 + useless2 + useless3 + useless4 + useless5 + useless6 + useless7 + useless8 + useless9 +]]) + +AT_CLEANUP + + + +## ---------------------- ## +## Useless Nonterminals. ## +## ---------------------- ## + +AT_SETUP([Useless Nonterminals]) + +AT_DATA([[input.y]], +[[%verbose +%output "input.c" + +%nterm useless1 +%nterm useless2 +%nterm useless3 +%nterm useless4 +%nterm useless5 +%nterm useless6 +%nterm useless7 +%nterm useless8 +%nterm useless9 + +%token useful +%% +exp: useful; +]]) + +AT_BISON_CHECK([[input.y]], 0, [], +[[input.y: warning: 9 nonterminals useless in grammar +input.y:4.8-15: warning: nonterminal useless in grammar: useless1 +input.y:5.8-15: warning: nonterminal useless in grammar: useless2 +input.y:6.8-15: warning: nonterminal useless in grammar: useless3 +input.y:7.8-15: warning: nonterminal useless in grammar: useless4 +input.y:8.8-15: warning: nonterminal useless in grammar: useless5 +input.y:9.8-15: warning: nonterminal useless in grammar: useless6 +input.y:10.8-15: warning: nonterminal useless in grammar: useless7 +input.y:11.8-15: warning: nonterminal useless in grammar: useless8 +input.y:12.8-15: warning: nonterminal useless in grammar: useless9 +]]) + +AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, +[[Nonterminals useless in grammar + useless1 + useless2 + useless3 + useless4 + useless5 + useless6 + useless7 + useless8 + useless9 +]]) + +AT_CLEANUP + + + +## --------------- ## +## Useless Rules. ## +## --------------- ## + +AT_SETUP([Useless Rules]) + +AT_KEYWORDS([report]) + +AT_DATA([[input.y]], +[[%verbose +%output "input.c" +%token useful +%% +exp: useful; +useless1: '1'; +useless2: '2'; +useless3: '3'; +useless4: '4'; +useless5: '5'; +useless6: '6'; +useless7: '7'; +useless8: '8'; +useless9: '9'; +]]) + +AT_BISON_CHECK([[input.y]], 0, [], +[[input.y: warning: 9 nonterminals useless in grammar +input.y: warning: 9 rules useless in grammar +input.y:6.1-8: warning: nonterminal useless in grammar: useless1 +input.y:7.1-8: warning: nonterminal useless in grammar: useless2 +input.y:8.1-8: warning: nonterminal useless in grammar: useless3 +input.y:9.1-8: warning: nonterminal useless in grammar: useless4 +input.y:10.1-8: warning: nonterminal useless in grammar: useless5 +input.y:11.1-8: warning: nonterminal useless in grammar: useless6 +input.y:12.1-8: warning: nonterminal useless in grammar: useless7 +input.y:13.1-8: warning: nonterminal useless in grammar: useless8 +input.y:14.1-8: warning: nonterminal useless in grammar: useless9 +input.y:6.11-13: warning: rule useless in grammar: useless1: '1' +input.y:7.11-13: warning: rule useless in grammar: useless2: '2' +input.y:8.11-13: warning: rule useless in grammar: useless3: '3' +input.y:9.11-13: warning: rule useless in grammar: useless4: '4' +input.y:10.11-13: warning: rule useless in grammar: useless5: '5' +input.y:11.11-13: warning: rule useless in grammar: useless6: '6' +input.y:12.11-13: warning: rule useless in grammar: useless7: '7' +input.y:13.11-13: warning: rule useless in grammar: useless8: '8' +input.y:14.11-13: warning: rule useless in grammar: useless9: '9' +]]) + +AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, +[[Nonterminals useless in grammar + useless1 + useless2 + useless3 + useless4 + useless5 + useless6 + useless7 + useless8 + useless9 +Terminals unused in grammar + '1' + '2' + '3' + '4' + '5' + '6' + '7' + '8' + '9' +Rules useless in grammar + 2 useless1: '1' + 3 useless2: '2' + 4 useless3: '3' + 5 useless4: '4' + 6 useless5: '5' + 7 useless6: '6' + 8 useless7: '7' + 9 useless8: '8' + 10 useless9: '9' +]]) + +AT_CLEANUP + + + +## ------------------- ## +## Reduced Automaton. ## +## ------------------- ## + +# Check that the automaton is that as the for the grammar reduced by +# hand. + +AT_SETUP([Reduced Automaton]) + +AT_KEYWORDS([report]) + +# The non reduced grammar. +# ------------------------ +AT_DATA([[not-reduced.y]], +[[/* A useless token. */ +%token useless_token +/* A useful one. */ +%token useful +%verbose +%output "not-reduced.c" + +%% + +exp: useful { /* A useful action. */ } + | non_productive { /* A non productive action. */ } + ; + +not_reachable: useful { /* A not reachable action. */ } + ; + +non_productive: non_productive useless_token + { /* Another non productive action. */ } + ; +%% +]]) + +AT_BISON_CHECK([[not-reduced.y]], 0, [], +[[not-reduced.y: warning: 2 nonterminals useless in grammar +not-reduced.y: warning: 3 rules useless in grammar +not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable +not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive +not-reduced.y:11.6-57: warning: rule useless in grammar: exp: non_productive +not-reduced.y:14.16-56: warning: rule useless in grammar: not_reachable: useful +not-reduced.y:17.17-18.63: warning: rule useless in grammar: non_productive: non_productive useless_token +]]) + +AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0, +[[Nonterminals useless in grammar + not_reachable + non_productive +Terminals unused in grammar + useless_token +Rules useless in grammar + 2 exp: non_productive + 3 not_reachable: useful + 4 non_productive: non_productive useless_token +]]) + +# The reduced grammar. +# -------------------- +AT_DATA([[reduced.y]], +[[/* A useless token. */ +%token useless_token +/* A useful one. */ +%token useful +%verbose +%output "reduced.c" + +%% + +exp: useful { /* A useful action. */ } +// | non_productive { /* A non productive action. */ } */ + ; + +//not_reachable: useful { /* A not reachable action. */ } +// ; + +//non_productive: non_productive useless_token +// { /* Another non productive action. */ } +// ; +%% +]]) + +AT_BISON_CHECK([[reduced.y]]) + +# Comparing the parsers. +cp reduced.c expout +AT_CHECK([sed 's/not-reduced/reduced/g' not-reduced.c], 0, [expout]) + +AT_CLEANUP + + + +## ------------------- ## +## Underivable Rules. ## +## ------------------- ## + +AT_SETUP([Underivable Rules]) + +AT_KEYWORDS([report]) + +AT_DATA([[input.y]], +[[%verbose +%output "input.c" +%token useful +%% +exp: useful | underivable; +underivable: indirection; +indirection: underivable; +]]) + +AT_BISON_CHECK([[input.y]], 0, [], +[[input.y: warning: 2 nonterminals useless in grammar +input.y: warning: 3 rules useless in grammar +input.y:5.15-25: warning: nonterminal useless in grammar: underivable +input.y:6.14-24: warning: nonterminal useless in grammar: indirection +input.y:5.15-25: warning: rule useless in grammar: exp: underivable +input.y:6.14-24: warning: rule useless in grammar: underivable: indirection +input.y:7.14-24: warning: rule useless in grammar: indirection: underivable +]]) + +AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, +[[Nonterminals useless in grammar + underivable + indirection +Rules useless in grammar + 2 exp: underivable + 3 underivable: indirection + 4 indirection: underivable +]]) + +AT_CLEANUP + + + +## ---------------- ## +## Empty Language. ## +## ---------------- ## + +AT_SETUP([Empty Language]) + +AT_DATA([[input.y]], +[[%output "input.c" +%% +exp: exp; +]]) + +AT_BISON_CHECK([[input.y]], 1, [], +[[input.y: warning: 2 nonterminals useless in grammar +input.y: warning: 2 rules useless in grammar +input.y:3.1-3: fatal error: start symbol exp does not derive any sentence +]]) + +AT_CLEANUP diff --git a/tests/regression.at b/tests/regression.at new file mode 100644 index 0000000..6bfc8d0 --- /dev/null +++ b/tests/regression.at @@ -0,0 +1,1281 @@ +# Bison Regressions. -*- Autotest -*- + +# 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 +# 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 . + +AT_BANNER([[Regression tests.]]) + + +## ------------------ ## +## Trivial grammars. ## +## ------------------ ## + +AT_SETUP([Trivial grammars]) + +AT_DATA_GRAMMAR([input.y], +[[%{ +void yyerror (char const *); +int yylex (void); +#define YYSTYPE int * +%} + +%error-verbose + +%% + +program: 'x'; +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input.o], [-c input.c]) +AT_COMPILE([input.o], [-DYYDEBUG -c input.c]) + +AT_CLEANUP + + + +## ----------------- ## +## YYSTYPE typedef. ## +## ----------------- ## + +AT_SETUP([YYSTYPE typedef]) + +AT_DATA_GRAMMAR([input.y], +[[%{ +void yyerror (char const *); +int yylex (void); +typedef union { char const *val; } YYSTYPE; +%} + +%type program + +%% + +program: { $$ = ""; }; +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input.o], [-c input.c]) + +AT_CLEANUP + + + +## ------------------------------------- ## +## Early token definitions with --yacc. ## +## ------------------------------------- ## + + +AT_SETUP([Early token definitions with --yacc]) + +# Found in GCJ: they expect the tokens to be defined before the user +# prologue, so that they can use the token definitions in it. + +AT_DATA_GRAMMAR([input.y], +[[%{ +void yyerror (const char *s); +int yylex (void); +%} + +%union +{ + int val; +}; +%{ +#ifndef MY_TOKEN +# error "MY_TOKEN not defined." +#endif +%} +%token MY_TOKEN +%% +exp: MY_TOKEN; +%% +]]) + +AT_BISON_CHECK([-y -o input.c input.y]) +AT_COMPILE([input.o], [-c input.c]) + +AT_CLEANUP + + + +## ---------------------------------------- ## +## Early token definitions without --yacc. ## +## ---------------------------------------- ## + + +AT_SETUP([Early token definitions without --yacc]) + +# Found in GCJ: they expect the tokens to be defined before the user +# prologue, so that they can use the token definitions in it. + +AT_DATA_GRAMMAR([input.y], +[[%{ +#include +void yyerror (const char *s); +int yylex (void); +void print_my_token (void); +%} + +%union +{ + int val; +}; +%{ +void +print_my_token (void) +{ + enum yytokentype my_token = MY_TOKEN; + printf ("%d\n", my_token); +} +%} +%token MY_TOKEN +%% +exp: MY_TOKEN; +%% +]]) + +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input.o], [-c input.c]) + +AT_CLEANUP + + + +## ---------------- ## +## Braces parsing. ## +## ---------------- ## + + +AT_SETUP([Braces parsing]) + +AT_DATA([input.y], +[[/* Bison used to swallow the character after `}'. */ + +%% +exp: { tests = {{{{{{{{{{}}}}}}}}}}; }; +%% +]]) + +AT_BISON_CHECK([-v -o input.c input.y]) + +AT_CHECK([grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c], 0, [ignore]) + +AT_CLEANUP + + +## ------------------ ## +## Duplicate string. ## +## ------------------ ## + + +AT_SETUP([Duplicate string]) + +AT_DATA([input.y], +[[/* `Bison -v' used to dump core when two tokens are defined with the same + string, as LE and GE below. */ + +%token NUM +%token LE "<=" +%token GE "<=" + +%% +exp: '(' exp ')' | NUM ; +%% +]]) + +AT_BISON_CHECK([-v -o input.c input.y], 0, [], +[[input.y:6.8-14: warning: symbol `"<="' used more than once as a literal string +]]) + +AT_CLEANUP + + +## ------------------- ## +## Rule Line Numbers. ## +## ------------------- ## + +AT_SETUP([Rule Line Numbers]) + +AT_KEYWORDS([report]) + +AT_DATA([input.y], +[[%% +expr: +'a' + +{ + +} + +'b' + +{ + +} + +| + + +{ + + +} + +'c' + +{ + +}; +]]) + +AT_BISON_CHECK([-o input.c -v input.y]) + +# Check the contents of the report. +AT_CHECK([cat input.output], [], +[[Grammar + + 0 $accept: expr $end + + 1 $@1: /* empty */ + + 2 expr: 'a' $@1 'b' + + 3 $@2: /* empty */ + + 4 expr: $@2 'c' + + +Terminals, with rules where they appear + +$end (0) 0 +'a' (97) 2 +'b' (98) 2 +'c' (99) 4 +error (256) + + +Nonterminals, with rules where they appear + +$accept (6) + on left: 0 +expr (7) + on left: 2 4, on right: 0 +$@1 (8) + on left: 1, on right: 2 +$@2 (9) + on left: 3, on right: 4 + + +state 0 + + 0 $accept: . expr $end + + 'a' shift, and go to state 1 + + $default reduce using rule 3 ($@2) + + expr go to state 2 + $@2 go to state 3 + + +state 1 + + 2 expr: 'a' . $@1 'b' + + $default reduce using rule 1 ($@1) + + $@1 go to state 4 + + +state 2 + + 0 $accept: expr . $end + + $end shift, and go to state 5 + + +state 3 + + 4 expr: $@2 . 'c' + + 'c' shift, and go to state 6 + + +state 4 + + 2 expr: 'a' $@1 . 'b' + + 'b' shift, and go to state 7 + + +state 5 + + 0 $accept: expr $end . + + $default accept + + +state 6 + + 4 expr: $@2 'c' . + + $default reduce using rule 4 (expr) + + +state 7 + + 2 expr: 'a' $@1 'b' . + + $default reduce using rule 2 (expr) +]]) + +AT_CLEANUP + + + +## ---------------------- ## +## Mixing %token styles. ## +## ---------------------- ## + + +AT_SETUP([Mixing %token styles]) + +# Taken from the documentation. +AT_DATA([input.y], +[[%token OR "||" +%token LE 134 "<=" +%left OR "<=" +%% +exp: ; +%% +]]) + +AT_BISON_CHECK([-v -o input.c input.y]) + +AT_CLEANUP + + + +## ---------------- ## +## Invalid inputs. ## +## ---------------- ## + + +AT_SETUP([Invalid inputs]) + +AT_DATA([input.y], +[[%% +? +default: 'a' } +%& +%a-does-not-exist +%- +%{ +]]) + +AT_BISON_CHECK([input.y], [1], [], +[[input.y:2.1: invalid character: `?' +input.y:3.14: invalid character: `}' +input.y:4.1: invalid character: `%' +input.y:4.2: invalid character: `&' +input.y:5.1-17: invalid directive: `%a-does-not-exist' +input.y:6.1: invalid character: `%' +input.y:6.2: invalid character: `-' +input.y:7.1-8.0: missing `%}' at end of file +input.y:7.1-8.0: syntax error, unexpected %{...%} +]]) + +AT_CLEANUP + + +AT_SETUP([Invalid inputs with {}]) + +AT_DATA([input.y], +[[ +%destructor +%initial-action +%lex-param +%parse-param +%printer +%union +]]) + +AT_BISON_CHECK([input.y], [1], [], +[[input.y:3.1-15: syntax error, unexpected %initial-action, expecting {...} +]]) + +AT_CLEANUP + + + +## ------------------- ## +## Token definitions. ## +## ------------------- ## + + +AT_SETUP([Token definitions]) + +# Bison managed, when fed with `%token 'f' "f"' to #define 'f'! +AT_DATA_GRAMMAR([input.y], +[%{ +#include +#include +void yyerror (const char *s); +int yylex (void); +%} +[%error-verbose +%token MYEOF 0 "end of file" +%token 'a' "a" +%token B_TOKEN "b" +%token C_TOKEN 'c' +%token 'd' D_TOKEN +%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" +%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" +%% +exp: "a" "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"; +%% +void +yyerror (char const *s) +{ + fprintf (stderr, "%s\n", s); +} + +int +yylex (void) +{ + static int called; + if (called++) + abort (); + return SPECIAL; +} + +int +main (void) +{ + return yyparse (); +} +]]) + +# Checking the warning message guarantees that the trigraph "??!" isn't +# unnecessarily escaped here even though it would need to be if encoded in a +# C-string literal. Also notice that unnecessary escaping, such as "\?", from +# the user specification is eliminated. +AT_BISON_CHECK([-o input.c input.y], [[0]], [[]], +[[input.y:22.8-14: warning: symbol SPECIAL redeclared +input.y:22.8-63: warning: symbol `"\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!"' used more than once as a literal string +]]) +AT_COMPILE([input]) + +# Checking the error message here guarantees that yytname, which does contain +# C-string literals, does have the trigraph escaped correctly. Thus, the +# symbol name reported by the parser is exactly the same as that reported by +# Bison itself. +AT_DATA([experr], +[[syntax error, unexpected "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!", expecting a +]]) +AT_PARSER_CHECK([./input], 1, [], [experr]) +AT_CLEANUP + + + +## -------------------- ## +## Characters Escapes. ## +## -------------------- ## + + +AT_SETUP([Characters Escapes]) + +AT_DATA_GRAMMAR([input.y], +[%{ +void yyerror (const char *s); +int yylex (void); +%} +[%% +exp: + '\'' "\'" +| '\"' "\"" +| '"' "'" +; +]]) +# Pacify font-lock-mode: " + +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input.o], [-c input.c]) +AT_CLEANUP + + + +## -------------- ## +## Web2c Report. ## +## -------------- ## + +# The generation of the reduction was once wrong in Bison, and made it +# miss some reductions. In the following test case, the reduction on +# `undef_id_tok' in state 1 was missing. This is stripped down from +# the actual web2c.y. + +AT_SETUP([Web2c Report]) + +AT_KEYWORDS([report]) + +AT_DATA([input.y], +[[%token undef_id_tok const_id_tok + +%start CONST_DEC_PART + +%% +CONST_DEC_PART: + CONST_DEC_LIST + ; + +CONST_DEC_LIST: + CONST_DEC + | CONST_DEC_LIST CONST_DEC + ; + +CONST_DEC: + { } undef_id_tok '=' const_id_tok ';' + ; +%% +]]) + +AT_BISON_CHECK([-v input.y]) +AT_CHECK([cat input.output], 0, +[[Grammar + + 0 $accept: CONST_DEC_PART $end + + 1 CONST_DEC_PART: CONST_DEC_LIST + + 2 CONST_DEC_LIST: CONST_DEC + 3 | CONST_DEC_LIST CONST_DEC + + 4 $@1: /* empty */ + + 5 CONST_DEC: $@1 undef_id_tok '=' const_id_tok ';' + + +Terminals, with rules where they appear + +$end (0) 0 +';' (59) 5 +'=' (61) 5 +error (256) +undef_id_tok (258) 5 +const_id_tok (259) 5 + + +Nonterminals, with rules where they appear + +$accept (7) + on left: 0 +CONST_DEC_PART (8) + on left: 1, on right: 0 +CONST_DEC_LIST (9) + on left: 2 3, on right: 1 3 +CONST_DEC (10) + on left: 5, on right: 2 3 +$@1 (11) + on left: 4, on right: 5 + + +state 0 + + 0 $accept: . CONST_DEC_PART $end + + $default reduce using rule 4 ($@1) + + CONST_DEC_PART go to state 1 + CONST_DEC_LIST go to state 2 + CONST_DEC go to state 3 + $@1 go to state 4 + + +state 1 + + 0 $accept: CONST_DEC_PART . $end + + $end shift, and go to state 5 + + +state 2 + + 1 CONST_DEC_PART: CONST_DEC_LIST . + 3 CONST_DEC_LIST: CONST_DEC_LIST . CONST_DEC + + undef_id_tok reduce using rule 4 ($@1) + $default reduce using rule 1 (CONST_DEC_PART) + + CONST_DEC go to state 6 + $@1 go to state 4 + + +state 3 + + 2 CONST_DEC_LIST: CONST_DEC . + + $default reduce using rule 2 (CONST_DEC_LIST) + + +state 4 + + 5 CONST_DEC: $@1 . undef_id_tok '=' const_id_tok ';' + + undef_id_tok shift, and go to state 7 + + +state 5 + + 0 $accept: CONST_DEC_PART $end . + + $default accept + + +state 6 + + 3 CONST_DEC_LIST: CONST_DEC_LIST CONST_DEC . + + $default reduce using rule 3 (CONST_DEC_LIST) + + +state 7 + + 5 CONST_DEC: $@1 undef_id_tok . '=' const_id_tok ';' + + '=' shift, and go to state 8 + + +state 8 + + 5 CONST_DEC: $@1 undef_id_tok '=' . const_id_tok ';' + + const_id_tok shift, and go to state 9 + + +state 9 + + 5 CONST_DEC: $@1 undef_id_tok '=' const_id_tok . ';' + + ';' shift, and go to state 10 + + +state 10 + + 5 CONST_DEC: $@1 undef_id_tok '=' const_id_tok ';' . + + $default reduce using rule 5 (CONST_DEC) +]]) + +AT_CLEANUP + + +## --------------- ## +## Web2c Actions. ## +## --------------- ## + +# The generation of the mapping `state -> action' was once wrong in +# extremely specific situations. web2c.y exhibits this situation. +# Below is a stripped version of the grammar. It looks like one can +# simplify it further, but just don't: it is tuned to exhibit a bug, +# which disapears when applying sane grammar transformations. +# +# It used to be wrong on yydefact only: +# +# static const yytype_uint8 yydefact[] = +# { +# - 2, 0, 1, 0, 0, 2, 3, 2, 5, 4, +# + 2, 0, 1, 0, 0, 0, 3, 2, 5, 4, +# 0, 0 +# }; +# +# but let's check all the tables. + + +AT_SETUP([Web2c Actions]) + +AT_KEYWORDS([report]) + +AT_DATA([input.y], +[[%% +statement: struct_stat; +struct_stat: /* empty. */ | if else; +if: "if" "const" "then" statement; +else: "else" statement; +%% +]]) + +AT_BISON_CHECK([-v -o input.c input.y]) + +# Check only the tables. +[sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c] + +AT_CHECK([[cat tables.c]], 0, +[[static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6 +}; +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 5, 6, 9, 14 +}; +static const yytype_int8 yyrhs[] = +{ + 8, 0, -1, 9, -1, -1, 10, 11, -1, 3, + 4, 5, 8, -1, 6, 8, -1 +}; +static const yytype_uint8 yyrline[] = +{ + 0, 2, 2, 3, 3, 4, 5 +}; +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"", + "\"else\"", "$accept", "statement", "struct_stat", "if", "else", 0 +}; +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261 +}; +static const yytype_uint8 yyr1[] = +{ + 0, 7, 8, 9, 9, 10, 11 +}; +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 0, 2, 4, 2 +}; +static const yytype_uint8 yydefact[] = +{ + 3, 0, 0, 2, 0, 0, 1, 3, 4, 3, + 6, 5 +}; +static const yytype_int8 yydefgoto[] = +{ + -1, 2, 3, 4, 8 +}; +static const yytype_int8 yypact[] = +{ + -2, -1, 4, -8, 0, 2, -8, -2, -8, -2, + -8, -8 +}; +static const yytype_int8 yypgoto[] = +{ + -8, -7, -8, -8, -8 +}; +static const yytype_uint8 yytable[] = +{ + 10, 1, 11, 5, 6, 0, 7, 9 +}; +static const yytype_int8 yycheck[] = +{ + 7, 3, 9, 4, 0, -1, 6, 5 +}; +static const yytype_uint8 yystos[] = +{ + 0, 3, 8, 9, 10, 4, 0, 6, 11, 5, + 8, 8 +}; +]]) + +AT_CLEANUP + + +## ------------------------- ## +## yycheck Bound Violation. ## +## ------------------------- ## + + +# _AT_DATA_DANCER_Y(BISON-OPTIONS) +# -------------------------------- +# The following grammar, taken from Andrew Suffield's GPL'd implementation +# of DGMTP, the Dancer Generic Message Transport Protocol, used to violate +# yycheck's bounds where issuing a verbose error message. Keep this test +# so that possible bound checking compilers could check all the skeletons. +m4_define([_AT_DATA_DANCER_Y], +[AT_DATA_GRAMMAR([dancer.y], +[%{ +static int yylex (AT_LALR1_CC_IF([int *], [void])); +AT_LALR1_CC_IF([], +[#include +#include +static void yyerror (const char *);]) +%} +$1 +%token ARROW INVALID NUMBER STRING DATA +%defines +%verbose +%error-verbose +/* Grammar follows */ +%% +line: header body + ; + +header: '<' from ARROW to '>' type ':' + | '<' ARROW to '>' type ':' + | ARROW to type ':' + | type ':' + | '<' '>' + ; + +from: DATA + | STRING + | INVALID + ; + +to: DATA + | STRING + | INVALID + ; + +type: DATA + | STRING + | INVALID + ; + +body: /* empty */ + | body member + ; + +member: STRING + | DATA + | '+' NUMBER + | '-' NUMBER + | NUMBER + | INVALID + ; +%% +AT_LALR1_CC_IF( +[/* A C++ error reporting function. */ +void +yy::parser::error (const location&, const std::string& m) +{ + std::cerr << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; +#if YYDEBUG + parser.set_debug_level (YYDEBUG); +#endif + return parser.parse (); +} +], +[static void +yyerror (const char *s) +{ + fprintf (stderr, "%s\n", s); +}]) + +static int +yylex (AT_LALR1_CC_IF([int *lval], [void])) +[{ + static int const tokens[] = + { + ':', -1 + }; + static size_t toknum; + ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[ + if (! (toknum < sizeof tokens / sizeof *tokens)) + abort (); + return tokens[toknum++]; +}] + +int +main (void) +{ + return yyparse (); +} +]) +])# _AT_DATA_DANCER_Y + + +# AT_CHECK_DANCER(BISON-OPTIONS) +# ------------------------------ +# Generate the grammar, compile it, run it. +m4_define([AT_CHECK_DANCER], +[AT_SETUP([Dancer $1]) +AT_BISON_OPTION_PUSHDEFS([$1]) +_AT_DATA_DANCER_Y([$1]) +AT_BISON_CHECK([-o dancer.c dancer.y]) +AT_LALR1_CC_IF( + [AT_BISON_CHECK([-o dancer.cc dancer.y]) + AT_COMPILE_CXX([dancer])], + [AT_BISON_CHECK([-o dancer.c dancer.y]) + AT_COMPILE([dancer])]) +AT_PARSER_CHECK([./dancer], 1, [], +[syntax error, unexpected ':' +]) +AT_BISON_OPTION_POPDEFS +AT_CLEANUP +]) + +AT_CHECK_DANCER() +AT_CHECK_DANCER([%glr-parser]) +AT_CHECK_DANCER([%skeleton "lalr1.cc"]) + + +## ------------------------------------------ ## +## Diagnostic that expects two alternatives. ## +## ------------------------------------------ ## + + +# _AT_DATA_EXPECT2_Y(BISON-OPTIONS) +# -------------------------------- +m4_define([_AT_DATA_EXPECT2_Y], +[AT_DATA_GRAMMAR([expect2.y], +[%{ +static int yylex (AT_LALR1_CC_IF([int *], [void])); +AT_LALR1_CC_IF([], +[#include +#include +static void yyerror (const char *);]) +%} +$1 +%defines +%error-verbose +%token A 1000 +%token B + +%% +program: /* empty */ + | program e ';' + | program error ';'; + +e: e '+' t | t; +t: A | B; + +%% +AT_LALR1_CC_IF( +[/* A C++ error reporting function. */ +void +yy::parser::error (const location&, const std::string& m) +{ + std::cerr << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; + return parser.parse (); +} +], +[static void +yyerror (const char *s) +{ + fprintf (stderr, "%s\n", s); +}]) + +static int +yylex (AT_LALR1_CC_IF([int *lval], [void])) +[{ + static int const tokens[] = + { + 1000, '+', '+', -1 + }; + static size_t toknum; + ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[ + if (! (toknum < sizeof tokens / sizeof *tokens)) + abort (); + return tokens[toknum++]; +}] + +int +main (void) +{ + return yyparse (); +} +]) +])# _AT_DATA_EXPECT2_Y + + +# AT_CHECK_EXPECT2(BISON-OPTIONS) +# ------------------------------ +# Generate the grammar, compile it, run it. +m4_define([AT_CHECK_EXPECT2], +[AT_SETUP([Expecting two tokens $1]) +AT_BISON_OPTION_PUSHDEFS([$1]) +_AT_DATA_EXPECT2_Y([$1]) +AT_BISON_CHECK([-o expect2.c expect2.y]) +AT_LALR1_CC_IF( + [AT_BISON_CHECK([-o expect2.cc expect2.y]) + AT_COMPILE_CXX([expect2])], + [AT_BISON_CHECK([-o expect2.c expect2.y]) + AT_COMPILE([expect2])]) +AT_PARSER_CHECK([./expect2], 1, [], +[syntax error, unexpected '+', expecting A or B +]) +AT_BISON_OPTION_POPDEFS +AT_CLEANUP +]) + +AT_CHECK_EXPECT2() +AT_CHECK_EXPECT2([%glr-parser]) +AT_CHECK_EXPECT2([%skeleton "lalr1.cc"]) + + + +## --------------------------------------------- ## +## Braced code in declaration in rules section. ## +## --------------------------------------------- ## + +AT_SETUP([Braced code in declaration in rules section]) + +# Bison once mistook braced code in a declaration in the rules section to be a +# rule action. + +AT_DATA_GRAMMAR([input.y], +[[%{ +#include +static void yyerror (char const *msg); +static int yylex (void); +%} + +%error-verbose + +%% + +start: + { + printf ("Bison would once convert this action to a midrule because of the" + " subsequent braced code.\n"); + } + ; + +%destructor { fprintf (stderr, "DESTRUCTOR\n"); } 'a'; +%printer { fprintf (yyoutput, "PRINTER"); } 'a'; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + return 'a'; +} + +int +main (void) +{ + yydebug = 1; + return !yyparse (); +} +]]) + +AT_BISON_CHECK([-t -o input.c input.y]) +AT_COMPILE([input]) +AT_PARSER_CHECK([./input], 0, +[[Bison would once convert this action to a midrule because of the subsequent braced code. +]], +[[Starting parse +Entering state 0 +Reducing stack by rule 1 (line 20): +-> $$ = nterm start () +Stack now 0 +Entering state 1 +Reading a token: Next token is token 'a' (PRINTER) +syntax error, unexpected 'a', expecting $end +Error: popping nterm start () +Stack now 0 +Cleanup: discarding lookahead token 'a' (PRINTER) +DESTRUCTOR +Stack now 0 +]]) + +AT_CLEANUP + + + +## --------------------------------- ## +## String alias declared after use. ## +## --------------------------------- ## + +AT_SETUP([String alias declared after use]) + +# Bison once incorrectly asserted that the symbol number for either a token or +# its alias was the highest symbol number so far at the point of the alias +# declaration. That was true unless the declaration appeared after their first +# uses and other tokens appeared in between. + +AT_DATA([input.y], +[[%% +start: 'a' "A" 'b'; +%token 'a' "A"; +]]) + +AT_BISON_CHECK([-t -o input.c input.y]) + +AT_CLEANUP + + + +## -------------------------------- ## +## Extra lookahead sets in report. ## +## -------------------------------- ## + +AT_SETUP([[Extra lookahead sets in report]]) + +# Bison prints each reduction's lookahead set only next to the associated +# state's one item that (1) is associated with the same rule as the reduction +# and (2) has its dot at the end of its RHS. Previously, Bison also +# erroneously printed the lookahead set next to all of the state's other items +# associated with the same rule. This bug affected only the `.output' file and +# not the generated parser source code. + +AT_DATA([[input.y]], +[[%% +start: a | 'a' a 'a' ; +a: 'a' ; +]]) + +AT_BISON_CHECK([[--report=all input.y]]) +AT_CHECK([[sed -n '/^state 1$/,/^state 2$/p' input.output]], [[0]], +[[state 1 + + 2 start: 'a' . a 'a' + 3 a: . 'a' + 3 | 'a' . [$end] + + 'a' shift, and go to state 4 + + $default reduce using rule 3 (a) + + a go to state 5 + + +state 2 +]]) + +AT_CLEANUP + + + +## ---------------------------------------- ## +## Token number in precedence declaration. ## +## ---------------------------------------- ## + +AT_SETUP([[Token number in precedence declaration]]) + +# POSIX says token numbers can be declared in %left, %right, and %nonassoc, but +# we lost this in Bison 1.50. + +AT_DATA_GRAMMAR([input.y], +[[%{ + #include + void yyerror (char const *); + int yylex (void); +%} + +%error-verbose +%left TK1 1 TK2 2 "tok alias" 3 + +%% + +start: TK1 sr_conflict "tok alias" ; + +sr_conflict: + TK2 + | TK2 "tok alias" + ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +yylex (void) +{ + static int const input[] = { 1, 2, 3, 0 }; + static int const *inputp = input; + return *inputp++; +} + +int +main (void) +{ + return yyparse (); +} +]]) + +AT_BISON_CHECK([[-o input.c input.y]], [[0]],, +[[input.y:24.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 "tok alias" +]]) +AT_COMPILE([[input]]) +AT_PARSER_CHECK([[./input]]) + +AT_CLEANUP + + + +## ----------------------------------------------- ## +## Fix user actions without a trailing semicolon. ## +## ----------------------------------------------- ## + +AT_SETUP([[Fix user actions without a trailing semicolon]]) + +# This feature is undocumented, but we accidentally broke it in 2.3a, and there +# was a complaint at: +# . + +AT_DATA([input.y], +[[%% +start: {asdffdsa} ; +]]) + +AT_BISON_CHECK([[-o input.c input.y]]) +AT_CHECK([[sed -n '/asdffdsa/s/^ *//p' input.c]], [[0]], +[[{asdffdsa;} +]]) + +AT_CLEANUP diff --git a/tests/sets.at b/tests/sets.at new file mode 100644 index 0000000..165daba --- /dev/null +++ b/tests/sets.at @@ -0,0 +1,300 @@ +# Exercising Bison Grammar Sets. -*- Autotest -*- +# Copyright (C) 2001, 2002, 2005, 2007 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 . + + +# AT_EXTRACT_SETS(INPUT, OUTPUT) +# ------------------------------ +# Extract the information about the grammar sets from a bison +# trace output (INPUT), and save it in OUTPUT. +# And remember, there is no alternation in portable sed. +m4_define([AT_EXTRACT_SETS], +[AT_DATA([extract.sed], +[[#n +/^NULLABLE$/ { + :null + p + n + /^[ ]*$/ !b null +} +/^FIRSTS$/ { + :firsts + p + n + /^[ ]*$/ !b firsts +} +/^FDERIVES$/ { + :fderiv + p + n + /^[ ]*$/ !b fderiv +} +/^DERIVES$/ { + :deriv + p + n + /^[ ]*$/ !b deriv +} +]]) +AT_CHECK([sed -f extract.sed $1], 0, [stdout]) +AT_CHECK([mv stdout $2]) +]) + + + +AT_BANNER([[Grammar Sets (Firsts etc.).]]) + + +## ---------- ## +## Nullable. ## +## ---------- ## + +AT_SETUP([Nullable]) + +# At some point, nullable had been smoking grass, and managed to say: +# +# Entering set_nullable +# NULLABLE +# 'e': yes +# (null): no +# ... + +AT_DATA([[input.y]], +[[%% +e: 'e' | /* Nothing */; +]]) + +AT_BISON_CHECK([[--trace=sets input.y]], [], [], [stderr]) +AT_EXTRACT_SETS([stderr], [sets]) +AT_CHECK([[cat sets]], [], +[[DERIVES + $accept derives + 0 e $end + e derives + 1 'e' + 2 /* empty */ +NULLABLE + $accept: no + e: yes +FIRSTS + $accept firsts + $accept + e + e firsts + e +FDERIVES + $accept derives + 0 e $end + 1 'e' + 2 /* empty */ + e derives + 1 'e' + 2 /* empty */ +]]) + +AT_CLEANUP + + +## ---------------- ## +## Broken Closure. ## +## ---------------- ## + +# TC was once broken during a massive `simplification' of the code. +# It resulted in bison dumping core on the following grammar (the +# computation of FIRSTS uses TC). It managed to produce a pretty +# exotic closure: +# +# TC: Input +# +# 01234567 +# +--------+ +# 0| 1 | +# 1| 1 | +# 2| 1 | +# 3| 1 | +# 4| 1 | +# 5| 1 | +# 6| 1| +# 7| | +# +--------+ +# +# TC: Output +# +# 01234567 +# +--------+ +# 0| 1 | +# 1| 111 | +# 2| 111 | +# 3| 1111 | +# 4| 111 1 | +# 5| 111 1 | +# 6| 111 1| +# 7| 111 | +# +--------+ +# +# instead of that below. + +AT_SETUP([Broken Closure]) + +AT_DATA([input.y], +[[%% +a: b; +b: c; +c: d; +d: e; +e: f; +f: g; +g: h; +h: 'h'; +]]) + +AT_BISON_CHECK([[--trace=sets input.y]], [], [], [stderr]) + +AT_CHECK([[sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr]], [], +[[RTC: Firsts Output BEGIN + + 012345678 + .---------. + 0|111111111| + 1| 11111111| + 2| 1111111| + 3| 111111| + 4| 11111| + 5| 1111| + 6| 111| + 7| 11| + 8| 1| + `---------' +RTC: Firsts Output END +]]) + +AT_CLEANUP + + + +## -------- ## +## Firsts. ## +## -------- ## + +AT_SETUP([Firsts]) + +AT_DATA([input.y], +[[%nonassoc '<' '>' +%left '+' '-' +%right '^' '=' +%% +exp: + exp '<' exp + | exp '>' exp + | exp '+' exp + | exp '-' exp + | exp '^' exp + | exp '=' exp + | "exp" + ; +]]) + +AT_BISON_CHECK([[--trace=sets input.y]], [], [], [stderr]) +AT_EXTRACT_SETS([stderr], [sets]) +AT_CHECK([[cat sets]], [], +[[DERIVES + $accept derives + 0 exp $end + exp derives + 1 exp '<' exp + 2 exp '>' exp + 3 exp '+' exp + 4 exp '-' exp + 5 exp '^' exp + 6 exp '=' exp + 7 "exp" +NULLABLE + $accept: no + exp: no +FIRSTS + $accept firsts + $accept + exp + exp firsts + exp +FDERIVES + $accept derives + 0 exp $end + 1 exp '<' exp + 2 exp '>' exp + 3 exp '+' exp + 4 exp '-' exp + 5 exp '^' exp + 6 exp '=' exp + 7 "exp" + exp derives + 1 exp '<' exp + 2 exp '>' exp + 3 exp '+' exp + 4 exp '-' exp + 5 exp '^' exp + 6 exp '=' exp + 7 "exp" +]]) + +AT_CLEANUP + + + + +## -------- ## +## Accept. ## +## -------- ## + +# In some weird cases Bison could compute an incorrect final state +# number. This happens only if the $end token is used in the user +# grammar, which is a very suspicious accidental feature introduced as +# a side effect of allowing the user to name $end using `%token END 0 +# "end of file"'. + +AT_SETUP([Accept]) + +AT_DATA([input.y], +[[%token END 0 +%% +input: + 'a' +| '(' input ')' +| '(' error END +; +]]) + +AT_BISON_CHECK([[-v -o input.c input.y]]) + +# Get the final state in the parser. +AT_CHECK([[sed -n 's/.*define YYFINAL *\([0-9][0-9]*\)/final state \1/p' input.c]], + 0, [stdout]) +mv stdout expout + +# Get the final state in the report, from the "accept" action.. +AT_CHECK([sed -n ' + /^state \(.*\)/{ + s//final state \1/ + x + } + / accept/{ + x + p + q + } + ' input.output], + 0, [expout]) + +AT_CLEANUP diff --git a/tests/skeletons.at b/tests/skeletons.at new file mode 100644 index 0000000..3845d3d --- /dev/null +++ b/tests/skeletons.at @@ -0,0 +1,290 @@ +# Checking skeleton support. -*- Autotest -*- +# Copyright (C) 2007 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 . + +AT_BANNER([[Skeleton Support.]]) + +## ------------------------------ ## +## Relative skeleton file names. ## +## ------------------------------ ## + +AT_SETUP([[Relative skeleton file names]]) + +AT_CHECK([[mkdir tmp]]) + +AT_DATA([[tmp/skel.c]], +[[m4@&t@_divert_push(0)d@&t@nl +@output(b4_parser_file_name@)d@&t@nl +b4_percent_define_get([[test]]) +m4@&t@_divert_pop(0) +]]) + +AT_DATA([[skel.c]], +[[m4@&t@_divert_push(0)d@&t@nl +@output(b4_parser_file_name@)d@&t@nl +b4_percent_define_get([[test]]) -- Local +m4@&t@_divert_pop(0) +]]) + +AT_DATA([[tmp/input-gram.y]], +[[%skeleton "./skel.c" +%define test "Hello World" +%% +start: ; +]]) + +AT_DATA([[input-gram.y]], +[[%skeleton "./skel.c" +%define test "Hello World" +%% +start: ; +]]) + +AT_DATA([[tmp/input-cmd-line.y]], +[[%define test "Hello World" +%% +start: ; +]]) + +AT_BISON_CHECK([[tmp/input-gram.y]]) +AT_CHECK([[cat input-gram.tab.c]], [[0]], +[[Hello World +]]) + +AT_BISON_CHECK([[input-gram.y]]) +AT_CHECK([[cat input-gram.tab.c]], [[0]], +[[Hello World -- Local +]]) + +AT_BISON_CHECK([[--skeleton=tmp/skel.c tmp/input-cmd-line.y]]) +AT_CHECK([[cat input-cmd-line.tab.c]], [[0]], +[[Hello World +]]) + +AT_CLEANUP + + +## ------------------------------- ## +## Installed skeleton file names. ## +## ------------------------------- ## + +AT_SETUP([[Installed skeleton file names]]) + +m4_pushdef([AT_GRAM], +[[%{ + #include + void yyerror (char const *msg); + int yylex (void); +%} + +%error-verbose +%token 'a' + +%% + +start: ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +yylex (void) +{ + return 'a'; +} + +int +main (void) +{ + return yyparse (); +} +]]) + +AT_DATA([[input-cmd-line.y]], +[AT_GRAM]) + +AT_DATA([[input-gram.y]], +[[%skeleton "yacc.c"] +AT_GRAM]) + +AT_BISON_CHECK([[--skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y]]) +AT_COMPILE([[input-cmd-line]]) +AT_PARSER_CHECK([[./input-cmd-line]], [[1]], [], +[[syntax error, unexpected 'a', expecting $end +]]) + +AT_BISON_CHECK([[-o input-gram.c input-gram.y]]) +AT_COMPILE([[input-gram]]) +AT_PARSER_CHECK([[./input-gram]], [[1]], [], +[[syntax error, unexpected 'a', expecting $end +]]) + +m4_popdef([AT_GRAM]) + +AT_CLEANUP + + +## ------------------------------------------------------ ## +## %define Boolean variables: invalid skeleton defaults. ## +## ------------------------------------------------------ ## + +AT_SETUP([[%define Boolean variables: invalid skeleton defaults]]) + +AT_DATA([[skel.c]], +[[b4_percent_define_default([[foo]], [[bogus value]]) +b4_percent_define_flag_if([[foo]]) +]]) + +AT_DATA([[input.y]], +[[%skeleton "./skel.c" +%% +start: ; +]]) + +AT_BISON_CHECK([[input.y]], [[1]], [[]], +[[[Bison:b4_percent_define_default]:1.0: invalid value for %define Boolean variable `foo' +]]) + +AT_CLEANUP + + +## --------------------------------------------- ## +## Complaining during macro argument expansion. ## +## --------------------------------------------- ## + +AT_SETUP([[Complaining during macro argument expansion]]) + +AT_DATA([[skel1.c]], +[[m4@&t@_define([foow], [b4_warn([[foow fubar]])]) +m4@&t@_define([foowat], [b4_warn_at([[foow.y:2.3]], + [[foow.y:5.4]], [[foowat fubar]])]) +m4@&t@_define([fooc], [b4_complain([[fooc fubar]])]) +m4@&t@_define([foocat], [b4_complain_at([[fooc.y:1.1]], + [[fooc.y:10.6]], [[foocat fubar]])]) +m4@&t@_define([foof], [b4_fatal([[foof fubar]])]) +m4@&t@_if(foow, [1], [yes]) +m4@&t@_if(foowat, [1], [yes]) +m4@&t@_if(fooc, [1], [yes]) +m4@&t@_if(foocat, [1], [yes]) +m4@&t@_if(foof, [1], [yes]) +]]) + +AT_DATA([[input1.y]], +[[%skeleton "./skel1.c" +%% +start: ; +]]) + +AT_BISON_CHECK([[input1.y]], [[1]], [[]], +[[input1.y: warning: foow fubar +foow.y:2.3-5.3: warning: foowat fubar +input1.y: fooc fubar +fooc.y:1.1-10.5: foocat fubar +input1.y: fatal error: foof fubar +]]) + +AT_DATA([[skel2.c]], +[[m4@&t@_define([foofat], [b4_fatal_at([[foof.y:12.11]], + [[foof.y:100.123]], [[foofat fubar]])]) +m4@&t@_if(foofat, [1], [yes]) +]]) + +AT_DATA([[input2.y]], +[[%skeleton "./skel2.c" +%% +start: ; +]]) + +AT_BISON_CHECK([[input2.y]], [[1]], [[]], +[[foof.y:12.11-100.122: fatal error: foofat fubar +]]) + +AT_DATA([[skel3.c]], +[[b4_complain_at(b4_percent_define_get_loc([[bogus]]), [[bad value]]) +]]) + +AT_DATA([[input3.y]], +[[%skeleton "./skel3.c" +%% +start: ; +]]) + +AT_BISON_CHECK([[input3.y]], [[1]], [[]], +[[input3.y: fatal error: undefined %define variable `bogus' passed to b4_percent_define_get_loc +]]) + +AT_DATA([[skel4.c]], +[[b4_warn_at(b4_percent_define_get_syncline([[bogus]]), [[bad value]]) +]]) + +AT_DATA([[input4.y]], +[[%skeleton "./skel4.c" +%% +start: ; +]]) + +AT_BISON_CHECK([[input4.y]], [[1]], [[]], +[[input4.y: fatal error: undefined %define variable `bogus' passed to b4_percent_define_get_syncline +]]) + +AT_CLEANUP + + +## --------------------------------------- ## +## Fatal errors make M4 exit immediately. ## +## --------------------------------------- ## + +AT_SETUP([[Fatal errors make M4 exit immediately]]) + +AT_DATA([[skel1.c]], +[[b4_complain([[non-fatal error]]) +b4_fatal([[M4 should exit immediately here]]) +m4@&t@_fatal([this should never be evaluated]) +]]) + +AT_DATA([[input1.y]], +[[%skeleton "./skel1.c" +%% +start: ; +]]) + +AT_BISON_CHECK([[input1.y]], [[1]], [[]], +[[input1.y: non-fatal error +input1.y: fatal error: M4 should exit immediately here +]]) + +AT_DATA([[skel2.c]], +[[b4_warn([[morning]]) +b4_fatal_at([[foo.y:1.5]], [[foo.y:1.7]], [[M4 should exit immediately here]]) +m4@&t@_fatal([this should never be evaluated]) +]]) + +AT_DATA([[input2.y]], +[[%skeleton "./skel2.c" +%% +start: ; +]]) + +AT_BISON_CHECK([[input2.y]], [[1]], [[]], +[[input2.y: warning: morning +foo.y:1.5-6: fatal error: M4 should exit immediately here +]]) + +AT_CLEANUP diff --git a/tests/synclines.at b/tests/synclines.at new file mode 100644 index 0000000..d971e54 --- /dev/null +++ b/tests/synclines.at @@ -0,0 +1,173 @@ +# Executing Actions. -*- Autotest -*- +# Copyright (C) 2002, 2004, 2005, 2007 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 . + +AT_BANNER([[User Actions.]]) + + +# AT_SYNCLINES_COMPILE(FILE) +# -------------------------- +# Compile FILE expecting an error, and save in the file stdout the +# normalized output. Ignore the exit status, since some compilers +# (e.g. c89 on IRIX 6.5) triger warnings on `#error', instead of +# errors. +m4_define([AT_SYNCLINES_COMPILE], +[AT_CHECK([$CC $CFLAGS $CPPFLAGS -c $1], [ignore], [], [stderr]) +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +AT_CHECK([[sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^@%:@]*\( @%:@error\)/\1\2/' stderr]], 0, [stdout]) +]) + +# AT_TEST_SYNCLINE(TITLE, INPUT, ERROR-MSG) +# ----------------------------------------- +# Check that compiling the parser produced from INPUT cause GCC +# to issue ERROR-MSG. +m4_define([AT_TEST_SYNCLINE], +[AT_SETUP([$1]) + +# It seems impossible to find a generic scheme to check the location +# of an error. Even requiring GCC is not sufficient, since for instance +# the version modified by Apple: +# +# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs +# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 +# | 19991024 (release) configure:2124: $? = 0 +# +# instead of: +# +# | input.y:2: #error "2" +# +# it reports: +# +# | input.y:2: "2" +# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode + +AT_DATA([syncline.c], +[[#error "1" +]]) + +AT_SYNCLINES_COMPILE([syncline.c]) +AT_CHECK([[test "`cat stdout`" = 'syncline.c:1: @%:@error "1"' || exit 77]]) + +AT_DATA([[input.y]], [$2]) +AT_BISON_CHECK([-o input.c input.y]) +AT_SYNCLINES_COMPILE([input.c]) +AT_CHECK([cat stdout], 0, [$3]) +AT_CLEANUP +]) + + +## --------------------- ## +## Prologue synch line. ## +## --------------------- ## + + +AT_TEST_SYNCLINE([Prologue synch line], +[[%{ +#error "2" +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: '0'; +]], +[input.y:2: #error "2" +]) + + +## ------------------- ## +## %union synch line. ## +## ------------------- ## + +AT_TEST_SYNCLINE([%union synch line], +[[%union { +#error "2" + char dummy; +} +%{ +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: '0'; +]], +[input.y:2: #error "2" +]) + + +## ------------------------- ## +## Postprologue synch line. ## +## ------------------------- ## + +AT_TEST_SYNCLINE([Postprologue synch line], +[[%{ +void yyerror (const char *s); +int yylex (void); +%} +%union +{ + int ival; +} +%{ +#error "10" +%} +%% +exp: '0'; +]], +[input.y:10: #error "10" +]) + + +## ------------------- ## +## Action synch line. ## +## ------------------- ## + +AT_TEST_SYNCLINE([Action synch line], +[[%{ +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: +{ +#error "8" +}; +]], +[input.y:8: #error "8" +]) + + +## --------------------- ## +## Epilogue synch line. ## +## --------------------- ## + +AT_TEST_SYNCLINE([Epilogue synch line], +[[%{ +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: '0'; +%% +#error "8" +]], +[input.y:8: #error "8" +]) diff --git a/tests/testsuite b/tests/testsuite new file mode 100755 index 0000000..32feed4 --- /dev/null +++ b/tests/testsuite @@ -0,0 +1,137014 @@ +#! /bin/sh +# Generated from local.at by GNU Autoconf 2.62. +# +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. +# This test suite is free software; the Free Software Foundation gives +# unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + + + +SHELL=${CONFIG_SHELL-/bin/sh} + +# How were we run? +at_cli_args="$@" + + +# Not all shells have the 'times' builtin; the subshell is needed to make +# sure we discard the 'times: not found' message from the shell. +at_times_p=false +(times) >/dev/null 2>&1 && at_times_p=: + +# CLI Arguments to pass to the debugging scripts. +at_debug_args= +# -e sets to true +at_errexit_p=false +# Shall we be verbose? ':' means no, empty means yes. +at_verbose=: +at_quiet= + +# Shall we keep the debug scripts? Must be `:' when the suite is +# run by a debug script, so that the script doesn't remove itself. +at_debug_p=false +# Display help message? +at_help_p=false +# Display the version message? +at_version_p=false +# List test groups? +at_list_p=false +# --clean +at_clean=false +# Test groups to run +at_groups= +# Whether a write failure occurred +at_write_fail=0 + +# The directory we run the suite in. Default to . if no -C option. +at_dir=`pwd` +# An absolute reference to this testsuite script. +case $as_myself in + [\\/]* | ?:[\\/]* ) at_myself=$as_myself ;; + * ) at_myself=$at_dir/$as_myself ;; +esac +# Whether -C is in effect. +at_change_dir=false + +# List of the tested programs. +at_tested='bison' +# List of the all the test groups. +at_groups_all=' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240' +# As many question marks as there are digits in the last test group number. +# Used to normalize the test group numbers so that `ls' lists them in +# numerical order. +at_format='???' +# Description of all the test groups. +at_help_all="1;input.at:27;Invalid \$n and @n;; +2;input.at:47;Type Clashes;; +3;input.at:161;Unused values;; +4;input.at:171;Unused values before symbol declarations;; +5;input.at:181;Default %printer and %destructor redeclared;; +6;input.at:241;Per-type %printer and %destructor redeclared;; +7;input.at:284;Unused values with default %destructor;; +8;input.at:326;Unused values with per-type %destructor;; +9;input.at:351;Incompatible Aliases;; +10;input.at:392;Torturing the Scanner;; +11;input.at:555;Typed symbol aliases;; +12;input.at:591;Require 1.0;; +13;input.at:592;Require 2.4.1;; +14;input.at:594;Require 100.0;; +15;input.at:601;String aliases for character tokens;; +16;input.at:622;Unclosed constructs;; +17;input.at:667;%start after first rule;; +18;input.at:688;%prec takes a token;; +19;input.at:709;Reject unused %code qualifiers;; +20;input.at:798;%define errors;; +21;input.at:828;%define Boolean variables;; +22;input.at:848;%define enum variables;; +23;input.at:866;Unused %define api.pure;; +24;input.at:899;C++ namespace reference errors;; +25;output.at:43;Output files: -dv ;; +26;output.at:45;Output files: -dv >&-;; +27;output.at:48;Output files: -dv -o foo.c ;; +28;output.at:50;Output files: -dv -o foo.tab.c ;; +29;output.at:52;Output files: -dv -y ;; +30;output.at:54;Output files: -dv -b bar ;; +31;output.at:56;Output files: -dv -g -o foo.c ;; +32;output.at:60;Output files: %defines %verbose ;; +33;output.at:62;Output files: %defines %verbose %yacc ;; +34;output.at:65;Output files: %defines %verbose %yacc ;; +35;output.at:69;Output files: %file-prefix \"bar\" %defines %verbose ;; +36;output.at:71;Output files: %output=\"bar.c\" %defines %verbose %yacc ;; +37;output.at:73;Output files: %file-prefix=\"baz\" %output \"bar.c\" %defines %verbose %yacc ;; +38;output.at:80;Output files: %defines %verbose ;; +39;output.at:83;Output files: %defines %verbose -o foo.c ;; +40;output.at:86;Output files: --defines=foo.hpp -o foo.c++ ;; +41;output.at:90;Output files: %defines \"foo.hpp\" -o foo.c++ ;; +42;output.at:94;Output files: -o foo.c++ --graph=foo.gph ;; +43;output.at:109;Output files: %skeleton \"lalr1.cc\" %defines %verbose ;; +44;output.at:112;Output files: %skeleton \"lalr1.cc\" %defines %verbose ;; +45;output.at:116;Output files: %skeleton \"lalr1.cc\" %defines %verbose -o subdir/foo.cc ;; +46;output.at:121;Output files: %skeleton \"lalr1.cc\" %defines %verbose %file-prefix \"output_dir/foo\" ;; +47;output.at:145;Conflicting output files: --graph=\"foo.tab.c\";; +48;output.at:150;Conflicting output files: %defines \"foo.output\" -v;; +49;output.at:155;Conflicting output files: %skeleton \"lalr1.cc\" %defines --graph=\"location.hh\";; +50;output.at:160;Conflicting output files: -o foo.y;; +51;output.at:200;Output file name: \`~!@#\$%^&*()-=_+{}[]|\\:;<>, .';c++; +52;output.at:207;Output file name: (;c++; +53;output.at:208;Output file name: );c++; +54;output.at:209;Output file name: #;c++; +55;output.at:210;Output file name: @@;c++; +56;output.at:211;Output file name: @{;c++; +57;output.at:212;Output file name: @};c++; +58;output.at:213;Output file name: [;c++; +59;output.at:214;Output file name: ];c++; +60;skeletons.at:23;Relative skeleton file names;; +61;skeletons.at:83;Installed skeleton file names;; +62;skeletons.at:148;%define Boolean variables: invalid skeleton defaults;; +63;skeletons.at:172;Complaining during macro argument expansion;; +64;skeletons.at:254;Fatal errors make M4 exit immediately;; +65;sets.at:64;Nullable;; +66;sets.at:149;Broken Closure;; +67;sets.at:191;Firsts;; +68;sets.at:267;Accept;; +69;reduce.at:24;Useless Terminals;; +70;reduce.at:68;Useless Nonterminals;; +71;reduce.at:123;Useless Rules;report; +72;reduce.at:211;Reduced Automaton;report; +73;reduce.at:301;Underivable Rules;report; +74;reduce.at:343;Empty Language;; +75;synclines.at:83;Prologue synch line;; +76;synclines.at:100;%union synch line;; +77;synclines.at:120;Postprologue synch line;; +78;synclines.at:143;Action synch line;; +79;synclines.at:162;Epilogue synch line;; +80;headers.at:25;%union and --defines;; +81;headers.at:75;Invalid CPP guards: input/input;; +82;headers.at:76;Invalid CPP guards: 9foo;; +83;headers.at:85;export YYLTYPE;; +84;actions.at:24;Mid-rule actions;; +85;actions.at:93;Exotic Dollars;; +86;actions.at:574;Printers and Destructors : ;; +87;actions.at:575;Printers and Destructors with union: ;; +88;actions.at:577;Printers and Destructors : %defines %skeleton \"lalr1.cc\";c++; +89;actions.at:578;Printers and Destructors with union: %defines %skeleton \"lalr1.cc\";c++; +90;actions.at:580;Printers and Destructors : %glr-parser;; +91;actions.at:581;Printers and Destructors with union: %glr-parser;; +92;actions.at:592;Default tagless %printer and %destructor;; +93;actions.at:710;Default tagged and per-type %printer and %destructor;; +94;actions.at:847;Default %printer and %destructor for user-defined end token;; +95;actions.at:961;Default %printer and %destructor are not for error or \$undefined;; +96;actions.at:1071;Default %printer and %destructor are not for \$accept;; +97;actions.at:1148;Default %printer and %destructor for mid-rule values;; +98;actions.at:1304;@\$ in %initial-action implies %locations;; +99;actions.at:1305;@\$ in %destructor implies %locations;; +100;actions.at:1306;@\$ in %printer implies %locations;; +101;conflicts.at:30;S/R in initial;; +102;conflicts.at:50;%nonassoc and eof;; +103;conflicts.at:125;Unresolved SR Conflicts;report; +104;conflicts.at:232;Resolved SR Conflicts;report; +105;conflicts.at:354;Defaulted Conflicted Reduction;report; +106;conflicts.at:473;%expect not enough;; +107;conflicts.at:493;%expect right;; +108;conflicts.at:510;%expect too much;; +109;conflicts.at:530;%expect with reduce conflicts;; +110;conflicts.at:550;%no-default-prec without %prec;; +111;conflicts.at:576;%no-default-prec with %prec;; +112;conflicts.at:600;%default-prec;; +113;conflicts.at:624;Unreachable States After Conflict Resolution;; +114;conflicts.at:835;Solved conflicts report for multiple reductions in a state;; +115;conflicts.at:915;%nonassoc error actions for multiple reductions in a state;; +116;calc.at:569;Calculator ;; +117;calc.at:571;Calculator %defines;; +118;calc.at:572;Calculator %locations;; +119;calc.at:573;Calculator %name-prefix=\"calc\";; +120;calc.at:574;Calculator %verbose;; +121;calc.at:575;Calculator %yacc;; +122;calc.at:576;Calculator %error-verbose;; +123;calc.at:578;Calculator %define api.pure %locations;; +124;calc.at:579;Calculator %define api.push_pull \"both\" %define api.pure %locations;; +125;calc.at:580;Calculator %error-verbose %locations;; +126;calc.at:582;Calculator %error-verbose %locations %defines %name-prefix \"calc\" %verbose %yacc;; +127;calc.at:584;Calculator %debug;; +128;calc.at:585;Calculator %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc;; +129;calc.at:587;Calculator %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc;; +130;calc.at:588;Calculator %define api.push_pull \"both\" %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc;; +131;calc.at:590;Calculator %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count};; +132;calc.at:607;Calculator %glr-parser ;; +133;calc.at:609;Calculator %glr-parser %defines;; +134;calc.at:610;Calculator %glr-parser %locations;; +135;calc.at:611;Calculator %glr-parser %name-prefix \"calc\";; +136;calc.at:612;Calculator %glr-parser %verbose;; +137;calc.at:613;Calculator %glr-parser %yacc;; +138;calc.at:614;Calculator %glr-parser %error-verbose;; +139;calc.at:616;Calculator %glr-parser %define api.pure %locations;; +140;calc.at:617;Calculator %glr-parser %error-verbose %locations;; +141;calc.at:619;Calculator %glr-parser %error-verbose %locations %defines %name-prefix \"calc\" %verbose %yacc;; +142;calc.at:621;Calculator %glr-parser %debug;; +143;calc.at:622;Calculator %glr-parser %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc;; +144;calc.at:624;Calculator %glr-parser %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc;; +145;calc.at:626;Calculator %glr-parser %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count};; +146;calc.at:636;Calculator %skeleton \"lalr1.cc\" %defines %locations;c++; +147;calc.at:645;Calculator %language \"C++\" %defines %locations ;c++; +148;calc.at:646;Calculator %language \"C++\" %defines %locations %error-verbose %name-prefix \"calc\" %verbose %yacc;c++; +149;calc.at:648;Calculator %language \"C++\" %defines %locations %error-verbose %debug %name-prefix \"calc\" %verbose %yacc;c++; +150;calc.at:650;Calculator %language \"C++\" %defines %locations %pure-parser %error-verbose %debug %name-prefix \"calc\" %verbose %yacc;c++; +151;calc.at:652;Calculator %language \"C++\" %defines %locations %pure-parser %error-verbose %debug %name-prefix \"calc\" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count};c++; +152;calc.at:663;Calculator %skeleton \"glr.cc\" %defines %locations;c++; +153;calc.at:672;Calculator %language \"C++\" %glr-parser %defines %locations ;c++; +154;calc.at:673;Calculator %language \"C++\" %glr-parser %defines %locations %error-verbose %name-prefix \"calc\" %verbose %yacc;c++; +155;calc.at:675;Calculator %language \"C++\" %glr-parser %defines %locations %debug;c++; +156;calc.at:676;Calculator %language \"C++\" %glr-parser %defines %locations %error-verbose %debug %name-prefix \"calc\" %verbose %yacc;c++; +157;calc.at:678;Calculator %language \"C++\" %glr-parser %defines %locations %pure-parser %error-verbose %debug %name-prefix \"calc\" %verbose %yacc;c++; +158;calc.at:680;Calculator %language \"C++\" %glr-parser %defines %locations %pure-parser %error-verbose %debug %name-prefix \"calc\" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count};c++; +159;torture.at:139;Big triangle;; +160;torture.at:232;Big horizontal;; +161;torture.at:372;Many lookahead tokens;; +162;torture.at:473;Exploding the Stack Size with Alloca;; +163;torture.at:519;Exploding the Stack Size with Malloc;; +164;existing.at:24;GNU AWK Grammar;; +165;existing.at:362;GNU Cim Grammar;; +166;existing.at:978;GNU pic Grammar;; +167;regression.at:26;Trivial grammars;; +168;regression.at:54;YYSTYPE typedef;; +169;regression.at:82;Early token definitions with --yacc;; +170;regression.at:120;Early token definitions without --yacc;; +171;regression.at:163;Braces parsing;; +172;regression.at:185;Duplicate string;; +173;regression.at:211;Rule Line Numbers;report; +174;regression.at:355;Mixing %token styles;; +175;regression.at:378;Invalid inputs;; +176;regression.at:405;Invalid inputs with {};; +177;regression.at:430;Token definitions;; +178;regression.at:500;Characters Escapes;; +179;regression.at:531;Web2c Report;report; +180;regression.at:708;Web2c Actions;report; +181;regression.at:954;Dancer ;; +182;regression.at:955;Dancer %glr-parser;; +183;regression.at:956;Dancer %skeleton \"lalr1.cc\";c++; +184;regression.at:1054;Expecting two tokens ;; +185;regression.at:1055;Expecting two tokens %glr-parser;; +186;regression.at:1056;Expecting two tokens %skeleton \"lalr1.cc\";c++; +187;regression.at:1064;Braced code in declaration in rules section;; +188;regression.at:1140;String alias declared after use;; +189;regression.at:1163;Extra lookahead sets in report;; +190;regression.at:1204;Token number in precedence declaration;; +191;regression.at:1265;Fix user actions without a trailing semicolon;; +192;c++.at:100;Doxygen Public Documentation;; +193;c++.at:101;Doxygen Private Documentation;; +194;c++.at:159;Relative namespace references;c++; +195;c++.at:165;Absolute namespace references;c++; +196;c++.at:174;Syntactically invalid namespace references;; +197;java.at:385;Calculator ;; +198;java.at:385;Calculator %error-verbose ;; +199;java.at:385;Calculator %locations ;; +200;java.at:385;Calculator %error-verbose %locations ;; +201;java.at:394;Calculator %lex-param { InputStream is } ;; +202;java.at:394;Calculator %error-verbose %lex-param { InputStream is } ;; +203;java.at:394;Calculator %locations %lex-param { InputStream is } ;; +204;java.at:394;Calculator %error-verbose %locations %lex-param { InputStream is } ;; +205;java.at:480;Java parser class and package names;; +206;java.at:501;Java parser class modifiers;; +207;java.at:559;Java parser class extends and implements;; +208;java.at:579;Java %parse-param and %lex-param;; +209;java.at:653;Java throws specifications;; +210;java.at:742;Java stype, position_class and location_class;; +211;cxx-type.at:413;GLR: Resolve ambiguity, impure, no locations;; +212;cxx-type.at:420;GLR: Resolve ambiguity, impure, locations;; +213;cxx-type.at:426;GLR: Resolve ambiguity, pure, no locations;; +214;cxx-type.at:433;GLR: Resolve ambiguity, pure, locations;; +215;cxx-type.at:440;GLR: Merge conflicting parses, impure, no locations;; +216;cxx-type.at:447;GLR: Merge conflicting parses, impure, locations;; +217;cxx-type.at:454;GLR: Merge conflicting parses, pure, no locations;; +218;cxx-type.at:460;GLR: Merge conflicting parses, pure, locations;; +219;cxx-type.at:467;GLR: Verbose messages, resolve ambiguity, impure, no locations;; +220;glr-regression.at:23;Badly Collapsed GLR States;; +221;glr-regression.at:118;Improper handling of embedded actions and dollar(-N) in GLR parsers;; +222;glr-regression.at:237;Improper merging of GLR delayed action sets;; +223;glr-regression.at:346;Duplicate representation of merged trees;; +224;glr-regression.at:449;User destructor for unresolved GLR semantic value;; +225;glr-regression.at:522;User destructor after an error during a split parse;; +226;glr-regression.at:589;Duplicated user destructor for lookahead;; +227;glr-regression.at:681;Incorrectly initialized location for empty right-hand side in GLR;; +228;glr-regression.at:779;No users destructors if stack 0 deleted;; +229;glr-regression.at:859;Corrupted semantic options if user action cuts parse;; +230;glr-regression.at:924;Undesirable destructors if user action cuts parse;; +231;glr-regression.at:993;Leaked semantic values if user action cuts parse;; +232;glr-regression.at:1126;Incorrect lookahead during deterministic GLR;; +233;glr-regression.at:1262;Incorrect lookahead during nondeterministic GLR;; +234;glr-regression.at:1482;Leaked semantic values when reporting ambiguity;; +235;glr-regression.at:1575;Leaked lookahead after nondeterministic parse syntax error;; +236;glr-regression.at:1644;Uninitialized location when reporting ambiguity;; +237;glr-regression.at:1731;Missed %merge type warnings when LHS type is declared later;; +238;push.at:23;Push Parsing: Memory Leak for Early Deletion;; +239;push.at:84;Push Parsing: Multiple impure instances;; +240;push.at:155;Push Parsing: Unsupported Skeletons;; +" + +# at_func_validate_ranges [N...] +# ------------------------------ +# validate test group ranges +at_func_validate_ranges () +{ + for at_grp + do + if test $at_grp -lt 1 || test $at_grp -gt 240; then + $as_echo "invalid test group: $at_grp" >&2 + exit 1 + fi + done +} + +at_prev= +for at_option +do + # If the previous option needs an argument, assign it. + if test -n "$at_prev"; then + at_option=$at_prev=$at_option + at_prev= + fi + + case $at_option in + *=*) at_optarg=`expr "x$at_option" : 'x[^=]*=\(.*\)'` ;; + *) at_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $at_option in + --help | -h ) + at_help_p=: + ;; + + --list | -l ) + at_list_p=: + ;; + + --version | -V ) + at_version_p=: + ;; + + --clean | -c ) + at_clean=: + ;; + + --debug | -d ) + at_debug_p=: + ;; + + --errexit | -e ) + at_debug_p=: + at_errexit_p=: + ;; + + --verbose | -v ) + at_verbose=; at_quiet=: + ;; + + --trace | -x ) + at_traceon='set -x'; at_traceoff='set +x' + ;; + + [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]) + at_func_validate_ranges $at_option + at_groups="$at_groups$at_option " + ;; + + # Ranges + [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-) + at_range_start=`echo $at_option |tr -d X-` + at_func_validate_ranges $at_range_start + at_range=`$as_echo " $at_groups_all " | \ + sed -e 's/^.* \('$at_range_start' \)/\1/'` + at_groups="$at_groups$at_range " + ;; + + -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]) + at_range_end=`echo $at_option |tr -d X-` + at_func_validate_ranges $at_range_end + at_range=`$as_echo " $at_groups_all " | \ + sed -e 's/\( '$at_range_end'\) .*$/\1/'` + at_groups="$at_groups$at_range " + ;; + + [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \ + [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \ + [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \ + [0-9][0-9][0-9]-[0-9][0-9][0-9] | \ + [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \ + [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] ) + at_range_start=`expr $at_option : '\(.*\)-'` + at_range_end=`expr $at_option : '.*-\(.*\)'` + if test $at_range_start -gt $at_range_end; then + at_tmp=$at_range_end + at_range_end=$at_range_start + at_range_start=$at_tmp + fi + at_func_validate_ranges $at_range_start $at_range_end + at_range=`$as_echo " $at_groups_all " | \ + sed -e 's/^.*\( '$at_range_start' \)/\1/' \ + -e 's/\( '$at_range_end'\) .*$/\1/'` + at_groups="$at_groups$at_range " + ;; + + # Directory selection. + --directory | -C ) + at_prev=--directory + ;; + --directory=* ) + at_change_dir=: + at_dir=$at_optarg + ;; + + # Keywords. + --keywords | -k ) + at_prev=--keywords + ;; + --keywords=* ) + at_groups_selected=$at_help_all + at_save_IFS=$IFS + IFS=, + set X $at_optarg + shift + IFS=$at_save_IFS + for at_keyword + do + at_invert= + case $at_keyword in + '!'*) + at_invert="-v" + at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'` + ;; + esac + # It is on purpose that we match the test group titles too. + at_groups_selected=`$as_echo "$at_groups_selected" | + grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"` + done + # Smash the newlines. + at_groups_selected=`$as_echo "$at_groups_selected" | sed 's/;.*//' | + tr "$as_nl" ' ' + ` + at_groups="$at_groups$at_groups_selected " + ;; + + *=*) + at_envvar=`expr "x$at_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $at_envvar in + '' | [0-9]* | *[!_$as_cr_alnum]* ) + { $as_echo "$as_me: error: invalid variable name: $at_envvar" >&2 + { (exit 1); exit 1; }; } ;; + esac + at_value=`$as_echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"` + # Export now, but save eval for later and for debug scripts. + export $at_envvar + at_debug_args="$at_debug_args $at_envvar='$at_value'" + ;; + + *) $as_echo "$as_me: invalid option: $at_option" >&2 + $as_echo "Try \`$0 --help' for more information." >&2 + exit 1 + ;; + esac +done + +# Verify our last option didn't require an argument +if test -n "$at_prev"; then + { $as_echo "$as_me: error: \`$at_prev' requires an argument." >&2 + { (exit 1); exit 1; }; } +fi + + +# Selected test groups. +if test -z "$at_groups"; then + at_groups=$at_groups_all +else + # Sort the tests, removing duplicates. + at_groups=`$as_echo "$at_groups" | tr ' ' "$as_nl" | sort -nu` +fi + +# Help message. +if $at_help_p; then + cat <<_ATEOF || at_write_fail=1 +Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS] + +Run all the tests, or the selected TESTS, given by numeric ranges, and +save a detailed log file. Upon failure, create debugging scripts. + +You should not change environment variables unless explicitly passed +as command line arguments. Set \`AUTOTEST_PATH' to select the executables +to exercise. Each relative directory is expanded as build and source +directories relatively to the top level of this distribution. E.g., + + $ $0 AUTOTEST_PATH=bin + +possibly amounts into + + PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH +_ATEOF +cat <<_ATEOF || at_write_fail=1 + +Operation modes: + -h, --help print the help message, then exit + -V, --version print version number, then exit + -c, --clean remove all the files this test suite might create and exit + -l, --list describes all the tests, or the selected TESTS +_ATEOF +cat <<_ATEOF || at_write_fail=1 + +Execution tuning: + -C, --directory=DIR + change to directory DIR before starting + -k, --keywords=KEYWORDS + select the tests matching all the comma-separated KEYWORDS + multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD + -e, --errexit abort as soon as a test fails; implies --debug + -v, --verbose force more detailed output + default for debugging scripts + -d, --debug inhibit clean up and top-level logging + default for debugging scripts + -x, --trace enable tests shell tracing +_ATEOF +cat <<_ATEOF || at_write_fail=1 + +Report bugs to . +_ATEOF + exit $at_write_fail +fi + +# List of tests. +if $at_list_p; then + cat <<_ATEOF || at_write_fail=1 +GNU Bison 2.4.1 test suite test groups: + + NUM: FILE-NAME:LINE TEST-GROUP-NAME + KEYWORDS + +_ATEOF + # Passing at_groups is tricky. We cannot use it to form a literal string + # or regexp because of the limitation of AIX awk. And Solaris' awk + # doesn't grok more than 99 fields in a record, so we have to use `split'. + # at_groups needs to be space-separated for this script to work. + case $at_groups in + *"$as_nl"* ) + at_groups=`$as_echo "$at_groups" | tr "$as_nl" ' '` ;; + esac + $as_echo "$at_groups$as_nl$at_help_all" | + awk 'BEGIN { FS = ";" } + NR == 1 { + for (n = split($ 0, a, " "); n; n--) selected[a[n]] = 1 + next + } + { + if (selected[$ 1]) { + printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3 + if ($ 4) printf " %s\n", $ 4 + } + }' || at_write_fail=1 + exit $at_write_fail +fi +if $at_version_p; then + $as_echo "$as_me (GNU Bison 2.4.1)" && + cat <<\_ACEOF || at_write_fail=1 + +Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +Free Software Foundation, Inc. +This test suite is free software; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. +_ACEOF + exit $at_write_fail +fi + +# Should we print banners? at_groups is space-separated for entire test, +# newline-separated if only a subset of the testsuite is run. +case $at_groups in + *' '*' '* | *"$as_nl"*"$as_nl"* ) + at_print_banners=: ;; + * ) at_print_banners=false ;; +esac +# Text for banner N, set to empty once printed. +# Banner 1. input.at:18 +# Category starts at test group 1. +at_banner_text_1="Input Processing." +# Banner 2. output.at:18 +# Category starts at test group 25. +at_banner_text_2="Output file names." +# Banner 3. skeletons.at:17 +# Category starts at test group 60. +at_banner_text_3="Skeleton Support." +# Banner 4. sets.at:57 +# Category starts at test group 65. +at_banner_text_4="Grammar Sets (Firsts etc.)." +# Banner 5. reduce.at:17 +# Category starts at test group 69. +at_banner_text_5="Grammar Reduction." +# Banner 6. synclines.at:17 +# Category starts at test group 75. +at_banner_text_6="User Actions." +# Banner 7. headers.at:17 +# Category starts at test group 80. +at_banner_text_7="Parser Headers." +# Banner 8. actions.at:18 +# Category starts at test group 84. +at_banner_text_8="User Actions." +# Banner 9. conflicts.at:18 +# Category starts at test group 101. +at_banner_text_9="Conflicts." +# Banner 10. calc.at:560 +# Category starts at test group 116. +at_banner_text_10="Simple LALR(1) Calculator." +# Banner 11. calc.at:597 +# Category starts at test group 132. +at_banner_text_11="Simple GLR Calculator." +# Banner 12. calc.at:633 +# Category starts at test group 146. +at_banner_text_12="Simple LALR(1) C++ Calculator." +# Banner 13. calc.at:660 +# Category starts at test group 152. +at_banner_text_13="Simple GLR C++ Calculator." +# Banner 14. torture.at:18 +# Category starts at test group 159. +at_banner_text_14="Torture Tests." +# Banner 15. existing.at:19 +# Category starts at test group 164. +at_banner_text_15="Existing Grammars." +# Banner 16. regression.at:19 +# Category starts at test group 167. +at_banner_text_16="Regression tests." +# Banner 17. c++.at:17 +# Category starts at test group 192. +at_banner_text_17="C++ Features." +# Banner 18. java.at:18 +# Category starts at test group 197. +at_banner_text_18="Java Calculator." +# Banner 19. java.at:407 +# Category starts at test group 205. +at_banner_text_19="Java Parameters." +# Banner 20. cxx-type.at:18 +# Category starts at test group 211. +at_banner_text_20="C++ Type Syntax (GLR)." +# Banner 21. glr-regression.at:17 +# Category starts at test group 220. +at_banner_text_21="GLR Regression Tests" +# Banner 22. push.at:17 +# Category starts at test group 238. +at_banner_text_22="Push Parsing Tests" + +# Take any -C into account. +if $at_change_dir ; then + if test x- = "x$at_dir" ; then + at_dir=./- + fi + test x != "x$at_dir" && cd "$at_dir" \ + || { $as_echo "$as_me: error: unable to change directory" >&2 + { (exit 1); exit 1; }; } + at_dir=`pwd` +fi + +# Load the config files for any default variable assignments. +for at_file in atconfig atlocal +do + test -r $at_file || continue + . ./$at_file || { $as_echo "$as_me: error: invalid content: $at_file" >&2 + { (exit 1); exit 1; }; } +done + +# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix: +: ${at_top_build_prefix=$at_top_builddir} + +# Perform any assignments requested during argument parsing. +eval "$at_debug_args" + +# atconfig delivers names relative to the directory the test suite is +# in, but the groups themselves are run in testsuite-dir/group-dir. +if test -n "$at_top_srcdir"; then + builddir=../.. + for at_dir_var in srcdir top_srcdir top_build_prefix + do + at_val=`eval 'as_val=${'at_$at_dir_var'} + $as_echo "$as_val"'` + case $at_val in + [\\/$]* | ?:[\\/]* ) at_prefix= ;; + *) at_prefix=../../ ;; + esac + eval "$at_dir_var=\$at_prefix\$at_val" + done +fi + +# The directory the whole suite works in. +# Should be absolute to let the user `cd' at will. +at_suite_dir=$at_dir/$as_me.dir +# The file containing the suite. +at_suite_log=$at_dir/$as_me.log +# The file containing the location of the last AT_CHECK. +at_check_line_file=$at_suite_dir/at-check-line +# The file containing the exit status of the last command. +at_status_file=$at_suite_dir/at-status +# The files containing the output of the tested commands. +at_stdout=$at_suite_dir/at-stdout +at_stder1=$at_suite_dir/at-stder1 +at_stderr=$at_suite_dir/at-stderr +# The file containing the function to run a test group. +at_test_source=$at_suite_dir/at-test-source +# The file containing dates. +at_times_file=$at_suite_dir/at-times + +if $at_clean; then + test -d "$at_suite_dir" && + find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; + rm -f -r "$at_suite_dir" "$at_suite_log" + exit $? +fi + +# Don't take risks: use only absolute directories in PATH. +# +# For stand-alone test suites (ie. atconfig was not found), +# AUTOTEST_PATH is relative to `.'. +# +# For embedded test suites, AUTOTEST_PATH is relative to the top level +# of the package. Then expand it into build/src parts, since users +# may create executables in both places. +AUTOTEST_PATH=`$as_echo "$AUTOTEST_PATH" | sed "s|:|$PATH_SEPARATOR|g"` +at_path= +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $AUTOTEST_PATH $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -n "$at_path" && at_path=$at_path$PATH_SEPARATOR +case $as_dir in + [\\/]* | ?:[\\/]* ) + at_path=$at_path$as_dir + ;; + * ) + if test -z "$at_top_build_prefix"; then + # Stand-alone test suite. + at_path=$at_path$as_dir + else + # Embedded test suite. + at_path=$at_path$at_top_build_prefix$as_dir$PATH_SEPARATOR + at_path=$at_path$at_top_srcdir/$as_dir + fi + ;; +esac +done +IFS=$as_save_IFS + + +# Now build and simplify PATH. +# +# There might be directories that don't exist, but don't redirect +# builtins' (eg., cd) stderr directly: Ultrix's sh hates that. +at_new_path= +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $at_path +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -d "$as_dir" || continue +case $as_dir in + [\\/]* | ?:[\\/]* ) ;; + * ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;; +esac +case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in + *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;; + $PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;; + *) at_new_path=$at_new_path$PATH_SEPARATOR$as_dir ;; +esac +done +IFS=$as_save_IFS + +PATH=$at_new_path +export PATH + +# Setting up the FDs. +# 5 is the log file. Not to be overwritten if `-d'. + +if $at_debug_p; then + at_suite_log=/dev/null +else + : >"$at_suite_log" +fi +exec 5>>"$at_suite_log" + +# Banners and logs. +cat <<\_ASBOX +## --------------------------- ## +## GNU Bison 2.4.1 test suite. ## +## --------------------------- ## +_ASBOX +{ + cat <<\_ASBOX +## --------------------------- ## +## GNU Bison 2.4.1 test suite. ## +## --------------------------- ## +_ASBOX + echo + + $as_echo "$as_me: command line was:" + $as_echo " \$ $0 $at_cli_args" + echo + + # Try to find a few ChangeLogs in case it might help determining the + # exact version. Use the relative dir: if the top dir is a symlink, + # find will not follow it (and options to follow the links are not + # portable), which would result in no output here. Prune directories + # matching the package tarname, since they tend to be leftovers from + # `make dist' or `make distcheck' and contain redundant or stale logs. + if test -n "$at_top_srcdir"; then + cat <<\_ASBOX +## ----------- ## +## ChangeLogs. ## +## ----------- ## +_ASBOX + echo + for at_file in `find "$at_top_srcdir" -name "bison-*" -prune -o -name ChangeLog -print` + do + $as_echo "$as_me: $at_file:" + sed 's/^/| /;10q' $at_file + echo + done + + fi + + { +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} + echo + + # Contents of the config files. + for at_file in atconfig atlocal + do + test -r $at_file || continue + $as_echo "$as_me: $at_file:" + sed 's/^/| /' $at_file + echo + done +} >&5 + + +## --------------- ## +## Shell functions ## +## --------------- ## + +# at_func_banner NUMBER +# --------------------- +# Output banner NUMBER, provided the testsuite is running multiple groups +# and this particular banner has not yet been printed. +at_func_banner () +{ + $at_print_banners || return 0 + eval at_banner_text=\$at_banner_text_$1 + test "x$at_banner_text" = x && return 0 + eval at_banner_text_$1= + $as_echo "$as_nl$at_banner_text$as_nl" +} # at_func_banner + +# at_func_check_newline COMMAND +# ----------------------------- +# Test if COMMAND includes a newline and, if so, print a message and return +# exit code 1 +at_func_check_newline () +{ + case "$1" in + *' +'*) echo 'Not enabling shell tracing (command contains an embedded newline)' + return 1 ;; + *) return 0 ;; + esac +} + +# at_func_filter_trace EXIT-CODE +# ------------------------------ +# Split the contents of file "$at_stder1" into the "set -x" trace (on stderr) +# and the other lines (on file "$at_stderr"). Return the exit code EXIT-CODE. +at_func_filter_trace () +{ + grep '^ *+' "$at_stder1" >&2 + grep -v '^ *+' "$at_stder1" >"$at_stderr" + return $1 +} + +# at_func_log_failure FILE-LIST +# ----------------------------- +# Copy the files in the list on stdout with a "> " prefix, and exit the shell +# with a failure exit code. +at_func_log_failure () +{ + for file + do $as_echo "$file:"; sed 's/^/> /' "$file"; done + echo 1 > "$at_status_file" + exit 1 +} + +# at_func_check_skip EXIT-CODE +# ---------------------------- +# Check whether EXIT-CODE is the special exit code 77, and if so exit the shell +# with that same exit code. +at_func_check_skip () +{ + case $1 in + 77) echo 77 > "$at_status_file"; exit 77;; + esac +} + +# at_func_check_status EXPECTED EXIT-CODE LINE +# -------------------------------------------- +# Check whether EXIT-CODE is the expected exit code, and if so do nothing. +# Otherwise, if it is 77 exit the shell with that same exit code; if it is +# anything else print an error message and fail the test. +at_func_check_status () +{ + case $2 in + $1 ) ;; + 77) echo 77 > "$at_status_file"; exit 77;; + *) $as_echo "$3: exit code was $2, expected $1" + at_failed=:;; + esac +} + +# at_func_diff_devnull FILE +# ------------------------- +# Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless +# diff invocations. +at_func_diff_devnull () +{ + test -s "$1" || return 0 + $at_diff "$at_devnull" "$1" +} + +# at_func_test NUMBER +# ------------------- +# Parse out test NUMBER from the tail of this file. +at_func_test () +{ + eval at_sed=\$at_sed$1 + sed "$at_sed" "$at_myself" > "$at_test_source" +} + +# at_func_create_debugging_script +# ------------------------------- +# Create the debugging script $at_group_dir/run which will reproduce the +# current test group. +at_func_create_debugging_script () +{ + { + echo "#! /bin/sh" && + echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' && + $as_echo "cd '$at_dir'" && + $as_echo "exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d $at_debug_args $at_group \${1+\"\$@\"}" && + echo 'exit 1' + } >"$at_group_dir/run" && + chmod +x "$at_group_dir/run" +} + +# at_func_arith +# ------------- +# Arithmetic evaluation, avoids expr if the shell is sane. +# +# subshell and eval are needed to keep Solaris sh from bailing out: +if ( eval 'test $(( 1 + 1 )) = 2' ) 2>/dev/null; then + # With "$@", bash does not split positional parameters: + eval 'at_func_arith () + { + at_func_arith_result=$(( $* )) + }' +else + at_func_arith () + { + at_func_arith_result=`expr "$@"` + } +fi + +## ---------------------- ## +## End of shell functions ## +## ---------------------- ## +{ + cat <<\_ASBOX +## ---------------- ## +## Tested programs. ## +## ---------------- ## +_ASBOX + echo +} >&5 + +# Report what programs are being tested. +for at_program in : $at_tested +do + test "$at_program" = : && continue + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -f "$as_dir/$at_program" && break +done +IFS=$as_save_IFS + + if test -f "$as_dir/$at_program"; then + { + $as_echo "$at_srcdir/local.at:323: $as_dir/$at_program --version" + "$as_dir/$at_program" --version &5 2>&1 + else + { { $as_echo "$as_me:$LINENO: error: cannot find $at_program" >&5 +$as_echo "$as_me: error: cannot find $at_program" >&2;} + { (exit 1); exit 1; }; } + fi +done + +{ + cat <<\_ASBOX +## ------------------ ## +## Running the tests. ## +## ------------------ ## +_ASBOX +} >&5 + +at_start_date=`date` +at_start_time=`date +%s 2>/dev/null` +$as_echo "$as_me: starting at: $at_start_date" >&5 +at_xpass_list= +at_xfail_list= +at_pass_list= +at_fail_list= +at_skip_list= +at_group_count=0 + +# Create the master directory if it doesn't already exist. +test -d "$at_suite_dir" || + mkdir "$at_suite_dir" || + { { $as_echo "$as_me:$LINENO: error: cannot create '$at_suite_dir'" >&5 +$as_echo "$as_me: error: cannot create '$at_suite_dir'" >&2;} + { (exit 1); exit 1; }; } + +# Can we diff with `/dev/null'? DU 5.0 refuses. +if diff /dev/null /dev/null >/dev/null 2>&1; then + at_devnull=/dev/null +else + at_devnull=$at_suite_dir/devnull + >"$at_devnull" +fi + +# Use `diff -u' when possible. +if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff" +then + at_diff='diff -u' +else + at_diff=diff +fi + +# Get the last needed group. +for at_group in : $at_groups; do :; done + +# Extract the start and end lines of each test group at the tail +# of this file +awk ' +BEGIN { FS="" } +/^#AT_START_/ { + start = NR +} +/^#AT_STOP_/ { + test = substr ($ 0, 10) + print "at_sed" test "=\"1," start "d;" (NR-1) "q\"" + if (test == "'"$at_group"'") exit +}' "$at_myself" > "$at_test_source" && +. "$at_test_source" || + { { $as_echo "$as_me:$LINENO: error: cannot create test line number cache" >&5 +$as_echo "$as_me: error: cannot create test line number cache" >&2;} + { (exit 1); exit 1; }; } + + +## ------------ ## +## Driver loop. ## +## ------------ ## +for at_group in $at_groups +do + # Be sure to come back to the top test directory. + cd "$at_suite_dir" + + # Clearly separate the test groups when verbose. + test $at_group_count != 0 && $at_verbose echo + + at_group_normalized=$at_group + + eval 'while :; do + case $at_group_normalized in #( + '"$at_format"'*) break;; + esac + at_group_normalized=0$at_group_normalized + done' + + + # Create a fresh directory for the next test group, and enter. + at_group_dir=$at_suite_dir/$at_group_normalized + at_group_log=$at_group_dir/$as_me.log + if test -d "$at_group_dir"; then + find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; + rm -fr "$at_group_dir" || + { $as_echo "$as_me:$LINENO: WARNING: test directory could not be cleaned." >&5 +$as_echo "$as_me: WARNING: test directory could not be cleaned." >&2;} + fi + # Be tolerant if the above `rm' was not able to remove the directory. + { as_dir="$at_group_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + cd "$at_group_dir" + + echo 0 > "$at_status_file" + + # In verbose mode, append to the log file *and* show on + # the standard output; in quiet mode only write to the log + if test -z "$at_verbose"; then + at_tee_pipe='tee -a "$at_group_log"' + else + at_tee_pipe='cat >> "$at_group_log"' + fi + + if at_func_test $at_group && . "$at_test_source"; then :; else + $as_echo "$as_me: unable to parse test group: $at_group" >&2 + at_failed=: + fi + + # Be sure to come back to the suite directory, in particular + # since below we might `rm' the group directory we are in currently. + cd "$at_suite_dir" + + if test ! -f "$at_check_line_file"; then + sed "s/^ */$as_me: warning: /" <<_ATEOF + A failure happened in a test group before any test could be + run. This means that test suite is improperly designed. Please + report this failure to . +_ATEOF + $as_echo "$at_setup_line" >"$at_check_line_file" + fi + at_func_arith 1 + $at_group_count + at_group_count=$at_func_arith_result + $at_verbose $as_echo_n "$at_group. $at_setup_line: " + $as_echo_n "$at_group. $at_setup_line: " >> "$at_group_log" + case $at_xfail:$at_status in + yes:0) + at_msg="UNEXPECTED PASS" + at_xpass_list="$at_xpass_list $at_group" + at_errexit=$at_errexit_p + ;; + no:0) + at_msg="ok" + at_pass_list="$at_pass_list $at_group" + at_errexit=false + ;; + *:77) + at_msg='skipped ('`cat "$at_check_line_file"`')' + at_skip_list="$at_skip_list $at_group" + at_errexit=false + ;; + yes:*) + at_msg='expected failure ('`cat "$at_check_line_file"`')' + at_xfail_list="$at_xfail_list $at_group" + at_errexit=false + ;; + no:*) + at_msg='FAILED ('`cat "$at_check_line_file"`')' + at_fail_list="$at_fail_list $at_group" + at_errexit=$at_errexit_p + ;; + esac + # Make sure there is a separator even with long titles. + $as_echo " $at_msg" + at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg" + case $at_status in + 0|77) + # $at_times_file is only available if the group succeeded. + # We're not including the group log, so the success message + # is written in the global log separately. But we also + # write to the group log in case they're using -d. + if test -f "$at_times_file"; then + at_log_msg="$at_log_msg ("`sed 1d "$at_times_file"`')' + rm -f "$at_times_file" + fi + $as_echo "$at_log_msg" >> "$at_group_log" + $as_echo "$at_log_msg" >&5 + + # Cleanup the group directory, unless the user wants the files. + if $at_debug_p ; then + at_func_create_debugging_script + else + if test -d "$at_group_dir"; then + find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; + rm -fr "$at_group_dir" + fi + rm -f "$at_test_source" + fi + ;; + *) + # Upon failure, include the log into the testsuite's global + # log. The failure message is written in the group log. It + # is later included in the global log. + $as_echo "$at_log_msg" >> "$at_group_log" + + # Upon failure, keep the group directory for autopsy, and + # create the debugging script. + at_func_create_debugging_script + $at_errexit && break + ;; + esac +done + +# Back to the top directory. +cd "$at_dir" + +# Compute the duration of the suite. +at_stop_date=`date` +at_stop_time=`date +%s 2>/dev/null` +$as_echo "$as_me: ending at: $at_stop_date" >&5 +case $at_start_time,$at_stop_time in + [0-9]*,[0-9]*) + at_func_arith $at_stop_time - $at_start_time + at_duration_s=$at_func_arith_result + at_func_arith $at_duration_s / 60 + at_duration_m=$at_func_arith_result + at_func_arith $at_duration_m / 60 + at_duration_h=$at_func_arith_result + at_func_arith $at_duration_s % 60 + at_duration_s=$at_func_arith_result + at_func_arith $at_duration_m % 60 + at_duration_m=$at_func_arith_result + at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s" + $as_echo "$as_me: test suite duration: $at_duration" >&5 + ;; +esac + +# Wrap up the test suite with summary statistics. +set X $at_skip_list; shift; at_skip_count=$# +set X $at_fail_list; shift; at_fail_count=$# +set X $at_xpass_list; shift; at_xpass_count=$# +set X $at_xfail_list; shift; at_xfail_count=$# + +at_func_arith $at_group_count - $at_skip_count +at_run_count=$at_func_arith_result +at_func_arith $at_xpass_count + $at_fail_count +at_unexpected_count=$at_func_arith_result +at_func_arith $at_xfail_count + $at_fail_count +at_total_fail_count=$at_func_arith_result + +echo +cat <<\_ASBOX +## ------------- ## +## Test results. ## +## ------------- ## +_ASBOX +echo +{ + echo + cat <<\_ASBOX +## ------------- ## +## Test results. ## +## ------------- ## +_ASBOX + echo +} >&5 + +if test $at_run_count = 1; then + at_result="1 test" + at_were=was +else + at_result="$at_run_count tests" + at_were=were +fi +if $at_errexit_p && test $at_unexpected_count != 0; then + if test $at_xpass_count = 1; then + at_result="$at_result $at_were run, one passed" + else + at_result="$at_result $at_were run, one failed" + fi + at_result="$at_result unexpectedly and inhibited subsequent tests." +else + # Don't you just love exponential explosion of the number of cases? + case $at_xpass_count:$at_fail_count:$at_xfail_count in + # So far, so good. + 0:0:0) at_result="$at_result $at_were successful." ;; + 0:0:*) at_result="$at_result behaved as expected." ;; + + # Some unexpected failures + 0:*:0) at_result="$at_result $at_were run, +$at_fail_count failed unexpectedly." ;; + + # Some failures, both expected and unexpected + 0:*:1) at_result="$at_result $at_were run, +$at_total_fail_count failed ($at_xfail_count expected failure)." ;; + 0:*:*) at_result="$at_result $at_were run, +$at_total_fail_count failed ($at_xfail_count expected failures)." ;; + + # No unexpected failures, but some xpasses + *:0:*) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly." ;; + + # No expected failures, but failures and xpasses + *:1:0) at_result="$at_result $at_were run, +$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;; + *:*:0) at_result="$at_result $at_were run, +$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;; + + # All of them. + *:*:1) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly, +$at_total_fail_count failed ($at_xfail_count expected failure)." ;; + *:*:*) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly, +$at_total_fail_count failed ($at_xfail_count expected failures)." ;; + esac + + if test $at_skip_count = 0 && test $at_run_count -gt 1; then + at_result="All $at_result" + fi +fi + +# Now put skips in the mix. +case $at_skip_count in + 0) ;; + 1) at_result="$at_result +1 test was skipped." ;; + *) at_result="$at_result +$at_skip_count tests were skipped." ;; +esac + +if test $at_unexpected_count = 0; then + echo "$at_result" + echo "$at_result" >&5 +else + echo "ERROR: $at_result" >&2 + echo "ERROR: $at_result" >&5 + { + echo + cat <<\_ASBOX +## ------------------------ ## +## Summary of the failures. ## +## ------------------------ ## +_ASBOX + + # Summary of failed and skipped tests. + if test $at_fail_count != 0; then + echo "Failed tests:" + $SHELL "$at_myself" $at_fail_list --list + echo + fi + if test $at_skip_count != 0; then + echo "Skipped tests:" + $SHELL "$at_myself" $at_skip_list --list + echo + fi + if test $at_xpass_count != 0; then + echo "Unexpected passes:" + $SHELL "$at_myself" $at_xpass_list --list + echo + fi + if test $at_fail_count != 0; then + cat <<\_ASBOX +## ---------------------- ## +## Detailed failed tests. ## +## ---------------------- ## +_ASBOX + echo + for at_group in $at_fail_list + do + at_group_normalized=$at_group + + eval 'while :; do + case $at_group_normalized in #( + '"$at_format"'*) break;; + esac + at_group_normalized=0$at_group_normalized + done' + + cat "$at_suite_dir/$at_group_normalized/$as_me.log" + echo + done + echo + fi + if test -n "$at_top_srcdir"; then + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## ${at_top_build_prefix}config.log ## +_ASBOX + sed 's/^/| /' ${at_top_build_prefix}config.log + echo + fi + } >&5 + + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## $as_me.log was created. ## +_ASBOX + + echo + $as_echo "Please send \`${at_testdir+${at_testdir}/}$as_me.log' and all information you think might help: + + To: + Subject: [GNU Bison 2.4.1] $as_me:$at_fail_list${at_fail_list:+ failed${at_xpass_list:+,}}$at_xpass_list${at_xpass_list:+ passed unexpectedly} +" + if test $at_debug_p = false; then + echo + echo 'You may investigate any problem if you feel able to do so, in which' + echo 'case the test suite provides a good starting point. Its output may' + $as_echo "be found below \`${at_testdir+${at_testdir}/}$as_me.dir'." + echo + fi + exit 1 +fi + +exit 0 + +## ------------- ## +## Actual tests. ## +## ------------- ## +#AT_START_1 +# 1. input.at:27: Invalid $n and @n +at_setup_line='input.at:27' +at_func_banner 1 +at_desc="Invalid \$n and @n" +$at_quiet $as_echo_n " 1: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "1. input.at:27: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%% +exp: { $$ = $1 ; }; +exp: { @$ = @1 ; }; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:35: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:35 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:2.13-14: integer out of range: \`\$1' +input.y:3.13-14: integer out of range: \`@1' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:35" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_1 +#AT_START_2 +# 2. input.at:47: Type Clashes +at_setup_line='input.at:47' +at_func_banner 1 +at_desc="Type Clashes" +$at_quiet $as_echo_n " 2: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "2. input.at:47: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%union { int bar; } +%token foo +%type exp +%% +exp: foo { $$; } foo { $2; } foo + | foo + | /* Empty. */ + ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:60: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:60 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:5.12-13: \$\$ for the midrule at \$2 of \`exp' has no declared type +input.y:5.24-25: \$2 of \`exp' has no declared type +input.y:5.6-32: warning: type clash on default action: != <> +input.y:6.6-8: warning: type clash on default action: != <> +input.y:7.5: warning: empty rule for typed nonterminal, and no action +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:60" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_2 +#AT_START_3 +# 3. input.at:161: Unused values +at_setup_line='input.at:161' +at_func_banner 1 +at_desc="Unused values" +$at_quiet $as_echo_n " 3: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "3. input.at:161: testing ..." + $at_traceon + +cat >input.y <<'_ATEOF' +%token INT; +%type a b c d e f g h i j k l; +%destructor { destroy ($$); } INT a b c d e f g h i j k l; +%% +start: + 'a' a { $2 } | 'b' b { $2 } | 'c' c { $2 } | 'd' d { $2 } | 'e' e { $2 } +| 'f' f { $2 } | 'g' g { $2 } | 'h' h { $2 } | 'i' i { $2 } | 'j' j { $2 } +| 'k' k { $2 } | 'l' l { $2 } +; + +a: INT | INT { } INT { } INT { }; +b: INT | /* empty */; +c: INT | INT { $1 } INT { $2 } INT { $4 }; +d: INT | INT { } INT { $1 } INT { $2 }; +e: INT | INT { } INT { } INT { $1 }; +f: INT | INT { } INT { } INT { $$ = $1 + $3 + $5; }; +g: INT | INT { $$; } INT { $$; } INT { }; +h: INT | INT { $$; } INT { $$ = $2; } INT { }; +i: INT | INT INT { } { $$ = $1 + $2; }; +j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; +k: INT | INT INT { $$; } { $$ = $3; } { }; +l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:162: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:162: bison --xml=xml-tests/test.xml input.y" +echo input.at:162 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:162: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:162: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:162: bison input.y" +echo input.at:162 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:11.10-32: warning: unset value: \$\$ +input.y:11.10-32: warning: unused value: \$1 +input.y:11.10-32: warning: unused value: \$3 +input.y:11.10-32: warning: unused value: \$5 +input.y:12.9: warning: empty rule for typed nonterminal, and no action +input.y:13.10-59: warning: unset value: \$\$ +input.y:13.10-59: warning: unused value: \$3 +input.y:13.10-59: warning: unused value: \$5 +input.y:14.10-47: warning: unset value: \$\$ +input.y:14.10-47: warning: unused value: \$3 +input.y:14.10-47: warning: unused value: \$5 +input.y:15.10-36: warning: unset value: \$\$ +input.y:15.10-36: warning: unused value: \$3 +input.y:15.10-36: warning: unused value: \$5 +input.y:17.10-58: warning: unset value: \$\$ +input.y:17.10-58: warning: unused value: \$1 +input.y:17.10-58: warning: unused value: \$3 +input.y:17.10-58: warning: unused value: \$5 +input.y:18.10-72: warning: unset value: \$\$ +input.y:18.10-72: warning: unused value: \$1 +input.y:18.10-72: warning: unused value: \$3 +input.y:18.10-72: warning: unused value: \$5 +input.y:21.10-68: warning: unset value: \$\$ +input.y:21.10-68: warning: unused value: \$1 +input.y:21.10-68: warning: unused value: \$2 +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + +cat >input.y <<'_ATEOF' +%token INT; +%type a b c d e f g h i j k l; +%destructor { destroy ($$); } INT a b c d e f g h i j k l; +%% +start: + 'a' a { $2 } | 'b' b { $2 } | 'c' c { $2 } | 'd' d { $2 } | 'e' e { $2 } +| 'f' f { $2 } | 'g' g { $2 } | 'h' h { $2 } | 'i' i { $2 } | 'j' j { $2 } +| 'k' k { $2 } | 'l' l { $2 } +; + +a: INT | INT { } INT { } INT { }; +b: INT | /* empty */; +c: INT | INT { $1 } INT { $2 } INT { $4 }; +d: INT | INT { } INT { $1 } INT { $2 }; +e: INT | INT { } INT { } INT { $1 }; +f: INT | INT { } INT { } INT { $$ = $1 + $3 + $5; }; +g: INT | INT { $$; } INT { $$; } INT { }; +h: INT | INT { $$; } INT { $$ = $2; } INT { }; +i: INT | INT INT { } { $$ = $1 + $2; }; +j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; +k: INT | INT INT { $$; } { $$ = $3; } { }; +l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:163: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --warnings=midrule-values input.y" +echo input.at:163 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:163: bison --xml=xml-tests/test.xml --warnings=midrule-values input.y" +echo input.at:163 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:163: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:163 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:163: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:163 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:163: bison --warnings=midrule-values input.y" +echo input.at:163 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:11.10-32: warning: unset value: \$\$ +input.y:11.10-32: warning: unused value: \$1 +input.y:11.10-32: warning: unused value: \$3 +input.y:11.10-32: warning: unused value: \$5 +input.y:12.9: warning: empty rule for typed nonterminal, and no action +input.y:13.14-19: warning: unset value: \$\$ +input.y:13.25-39: warning: unset value: \$\$ +input.y:13.10-59: warning: unset value: \$\$ +input.y:13.10-59: warning: unused value: \$3 +input.y:13.10-59: warning: unused value: \$5 +input.y:14.14-16: warning: unset value: \$\$ +input.y:14.10-47: warning: unset value: \$\$ +input.y:14.10-47: warning: unused value: \$3 +input.y:14.10-47: warning: unused value: \$5 +input.y:15.10-36: warning: unset value: \$\$ +input.y:15.10-36: warning: unused value: \$3 +input.y:15.10-36: warning: unused value: \$5 +input.y:17.10-58: warning: unset value: \$\$ +input.y:17.10-58: warning: unused value: \$1 +input.y:17.10-58: warning: unused value: \$2 +input.y:17.10-58: warning: unused value: \$3 +input.y:17.10-58: warning: unused value: \$4 +input.y:17.10-58: warning: unused value: \$5 +input.y:18.10-72: warning: unset value: \$\$ +input.y:18.10-72: warning: unused value: \$1 +input.y:18.10-72: warning: unused value: \$3 +input.y:18.10-72: warning: unused value: \$4 +input.y:18.10-72: warning: unused value: \$5 +input.y:20.10-55: warning: unused value: \$3 +input.y:21.10-68: warning: unset value: \$\$ +input.y:21.10-68: warning: unused value: \$1 +input.y:21.10-68: warning: unused value: \$2 +input.y:21.10-68: warning: unused value: \$4 +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_3 +#AT_START_4 +# 4. input.at:171: Unused values before symbol declarations +at_setup_line='input.at:171' +at_func_banner 1 +at_desc="Unused values before symbol declarations" +$at_quiet $as_echo_n " 4: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "4. input.at:171: testing ..." + $at_traceon + +cat >input.y <<'_ATEOF' + + + +%% +start: + 'a' a { $2 } | 'b' b { $2 } | 'c' c { $2 } | 'd' d { $2 } | 'e' e { $2 } +| 'f' f { $2 } | 'g' g { $2 } | 'h' h { $2 } | 'i' i { $2 } | 'j' j { $2 } +| 'k' k { $2 } | 'l' l { $2 } +; + +a: INT | INT { } INT { } INT { }; +b: INT | /* empty */; +c: INT | INT { $1 } INT { $2 } INT { $4 }; +d: INT | INT { } INT { $1 } INT { $2 }; +e: INT | INT { } INT { } INT { $1 }; +f: INT | INT { } INT { } INT { $$ = $1 + $3 + $5; }; +g: INT | INT { $$; } INT { $$; } INT { }; +h: INT | INT { $$; } INT { $$ = $2; } INT { }; +i: INT | INT INT { } { $$ = $1 + $2; }; +j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; +k: INT | INT INT { $$; } { $$ = $3; } { }; +l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; +%token INT; +%type a b c d e f g h i j k l; +%destructor { destroy ($$); } INT a b c d e f g h i j k l; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:172: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:172 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:172" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:172: bison --xml=xml-tests/test.xml input.y" +echo input.at:172 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:172" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:172: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:172 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:172" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:172: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:172 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:172" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:172: bison input.y" +echo input.at:172 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:11.10-32: warning: unset value: \$\$ +input.y:11.10-32: warning: unused value: \$1 +input.y:11.10-32: warning: unused value: \$3 +input.y:11.10-32: warning: unused value: \$5 +input.y:12.9: warning: empty rule for typed nonterminal, and no action +input.y:13.10-59: warning: unset value: \$\$ +input.y:13.10-59: warning: unused value: \$3 +input.y:13.10-59: warning: unused value: \$5 +input.y:14.10-47: warning: unset value: \$\$ +input.y:14.10-47: warning: unused value: \$3 +input.y:14.10-47: warning: unused value: \$5 +input.y:15.10-36: warning: unset value: \$\$ +input.y:15.10-36: warning: unused value: \$3 +input.y:15.10-36: warning: unused value: \$5 +input.y:17.10-58: warning: unset value: \$\$ +input.y:17.10-58: warning: unused value: \$1 +input.y:17.10-58: warning: unused value: \$3 +input.y:17.10-58: warning: unused value: \$5 +input.y:18.10-72: warning: unset value: \$\$ +input.y:18.10-72: warning: unused value: \$1 +input.y:18.10-72: warning: unused value: \$3 +input.y:18.10-72: warning: unused value: \$5 +input.y:21.10-68: warning: unset value: \$\$ +input.y:21.10-68: warning: unused value: \$1 +input.y:21.10-68: warning: unused value: \$2 +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:172" + +$at_failed && at_func_log_failure +$at_traceon; } + +cat >input.y <<'_ATEOF' + + + +%% +start: + 'a' a { $2 } | 'b' b { $2 } | 'c' c { $2 } | 'd' d { $2 } | 'e' e { $2 } +| 'f' f { $2 } | 'g' g { $2 } | 'h' h { $2 } | 'i' i { $2 } | 'j' j { $2 } +| 'k' k { $2 } | 'l' l { $2 } +; + +a: INT | INT { } INT { } INT { }; +b: INT | /* empty */; +c: INT | INT { $1 } INT { $2 } INT { $4 }; +d: INT | INT { } INT { $1 } INT { $2 }; +e: INT | INT { } INT { } INT { $1 }; +f: INT | INT { } INT { } INT { $$ = $1 + $3 + $5; }; +g: INT | INT { $$; } INT { $$; } INT { }; +h: INT | INT { $$; } INT { $$ = $2; } INT { }; +i: INT | INT INT { } { $$ = $1 + $2; }; +j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; +k: INT | INT INT { $$; } { $$ = $3; } { }; +l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; +%token INT; +%type a b c d e f g h i j k l; +%destructor { destroy ($$); } INT a b c d e f g h i j k l; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:173: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --warnings=midrule-values input.y" +echo input.at:173 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:173: bison --xml=xml-tests/test.xml --warnings=midrule-values input.y" +echo input.at:173 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:173: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:173 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:173: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:173 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:173: bison --warnings=midrule-values input.y" +echo input.at:173 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --warnings=midrule-values input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:11.10-32: warning: unset value: \$\$ +input.y:11.10-32: warning: unused value: \$1 +input.y:11.10-32: warning: unused value: \$3 +input.y:11.10-32: warning: unused value: \$5 +input.y:12.9: warning: empty rule for typed nonterminal, and no action +input.y:13.14-19: warning: unset value: \$\$ +input.y:13.25-39: warning: unset value: \$\$ +input.y:13.10-59: warning: unset value: \$\$ +input.y:13.10-59: warning: unused value: \$3 +input.y:13.10-59: warning: unused value: \$5 +input.y:14.14-16: warning: unset value: \$\$ +input.y:14.10-47: warning: unset value: \$\$ +input.y:14.10-47: warning: unused value: \$3 +input.y:14.10-47: warning: unused value: \$5 +input.y:15.10-36: warning: unset value: \$\$ +input.y:15.10-36: warning: unused value: \$3 +input.y:15.10-36: warning: unused value: \$5 +input.y:17.10-58: warning: unset value: \$\$ +input.y:17.10-58: warning: unused value: \$1 +input.y:17.10-58: warning: unused value: \$2 +input.y:17.10-58: warning: unused value: \$3 +input.y:17.10-58: warning: unused value: \$4 +input.y:17.10-58: warning: unused value: \$5 +input.y:18.10-72: warning: unset value: \$\$ +input.y:18.10-72: warning: unused value: \$1 +input.y:18.10-72: warning: unused value: \$3 +input.y:18.10-72: warning: unused value: \$4 +input.y:18.10-72: warning: unused value: \$5 +input.y:20.10-55: warning: unused value: \$3 +input.y:21.10-68: warning: unset value: \$\$ +input.y:21.10-68: warning: unused value: \$1 +input.y:21.10-68: warning: unused value: \$2 +input.y:21.10-68: warning: unused value: \$4 +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_4 +#AT_START_5 +# 5. input.at:181: Default %printer and %destructor redeclared +at_setup_line='input.at:181' +at_func_banner 1 +at_desc="Default %printer and %destructor redeclared" +$at_quiet $as_echo_n " 5: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "5. input.at:181: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%destructor { destroy ($$); } <*> <*> +%printer { destroy ($$); } <*> <*> + +%destructor { destroy ($$); } <*> +%printer { destroy ($$); } <*> + +%destructor { destroy ($$); } <> <> +%printer { destroy ($$); } <> <> + +%destructor { destroy ($$); } <> +%printer { destroy ($$); } <> + +%% + +start: ; + +%destructor { destroy ($$); } <*>; +%printer { destroy ($$); } <*>; + +%destructor { destroy ($$); } <>; +%printer { destroy ($$); } <>; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:207: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:207 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.13-29: redeclaration for default tagged %destructor +input.y:1.13-29: previous declaration +input.y:2.10-26: redeclaration for default tagged %printer +input.y:2.10-26: previous declaration +input.y:4.13-29: redeclaration for default tagged %destructor +input.y:1.13-29: previous declaration +input.y:5.10-26: redeclaration for default tagged %printer +input.y:2.10-26: previous declaration +input.y:7.13-29: redeclaration for default tagless %destructor +input.y:7.13-29: previous declaration +input.y:8.10-26: redeclaration for default tagless %printer +input.y:8.10-26: previous declaration +input.y:10.13-29: redeclaration for default tagless %destructor +input.y:7.13-29: previous declaration +input.y:11.10-26: redeclaration for default tagless %printer +input.y:8.10-26: previous declaration +input.y:17.13-29: redeclaration for default tagged %destructor +input.y:4.13-29: previous declaration +input.y:18.10-26: redeclaration for default tagged %printer +input.y:5.10-26: previous declaration +input.y:20.13-29: redeclaration for default tagless %destructor +input.y:10.13-29: previous declaration +input.y:21.10-26: redeclaration for default tagless %printer +input.y:11.10-26: previous declaration +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_5 +#AT_START_6 +# 6. input.at:241: Per-type %printer and %destructor redeclared +at_setup_line='input.at:241' +at_func_banner 1 +at_desc="Per-type %printer and %destructor redeclared" +$at_quiet $as_echo_n " 6: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "6. input.at:241: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%destructor { destroy ($$); } +%printer { destroy ($$); } + +%destructor { destroy ($$); } +%printer { destroy ($$); } + +%% + +start: ; + +%destructor { destroy ($$); } ; +%printer { destroy ($$); } ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:258: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:258 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:4.13-29: %destructor redeclaration for +input.y:1.13-29: previous declaration +input.y:4.13-29: %destructor redeclaration for +input.y:4.13-29: previous declaration +input.y:5.10-26: %printer redeclaration for +input.y:2.10-26: previous declaration +input.y:5.10-26: %printer redeclaration for +input.y:5.10-26: previous declaration +input.y:11.13-29: %destructor redeclaration for +input.y:4.13-29: previous declaration +input.y:11.13-29: %destructor redeclaration for +input.y:1.13-29: previous declaration +input.y:12.10-26: %printer redeclaration for +input.y:2.10-26: previous declaration +input.y:12.10-26: %printer redeclaration for +input.y:5.10-26: previous declaration +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:258" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_6 +#AT_START_7 +# 7. input.at:284: Unused values with default %destructor +at_setup_line='input.at:284' +at_func_banner 1 +at_desc="Unused values with default %destructor" +$at_quiet $as_echo_n " 7: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "7. input.at:284: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%destructor { destroy ($$); } <> +%type tagged + +%% + +start: end end tagged tagged { $1; $3; } ; +end: { } ; +tagged: { } ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:297: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:297 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:297" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:297: bison --xml=xml-tests/test.xml input.y" +echo input.at:297 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:297" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:297: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:297 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:297" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:297: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:297 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:297" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:297: bison input.y" +echo input.at:297 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:6.8-45: warning: unset value: \$\$ +input.y:6.8-45: warning: unused value: \$2 +input.y:7.6-8: warning: unset value: \$\$ +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:297" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input.y <<'_ATEOF' +%destructor { destroy ($$); } <*> +%type tagged + +%% + +start: end end tagged tagged { $1; $3; } ; +end: { } ; +tagged: { } ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:314: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:314 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:314" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:314: bison --xml=xml-tests/test.xml input.y" +echo input.at:314 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:314" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:314: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:314 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:314" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:314: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:314 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:314" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:314: bison input.y" +echo input.at:314 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:6.8-45: warning: unused value: \$4 +input.y:8.9-11: warning: unset value: \$\$ +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:314" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_7 +#AT_START_8 +# 8. input.at:326: Unused values with per-type %destructor +at_setup_line='input.at:326' +at_func_banner 1 +at_desc="Unused values with per-type %destructor" +$at_quiet $as_echo_n " 8: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "8. input.at:326: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%destructor { destroy ($$); } +%type start end + +%% + +start: end end { $1; } ; +end: { } ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:338: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:338 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:338" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:338: bison --xml=xml-tests/test.xml input.y" +echo input.at:338 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:338" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:338: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:338 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:338" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:338: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:338 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:338" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:338: bison input.y" +echo input.at:338 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:6.8-22: warning: unset value: \$\$ +input.y:6.8-22: warning: unused value: \$2 +input.y:7.6-8: warning: unset value: \$\$ +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:338" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_8 +#AT_START_9 +# 9. input.at:351: Incompatible Aliases +at_setup_line='input.at:351' +at_func_banner 1 +at_desc="Incompatible Aliases" +$at_quiet $as_echo_n " 9: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "9. input.at:351: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%token foo "foo" + +%type foo +%printer {bar} foo +%destructor {bar} foo +%left foo + +%type "foo" +%printer {baz} "foo" +%destructor {baz} "foo" +%left "foo" + +%% +exp: foo; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:370: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:370 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:8.7-11: %type redeclaration for foo +input.y:3.7-11: previous declaration +input.y:10.13-17: %destructor redeclaration for foo +input.y:5.13-17: previous declaration +input.y:9.10-14: %printer redeclaration for foo +input.y:4.10-14: previous declaration +input.y:11.1-5: %left redeclaration for foo +input.y:6.1-5: previous declaration +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:370" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_9 +#AT_START_10 +# 10. input.at:392: Torturing the Scanner +at_setup_line='input.at:392' +at_func_banner 1 +at_desc="Torturing the Scanner" +$at_quiet $as_echo_n " 10: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "10. input.at:392: testing ..." + $at_traceon + + + +cat >input.y <<'_ATEOF' +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:396: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:396 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.1: syntax error, unexpected end of file +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:396" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +{} +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:404: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:404 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.1-2: syntax error, unexpected {...} +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:404" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +/* This is seen in GCC: a %{ and %} in middle of a comment. */ +const char *foo = "So %{ and %} can be here too."; + +#if 0 +/* These examples test Bison while not stressing C compilers too much. + Many C compilers mishandle backslash-newlines, so this part of the + test is inside "#if 0". The comment and string are written so that + the "#endif" will be seen regardless of the C compiler bugs that we + know about, namely: + + HP C (as of late 2002) mishandles *\[newline]\[newline]/ within a + comment. + + The Apple Darwin compiler (as of late 2002) mishandles + \\[newline]' within a character constant. + + */ + +/\ +* A comment with backslash-newlines in it. %} *\ +\ +/ +/* { Close the above comment, if the C compiler mishandled it. */ + +char str[] = "\\ +" A string with backslash-newlines in it %{ %} \\ +\ +""; + +char apostrophe = '\''; +#endif + +#include +#include +%} +/* %{ and %} can be here too. */ + +%{ +/* Exercise pre-prologue dependency to %union. */ +typedef int value; +%} + +/* Exercise M4 quoting: ']]', 0. */ + +/* Also exercise %union. */ +%union +{ + value ival; /* A comment to exercise an old bug. */ +}; + + +/* Exercise post-prologue dependency to %union. */ +%{ +static YYSTYPE value_as_yystype (value val); + +/* Exercise quotes in declarations. */ +char quote[] = "]],"; +%} + +%{ +static void yyerror (const char *s); +static int yylex (void); +%} + +%type '[' + +/* Exercise quotes in strings. */ +%token FAKE "fake [] \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c ??!??'??(??)??-??/?? \x1\1" + +%% +/* Exercise M4 quoting: ']]', [, 1. */ +exp: '[' '\1' two '$' '@' '{' oline output.or.oline.opt + { + /* Exercise quotes in braces. */ + char tmp[] = "[%c],\n"; + printf (tmp, $1); + } +; + +two: '\x000000000000000000000000000000000000000000000000000000000000000000002'; +oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_'; +output.or.oline.opt: ;|oline;;|output;;; +output: '#' 'o' 'u' 't' 'p' 'u' 't' ' '; +%% +/* Exercise M4 quoting: ']]', [, 2. */ + +static YYSTYPE +value_as_yystype (value val) +{ + YYSTYPE res; + res.ival = val; + return res; +} + +static int +yylex (void) +{ + static char const input[] = "[\1\2$@{@oline@__oline__\ +#output "; /* " + */ + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylval = value_as_yystype (input[toknum]); + return input[toknum++]; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} +_ATEOF + + + +# Pacify Emacs'font-lock-mode: " + +cat >main.c <<'_ATEOF' +typedef int value; +#include "input.h" + +int yyparse (void); + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:540: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -d -v -o input.c input.y" +echo input.at:540 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:540: bison --xml=xml-tests/test.xml -d -v -o input.c input.y" +echo input.at:540 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:540: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:540 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:540: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:540 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:540: bison -d -v -o input.c input.y" +echo input.at:540 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:541: \$CC \$CFLAGS \$CPPFLAGS -o input.o -c input.c" +echo input.at:541 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o input.o -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:541" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:542: \$CC \$CFLAGS \$CPPFLAGS -o main.o -c main.c" +echo input.at:542 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o main.o -c main.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o main.o -c main.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o main.o -c main.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:542" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:543: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.o main.o \$LIBS" +echo input.at:543 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.o main.o $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.o main.o $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.o main.o $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:543" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:544: \$PREPARSER ./input" +echo input.at:544 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "[[], +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:544" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_10 +#AT_START_11 +# 11. input.at:555: Typed symbol aliases +at_setup_line='input.at:555' +at_func_banner 1 +at_desc="Typed symbol aliases" +$at_quiet $as_echo_n " 11: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "11. input.at:555: testing ..." + $at_traceon + + +# Bison 2.0 broke typed symbol aliases - ensure they work. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%union +{ + int val; +}; +%token MY_TOKEN "MY TOKEN" +%type exp +%% +exp: "MY TOKEN"; +%% +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:571: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo input.at:571 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:571: bison --xml=xml-tests/test.xml -o input.c input.y" +echo input.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:571: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:571 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:571: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:571 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:571: bison -o input.c input.y" +echo input.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_11 +#AT_START_12 +# 12. input.at:591: Require 1.0 +at_setup_line='input.at:591' +at_func_banner 1 +at_desc="Require 1.0" +$at_quiet $as_echo_n " 12: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "12. input.at:591: testing ..." + $at_traceon + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%require "1.0"; +%% +empty_file:; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:591: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo input.at:591 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:591" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:591: bison --xml=xml-tests/test.xml -o input.c input.y" +echo input.at:591 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:591" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:591: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:591 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:591" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:591: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:591 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:591" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:591: bison -o input.c input.y" +echo input.at:591 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:591" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_12 +#AT_START_13 +# 13. input.at:592: Require 2.4.1 +at_setup_line='input.at:592' +at_func_banner 1 +at_desc="Require 2.4.1" +$at_quiet $as_echo_n " 13: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "13. input.at:592: testing ..." + $at_traceon + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%require "2.4.1"; +%% +empty_file:; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:592: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo input.at:592 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:592: bison --xml=xml-tests/test.xml -o input.c input.y" +echo input.at:592 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:592: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:592 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:592: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:592 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:592: bison -o input.c input.y" +echo input.at:592 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_13 +#AT_START_14 +# 14. input.at:594: Require 100.0 +at_setup_line='input.at:594' +at_func_banner 1 +at_desc="Require 100.0" +$at_quiet $as_echo_n " 14: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "14. input.at:594: testing ..." + $at_traceon + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%require "100.0"; +%% +empty_file:; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:594: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y" +echo input.at:594 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 63 $at_status "$at_srcdir/input.at:594" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_14 +#AT_START_15 +# 15. input.at:601: String aliases for character tokens +at_setup_line='input.at:601' +at_func_banner 1 +at_desc="String aliases for character tokens" +$at_quiet $as_echo_n " 15: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "15. input.at:601: testing ..." + $at_traceon + + +# Bison once thought a character token and its alias were different symbols +# with the same user token number. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%token 'a' "a" +%% +start: 'a'; +%% +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:613: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo input.at:613 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:613: bison --xml=xml-tests/test.xml -o input.c input.y" +echo input.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:613: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:613 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:613: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:613 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:613: bison -o input.c input.y" +echo input.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_15 +#AT_START_16 +# 16. input.at:622: Unclosed constructs +at_setup_line='input.at:622' +at_func_banner 1 +at_desc="Unclosed constructs" +$at_quiet $as_echo_n " 16: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "16. input.at:622: testing ..." + $at_traceon + + +# Bison's scan-gram.l once forgot to STRING_FINISH some unclosed constructs, so +# they were prepended to whatever it STRING_GROW'ed next. It also threw them +# away rather than returning them to the parser. The effect was confusing +# subsequent error messages. + +cat >input.y <<'_ATEOF' +%token A "a +%token B "b" +%token AB "ab" // Used to complain that "ab" was already used. +%token C '1 +%token TWO "2" +%token TICK_TWELVE "'12" // Used to complain that "'12" was already used. + +%% + +start: ; + +// Used to report a syntax error because it didn't see any kind of symbol +// identifier. +%type 'a +; +%type "a +; +// Used to report a syntax error because it didn't see braced code. +%destructor { free ($$) +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:651: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y" +echo input.at:651 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.10-2.0: missing \`\"' at end of line +input.y:4.10-5.0: missing \`'' at end of line +input.y:14.11-15.0: missing \`'' at end of line +input.y:16.11-17.0: missing \`\"' at end of line +input.y:19.13-20.0: missing \`}' at end of file +input.y:20.1: syntax error, unexpected end of file +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:651" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_16 +#AT_START_17 +# 17. input.at:667: %start after first rule +at_setup_line='input.at:667' +at_func_banner 1 +at_desc="%start after first rule" +$at_quiet $as_echo_n " 17: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "17. input.at:667: testing ..." + $at_traceon + + +# Bison once complained that a %start after the first rule was a redeclaration +# of the start symbol. + +cat >input.y <<'_ATEOF' +%% +false_start: ; +start: false_start ; +%start start; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:679: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo input.at:679 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:679" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:679: bison --xml=xml-tests/test.xml -o input.c input.y" +echo input.at:679 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:679" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:679: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:679 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:679" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:679: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:679 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:679" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:679: bison -o input.c input.y" +echo input.at:679 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:679" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_17 +#AT_START_18 +# 18. input.at:688: %prec takes a token +at_setup_line='input.at:688' +at_func_banner 1 +at_desc="%prec takes a token" +$at_quiet $as_echo_n " 18: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "18. input.at:688: testing ..." + $at_traceon + + +# Bison once allowed %prec sym where sym was a nonterminal. + +cat >input.y <<'_ATEOF' +%% +start: PREC %prec PREC ; +PREC: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:698: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:698 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.1-4: rule given for PREC, which is a token +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:698" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_18 +#AT_START_19 +# 19. input.at:709: Reject unused %code qualifiers +at_setup_line='input.at:709' +at_func_banner 1 +at_desc="Reject unused %code qualifiers" +$at_quiet $as_echo_n " 19: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "19. input.at:709: testing ..." + $at_traceon + + +cat >input-c.y <<'_ATEOF' +%code q {} +%code bad {} +%code bad {} +%code format {} +%% +start: ; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:719: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input-c.y" +echo input.at:719 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-c.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-c.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:719" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:719: bison --xml=xml-tests/test.xml input-c.y" +echo input.at:719 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input-c.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input-c.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:719" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:719: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:719 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:719" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:719: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:719 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:719" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:719: bison input-c.y" +echo input.at:719 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input-c.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input-c.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input-c.y:1.7: warning: %code qualifier \`q' is not used +input-c.y:2.7-9: warning: %code qualifier \`bad' is not used +input-c.y:3.7-9: warning: %code qualifier \`bad' is not used +input-c.y:4.7-12: warning: %code qualifier \`format' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:719" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input-c-glr.y <<'_ATEOF' +%code q {} +%code bad {} + %code bad {} +%% +start: ; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:733: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input-c-glr.y" +echo input.at:733 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-c-glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-c-glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:733" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:733: bison --xml=xml-tests/test.xml input-c-glr.y" +echo input.at:733 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input-c-glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input-c-glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:733" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:733: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:733 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:733" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:733: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:733 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:733" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:733: bison input-c-glr.y" +echo input.at:733 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input-c-glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input-c-glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input-c-glr.y:1.7: warning: %code qualifier \`q' is not used +input-c-glr.y:2.7-9: warning: %code qualifier \`bad' is not used +input-c-glr.y:3.8-10: warning: %code qualifier \`bad' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:733" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input-c++.y <<'_ATEOF' +%code q {} +%code bad {} + %code q {} +%% +start: ; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:746: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input-c++.y" +echo input.at:746 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-c++.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-c++.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:746" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:746: bison --xml=xml-tests/test.xml input-c++.y" +echo input.at:746 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input-c++.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input-c++.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:746" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:746: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:746 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:746" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:746: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:746 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:746" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:746: bison input-c++.y" +echo input.at:746 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input-c++.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input-c++.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input-c++.y:1.7: warning: %code qualifier \`q' is not used +input-c++.y:2.7-9: warning: %code qualifier \`bad' is not used +input-c++.y:3.8: warning: %code qualifier \`q' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:746" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input-c++-glr.y <<'_ATEOF' +%code bad {} +%code q {} +%code q {} +%% +start: ; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:759: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input-c++-glr.y" +echo input.at:759 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-c++-glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-c++-glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:759" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:759: bison --xml=xml-tests/test.xml input-c++-glr.y" +echo input.at:759 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input-c++-glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input-c++-glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:759" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:759: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:759 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:759" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:759: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:759 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:759" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:759: bison input-c++-glr.y" +echo input.at:759 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input-c++-glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input-c++-glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input-c++-glr.y:1.7-9: warning: %code qualifier \`bad' is not used +input-c++-glr.y:2.7: warning: %code qualifier \`q' is not used +input-c++-glr.y:3.7: warning: %code qualifier \`q' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:759" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >special-char-@@.y <<'_ATEOF' +%code bad {} +%code q {} +%code q {} +%% +start: ; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:772: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot special-char-@@.y" +echo input.at:772 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot special-char-@@.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot special-char-@@.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:772" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:772: bison --xml=xml-tests/test.xml special-char-@@.y" +echo input.at:772 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml special-char-@@.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml special-char-@@.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:772" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:772: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:772 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:772" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:772: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:772 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:772" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:772: bison special-char-@@.y" +echo input.at:772 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison special-char-@@.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison special-char-@@.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "special-char-@@.y:1.7-9: warning: %code qualifier \`bad' is not used +special-char-@@.y:2.7: warning: %code qualifier \`q' is not used +special-char-@@.y:3.7: warning: %code qualifier \`q' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:772" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >special-char-].y <<'_ATEOF' +%code bad {} +%code q {} +%code q {} +%% +start: ; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:785: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot special-char-].y" +echo input.at:785 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot special-char-].y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot special-char-].y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:785" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:785: bison --xml=xml-tests/test.xml special-char-].y" +echo input.at:785 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml special-char-].y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml special-char-].y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:785" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:785: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:785 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:785" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:785: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:785 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:785" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:785: bison special-char-].y" +echo input.at:785 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison special-char-].y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison special-char-].y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "special-char-].y:1.7-9: warning: %code qualifier \`bad' is not used +special-char-].y:2.7: warning: %code qualifier \`q' is not used +special-char-].y:3.7: warning: %code qualifier \`q' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:785" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_19 +#AT_START_20 +# 20. input.at:798: %define errors +at_setup_line='input.at:798' +at_func_banner 1 +at_desc="%define errors" +$at_quiet $as_echo_n " 20: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "20. input.at:798: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%define var "value1" +%define var "value1" + %define var "value2" +%define special1 "]" +%define special2 "[" +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:810: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:810 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:810" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:810: bison --xml=xml-tests/test.xml input.y" +echo input.at:810 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:810" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:810: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:810 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:810" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:810: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:810 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:810" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:810: bison input.y" +echo input.at:810 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:2.9-11: warning: %define variable \`var' redefined +input.y:1.9-11: warning: previous definition +input.y:3.10-12: warning: %define variable \`var' redefined +input.y:2.9-11: warning: previous definition +input.y:1.9-11: warning: %define variable \`var' is not used +input.y:2.9-11: warning: %define variable \`var' is not used +input.y:3.10-12: warning: %define variable \`var' is not used +input.y:4.9-16: warning: %define variable \`special1' is not used +input.y:5.9-16: warning: %define variable \`special2' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:810" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_20 +#AT_START_21 +# 21. input.at:828: %define Boolean variables +at_setup_line='input.at:828' +at_func_banner 1 +at_desc="%define Boolean variables" +$at_quiet $as_echo_n " 21: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "21. input.at:828: testing ..." + $at_traceon + + +cat >Input.y <<'_ATEOF' +%language "Java" +%define public "maybe" +%define parser_class_name "Input" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:838: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison Input.y" +echo input.at:838 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison Input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison Input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison Input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Input.y:2.9-14: invalid value for %define Boolean variable \`public' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:838" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_21 +#AT_START_22 +# 22. input.at:848: %define enum variables +at_setup_line='input.at:848' +at_func_banner 1 +at_desc="%define enum variables" +$at_quiet $as_echo_n " 22: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "22. input.at:848: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%define api.push_pull "neither" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:856: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:856 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.9-21: invalid value for %define variable \`api.push_pull': \`neither' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:856" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_22 +#AT_START_23 +# 23. input.at:866: Unused %define api.pure +at_setup_line='input.at:866' +at_func_banner 1 +at_desc="Unused %define api.pure" +$at_quiet $as_echo_n " 23: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "23. input.at:866: testing ..." + $at_traceon + + +# AT_CHECK_API_PURE(DECLS, VALUE) +# ------------------------------- +# Make sure Bison reports that `%define api.pure VALUE' is unused when DECLS +# are specified. + + + +cat >input.y <<'_ATEOF' +%define api.pure +%language "c++" %defines +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:886: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:886 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:886" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:886: bison --xml=xml-tests/test.xml input.y" +echo input.at:886 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:886" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:886: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:886 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:886" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:886: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:886 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:886" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:886: bison input.y" +echo input.at:886 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.9-16: warning: %define variable \`api.pure' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:886" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%define api.pure "false" +%language "c++" %defines +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:887: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:887 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:887" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:887: bison --xml=xml-tests/test.xml input.y" +echo input.at:887 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:887" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:887: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:887 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:887" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:887: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:887 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:887" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:887: bison input.y" +echo input.at:887 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.9-16: warning: %define variable \`api.pure' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:887" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%define api.pure "" +%language "c++" %defines %glr-parser +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:888: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:888 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:888" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:888: bison --xml=xml-tests/test.xml input.y" +echo input.at:888 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:888" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:888: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:888 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:888" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:888: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:888 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:888" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:888: bison input.y" +echo input.at:888 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.9-16: warning: %define variable \`api.pure' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:888" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%define api.pure "false" +%language "c++" %defines %glr-parser +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:889: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:889 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:889" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:889: bison --xml=xml-tests/test.xml input.y" +echo input.at:889 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:889" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:889: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:889 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:889" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:889: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:889 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:889" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:889: bison input.y" +echo input.at:889 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.9-16: warning: %define variable \`api.pure' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:889" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%define api.pure "true" +%language "java" +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:890: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:890 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:890" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:890: bison --xml=xml-tests/test.xml input.y" +echo input.at:890 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:890" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:890: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:890 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:890" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:890: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:890 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:890" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:890: bison input.y" +echo input.at:890 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.9-16: warning: %define variable \`api.pure' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:890" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%define api.pure "false" +%language "java" +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/input.at:891: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo input.at:891 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:891" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/input.at:891: bison --xml=xml-tests/test.xml input.y" +echo input.at:891 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/input.at:891" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:891: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo input.at:891 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:891" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/input.at:891: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo input.at:891 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:891" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/input.at:891: bison input.y" +echo input.at:891 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:1.9-16: warning: %define variable \`api.pure' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/input.at:891" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_23 +#AT_START_24 +# 24. input.at:899: C++ namespace reference errors +at_setup_line='input.at:899' +at_func_banner 1 +at_desc="C++ namespace reference errors" +$at_quiet $as_echo_n " 24: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "24. input.at:899: testing ..." + $at_traceon + + +# AT_CHECK_NAMESPACE_ERROR(NAMESPACE-DECL, ERROR, [ERROR], ...) +# ------------------------------------------------------------- +# Make sure Bison reports all ERROR's for %define namespace "NAMESPACE-DECL". + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace "" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:920: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:920 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference is empty +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:920" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace " " +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:922: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:922 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference is empty +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:922" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace "foo::::bar" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:924: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:924 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference has consecutive \"::\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:924" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace "foo:: ::bar" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:926: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:926 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference has consecutive \"::\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:926" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace "::::bar" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:928: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:928 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference has consecutive \"::\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:928" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace ":: ::bar" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:930: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:930 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference has consecutive \"::\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:930" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace "foo::bar:: ::" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:932: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:932 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference has consecutive \"::\" +input.y:3.9-17: namespace reference has a trailing \"::\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:932" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace "foo::bar::" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:935: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:935 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference has a trailing \"::\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:935" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace "foo::bar:: " +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:937: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:937 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference has a trailing \"::\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:937" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%language "C++" +%defines +%define namespace "::" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/input.at:939: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo input.at:939 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.9-17: namespace reference has a trailing \"::\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/input.at:939" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_24 +#AT_START_25 +# 25. output.at:43: Output files: -dv +at_setup_line='output.at:43' +at_func_banner 2 +at_desc="Output files: -dv " +$at_quiet $as_echo_n " 25: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "25. output.at:43: testing ..." + $at_traceon + +for file in foo.y foo.output foo.tab.c foo.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:43: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -dv foo.y " +echo output.at:43 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:43" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:43: bison --xml=xml-tests/test.xml -dv foo.y " +echo output.at:43 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -dv foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -dv foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:43" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:43: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:43 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:43" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:43: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:43 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:43" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:43: bison -dv foo.y " +echo output.at:43 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -dv foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -dv foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:43" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:43: ls foo.output foo.tab.c foo.tab.h" +echo output.at:43 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.output foo.tab.c foo.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.output foo.tab.c foo.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:43" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_25 +#AT_START_26 +# 26. output.at:45: Output files: -dv >&- +at_setup_line='output.at:45' +at_func_banner 2 +at_desc="Output files: -dv >&-" +$at_quiet $as_echo_n " 26: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "26. output.at:45: testing ..." + $at_traceon + +for file in foo.y foo.output foo.tab.c foo.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:45: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -dv foo.y >&-" +echo output.at:45 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv foo.y >&- ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv foo.y >&- ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:45: bison --xml=xml-tests/test.xml -dv foo.y >&-" +echo output.at:45 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -dv foo.y >&- ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -dv foo.y >&- ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:45: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:45 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:45: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:45 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:45: bison -dv foo.y >&-" +echo output.at:45 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -dv foo.y >&- ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -dv foo.y >&- ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:45: ls foo.output foo.tab.c foo.tab.h" +echo output.at:45 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.output foo.tab.c foo.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.output foo.tab.c foo.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_26 +#AT_START_27 +# 27. output.at:48: Output files: -dv -o foo.c +at_setup_line='output.at:48' +at_func_banner 2 +at_desc="Output files: -dv -o foo.c " +$at_quiet $as_echo_n " 27: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "27. output.at:48: testing ..." + $at_traceon + +for file in foo.y foo.c foo.h foo.output; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:48: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -dv -o foo.c foo.y " +echo output.at:48 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -o foo.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -o foo.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:48" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:48: bison --xml=xml-tests/test.xml -dv -o foo.c foo.y " +echo output.at:48 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -dv -o foo.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -dv -o foo.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:48" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:48: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:48 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:48" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:48: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:48 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:48" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:48: bison -dv -o foo.c foo.y " +echo output.at:48 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -dv -o foo.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -dv -o foo.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:48" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:48: ls foo.c foo.h foo.output" +echo output.at:48 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.c foo.h foo.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.c foo.h foo.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:48" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_27 +#AT_START_28 +# 28. output.at:50: Output files: -dv -o foo.tab.c +at_setup_line='output.at:50' +at_func_banner 2 +at_desc="Output files: -dv -o foo.tab.c " +$at_quiet $as_echo_n " 28: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "28. output.at:50: testing ..." + $at_traceon + +for file in foo.y foo.output foo.tab.c foo.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:50: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -dv -o foo.tab.c foo.y " +echo output.at:50 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -o foo.tab.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -o foo.tab.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:50" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:50: bison --xml=xml-tests/test.xml -dv -o foo.tab.c foo.y " +echo output.at:50 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -dv -o foo.tab.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -dv -o foo.tab.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:50" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:50: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:50 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:50" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:50: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:50 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:50" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:50: bison -dv -o foo.tab.c foo.y " +echo output.at:50 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -dv -o foo.tab.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -dv -o foo.tab.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:50" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:50: ls foo.output foo.tab.c foo.tab.h" +echo output.at:50 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.output foo.tab.c foo.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.output foo.tab.c foo.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:50" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_28 +#AT_START_29 +# 29. output.at:52: Output files: -dv -y +at_setup_line='output.at:52' +at_func_banner 2 +at_desc="Output files: -dv -y " +$at_quiet $as_echo_n " 29: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "29. output.at:52: testing ..." + $at_traceon + +for file in foo.y y.output y.tab.c y.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:52: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -dv -y foo.y " +echo output.at:52 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -y foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -y foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:52" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:52: bison --xml=xml-tests/test.xml -dv -y foo.y " +echo output.at:52 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -dv -y foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -dv -y foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:52" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:52: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:52 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:52" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:52: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:52 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:52" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:52: bison -dv -y foo.y " +echo output.at:52 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -dv -y foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -dv -y foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:52" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:52: ls y.output y.tab.c y.tab.h" +echo output.at:52 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls y.output y.tab.c y.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls y.output y.tab.c y.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:52" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_29 +#AT_START_30 +# 30. output.at:54: Output files: -dv -b bar +at_setup_line='output.at:54' +at_func_banner 2 +at_desc="Output files: -dv -b bar " +$at_quiet $as_echo_n " 30: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "30. output.at:54: testing ..." + $at_traceon + +for file in foo.y bar.output bar.tab.c bar.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:54: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -dv -b bar foo.y " +echo output.at:54 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -b bar foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -b bar foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:54" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:54: bison --xml=xml-tests/test.xml -dv -b bar foo.y " +echo output.at:54 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -dv -b bar foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -dv -b bar foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:54" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:54: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:54 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:54" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:54: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:54 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:54" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:54: bison -dv -b bar foo.y " +echo output.at:54 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -dv -b bar foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -dv -b bar foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:54" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:54: ls bar.output bar.tab.c bar.tab.h" +echo output.at:54 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls bar.output bar.tab.c bar.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls bar.output bar.tab.c bar.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:54" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_30 +#AT_START_31 +# 31. output.at:56: Output files: -dv -g -o foo.c +at_setup_line='output.at:56' +at_func_banner 2 +at_desc="Output files: -dv -g -o foo.c " +$at_quiet $as_echo_n " 31: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "31. output.at:56: testing ..." + $at_traceon + +for file in foo.y foo.c foo.dot foo.h foo.output; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:56: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -dv -g -o foo.c foo.y " +echo output.at:56 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -g -o foo.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -dv -g -o foo.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:56" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:56: bison --xml=xml-tests/test.xml -dv -g -o foo.c foo.y " +echo output.at:56 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -dv -g -o foo.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -dv -g -o foo.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:56" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:56: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:56 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:56" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:56: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:56 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:56" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:56: bison -dv -g -o foo.c foo.y " +echo output.at:56 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -dv -g -o foo.c foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -dv -g -o foo.c foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:56" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:56: ls foo.c foo.dot foo.h foo.output" +echo output.at:56 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.c foo.dot foo.h foo.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.c foo.dot foo.h foo.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:56" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_31 +#AT_START_32 +# 32. output.at:60: Output files: %defines %verbose +at_setup_line='output.at:60' +at_func_banner 2 +at_desc="Output files: %defines %verbose " +$at_quiet $as_echo_n " 32: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "32. output.at:60: testing ..." + $at_traceon + +for file in foo.y foo.output foo.tab.c foo.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' +%defines %verbose +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:60: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.y " +echo output.at:60 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:60" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:60: bison --xml=xml-tests/test.xml foo.y " +echo output.at:60 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:60" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:60: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:60 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:60" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:60: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:60 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:60" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:60: bison foo.y " +echo output.at:60 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:60" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:60: ls foo.output foo.tab.c foo.tab.h" +echo output.at:60 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.output foo.tab.c foo.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.output foo.tab.c foo.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:60" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_32 +#AT_START_33 +# 33. output.at:62: Output files: %defines %verbose %yacc +at_setup_line='output.at:62' +at_func_banner 2 +at_desc="Output files: %defines %verbose %yacc " +$at_quiet $as_echo_n " 33: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "33. output.at:62: testing ..." + $at_traceon + +for file in foo.y y.output y.tab.c y.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' +%defines %verbose %yacc +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:62: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.y " +echo output.at:62 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:62" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:62: bison --xml=xml-tests/test.xml foo.y " +echo output.at:62 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:62" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:62: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:62 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:62" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:62: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:62 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:62" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:62: bison foo.y " +echo output.at:62 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:62" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:62: ls y.output y.tab.c y.tab.h" +echo output.at:62 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls y.output y.tab.c y.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls y.output y.tab.c y.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:62" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_33 +#AT_START_34 +# 34. output.at:65: Output files: %defines %verbose %yacc +at_setup_line='output.at:65' +at_func_banner 2 +at_desc="Output files: %defines %verbose %yacc " +$at_quiet $as_echo_n " 34: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "34. output.at:65: testing ..." + $at_traceon + +for file in foo.yy y.output y.tab.c y.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.yy <<'_ATEOF' +%defines %verbose %yacc +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:65: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.yy " +echo output.at:65 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:65" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:65: bison --xml=xml-tests/test.xml foo.yy " +echo output.at:65 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:65" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:65: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:65 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:65" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:65: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:65 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:65" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:65: bison foo.yy " +echo output.at:65 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:65" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:65: ls y.output y.tab.c y.tab.h" +echo output.at:65 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls y.output y.tab.c y.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls y.output y.tab.c y.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:65" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_34 +#AT_START_35 +# 35. output.at:69: Output files: %file-prefix "bar" %defines %verbose +at_setup_line='output.at:69' +at_func_banner 2 +at_desc="Output files: %file-prefix \"bar\" %defines %verbose " +$at_quiet $as_echo_n " 35: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "35. output.at:69: testing ..." + $at_traceon + +for file in foo.y bar.output bar.tab.c bar.tab.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' +%file-prefix "bar" %defines %verbose +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:69: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.y " +echo output.at:69 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:69" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:69: bison --xml=xml-tests/test.xml foo.y " +echo output.at:69 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:69" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:69: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:69 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:69" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:69: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:69 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:69" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:69: bison foo.y " +echo output.at:69 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:69" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:69: ls bar.output bar.tab.c bar.tab.h" +echo output.at:69 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls bar.output bar.tab.c bar.tab.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls bar.output bar.tab.c bar.tab.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:69" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_35 +#AT_START_36 +# 36. output.at:71: Output files: %output="bar.c" %defines %verbose %yacc +at_setup_line='output.at:71' +at_func_banner 2 +at_desc="Output files: %output=\"bar.c\" %defines %verbose %yacc " +$at_quiet $as_echo_n " 36: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "36. output.at:71: testing ..." + $at_traceon + +for file in foo.y bar.output bar.c bar.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' +%output="bar.c" %defines %verbose %yacc +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:71: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.y " +echo output.at:71 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:71: bison --xml=xml-tests/test.xml foo.y " +echo output.at:71 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:71: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:71 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:71: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:71 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:71: bison foo.y " +echo output.at:71 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:71: ls bar.output bar.c bar.h" +echo output.at:71 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls bar.output bar.c bar.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls bar.output bar.c bar.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_36 +#AT_START_37 +# 37. output.at:73: Output files: %file-prefix="baz" %output "bar.c" %defines %verbose %yacc +at_setup_line='output.at:73' +at_func_banner 2 +at_desc="Output files: %file-prefix=\"baz\" %output \"bar.c\" %defines %verbose %yacc " +$at_quiet $as_echo_n " 37: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "37. output.at:73: testing ..." + $at_traceon + +for file in foo.y bar.output bar.c bar.h; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.y <<'_ATEOF' +%file-prefix="baz" %output "bar.c" %defines %verbose %yacc +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:73: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.y " +echo output.at:73 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:73" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:73: bison --xml=xml-tests/test.xml foo.y " +echo output.at:73 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:73" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:73: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:73 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:73" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:73: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:73 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:73" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:73: bison foo.y " +echo output.at:73 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:73" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:73: ls bar.output bar.c bar.h" +echo output.at:73 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls bar.output bar.c bar.h ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls bar.output bar.c bar.h ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:73" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_37 +#AT_START_38 +# 38. output.at:80: Output files: %defines %verbose +at_setup_line='output.at:80' +at_func_banner 2 +at_desc="Output files: %defines %verbose " +$at_quiet $as_echo_n " 38: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "38. output.at:80: testing ..." + $at_traceon + +for file in foo.yy foo.output foo.tab.cc foo.tab.hh; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.yy <<'_ATEOF' +%defines %verbose +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:80: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.yy " +echo output.at:80 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:80" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:80: bison --xml=xml-tests/test.xml foo.yy " +echo output.at:80 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:80" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:80: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:80 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:80" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:80: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:80 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:80" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:80: bison foo.yy " +echo output.at:80 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:80" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:80: ls foo.output foo.tab.cc foo.tab.hh" +echo output.at:80 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.output foo.tab.cc foo.tab.hh ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.output foo.tab.cc foo.tab.hh ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:80" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_38 +#AT_START_39 +# 39. output.at:83: Output files: %defines %verbose -o foo.c +at_setup_line='output.at:83' +at_func_banner 2 +at_desc="Output files: %defines %verbose -o foo.c " +$at_quiet $as_echo_n " 39: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "39. output.at:83: testing ..." + $at_traceon + +for file in foo.yy foo.c foo.h foo.output; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.yy <<'_ATEOF' +%defines %verbose +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:83: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o foo.c foo.yy " +echo output.at:83 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o foo.c foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o foo.c foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:83: bison --xml=xml-tests/test.xml -o foo.c foo.yy " +echo output.at:83 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o foo.c foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o foo.c foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:83: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:83 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:83: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:83 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:83: bison -o foo.c foo.yy " +echo output.at:83 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o foo.c foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o foo.c foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:83: ls foo.c foo.h foo.output" +echo output.at:83 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.c foo.h foo.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.c foo.h foo.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_39 +#AT_START_40 +# 40. output.at:86: Output files: --defines=foo.hpp -o foo.c++ +at_setup_line='output.at:86' +at_func_banner 2 +at_desc="Output files: --defines=foo.hpp -o foo.c++ " +$at_quiet $as_echo_n " 40: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "40. output.at:86: testing ..." + $at_traceon + +for file in foo.yy foo.c++ foo.hpp; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.yy <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:86: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --defines=foo.hpp -o foo.c++ foo.yy " +echo output.at:86 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines=foo.hpp -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines=foo.hpp -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:86" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:86: bison --xml=xml-tests/test.xml --defines=foo.hpp -o foo.c++ foo.yy " +echo output.at:86 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --defines=foo.hpp -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --defines=foo.hpp -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:86" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:86: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:86 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:86" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:86: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:86 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:86" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:86: bison --defines=foo.hpp -o foo.c++ foo.yy " +echo output.at:86 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --defines=foo.hpp -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --defines=foo.hpp -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:86" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:86: ls foo.c++ foo.hpp" +echo output.at:86 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.c++ foo.hpp ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.c++ foo.hpp ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:86" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_40 +#AT_START_41 +# 41. output.at:90: Output files: %defines "foo.hpp" -o foo.c++ +at_setup_line='output.at:90' +at_func_banner 2 +at_desc="Output files: %defines \"foo.hpp\" -o foo.c++ " +$at_quiet $as_echo_n " 41: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "41. output.at:90: testing ..." + $at_traceon + +for file in foo.yy foo.c++ foo.hpp; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.yy <<'_ATEOF' +%defines "foo.hpp" +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:90: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o foo.c++ foo.yy " +echo output.at:90 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:90" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:90: bison --xml=xml-tests/test.xml -o foo.c++ foo.yy " +echo output.at:90 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:90" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:90: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:90 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:90" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:90: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:90 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:90" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:90: bison -o foo.c++ foo.yy " +echo output.at:90 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:90" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:90: ls foo.c++ foo.hpp" +echo output.at:90 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.c++ foo.hpp ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.c++ foo.hpp ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:90" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_41 +#AT_START_42 +# 42. output.at:94: Output files: -o foo.c++ --graph=foo.gph +at_setup_line='output.at:94' +at_func_banner 2 +at_desc="Output files: -o foo.c++ --graph=foo.gph " +$at_quiet $as_echo_n " 42: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "42. output.at:94: testing ..." + $at_traceon + +for file in foo.yy foo.c++ foo.gph; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.yy <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:94: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o foo.c++ foo.yy " +echo output.at:94 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:94" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:94: bison --xml=xml-tests/test.xml -o foo.c++ foo.yy " +echo output.at:94 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o foo.c++ foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:94" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:94: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:94 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:94" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:94: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:94 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:94" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:94: bison -o foo.c++ --graph=foo.gph foo.yy " +echo output.at:94 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o foo.c++ --graph=foo.gph foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o foo.c++ --graph=foo.gph foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:94" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:94: ls foo.c++ foo.gph" +echo output.at:94 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.c++ foo.gph ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.c++ foo.gph ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:94" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_42 +#AT_START_43 +# 43. output.at:109: Output files: %skeleton "lalr1.cc" %defines %verbose +at_setup_line='output.at:109' +at_func_banner 2 +at_desc="Output files: %skeleton \"lalr1.cc\" %defines %verbose " +$at_quiet $as_echo_n " 43: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "43. output.at:109: testing ..." + $at_traceon + +for file in foo.yy foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >foo.yy <<'_ATEOF' +%skeleton "lalr1.cc" %defines %verbose +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:109: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.yy " +echo output.at:109 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:109" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:109: bison --xml=xml-tests/test.xml foo.yy " +echo output.at:109 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:109" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:109: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:109 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:109" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:109: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:109 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:109" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:109: bison foo.yy " +echo output.at:109 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:109" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:109: ls foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh" +echo output.at:109 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:109" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_43 +#AT_START_44 +# 44. output.at:112: Output files: %skeleton "lalr1.cc" %defines %verbose +at_setup_line='output.at:112' +at_func_banner 2 +at_desc="Output files: %skeleton \"lalr1.cc\" %defines %verbose " +$at_quiet $as_echo_n " 44: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "44. output.at:112: testing ..." + $at_traceon + +for file in subdir/foo.yy foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >subdir/foo.yy <<'_ATEOF' +%skeleton "lalr1.cc" %defines %verbose +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:112: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot subdir/foo.yy " +echo output.at:112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot subdir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot subdir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:112: bison --xml=xml-tests/test.xml subdir/foo.yy " +echo output.at:112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml subdir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml subdir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:112: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:112: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:112: bison subdir/foo.yy " +echo output.at:112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison subdir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison subdir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:112: ls foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh" +echo output.at:112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + +# Also make sure that the includes do not refer to the subdirectory. +{ $at_traceoff +$as_echo "$at_srcdir/output.at:112: grep 'include .subdir/' foo.tab.cc" +echo output.at:112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep 'include .subdir/' foo.tab.cc ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep 'include .subdir/' foo.tab.cc ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/output.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:112: grep 'include .subdir/' foo.tab.hh" +echo output.at:112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep 'include .subdir/' foo.tab.hh ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep 'include .subdir/' foo.tab.hh ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/output.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_44 +#AT_START_45 +# 45. output.at:116: Output files: %skeleton "lalr1.cc" %defines %verbose -o subdir/foo.cc +at_setup_line='output.at:116' +at_func_banner 2 +at_desc="Output files: %skeleton \"lalr1.cc\" %defines %verbose -o subdir/foo.cc " +$at_quiet $as_echo_n " 45: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "45. output.at:116: testing ..." + $at_traceon + +for file in subdir/foo.yy subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >subdir/foo.yy <<'_ATEOF' +%skeleton "lalr1.cc" %defines %verbose +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:116: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o subdir/foo.cc subdir/foo.yy " +echo output.at:116 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o subdir/foo.cc subdir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o subdir/foo.cc subdir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:116" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:116: bison --xml=xml-tests/test.xml -o subdir/foo.cc subdir/foo.yy " +echo output.at:116 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o subdir/foo.cc subdir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o subdir/foo.cc subdir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:116" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:116: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:116 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:116" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:116: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:116 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:116" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:116: bison -o subdir/foo.cc subdir/foo.yy " +echo output.at:116 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o subdir/foo.cc subdir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o subdir/foo.cc subdir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:116" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:116: ls subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh" +echo output.at:116 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:116" + +$at_failed && at_func_log_failure +$at_traceon; } + +# Also make sure that the includes do not refer to the subdirectory. +{ $at_traceoff +$as_echo "$at_srcdir/output.at:116: grep 'include .subdir/' subdir/foo.cc" +echo output.at:116 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep 'include .subdir/' subdir/foo.cc ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep 'include .subdir/' subdir/foo.cc ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/output.at:116" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:116: grep 'include .subdir/' subdir/foo.hh" +echo output.at:116 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep 'include .subdir/' subdir/foo.hh ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep 'include .subdir/' subdir/foo.hh ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/output.at:116" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_45 +#AT_START_46 +# 46. output.at:121: Output files: %skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo" +at_setup_line='output.at:121' +at_func_banner 2 +at_desc="Output files: %skeleton \"lalr1.cc\" %defines %verbose %file-prefix \"output_dir/foo\" " +$at_quiet $as_echo_n " 46: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "46. output.at:121: testing ..." + $at_traceon + +for file in gram_dir/foo.yy output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/location.hh output_dir/stack.hh output_dir/position.hh; do + case "$file" in + */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;; + esac +done +cat >gram_dir/foo.yy <<'_ATEOF' +%skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo" +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:121: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot gram_dir/foo.yy " +echo output.at:121 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot gram_dir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot gram_dir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:121" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:121: bison --xml=xml-tests/test.xml gram_dir/foo.yy " +echo output.at:121 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml gram_dir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml gram_dir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:121" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:121: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:121 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:121" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:121: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:121 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:121" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:121: bison gram_dir/foo.yy " +echo output.at:121 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison gram_dir/foo.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison gram_dir/foo.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:121" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:121: ls output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/location.hh output_dir/stack.hh output_dir/position.hh" +echo output.at:121 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/location.hh output_dir/stack.hh output_dir/position.hh ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/location.hh output_dir/stack.hh output_dir/position.hh ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:121" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_46 +#AT_START_47 +# 47. output.at:145: Conflicting output files: --graph="foo.tab.c" +at_setup_line='output.at:145' +at_func_banner 2 +at_desc="Conflicting output files: --graph=\"foo.tab.c\"" +$at_quiet $as_echo_n " 47: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "47. output.at:145: testing ..." + $at_traceon + +case "foo.y" in + */*) mkdir `echo "foo.y" | sed 's,/.*,,'`;; +esac +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:145: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.y" +echo output.at:145 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:145: bison --xml=xml-tests/test.xml foo.y" +echo output.at:145 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:145: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:145 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:145: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:145 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:145: bison --graph=\"foo.tab.c\" foo.y" +echo output.at:145 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --graph="foo.tab.c" foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --graph="foo.tab.c" foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "foo.y: warning: conflicting outputs to file \`foo.tab.c' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_47 +#AT_START_48 +# 48. output.at:150: Conflicting output files: %defines "foo.output" -v +at_setup_line='output.at:150' +at_func_banner 2 +at_desc="Conflicting output files: %defines \"foo.output\" -v" +$at_quiet $as_echo_n " 48: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "48. output.at:150: testing ..." + $at_traceon + +case "foo.y" in + */*) mkdir `echo "foo.y" | sed 's,/.*,,'`;; +esac +cat >foo.y <<'_ATEOF' +%defines "foo.output" +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:150: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -v foo.y" +echo output.at:150 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:150" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:150: bison --xml=xml-tests/test.xml -v foo.y" +echo output.at:150 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -v foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -v foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:150" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:150: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:150 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:150" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:150: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:150 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:150" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:150: bison -v foo.y" +echo output.at:150 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "foo.y: warning: conflicting outputs to file \`foo.output' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:150" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_48 +#AT_START_49 +# 49. output.at:155: Conflicting output files: %skeleton "lalr1.cc" %defines --graph="location.hh" +at_setup_line='output.at:155' +at_func_banner 2 +at_desc="Conflicting output files: %skeleton \"lalr1.cc\" %defines --graph=\"location.hh\"" +$at_quiet $as_echo_n " 49: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "49. output.at:155: testing ..." + $at_traceon + +case "foo.y" in + */*) mkdir `echo "foo.y" | sed 's,/.*,,'`;; +esac +cat >foo.y <<'_ATEOF' +%skeleton "lalr1.cc" %defines +%% +foo: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:155: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot foo.y" +echo output.at:155 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:155: bison --xml=xml-tests/test.xml foo.y" +echo output.at:155 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:155: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:155 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:155: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:155 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:155: bison --graph=\"location.hh\" foo.y" +echo output.at:155 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --graph="location.hh" foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --graph="location.hh" foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "foo.y: warning: conflicting outputs to file \`location.hh' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_49 +#AT_START_50 +# 50. output.at:160: Conflicting output files: -o foo.y +at_setup_line='output.at:160' +at_func_banner 2 +at_desc="Conflicting output files: -o foo.y" +$at_quiet $as_echo_n " 50: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "50. output.at:160: testing ..." + $at_traceon + +case "foo.y" in + */*) mkdir `echo "foo.y" | sed 's,/.*,,'`;; +esac +cat >foo.y <<'_ATEOF' + +%% +foo: {}; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:160: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o foo.y foo.y" +echo output.at:160 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o foo.y foo.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o foo.y foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o foo.y foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "foo.y: fatal error: refusing to overwrite the input file \`foo.y' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/output.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_50 +#AT_START_51 +# 51. output.at:200: Output file name: `~!@#$%^&*()-=_+{}[]|\:;<>, .' +at_setup_line='output.at:200' +at_func_banner 2 +at_desc="Output file name: \`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'" +$at_quiet $as_echo_n " 51: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "51. output.at:200: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:200: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --defines=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" glr.y" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:200: bison --xml=xml-tests/test.xml -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --defines=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" glr.y" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:200: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:200: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:200: bison -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --defines=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" glr.y" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; bison -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:200: ls \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\"" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; ls "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:200: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\"" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:200: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --defines=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" cxx.y" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:200: bison --xml=xml-tests/test.xml -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --defines=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" cxx.y" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:200: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:200: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:200: bison -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --defines=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" cxx.y" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; bison -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --defines="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:200: ls \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\"" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; ls "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:200: \$BISON_CXX_WORKS" +echo output.at:200 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:200: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\"" +echo output.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_51 +#AT_START_52 +# 52. output.at:207: Output file name: ( +at_setup_line='output.at:207' +at_func_banner 2 +at_desc="Output file name: (" +$at_quiet $as_echo_n " 52: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "52. output.at:207: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:207: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"(.c\" --defines=\"(.h\" glr.y" +echo output.at:207 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "(.c" --defines="(.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "(.c" --defines="(.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:207: bison --xml=xml-tests/test.xml -o \"(.c\" --defines=\"(.h\" glr.y" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "(.c" --defines="(.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "(.c" --defines="(.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:207: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:207 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:207: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:207 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:207: bison -o \"(.c\" --defines=\"(.h\" glr.y" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "(.c" --defines="(.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "(.c" --defines="(.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:207: ls \"(.c\" \"(.h\"" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "(.c" "(.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "(.c" "(.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:207: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \"(.c\"" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o glr.o -c \"(.c\""; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c "(.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c "(.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:207: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"(.c\" --defines=\"(.h\" cxx.y" +echo output.at:207 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "(.c" --defines="(.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "(.c" --defines="(.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:207: bison --xml=xml-tests/test.xml -o \"(.c\" --defines=\"(.h\" cxx.y" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "(.c" --defines="(.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "(.c" --defines="(.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:207: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:207 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:207: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:207 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:207: bison -o \"(.c\" --defines=\"(.h\" cxx.y" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "(.c" --defines="(.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "(.c" --defines="(.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:207: ls \"(.c\" \"(.h\"" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "(.c" "(.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "(.c" "(.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:207: \$BISON_CXX_WORKS" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:207: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \"(.c\"" +echo output.at:207 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c \"(.c\""; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "(.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "(.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:207" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_52 +#AT_START_53 +# 53. output.at:208: Output file name: ) +at_setup_line='output.at:208' +at_func_banner 2 +at_desc="Output file name: )" +$at_quiet $as_echo_n " 53: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "53. output.at:208: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:208: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \").c\" --defines=\").h\" glr.y" +echo output.at:208 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o ").c" --defines=").h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o ").c" --defines=").h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:208: bison --xml=xml-tests/test.xml -o \").c\" --defines=\").h\" glr.y" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o ").c" --defines=").h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o ").c" --defines=").h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:208: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:208 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:208: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:208 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:208: bison -o \").c\" --defines=\").h\" glr.y" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o ").c" --defines=").h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o ").c" --defines=").h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:208: ls \").c\" \").h\"" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls ").c" ").h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls ").c" ").h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:208: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \").c\"" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o glr.o -c \").c\""; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c ").c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c ").c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:208: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \").c\" --defines=\").h\" cxx.y" +echo output.at:208 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o ").c" --defines=").h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o ").c" --defines=").h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:208: bison --xml=xml-tests/test.xml -o \").c\" --defines=\").h\" cxx.y" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o ").c" --defines=").h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o ").c" --defines=").h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:208: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:208 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:208: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:208 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:208: bison -o \").c\" --defines=\").h\" cxx.y" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o ").c" --defines=").h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o ").c" --defines=").h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:208: ls \").c\" \").h\"" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls ").c" ").h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls ").c" ").h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:208: \$BISON_CXX_WORKS" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:208: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \").c\"" +echo output.at:208 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c \").c\""; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c ").c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c ").c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:208" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_53 +#AT_START_54 +# 54. output.at:209: Output file name: # +at_setup_line='output.at:209' +at_func_banner 2 +at_desc="Output file name: #" +$at_quiet $as_echo_n " 54: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "54. output.at:209: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:209: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"#.c\" --defines=\"#.h\" glr.y" +echo output.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "#.c" --defines="#.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "#.c" --defines="#.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:209: bison --xml=xml-tests/test.xml -o \"#.c\" --defines=\"#.h\" glr.y" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "#.c" --defines="#.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "#.c" --defines="#.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:209: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:209: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:209: bison -o \"#.c\" --defines=\"#.h\" glr.y" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "#.c" --defines="#.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "#.c" --defines="#.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:209: ls \"#.c\" \"#.h\"" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "#.c" "#.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "#.c" "#.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:209: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \"#.c\"" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o glr.o -c \"#.c\""; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c "#.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c "#.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:209: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"#.c\" --defines=\"#.h\" cxx.y" +echo output.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "#.c" --defines="#.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "#.c" --defines="#.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:209: bison --xml=xml-tests/test.xml -o \"#.c\" --defines=\"#.h\" cxx.y" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "#.c" --defines="#.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "#.c" --defines="#.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:209: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:209: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:209: bison -o \"#.c\" --defines=\"#.h\" cxx.y" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "#.c" --defines="#.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "#.c" --defines="#.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:209: ls \"#.c\" \"#.h\"" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "#.c" "#.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "#.c" "#.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:209: \$BISON_CXX_WORKS" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:209: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \"#.c\"" +echo output.at:209 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c \"#.c\""; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "#.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "#.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_54 +#AT_START_55 +# 55. output.at:210: Output file name: @@ +at_setup_line='output.at:210' +at_func_banner 2 +at_desc="Output file name: @@" +$at_quiet $as_echo_n " 55: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "55. output.at:210: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:210: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"@@.c\" --defines=\"@@.h\" glr.y" +echo output.at:210 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@@.c" --defines="@@.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@@.c" --defines="@@.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:210: bison --xml=xml-tests/test.xml -o \"@@.c\" --defines=\"@@.h\" glr.y" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "@@.c" --defines="@@.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "@@.c" --defines="@@.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:210: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:210 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:210: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:210 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:210: bison -o \"@@.c\" --defines=\"@@.h\" glr.y" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "@@.c" --defines="@@.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "@@.c" --defines="@@.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:210: ls \"@@.c\" \"@@.h\"" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "@@.c" "@@.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "@@.c" "@@.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:210: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \"@@.c\"" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o glr.o -c \"@@.c\""; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c "@@.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c "@@.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:210: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"@@.c\" --defines=\"@@.h\" cxx.y" +echo output.at:210 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@@.c" --defines="@@.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@@.c" --defines="@@.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:210: bison --xml=xml-tests/test.xml -o \"@@.c\" --defines=\"@@.h\" cxx.y" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "@@.c" --defines="@@.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "@@.c" --defines="@@.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:210: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:210 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:210: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:210 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:210: bison -o \"@@.c\" --defines=\"@@.h\" cxx.y" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "@@.c" --defines="@@.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "@@.c" --defines="@@.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:210: ls \"@@.c\" \"@@.h\"" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "@@.c" "@@.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "@@.c" "@@.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:210: \$BISON_CXX_WORKS" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:210: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \"@@.c\"" +echo output.at:210 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c \"@@.c\""; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "@@.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "@@.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_55 +#AT_START_56 +# 56. output.at:211: Output file name: @{ +at_setup_line='output.at:211' +at_func_banner 2 +at_desc="Output file name: @{" +$at_quiet $as_echo_n " 56: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "56. output.at:211: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:211: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"@{.c\" --defines=\"@{.h\" glr.y" +echo output.at:211 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@{.c" --defines="@{.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@{.c" --defines="@{.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:211: bison --xml=xml-tests/test.xml -o \"@{.c\" --defines=\"@{.h\" glr.y" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "@{.c" --defines="@{.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "@{.c" --defines="@{.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:211: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:211 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:211: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:211 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:211: bison -o \"@{.c\" --defines=\"@{.h\" glr.y" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "@{.c" --defines="@{.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "@{.c" --defines="@{.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:211: ls \"@{.c\" \"@{.h\"" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "@{.c" "@{.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "@{.c" "@{.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:211: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \"@{.c\"" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o glr.o -c \"@{.c\""; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c "@{.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c "@{.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:211: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"@{.c\" --defines=\"@{.h\" cxx.y" +echo output.at:211 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@{.c" --defines="@{.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@{.c" --defines="@{.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:211: bison --xml=xml-tests/test.xml -o \"@{.c\" --defines=\"@{.h\" cxx.y" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "@{.c" --defines="@{.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "@{.c" --defines="@{.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:211: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:211 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:211: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:211 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:211: bison -o \"@{.c\" --defines=\"@{.h\" cxx.y" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "@{.c" --defines="@{.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "@{.c" --defines="@{.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:211: ls \"@{.c\" \"@{.h\"" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "@{.c" "@{.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "@{.c" "@{.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:211: \$BISON_CXX_WORKS" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:211: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \"@{.c\"" +echo output.at:211 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c \"@{.c\""; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "@{.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "@{.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_56 +#AT_START_57 +# 57. output.at:212: Output file name: @} +at_setup_line='output.at:212' +at_func_banner 2 +at_desc="Output file name: @}" +$at_quiet $as_echo_n " 57: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "57. output.at:212: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:212: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"@}.c\" --defines=\"@}.h\" glr.y" +echo output.at:212 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@}.c" --defines="@}.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@}.c" --defines="@}.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:212: bison --xml=xml-tests/test.xml -o \"@}.c\" --defines=\"@}.h\" glr.y" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "@}.c" --defines="@}.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "@}.c" --defines="@}.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:212: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:212 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:212: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:212 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:212: bison -o \"@}.c\" --defines=\"@}.h\" glr.y" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "@}.c" --defines="@}.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "@}.c" --defines="@}.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:212: ls \"@}.c\" \"@}.h\"" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "@}.c" "@}.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "@}.c" "@}.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:212: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \"@}.c\"" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o glr.o -c \"@}.c\""; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c "@}.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c "@}.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:212: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"@}.c\" --defines=\"@}.h\" cxx.y" +echo output.at:212 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@}.c" --defines="@}.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "@}.c" --defines="@}.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:212: bison --xml=xml-tests/test.xml -o \"@}.c\" --defines=\"@}.h\" cxx.y" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "@}.c" --defines="@}.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "@}.c" --defines="@}.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:212: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:212 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:212: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:212 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:212: bison -o \"@}.c\" --defines=\"@}.h\" cxx.y" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "@}.c" --defines="@}.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "@}.c" --defines="@}.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:212: ls \"@}.c\" \"@}.h\"" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "@}.c" "@}.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "@}.c" "@}.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:212: \$BISON_CXX_WORKS" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:212: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \"@}.c\"" +echo output.at:212 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c \"@}.c\""; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "@}.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "@}.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:212" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_57 +#AT_START_58 +# 58. output.at:213: Output file name: [ +at_setup_line='output.at:213' +at_func_banner 2 +at_desc="Output file name: [" +$at_quiet $as_echo_n " 58: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "58. output.at:213: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:213: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"[.c\" --defines=\"[.h\" glr.y" +echo output.at:213 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "[.c" --defines="[.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "[.c" --defines="[.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:213: bison --xml=xml-tests/test.xml -o \"[.c\" --defines=\"[.h\" glr.y" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "[.c" --defines="[.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "[.c" --defines="[.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:213: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:213 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:213: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:213 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:213: bison -o \"[.c\" --defines=\"[.h\" glr.y" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "[.c" --defines="[.h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "[.c" --defines="[.h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:213: ls \"[.c\" \"[.h\"" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "[.c" "[.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "[.c" "[.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:213: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \"[.c\"" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o glr.o -c \"[.c\""; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c "[.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c "[.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:213: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"[.c\" --defines=\"[.h\" cxx.y" +echo output.at:213 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "[.c" --defines="[.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "[.c" --defines="[.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:213: bison --xml=xml-tests/test.xml -o \"[.c\" --defines=\"[.h\" cxx.y" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "[.c" --defines="[.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "[.c" --defines="[.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:213: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:213 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:213: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:213 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:213: bison -o \"[.c\" --defines=\"[.h\" cxx.y" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "[.c" --defines="[.h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "[.c" --defines="[.h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:213: ls \"[.c\" \"[.h\"" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "[.c" "[.h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "[.c" "[.h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:213: \$BISON_CXX_WORKS" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:213: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \"[.c\"" +echo output.at:213 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c \"[.c\""; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "[.c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "[.c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:213" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_58 +#AT_START_59 +# 59. output.at:214: Output file name: ] +at_setup_line='output.at:214' +at_func_banner 2 +at_desc="Output file name: ]" +$at_quiet $as_echo_n " 59: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "59. output.at:214: testing ..." + $at_traceon + + +cat >glr.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser +%code { + int yylex (void); + void yyerror (const char *); +} +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:214: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"].c\" --defines=\"].h\" glr.y" +echo output.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "].c" --defines="].h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "].c" --defines="].h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:214: bison --xml=xml-tests/test.xml -o \"].c\" --defines=\"].h\" glr.y" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "].c" --defines="].h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "].c" --defines="].h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:214: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:214: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:214: bison -o \"].c\" --defines=\"].h\" glr.y" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "].c" --defines="].h" glr.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "].c" --defines="].h" glr.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:214: ls \"].c\" \"].h\"" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "].c" "].h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "].c" "].h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:214: \$CC \$CFLAGS \$CPPFLAGS -o glr.o -c \"].c\"" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o glr.o -c \"].c\""; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o glr.o -c "].c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o glr.o -c "].c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >cxx.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%skeleton "lalr1.cc" +%code { int yylex (yy::parser::semantic_type*); } +%% +start: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/output.at:214: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o \"].c\" --defines=\"].h\" cxx.y" +echo output.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "].c" --defines="].h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o "].c" --defines="].h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/output.at:214: bison --xml=xml-tests/test.xml -o \"].c\" --defines=\"].h\" cxx.y" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o "].c" --defines="].h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o "].c" --defines="].h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:214: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo output.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/output.at:214: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo output.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/output.at:214: bison -o \"].c\" --defines=\"].h\" cxx.y" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o "].c" --defines="].h" cxx.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o "].c" --defines="].h" cxx.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:214: ls \"].c\" \"].h\"" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ls "].c" "].h" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ls "].c" "].h" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:214: \$BISON_CXX_WORKS" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/output.at:214: \$CXX \$CXXFLAGS \$CPPFLAGS -o cxx.o -c \"].c\"" +echo output.at:214 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c \"].c\""; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "].c" ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS -o cxx.o -c "].c" ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/output.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_59 +#AT_START_60 +# 60. skeletons.at:23: Relative skeleton file names +at_setup_line='skeletons.at:23' +at_func_banner 3 +at_desc="Relative skeleton file names" +$at_quiet $as_echo_n " 60: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "60. skeletons.at:23: testing ..." + $at_traceon + + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:25: mkdir tmp" +echo skeletons.at:25 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; mkdir tmp ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; mkdir tmp ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:25" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >tmp/skel.c <<'_ATEOF' +m4_divert_push(0)dnl +@output(b4_parser_file_name@)dnl +b4_percent_define_get([[test]]) +m4_divert_pop(0) +_ATEOF + + +cat >skel.c <<'_ATEOF' +m4_divert_push(0)dnl +@output(b4_parser_file_name@)dnl +b4_percent_define_get([[test]]) -- Local +m4_divert_pop(0) +_ATEOF + + +cat >tmp/input-gram.y <<'_ATEOF' +%skeleton "./skel.c" +%define test "Hello World" +%% +start: ; +_ATEOF + + +cat >input-gram.y <<'_ATEOF' +%skeleton "./skel.c" +%define test "Hello World" +%% +start: ; +_ATEOF + + +cat >tmp/input-cmd-line.y <<'_ATEOF' +%define test "Hello World" +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:61: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot tmp/input-gram.y" +echo skeletons.at:61 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot tmp/input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot tmp/input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:61" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:61: bison --xml=xml-tests/test.xml tmp/input-gram.y" +echo skeletons.at:61 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml tmp/input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml tmp/input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:61" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:61: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo skeletons.at:61 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:61" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:61: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo skeletons.at:61 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:61" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:61: bison tmp/input-gram.y" +echo skeletons.at:61 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison tmp/input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison tmp/input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:61" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:62: cat input-gram.tab.c" +echo skeletons.at:62 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input-gram.tab.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input-gram.tab.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Hello World +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:62" + +$at_failed && at_func_log_failure +$at_traceon; } + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:66: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input-gram.y" +echo skeletons.at:66 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:66" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:66: bison --xml=xml-tests/test.xml input-gram.y" +echo skeletons.at:66 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:66" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:66: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo skeletons.at:66 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:66" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:66: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo skeletons.at:66 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:66" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:66: bison input-gram.y" +echo skeletons.at:66 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:66" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:67: cat input-gram.tab.c" +echo skeletons.at:67 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input-gram.tab.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input-gram.tab.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Hello World -- Local +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:67" + +$at_failed && at_func_log_failure +$at_traceon; } + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:71: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --skeleton=tmp/skel.c tmp/input-cmd-line.y" +echo skeletons.at:71 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:71: bison --xml=xml-tests/test.xml --skeleton=tmp/skel.c tmp/input-cmd-line.y" +echo skeletons.at:71 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:71: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo skeletons.at:71 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:71: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo skeletons.at:71 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:71: bison --skeleton=tmp/skel.c tmp/input-cmd-line.y" +echo skeletons.at:71 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:72: cat input-cmd-line.tab.c" +echo skeletons.at:72 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input-cmd-line.tab.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input-cmd-line.tab.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Hello World +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:72" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_60 +#AT_START_61 +# 61. skeletons.at:83: Installed skeleton file names +at_setup_line='skeletons.at:83' +at_func_banner 3 +at_desc="Installed skeleton file names" +$at_quiet $as_echo_n " 61: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "61. skeletons.at:83: testing ..." + $at_traceon + + + + +cat >input-cmd-line.y <<'_ATEOF' +%{ + #include + void yyerror (char const *msg); + int yylex (void); +%} + +%error-verbose +%token 'a' + +%% + +start: ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +yylex (void) +{ + return 'a'; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + +cat >input-gram.y <<'_ATEOF' +%skeleton "yacc.c" +%{ + #include + void yyerror (char const *msg); + int yylex (void); +%} + +%error-verbose +%token 'a' + +%% + +start: ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +yylex (void) +{ + return 'a'; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:127: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y" +echo skeletons.at:127 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:127" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:127: bison --xml=xml-tests/test.xml --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y" +echo skeletons.at:127 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:127" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:127: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo skeletons.at:127 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:127" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:127: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo skeletons.at:127 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:127" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:127: bison --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y" +echo skeletons.at:127 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:127" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:128: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input-cmd-line input-cmd-line.c \$LIBS" +echo skeletons.at:128 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-cmd-line input-cmd-line.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-cmd-line input-cmd-line.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-cmd-line input-cmd-line.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:128" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:129: \$PREPARSER ./input-cmd-line" +echo skeletons.at:129 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input-cmd-line"; then + ( $at_traceon; $PREPARSER ./input-cmd-line ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input-cmd-line ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected 'a', expecting \$end +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:129" + +$at_failed && at_func_log_failure +$at_traceon; } + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:133: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input-gram.c input-gram.y" +echo skeletons.at:133 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input-gram.c input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input-gram.c input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:133" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:133: bison --xml=xml-tests/test.xml -o input-gram.c input-gram.y" +echo skeletons.at:133 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input-gram.c input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input-gram.c input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:133" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:133: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo skeletons.at:133 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:133" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/skeletons.at:133: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo skeletons.at:133 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:133" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:133: bison -o input-gram.c input-gram.y" +echo skeletons.at:133 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input-gram.c input-gram.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input-gram.c input-gram.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:133" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:134: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input-gram input-gram.c \$LIBS" +echo skeletons.at:134 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-gram input-gram.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-gram input-gram.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-gram input-gram.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/skeletons.at:134" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:135: \$PREPARSER ./input-gram" +echo skeletons.at:135 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input-gram"; then + ( $at_traceon; $PREPARSER ./input-gram ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input-gram ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected 'a', expecting \$end +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:135" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_61 +#AT_START_62 +# 62. skeletons.at:148: %define Boolean variables: invalid skeleton defaults +at_setup_line='skeletons.at:148' +at_func_banner 3 +at_desc="%define Boolean variables: invalid skeleton defaults" +$at_quiet $as_echo_n " 62: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "62. skeletons.at:148: testing ..." + $at_traceon + + +cat >skel.c <<'_ATEOF' +b4_percent_define_default([[foo]], [[bogus value]]) +b4_percent_define_flag_if([[foo]]) +_ATEOF + + +cat >input.y <<'_ATEOF' +%skeleton "./skel.c" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:161: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo skeletons.at:161 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "[Bison:b4_percent_define_default]:1.0: invalid value for %define Boolean variable \`foo' +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_62 +#AT_START_63 +# 63. skeletons.at:172: Complaining during macro argument expansion +at_setup_line='skeletons.at:172' +at_func_banner 3 +at_desc="Complaining during macro argument expansion" +$at_quiet $as_echo_n " 63: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "63. skeletons.at:172: testing ..." + $at_traceon + + +cat >skel1.c <<'_ATEOF' +m4_define([foow], [b4_warn([[foow fubar]])]) +m4_define([foowat], [b4_warn_at([[foow.y:2.3]], + [[foow.y:5.4]], [[foowat fubar]])]) +m4_define([fooc], [b4_complain([[fooc fubar]])]) +m4_define([foocat], [b4_complain_at([[fooc.y:1.1]], + [[fooc.y:10.6]], [[foocat fubar]])]) +m4_define([foof], [b4_fatal([[foof fubar]])]) +m4_if(foow, [1], [yes]) +m4_if(foowat, [1], [yes]) +m4_if(fooc, [1], [yes]) +m4_if(foocat, [1], [yes]) +m4_if(foof, [1], [yes]) +_ATEOF + + +cat >input1.y <<'_ATEOF' +%skeleton "./skel1.c" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:195: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input1.y" +echo skeletons.at:195 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input1.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input1.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input1.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input1.y: warning: foow fubar +foow.y:2.3-5.3: warning: foowat fubar +input1.y: fooc fubar +fooc.y:1.1-10.5: foocat fubar +input1.y: fatal error: foof fubar +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:195" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >skel2.c <<'_ATEOF' +m4_define([foofat], [b4_fatal_at([[foof.y:12.11]], + [[foof.y:100.123]], [[foofat fubar]])]) +m4_if(foofat, [1], [yes]) +_ATEOF + + +cat >input2.y <<'_ATEOF' +%skeleton "./skel2.c" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:215: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input2.y" +echo skeletons.at:215 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input2.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "foof.y:12.11-100.122: fatal error: foofat fubar +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:215" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >skel3.c <<'_ATEOF' +b4_complain_at(b4_percent_define_get_loc([[bogus]]), [[bad value]]) +_ATEOF + + +cat >input3.y <<'_ATEOF' +%skeleton "./skel3.c" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:229: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input3.y" +echo skeletons.at:229 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input3.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input3.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input3.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input3.y: fatal error: undefined %define variable \`bogus' passed to b4_percent_define_get_loc +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:229" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >skel4.c <<'_ATEOF' +b4_warn_at(b4_percent_define_get_syncline([[bogus]]), [[bad value]]) +_ATEOF + + +cat >input4.y <<'_ATEOF' +%skeleton "./skel4.c" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:243: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input4.y" +echo skeletons.at:243 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input4.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input4.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input4.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input4.y: fatal error: undefined %define variable \`bogus' passed to b4_percent_define_get_syncline +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:243" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_63 +#AT_START_64 +# 64. skeletons.at:254: Fatal errors make M4 exit immediately +at_setup_line='skeletons.at:254' +at_func_banner 3 +at_desc="Fatal errors make M4 exit immediately" +$at_quiet $as_echo_n " 64: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "64. skeletons.at:254: testing ..." + $at_traceon + + +cat >skel1.c <<'_ATEOF' +b4_complain([[non-fatal error]]) +b4_fatal([[M4 should exit immediately here]]) +m4_fatal([this should never be evaluated]) +_ATEOF + + +cat >input1.y <<'_ATEOF' +%skeleton "./skel1.c" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:268: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input1.y" +echo skeletons.at:268 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input1.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input1.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input1.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input1.y: non-fatal error +input1.y: fatal error: M4 should exit immediately here +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:268" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >skel2.c <<'_ATEOF' +b4_warn([[morning]]) +b4_fatal_at([[foo.y:1.5]], [[foo.y:1.7]], [[M4 should exit immediately here]]) +m4_fatal([this should never be evaluated]) +_ATEOF + + +cat >input2.y <<'_ATEOF' +%skeleton "./skel2.c" +%% +start: ; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/skeletons.at:285: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input2.y" +echo skeletons.at:285 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input2.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input2.y: warning: morning +foo.y:1.5-6: fatal error: M4 should exit immediately here +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/skeletons.at:285" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_64 +#AT_START_65 +# 65. sets.at:64: Nullable +at_setup_line='sets.at:64' +at_func_banner 4 +at_desc="Nullable" +$at_quiet $as_echo_n " 65: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "65. sets.at:64: testing ..." + $at_traceon + + +# At some point, nullable had been smoking grass, and managed to say: +# +# Entering set_nullable +# NULLABLE +# 'e': yes +# (null): no +# ... + +cat >input.y <<'_ATEOF' +%% +e: 'e' | /* Nothing */; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/sets.at:79: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --trace=sets input.y" +echo sets.at:79 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:79" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/sets.at:79: bison --xml=xml-tests/test.xml --trace=sets input.y" +echo sets.at:79 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:79" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/sets.at:79: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo sets.at:79 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:79" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/sets.at:79: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo sets.at:79 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:79" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:79: bison --trace=sets input.y" +echo sets.at:79 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:79" + +$at_failed && at_func_log_failure +$at_traceon; } + +cat >extract.sed <<'_ATEOF' +#n +/^NULLABLE$/ { + :null + p + n + /^[ ]*$/ !b null +} +/^FIRSTS$/ { + :firsts + p + n + /^[ ]*$/ !b firsts +} +/^FDERIVES$/ { + :fderiv + p + n + /^[ ]*$/ !b fderiv +} +/^DERIVES$/ { + :deriv + p + n + /^[ ]*$/ !b deriv +} +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:80: sed -f extract.sed stderr" +echo sets.at:80 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; sed -f extract.sed stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -f extract.sed stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:80" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:80: mv stdout sets" +echo sets.at:80 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; mv stdout sets ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; mv stdout sets ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:80" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:81: cat sets" +echo sets.at:81 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat sets ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat sets ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "DERIVES + \$accept derives + 0 e \$end + e derives + 1 'e' + 2 /* empty */ +NULLABLE + \$accept: no + e: yes +FIRSTS + \$accept firsts + \$accept + e + e firsts + e +FDERIVES + \$accept derives + 0 e \$end + 1 'e' + 2 /* empty */ + e derives + 1 'e' + 2 /* empty */ +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:81" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_65 +#AT_START_66 +# 66. sets.at:149: Broken Closure +at_setup_line='sets.at:149' +at_func_banner 4 +at_desc="Broken Closure" +$at_quiet $as_echo_n " 66: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "66. sets.at:149: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%% +a: b; +b: c; +c: d; +d: e; +e: f; +f: g; +g: h; +h: 'h'; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/sets.at:163: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --trace=sets input.y" +echo sets.at:163 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/sets.at:163: bison --xml=xml-tests/test.xml --trace=sets input.y" +echo sets.at:163 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/sets.at:163: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo sets.at:163 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/sets.at:163: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo sets.at:163 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:163: bison --trace=sets input.y" +echo sets.at:163 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:163" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:165: sed -n 's/[ ]*\$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr" +echo sets.at:165 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr"; then + ( $at_traceon; sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "RTC: Firsts Output BEGIN + + 012345678 + .---------. + 0|111111111| + 1| 11111111| + 2| 1111111| + 3| 111111| + 4| 11111| + 5| 1111| + 6| 111| + 7| 11| + 8| 1| + \`---------' +RTC: Firsts Output END +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:165" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_66 +#AT_START_67 +# 67. sets.at:191: Firsts +at_setup_line='sets.at:191' +at_func_banner 4 +at_desc="Firsts" +$at_quiet $as_echo_n " 67: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "67. sets.at:191: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%nonassoc '<' '>' +%left '+' '-' +%right '^' '=' +%% +exp: + exp '<' exp + | exp '>' exp + | exp '+' exp + | exp '-' exp + | exp '^' exp + | exp '=' exp + | "exp" + ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/sets.at:209: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --trace=sets input.y" +echo sets.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/sets.at:209: bison --xml=xml-tests/test.xml --trace=sets input.y" +echo sets.at:209 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/sets.at:209: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo sets.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/sets.at:209: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo sets.at:209 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:209: bison --trace=sets input.y" +echo sets.at:209 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --trace=sets input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --trace=sets input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:209" + +$at_failed && at_func_log_failure +$at_traceon; } + +cat >extract.sed <<'_ATEOF' +#n +/^NULLABLE$/ { + :null + p + n + /^[ ]*$/ !b null +} +/^FIRSTS$/ { + :firsts + p + n + /^[ ]*$/ !b firsts +} +/^FDERIVES$/ { + :fderiv + p + n + /^[ ]*$/ !b fderiv +} +/^DERIVES$/ { + :deriv + p + n + /^[ ]*$/ !b deriv +} +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:210: sed -f extract.sed stderr" +echo sets.at:210 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; sed -f extract.sed stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -f extract.sed stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:210: mv stdout sets" +echo sets.at:210 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; mv stdout sets ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; mv stdout sets ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:210" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:211: cat sets" +echo sets.at:211 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat sets ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat sets ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "DERIVES + \$accept derives + 0 exp \$end + exp derives + 1 exp '<' exp + 2 exp '>' exp + 3 exp '+' exp + 4 exp '-' exp + 5 exp '^' exp + 6 exp '=' exp + 7 \"exp\" +NULLABLE + \$accept: no + exp: no +FIRSTS + \$accept firsts + \$accept + exp + exp firsts + exp +FDERIVES + \$accept derives + 0 exp \$end + 1 exp '<' exp + 2 exp '>' exp + 3 exp '+' exp + 4 exp '-' exp + 5 exp '^' exp + 6 exp '=' exp + 7 \"exp\" + exp derives + 1 exp '<' exp + 2 exp '>' exp + 3 exp '+' exp + 4 exp '-' exp + 5 exp '^' exp + 6 exp '=' exp + 7 \"exp\" +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:211" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_67 +#AT_START_68 +# 68. sets.at:267: Accept +at_setup_line='sets.at:267' +at_func_banner 4 +at_desc="Accept" +$at_quiet $as_echo_n " 68: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "68. sets.at:267: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%token END 0 +%% +input: + 'a' +| '(' input ')' +| '(' error END +; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/sets.at:279: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -v -o input.c input.y" +echo sets.at:279 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:279" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/sets.at:279: bison --xml=xml-tests/test.xml -v -o input.c input.y" +echo sets.at:279 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:279" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/sets.at:279: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo sets.at:279 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:279" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/sets.at:279: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo sets.at:279 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:279" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:279: bison -v -o input.c input.y" +echo sets.at:279 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:279" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Get the final state in the parser. +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:282: sed -n 's/.*define YYFINAL *\\([0-9][0-9]*\\)/final state \\1/p' input.c" +echo sets.at:282 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; sed -n 's/.*define YYFINAL *\([0-9][0-9]*\)/final state \1/p' input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n 's/.*define YYFINAL *\([0-9][0-9]*\)/final state \1/p' input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/sets.at:282" + +$at_failed && at_func_log_failure +$at_traceon; } + +mv stdout expout + +# Get the final state in the report, from the "accept" action.. +{ $at_traceoff +$as_echo "$at_srcdir/sets.at:287: sed -n ' + /^state \\(.*\\)/{ + s//final state \\1/ + x + } + / accept/{ + x + p + q + } + ' input.output" +echo sets.at:287 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; sed -n ' + /^state \(.*\)/{ + s//final state \1/ + x + } + / accept/{ + x + p + q + } + ' input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n ' + /^state \(.*\)/{ + s//final state \1/ + x + } + / accept/{ + x + p + q + } + ' input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/sets.at:287" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_68 +#AT_START_69 +# 69. reduce.at:24: Useless Terminals +at_setup_line='reduce.at:24' +at_func_banner 5 +at_desc="Useless Terminals" +$at_quiet $as_echo_n " 69: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "69. reduce.at:24: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%verbose +%output "input.c" + +%token useless1 +%token useless2 +%token useless3 +%token useless4 +%token useless5 +%token useless6 +%token useless7 +%token useless8 +%token useless9 + +%token useful +%% +exp: useful; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:45: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo reduce.at:45 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:45: bison --xml=xml-tests/test.xml input.y" +echo reduce.at:45 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:45: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo reduce.at:45 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:45: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo reduce.at:45 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:45: bison input.y" +echo reduce.at:45 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:45" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:47: sed -n '/^Grammar/q;/^\$/!p' input.output" +echo reduce.at:47 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -n '/^Grammar/q;/^$/!p' input.output"; then + ( $at_traceon; sed -n '/^Grammar/q;/^$/!p' input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n '/^Grammar/q;/^$/!p' input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Terminals unused in grammar + useless1 + useless2 + useless3 + useless4 + useless5 + useless6 + useless7 + useless8 + useless9 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:47" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_69 +#AT_START_70 +# 70. reduce.at:68: Useless Nonterminals +at_setup_line='reduce.at:68' +at_func_banner 5 +at_desc="Useless Nonterminals" +$at_quiet $as_echo_n " 70: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "70. reduce.at:68: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%verbose +%output "input.c" + +%nterm useless1 +%nterm useless2 +%nterm useless3 +%nterm useless4 +%nterm useless5 +%nterm useless6 +%nterm useless7 +%nterm useless8 +%nterm useless9 + +%token useful +%% +exp: useful; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:89: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo reduce.at:89 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:89" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:89: bison --xml=xml-tests/test.xml input.y" +echo reduce.at:89 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:89" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:89: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo reduce.at:89 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:89" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:89: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo reduce.at:89 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:89" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:89: bison input.y" +echo reduce.at:89 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: warning: 9 nonterminals useless in grammar +input.y:4.8-15: warning: nonterminal useless in grammar: useless1 +input.y:5.8-15: warning: nonterminal useless in grammar: useless2 +input.y:6.8-15: warning: nonterminal useless in grammar: useless3 +input.y:7.8-15: warning: nonterminal useless in grammar: useless4 +input.y:8.8-15: warning: nonterminal useless in grammar: useless5 +input.y:9.8-15: warning: nonterminal useless in grammar: useless6 +input.y:10.8-15: warning: nonterminal useless in grammar: useless7 +input.y:11.8-15: warning: nonterminal useless in grammar: useless8 +input.y:12.8-15: warning: nonterminal useless in grammar: useless9 +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:89" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:102: sed -n '/^Grammar/q;/^\$/!p' input.output" +echo reduce.at:102 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -n '/^Grammar/q;/^$/!p' input.output"; then + ( $at_traceon; sed -n '/^Grammar/q;/^$/!p' input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n '/^Grammar/q;/^$/!p' input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Nonterminals useless in grammar + useless1 + useless2 + useless3 + useless4 + useless5 + useless6 + useless7 + useless8 + useless9 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:102" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_70 +#AT_START_71 +# 71. reduce.at:123: Useless Rules +at_setup_line='reduce.at:123' +at_func_banner 5 +at_desc="Useless Rules" +$at_quiet $as_echo_n " 71: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "71. reduce.at:123: testing ..." + $at_traceon + + + + +cat >input.y <<'_ATEOF' +%verbose +%output "input.c" +%token useful +%% +exp: useful; +useless1: '1'; +useless2: '2'; +useless3: '3'; +useless4: '4'; +useless5: '5'; +useless6: '6'; +useless7: '7'; +useless8: '8'; +useless9: '9'; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:144: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo reduce.at:144 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:144: bison --xml=xml-tests/test.xml input.y" +echo reduce.at:144 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:144: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo reduce.at:144 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:144: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo reduce.at:144 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:144: bison input.y" +echo reduce.at:144 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: warning: 9 nonterminals useless in grammar +input.y: warning: 9 rules useless in grammar +input.y:6.1-8: warning: nonterminal useless in grammar: useless1 +input.y:7.1-8: warning: nonterminal useless in grammar: useless2 +input.y:8.1-8: warning: nonterminal useless in grammar: useless3 +input.y:9.1-8: warning: nonterminal useless in grammar: useless4 +input.y:10.1-8: warning: nonterminal useless in grammar: useless5 +input.y:11.1-8: warning: nonterminal useless in grammar: useless6 +input.y:12.1-8: warning: nonterminal useless in grammar: useless7 +input.y:13.1-8: warning: nonterminal useless in grammar: useless8 +input.y:14.1-8: warning: nonterminal useless in grammar: useless9 +input.y:6.11-13: warning: rule useless in grammar: useless1: '1' +input.y:7.11-13: warning: rule useless in grammar: useless2: '2' +input.y:8.11-13: warning: rule useless in grammar: useless3: '3' +input.y:9.11-13: warning: rule useless in grammar: useless4: '4' +input.y:10.11-13: warning: rule useless in grammar: useless5: '5' +input.y:11.11-13: warning: rule useless in grammar: useless6: '6' +input.y:12.11-13: warning: rule useless in grammar: useless7: '7' +input.y:13.11-13: warning: rule useless in grammar: useless8: '8' +input.y:14.11-13: warning: rule useless in grammar: useless9: '9' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:167: sed -n '/^Grammar/q;/^\$/!p' input.output" +echo reduce.at:167 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -n '/^Grammar/q;/^$/!p' input.output"; then + ( $at_traceon; sed -n '/^Grammar/q;/^$/!p' input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n '/^Grammar/q;/^$/!p' input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Nonterminals useless in grammar + useless1 + useless2 + useless3 + useless4 + useless5 + useless6 + useless7 + useless8 + useless9 +Terminals unused in grammar + '1' + '2' + '3' + '4' + '5' + '6' + '7' + '8' + '9' +Rules useless in grammar + 2 useless1: '1' + 3 useless2: '2' + 4 useless3: '3' + 5 useless4: '4' + 6 useless5: '5' + 7 useless6: '6' + 8 useless7: '7' + 9 useless8: '8' + 10 useless9: '9' +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_71 +#AT_START_72 +# 72. reduce.at:211: Reduced Automaton +at_setup_line='reduce.at:211' +at_func_banner 5 +at_desc="Reduced Automaton" +$at_quiet $as_echo_n " 72: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "72. reduce.at:211: testing ..." + $at_traceon + + + + +# The non reduced grammar. +# ------------------------ +cat >not-reduced.y <<'_ATEOF' +/* A useless token. */ +%token useless_token +/* A useful one. */ +%token useful +%verbose +%output "not-reduced.c" + +%% + +exp: useful { /* A useful action. */ } + | non_productive { /* A non productive action. */ } + ; + +not_reachable: useful { /* A not reachable action. */ } + ; + +non_productive: non_productive useless_token + { /* Another non productive action. */ } + ; +%% +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:240: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot not-reduced.y" +echo reduce.at:240 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot not-reduced.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot not-reduced.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:240" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:240: bison --xml=xml-tests/test.xml not-reduced.y" +echo reduce.at:240 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml not-reduced.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml not-reduced.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:240" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:240: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo reduce.at:240 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:240" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:240: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo reduce.at:240 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:240" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:240: bison not-reduced.y" +echo reduce.at:240 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison not-reduced.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison not-reduced.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "not-reduced.y: warning: 2 nonterminals useless in grammar +not-reduced.y: warning: 3 rules useless in grammar +not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable +not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive +not-reduced.y:11.6-57: warning: rule useless in grammar: exp: non_productive +not-reduced.y:14.16-56: warning: rule useless in grammar: not_reachable: useful +not-reduced.y:17.17-18.63: warning: rule useless in grammar: non_productive: non_productive useless_token +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:240" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:250: sed -n '/^Grammar/q;/^\$/!p' not-reduced.output" +echo reduce.at:250 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -n '/^Grammar/q;/^$/!p' not-reduced.output"; then + ( $at_traceon; sed -n '/^Grammar/q;/^$/!p' not-reduced.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n '/^Grammar/q;/^$/!p' not-reduced.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Nonterminals useless in grammar + not_reachable + non_productive +Terminals unused in grammar + useless_token +Rules useless in grammar + 2 exp: non_productive + 3 not_reachable: useful + 4 non_productive: non_productive useless_token +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:250" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# The reduced grammar. +# -------------------- +cat >reduced.y <<'_ATEOF' +/* A useless token. */ +%token useless_token +/* A useful one. */ +%token useful +%verbose +%output "reduced.c" + +%% + +exp: useful { /* A useful action. */ } +// | non_productive { /* A non productive action. */ } */ + ; + +//not_reachable: useful { /* A not reachable action. */ } +// ; + +//non_productive: non_productive useless_token +// { /* Another non productive action. */ } +// ; +%% +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:287: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot reduced.y" +echo reduce.at:287 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot reduced.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot reduced.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:287" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:287: bison --xml=xml-tests/test.xml reduced.y" +echo reduce.at:287 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml reduced.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml reduced.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:287" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:287: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo reduce.at:287 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:287" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:287: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo reduce.at:287 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:287" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:287: bison reduced.y" +echo reduce.at:287 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison reduced.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison reduced.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:287" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Comparing the parsers. +cp reduced.c expout +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:291: sed 's/not-reduced/reduced/g' not-reduced.c" +echo reduce.at:291 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; sed 's/not-reduced/reduced/g' not-reduced.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed 's/not-reduced/reduced/g' not-reduced.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:291" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_72 +#AT_START_73 +# 73. reduce.at:301: Underivable Rules +at_setup_line='reduce.at:301' +at_func_banner 5 +at_desc="Underivable Rules" +$at_quiet $as_echo_n " 73: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "73. reduce.at:301: testing ..." + $at_traceon + + + + +cat >input.y <<'_ATEOF' +%verbose +%output "input.c" +%token useful +%% +exp: useful | underivable; +underivable: indirection; +indirection: underivable; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:315: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo reduce.at:315 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:315" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:315: bison --xml=xml-tests/test.xml input.y" +echo reduce.at:315 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:315" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:315: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo reduce.at:315 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:315" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/reduce.at:315: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo reduce.at:315 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:315" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:315: bison input.y" +echo reduce.at:315 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: warning: 2 nonterminals useless in grammar +input.y: warning: 3 rules useless in grammar +input.y:5.15-25: warning: nonterminal useless in grammar: underivable +input.y:6.14-24: warning: nonterminal useless in grammar: indirection +input.y:5.15-25: warning: rule useless in grammar: exp: underivable +input.y:6.14-24: warning: rule useless in grammar: underivable: indirection +input.y:7.14-24: warning: rule useless in grammar: indirection: underivable +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:315" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:325: sed -n '/^Grammar/q;/^\$/!p' input.output" +echo reduce.at:325 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -n '/^Grammar/q;/^$/!p' input.output"; then + ( $at_traceon; sed -n '/^Grammar/q;/^$/!p' input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n '/^Grammar/q;/^$/!p' input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Nonterminals useless in grammar + underivable + indirection +Rules useless in grammar + 2 exp: underivable + 3 underivable: indirection + 4 indirection: underivable +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/reduce.at:325" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_73 +#AT_START_74 +# 74. reduce.at:343: Empty Language +at_setup_line='reduce.at:343' +at_func_banner 5 +at_desc="Empty Language" +$at_quiet $as_echo_n " 74: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "74. reduce.at:343: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%output "input.c" +%% +exp: exp; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/reduce.at:351: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo reduce.at:351 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: warning: 2 nonterminals useless in grammar +input.y: warning: 2 rules useless in grammar +input.y:3.1-3: fatal error: start symbol exp does not derive any sentence +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/reduce.at:351" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_74 +#AT_START_75 +# 75. synclines.at:83: Prologue synch line +at_setup_line='synclines.at:83' +at_func_banner 6 +at_desc="Prologue synch line" +$at_quiet $as_echo_n " 75: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "75. synclines.at:83: testing ..." + $at_traceon + + +# It seems impossible to find a generic scheme to check the location +# of an error. Even requiring GCC is not sufficient, since for instance +# the version modified by Apple: +# +# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs +# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 +# | 19991024 (release) configure:2124: $? = 0 +# +# instead of: +# +# | input.y:2: #error "2" +# +# it reports: +# +# | input.y:2: "2" +# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode + +cat >syncline.c <<'_ATEOF' +#error "1" +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" +echo synclines.at:83 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c syncline.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:83 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" +echo synclines.at:83 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input.y <<'_ATEOF' +%{ +#error "2" +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: '0'; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo synclines.at:83 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: bison --xml=xml-tests/test.xml -o input.c input.y" +echo synclines.at:83 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo synclines.at:83 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo synclines.at:83 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: bison -o input.c input.y" +echo synclines.at:83 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: \$CC \$CFLAGS \$CPPFLAGS -c input.c" +echo synclines.at:83 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:83 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:83: cat stdout" +echo synclines.at:83 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stdout ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stdout ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "input.y:2: #error \"2\" +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:83" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_75 +#AT_START_76 +# 76. synclines.at:100: %union synch line +at_setup_line='synclines.at:100' +at_func_banner 6 +at_desc="%union synch line" +$at_quiet $as_echo_n " 76: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "76. synclines.at:100: testing ..." + $at_traceon + + +# It seems impossible to find a generic scheme to check the location +# of an error. Even requiring GCC is not sufficient, since for instance +# the version modified by Apple: +# +# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs +# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 +# | 19991024 (release) configure:2124: $? = 0 +# +# instead of: +# +# | input.y:2: #error "2" +# +# it reports: +# +# | input.y:2: "2" +# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode + +cat >syncline.c <<'_ATEOF' +#error "1" +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" +echo synclines.at:100 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c syncline.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:100 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" +echo synclines.at:100 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input.y <<'_ATEOF' +%union { +#error "2" + char dummy; +} +%{ +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: '0'; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo synclines.at:100 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: bison --xml=xml-tests/test.xml -o input.c input.y" +echo synclines.at:100 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo synclines.at:100 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo synclines.at:100 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: bison -o input.c input.y" +echo synclines.at:100 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: \$CC \$CFLAGS \$CPPFLAGS -c input.c" +echo synclines.at:100 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:100 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:100: cat stdout" +echo synclines.at:100 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stdout ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stdout ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "input.y:2: #error \"2\" +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_76 +#AT_START_77 +# 77. synclines.at:120: Postprologue synch line +at_setup_line='synclines.at:120' +at_func_banner 6 +at_desc="Postprologue synch line" +$at_quiet $as_echo_n " 77: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "77. synclines.at:120: testing ..." + $at_traceon + + +# It seems impossible to find a generic scheme to check the location +# of an error. Even requiring GCC is not sufficient, since for instance +# the version modified by Apple: +# +# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs +# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 +# | 19991024 (release) configure:2124: $? = 0 +# +# instead of: +# +# | input.y:2: #error "2" +# +# it reports: +# +# | input.y:2: "2" +# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode + +cat >syncline.c <<'_ATEOF' +#error "1" +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" +echo synclines.at:120 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c syncline.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:120 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" +echo synclines.at:120 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input.y <<'_ATEOF' +%{ +void yyerror (const char *s); +int yylex (void); +%} +%union +{ + int ival; +} +%{ +#error "10" +%} +%% +exp: '0'; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo synclines.at:120 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: bison --xml=xml-tests/test.xml -o input.c input.y" +echo synclines.at:120 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo synclines.at:120 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo synclines.at:120 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: bison -o input.c input.y" +echo synclines.at:120 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: \$CC \$CFLAGS \$CPPFLAGS -c input.c" +echo synclines.at:120 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:120 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:120: cat stdout" +echo synclines.at:120 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stdout ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stdout ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "input.y:10: #error \"10\" +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:120" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_77 +#AT_START_78 +# 78. synclines.at:143: Action synch line +at_setup_line='synclines.at:143' +at_func_banner 6 +at_desc="Action synch line" +$at_quiet $as_echo_n " 78: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "78. synclines.at:143: testing ..." + $at_traceon + + +# It seems impossible to find a generic scheme to check the location +# of an error. Even requiring GCC is not sufficient, since for instance +# the version modified by Apple: +# +# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs +# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 +# | 19991024 (release) configure:2124: $? = 0 +# +# instead of: +# +# | input.y:2: #error "2" +# +# it reports: +# +# | input.y:2: "2" +# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode + +cat >syncline.c <<'_ATEOF' +#error "1" +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" +echo synclines.at:143 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c syncline.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:143 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" +echo synclines.at:143 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input.y <<'_ATEOF' +%{ +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: +{ +#error "8" +}; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo synclines.at:143 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: bison --xml=xml-tests/test.xml -o input.c input.y" +echo synclines.at:143 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo synclines.at:143 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo synclines.at:143 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: bison -o input.c input.y" +echo synclines.at:143 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: \$CC \$CFLAGS \$CPPFLAGS -c input.c" +echo synclines.at:143 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:143 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:143: cat stdout" +echo synclines.at:143 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stdout ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stdout ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "input.y:8: #error \"8\" +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:143" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_78 +#AT_START_79 +# 79. synclines.at:162: Epilogue synch line +at_setup_line='synclines.at:162' +at_func_banner 6 +at_desc="Epilogue synch line" +$at_quiet $as_echo_n " 79: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "79. synclines.at:162: testing ..." + $at_traceon + + +# It seems impossible to find a generic scheme to check the location +# of an error. Even requiring GCC is not sufficient, since for instance +# the version modified by Apple: +# +# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs +# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 +# | 19991024 (release) configure:2124: $? = 0 +# +# instead of: +# +# | input.y:2: #error "2" +# +# it reports: +# +# | input.y:2: "2" +# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode + +cat >syncline.c <<'_ATEOF' +#error "1" +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" +echo synclines.at:162 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c syncline.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:162 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" +echo synclines.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input.y <<'_ATEOF' +%{ +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: '0'; +%% +#error "8" +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo synclines.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: bison --xml=xml-tests/test.xml -o input.c input.y" +echo synclines.at:162 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo synclines.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo synclines.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: bison -o input.c input.y" +echo synclines.at:162 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: \$CC \$CFLAGS \$CPPFLAGS -c input.c" +echo synclines.at:162 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_skip $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + +# In case GCC displays column information, strip it down. +# +# input.y:4:2: #error "4" or +# input.y:4.2: #error "4" or +# input.y:4:2: error: #error "4" +# => +# input.y:4: #error "4" +# +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr" +echo synclines.at:162 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -e 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)$/\\1:\\2/' -e 's/^\\([^:]*:[^:]*:\\)[^#]*\\( #error\\)/\\1\\2/' stderr"; then + ( $at_traceon; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^#]*\( #error\)/\1\2/' stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/synclines.at:162: cat stdout" +echo synclines.at:162 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stdout ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stdout ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "input.y:8: #error \"8\" +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/synclines.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_79 +#AT_START_80 +# 80. headers.at:25: %union and --defines +at_setup_line='headers.at:25' +at_func_banner 7 +at_desc="%union and --defines" +$at_quiet $as_echo_n " 80: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "80. headers.at:25: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%union +{ + int integer; + char *string ; +} +%% +exp: {}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/headers.at:37: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --defines input.y" +echo headers.at:37 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:37" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/headers.at:37: bison --xml=xml-tests/test.xml --defines input.y" +echo headers.at:37 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:37" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/headers.at:37: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo headers.at:37 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:37" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/headers.at:37: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo headers.at:37 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:37" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:37: bison --defines input.y" +echo headers.at:37 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:37" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_80 +#AT_START_81 +# 81. headers.at:75: Invalid CPP guards: input/input +at_setup_line='headers.at:75' +at_func_banner 7 +at_desc="Invalid CPP guards: input/input" +$at_quiet $as_echo_n " 81: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "81. headers.at:75: testing ..." + $at_traceon + + +# Possibly create inner directories. +dirname=`$as_dirname -- input/input || +$as_expr Xinput/input : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + Xinput/input : 'X\(//\)[^/]' \| \ + Xinput/input : 'X\(//\)$' \| \ + Xinput/input : 'X\(/\)' \| . 2>/dev/null || +$as_echo Xinput/input | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +{ as_dir=$dirname + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + +cat >input/input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +#include +void yyerror (const char *); +int yylex (void); +%} +%% +dummy:; +%% +#include +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/headers.at:75: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --defines=input/input.h --output=y.tab.c input/input.y" +echo headers.at:75 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines=input/input.h --output=y.tab.c input/input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines=input/input.h --output=y.tab.c input/input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:75" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/headers.at:75: bison --xml=xml-tests/test.xml --defines=input/input.h --output=y.tab.c input/input.y" +echo headers.at:75 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --defines=input/input.h --output=y.tab.c input/input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --defines=input/input.h --output=y.tab.c input/input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:75" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/headers.at:75: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo headers.at:75 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:75" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/headers.at:75: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo headers.at:75 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:75" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:75: bison --defines=input/input.h --output=y.tab.c input/input.y" +echo headers.at:75 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --defines=input/input.h --output=y.tab.c input/input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --defines=input/input.h --output=y.tab.c input/input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:75" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:75: \$CC \$CFLAGS \$CPPFLAGS -o y.tab.o -I. -c y.tab.c" +echo headers.at:75 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o y.tab.o -I. -c y.tab.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o y.tab.o -I. -c y.tab.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o y.tab.o -I. -c y.tab.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:75" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_81 +#AT_START_82 +# 82. headers.at:76: Invalid CPP guards: 9foo +at_setup_line='headers.at:76' +at_func_banner 7 +at_desc="Invalid CPP guards: 9foo" +$at_quiet $as_echo_n " 82: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "82. headers.at:76: testing ..." + $at_traceon + + +# Possibly create inner directories. +dirname=`$as_dirname -- 9foo || +$as_expr X9foo : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X9foo : 'X\(//\)[^/]' \| \ + X9foo : 'X\(//\)$' \| \ + X9foo : 'X\(/\)' \| . 2>/dev/null || +$as_echo X9foo | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +{ as_dir=$dirname + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + +cat >9foo.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +#include <9foo.h> +void yyerror (const char *); +int yylex (void); +%} +%% +dummy:; +%% +#include <9foo.h> +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/headers.at:76: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --defines=9foo.h --output=y.tab.c 9foo.y" +echo headers.at:76 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines=9foo.h --output=y.tab.c 9foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines=9foo.h --output=y.tab.c 9foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:76" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/headers.at:76: bison --xml=xml-tests/test.xml --defines=9foo.h --output=y.tab.c 9foo.y" +echo headers.at:76 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --defines=9foo.h --output=y.tab.c 9foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --defines=9foo.h --output=y.tab.c 9foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:76" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/headers.at:76: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo headers.at:76 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:76" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/headers.at:76: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo headers.at:76 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:76" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:76: bison --defines=9foo.h --output=y.tab.c 9foo.y" +echo headers.at:76 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --defines=9foo.h --output=y.tab.c 9foo.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --defines=9foo.h --output=y.tab.c 9foo.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:76" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:76: \$CC \$CFLAGS \$CPPFLAGS -o y.tab.o -I. -c y.tab.c" +echo headers.at:76 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o y.tab.o -I. -c y.tab.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o y.tab.o -I. -c y.tab.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o y.tab.o -I. -c y.tab.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:76" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_82 +#AT_START_83 +# 83. headers.at:85: export YYLTYPE +at_setup_line='headers.at:85' +at_func_banner 7 +at_desc="export YYLTYPE" +$at_quiet $as_echo_n " 83: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "83. headers.at:85: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%locations + +%name-prefix "my_" +%{ +#include +#include + +static int +my_lex (void) +{ + return EOF; +} + +static void +my_error (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +%} +%% +exp:; +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/headers.at:112: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --defines -o input.c input.y" +echo headers.at:112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --defines -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/headers.at:112: bison --xml=xml-tests/test.xml --defines -o input.c input.y" +echo headers.at:112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --defines -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --defines -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/headers.at:112: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo headers.at:112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/headers.at:112: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo headers.at:112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:112: bison --defines -o input.c input.y" +echo headers.at:112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --defines -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --defines -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:112" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# YYLTYPE should be defined, and MY_LLOC declared. +cat >caller.c <<'_ATEOF' +#include "input.h" +YYLTYPE *my_llocp = &my_lloc; + +int my_parse (void); + +int +main (void) +{ + return my_parse (); +} +_ATEOF + + +# Link and execute, just to make sure everything is fine (and in +# particular, that MY_LLOC is indeed defined somewhere). +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:130: \$CC \$CFLAGS \$CPPFLAGS -o caller.o -c caller.c" +echo headers.at:130 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o caller.o -c caller.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o caller.o -c caller.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o caller.o -c caller.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:130" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:131: \$CC \$CFLAGS \$CPPFLAGS -o input.o -c input.c" +echo headers.at:131 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o input.o -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:131" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:132: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o caller caller.o input.o \$LIBS" +echo headers.at:132 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o caller caller.o input.o $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o caller caller.o input.o $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o caller caller.o input.o $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/headers.at:132" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/headers.at:133: \$PREPARSER ./caller" +echo headers.at:133 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./caller"; then + ( $at_traceon; $PREPARSER ./caller ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./caller ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/headers.at:133" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_83 +#AT_START_84 +# 84. actions.at:24: Mid-rule actions +at_setup_line='actions.at:24' +at_func_banner 8 +at_desc="Mid-rule actions" +$at_quiet $as_echo_n " 84: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "84. actions.at:24: testing ..." + $at_traceon + + +# Bison once forgot the mid-rule actions. It was because the action +# was attached to the host rule (the one with the mid-rule action), +# instead of being attached to the empty rule dedicated to this +# action. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%error-verbose +%debug +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +%} +%% +exp: { putchar ('0'); } + '1' { putchar ('1'); } + '2' { putchar ('2'); } + '3' { putchar ('3'); } + '4' { putchar ('4'); } + '5' { putchar ('5'); } + '6' { putchar ('6'); } + '7' { putchar ('7'); } + '8' { putchar ('8'); } + '9' { putchar ('9'); } + { putchar ('\n'); } + ; +%% +static int +yylex (void) +{ + static char const input[] = "123456789"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:77: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -d -v -o input.c input.y" +echo actions.at:77 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:77" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:77: bison --xml=xml-tests/test.xml -d -v -o input.c input.y" +echo actions.at:77 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:77" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:77: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:77 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:77" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:77: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:77 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:77" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:77: bison -d -v -o input.c input.y" +echo actions.at:77 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:77" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:78: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:78 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:78" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:79: \$PREPARSER ./input" +echo actions.at:79 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "0123456789 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:79" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_84 +#AT_START_85 +# 85. actions.at:93: Exotic Dollars +at_setup_line='actions.at:93' +at_func_banner 8 +at_desc="Exotic Dollars" +$at_quiet $as_echo_n " 85: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "85. actions.at:93: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%error-verbose +%debug +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(Var) +%} + +%union +{ + int val; +}; + +%type a_1 a_2 a_5 + sum_of_the_five_previous_values + +%% +exp: a_1 a_2 { $$ = 3; } { $$ = $3 + 1; } a_5 + sum_of_the_five_previous_values + { + USE (($1, $2, $3, $4, $5)); + printf ("%d\n", $6); + } +; +a_1: { $$ = 1; }; +a_2: { $$ = 2; }; +a_5: { $$ = 5; }; + +sum_of_the_five_previous_values: + { + $$ = $0 + $-1 + $-2 + $-3 + $-4; + } +; + +%% +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return EOF; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:155: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -d -v -o input.c input.y" +echo actions.at:155 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:155: bison --xml=xml-tests/test.xml -d -v -o input.c input.y" +echo actions.at:155 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:155: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:155 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:155: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:155 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:155: bison -d -v -o input.c input.y" +echo actions.at:155 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -d -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:155" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:156: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:156 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:156" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:157: \$PREPARSER ./input" +echo actions.at:157 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "15 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:157" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_85 +#AT_START_86 +# 86. actions.at:574: Printers and Destructors : +at_setup_line='actions.at:574' +at_func_banner 8 +at_desc="Printers and Destructors : " +$at_quiet $as_echo_n " 86: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "86. actions.at:574: testing ..." + $at_traceon + + + +# Make sure complex $n work. + +# Be sure to pass all the %directives to this macro to have correct +# helping macros. So don't put any directly in the Bison file. + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code requires { +#include +#include +#include +#include + +#define YYINITDEPTH 10 +#define YYMAXDEPTH 10 +#define RANGE(Location) (Location).first_line, (Location).last_line +} + +%error-verbose +%debug +%verbose +%locations + + + +%code { + +static int yylex (void); +static void yyerror (const char *msg); +} + + + +/* FIXME: This %printer isn't actually tested. */ +%printer + { + fprintf (yyoutput, "%d", $$); + } + input line thing 'x' 'y' + +%destructor + { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } + input + +%destructor + { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } + line + +%destructor + { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } + thing + +%destructor + { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'x' + +%destructor + { printf ("Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'y' + +%token END 0 +%destructor + { printf ("Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } + END + +%% +/* + This grammar is made to exercise error recovery. + "Lines" starting with `(' support error recovery, with + ')' as synchronizing token. Lines starting with 'x' can never + be recovered from if in error. +*/ + +input: + /* Nothing. */ + { + $$ = 0; + printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); + } +| line input /* Right recursive to load the stack so that popping at + END can be exercised. */ + { + $$ = 2; + printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); + } +; + +line: + thing thing thing ';' + { + $$ = $1; + printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); + } +| '(' error ')' + { + $$ = -1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) error (@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), RANGE (@2), $3, RANGE (@3)); + } +; + +thing: + 'x' + { + $$ = $1; + printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1)); + } +; +%% +/* Alias to ARGV[1]. */ +const char *source = 0; + +static int +yylex (void) +{ + static unsigned int counter = 0; + + int c = (yylval) = counter++; + /* As in BASIC, line numbers go from 10 to 10. */ + (yylloc).first_line = (yylloc).first_column = 10 * c; + (yylloc).last_line = (yylloc).last_column = (yylloc).first_line + 9; + + + if (! (0 <= c && c <= strlen (source))) + abort (); + if (source[c]) + printf ("sending: '%c'", source[c]); + else + printf ("sending: END"); + printf (" (%d@%d-%d)\n", c, RANGE ((yylloc))); + return source[c]; +} + +static void +yyerror (const char *msg) +{ + printf ("%d-%d: %s\n", RANGE (yylloc), msg); +} + +int +main (int argc, const char *argv[]) +{ + int status; + yydebug = !!getenv ("YYDEBUG"); + assert (argc == 2); + source = argv[1]; + status = yyparse (); + switch (status) + { + case 0: printf ("Successful parse.\n"); break; + case 1: printf ("Parsing FAILED.\n"); break; + default: printf ("Parsing FAILED (status %d).\n", status); break; + } + return status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:574: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:574 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:574: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:574: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:574 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:574: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:574 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:574: bison -o input.c input.y" +echo actions.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:574: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check the location of "empty" +# ----------------------------- +# I.e., epsilon-reductions, as in "(x)" which ends by reducing +# an empty "line" nterm. +# FIXME: This location is not satisfying. Depend on the lookahead? +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:574: \$PREPARSER ./input '(x)'" +echo actions.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)'"; then + ( $at_traceon; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (0@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check locations in error recovery +# --------------------------------- +# '(y)' is an error, but can be recovered from. But what's the location +# of the error itself ('y'), and of the resulting reduction ('(error)'). +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:574: \$PREPARSER ./input '(y)'" +echo actions.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(y)'"; then + ( $at_traceon; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'y' (1@10-19) +10-19: syntax error, unexpected 'y', expecting 'x' +Freeing token 'y' (1@10-19) +sending: ')' (2@20-29) +line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (-1@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax errors caught by the parser +# ---------------------------------- +# Exercise the discarding of stack top and input until `error' +# can be reduced. +# +# '(', 'x', 'x', 'x', 'x', 'x', ')', +# +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'y' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:574: \$PREPARSER ./input '(xxxxx)(x)(x)y'" +echo actions.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(xxxxx)(x)(x)y'"; then + ( $at_traceon; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: 'x' (2@20-29) +thing (2@20-29): 'x' (2@20-29) +sending: 'x' (3@30-39) +30-39: syntax error, unexpected 'x', expecting ')' +Freeing nterm thing (2@20-29) +Freeing nterm thing (1@10-19) +Freeing token 'x' (3@30-39) +sending: 'x' (4@40-49) +Freeing token 'x' (4@40-49) +sending: 'x' (5@50-59) +Freeing token 'x' (5@50-59) +sending: ')' (6@60-69) +line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) +sending: '(' (7@70-79) +sending: 'x' (8@80-89) +thing (8@80-89): 'x' (8@80-89) +sending: ')' (9@90-99) +line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) +sending: '(' (10@100-109) +sending: 'x' (11@110-119) +thing (11@110-119): 'x' (11@110-119) +sending: ')' (12@120-129) +line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) +sending: 'y' (13@130-139) +input (0@129-129): /* Nothing */ +input (2@100-129): line (10@100-129) input (0@129-129) +input (2@70-129): line (7@70-99) input (2@100-129) +input (2@0-129): line (-1@0-69) input (2@70-129) +130-139: syntax error, unexpected 'y', expecting END +Freeing nterm input (2@0-129) +Freeing token 'y' (13@130-139) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax error caught by the parser where lookahead = END +# -------------------------------------------------------- +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'x' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:574: \$PREPARSER ./input '(x)(x)x'" +echo actions.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)(x)x'"; then + ( $at_traceon; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: 'x' (6@60-69) +thing (6@60-69): 'x' (6@60-69) +sending: END (7@70-79) +70-79: syntax error, unexpected END, expecting 'x' +Freeing nterm thing (6@60-69) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Freeing token END (7@70-79) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check destruction upon stack overflow +# ------------------------------------- +# Upon stack overflow, all symbols on the stack should be destroyed. +# Only check for yacc.c. + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:574: \$PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)'" +echo actions.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)'"; then + ( $at_traceon; $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: '(' (6@60-69) +sending: 'x' (7@70-79) +thing (7@70-79): 'x' (7@70-79) +sending: ')' (8@80-89) +line (6@60-89): '(' (6@60-69) thing (7@70-79) ')' (8@80-89) +sending: '(' (9@90-99) +sending: 'x' (10@100-109) +thing (10@100-109): 'x' (10@100-109) +sending: ')' (11@110-119) +line (9@90-119): '(' (9@90-99) thing (10@100-109) ')' (11@110-119) +sending: '(' (12@120-129) +sending: 'x' (13@130-139) +thing (13@130-139): 'x' (13@130-139) +sending: ')' (14@140-149) +line (12@120-149): '(' (12@120-129) thing (13@130-139) ')' (14@140-149) +sending: '(' (15@150-159) +sending: 'x' (16@160-169) +thing (16@160-169): 'x' (16@160-169) +sending: ')' (17@170-179) +line (15@150-179): '(' (15@150-159) thing (16@160-169) ')' (17@170-179) +sending: '(' (18@180-189) +sending: 'x' (19@190-199) +thing (19@190-199): 'x' (19@190-199) +sending: ')' (20@200-209) +200-209: memory exhausted +Freeing nterm thing (19@190-199) +Freeing nterm line (15@150-179) +Freeing nterm line (12@120-149) +Freeing nterm line (9@90-119) +Freeing nterm line (6@60-89) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Parsing FAILED (status 2). +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 2 $at_status "$at_srcdir/actions.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_86 +#AT_START_87 +# 87. actions.at:575: Printers and Destructors with union: +at_setup_line='actions.at:575' +at_func_banner 8 +at_desc="Printers and Destructors with union: " +$at_quiet $as_echo_n " 87: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "87. actions.at:575: testing ..." + $at_traceon + + + +# Make sure complex $n work. + +# Be sure to pass all the %directives to this macro to have correct +# helping macros. So don't put any directly in the Bison file. + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code requires { +#include +#include +#include +#include + +#define YYINITDEPTH 10 +#define YYMAXDEPTH 10 +#define RANGE(Location) (Location).first_line, (Location).last_line +} + +%error-verbose +%debug +%verbose +%locations + +%union +{ + int ival; +} + +%code provides { + +static int yylex (void); +static void yyerror (const char *msg); +} + +%type '(' 'x' 'y' ')' ';' thing line input END + +/* FIXME: This %printer isn't actually tested. */ +%printer + { + fprintf (yyoutput, "%d", $$); + } + input line thing 'x' 'y' + +%destructor + { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } + input + +%destructor + { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } + line + +%destructor + { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } + thing + +%destructor + { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'x' + +%destructor + { printf ("Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'y' + +%token END 0 +%destructor + { printf ("Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } + END + +%% +/* + This grammar is made to exercise error recovery. + "Lines" starting with `(' support error recovery, with + ')' as synchronizing token. Lines starting with 'x' can never + be recovered from if in error. +*/ + +input: + /* Nothing. */ + { + $$ = 0; + printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); + } +| line input /* Right recursive to load the stack so that popping at + END can be exercised. */ + { + $$ = 2; + printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); + } +; + +line: + thing thing thing ';' + { + $$ = $1; + printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); + } +| '(' error ')' + { + $$ = -1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) error (@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), RANGE (@2), $3, RANGE (@3)); + } +; + +thing: + 'x' + { + $$ = $1; + printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1)); + } +; +%% +/* Alias to ARGV[1]. */ +const char *source = 0; + +static int +yylex (void) +{ + static unsigned int counter = 0; + + int c = (yylval).ival = counter++; + /* As in BASIC, line numbers go from 10 to 10. */ + (yylloc).first_line = (yylloc).first_column = 10 * c; + (yylloc).last_line = (yylloc).last_column = (yylloc).first_line + 9; + + + if (! (0 <= c && c <= strlen (source))) + abort (); + if (source[c]) + printf ("sending: '%c'", source[c]); + else + printf ("sending: END"); + printf (" (%d@%d-%d)\n", c, RANGE ((yylloc))); + return source[c]; +} + +static void +yyerror (const char *msg) +{ + printf ("%d-%d: %s\n", RANGE (yylloc), msg); +} + +int +main (int argc, const char *argv[]) +{ + int status; + yydebug = !!getenv ("YYDEBUG"); + assert (argc == 2); + source = argv[1]; + status = yyparse (); + switch (status) + { + case 0: printf ("Successful parse.\n"); break; + case 1: printf ("Parsing FAILED.\n"); break; + default: printf ("Parsing FAILED (status %d).\n", status); break; + } + return status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:575: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:575 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:575: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:575: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:575 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:575: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:575 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:575: bison -o input.c input.y" +echo actions.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:575: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check the location of "empty" +# ----------------------------- +# I.e., epsilon-reductions, as in "(x)" which ends by reducing +# an empty "line" nterm. +# FIXME: This location is not satisfying. Depend on the lookahead? +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:575: \$PREPARSER ./input '(x)'" +echo actions.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)'"; then + ( $at_traceon; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (0@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check locations in error recovery +# --------------------------------- +# '(y)' is an error, but can be recovered from. But what's the location +# of the error itself ('y'), and of the resulting reduction ('(error)'). +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:575: \$PREPARSER ./input '(y)'" +echo actions.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(y)'"; then + ( $at_traceon; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'y' (1@10-19) +10-19: syntax error, unexpected 'y', expecting 'x' +Freeing token 'y' (1@10-19) +sending: ')' (2@20-29) +line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (-1@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax errors caught by the parser +# ---------------------------------- +# Exercise the discarding of stack top and input until `error' +# can be reduced. +# +# '(', 'x', 'x', 'x', 'x', 'x', ')', +# +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'y' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:575: \$PREPARSER ./input '(xxxxx)(x)(x)y'" +echo actions.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(xxxxx)(x)(x)y'"; then + ( $at_traceon; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: 'x' (2@20-29) +thing (2@20-29): 'x' (2@20-29) +sending: 'x' (3@30-39) +30-39: syntax error, unexpected 'x', expecting ')' +Freeing nterm thing (2@20-29) +Freeing nterm thing (1@10-19) +Freeing token 'x' (3@30-39) +sending: 'x' (4@40-49) +Freeing token 'x' (4@40-49) +sending: 'x' (5@50-59) +Freeing token 'x' (5@50-59) +sending: ')' (6@60-69) +line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) +sending: '(' (7@70-79) +sending: 'x' (8@80-89) +thing (8@80-89): 'x' (8@80-89) +sending: ')' (9@90-99) +line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) +sending: '(' (10@100-109) +sending: 'x' (11@110-119) +thing (11@110-119): 'x' (11@110-119) +sending: ')' (12@120-129) +line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) +sending: 'y' (13@130-139) +input (0@129-129): /* Nothing */ +input (2@100-129): line (10@100-129) input (0@129-129) +input (2@70-129): line (7@70-99) input (2@100-129) +input (2@0-129): line (-1@0-69) input (2@70-129) +130-139: syntax error, unexpected 'y', expecting END +Freeing nterm input (2@0-129) +Freeing token 'y' (13@130-139) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax error caught by the parser where lookahead = END +# -------------------------------------------------------- +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'x' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:575: \$PREPARSER ./input '(x)(x)x'" +echo actions.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)(x)x'"; then + ( $at_traceon; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: 'x' (6@60-69) +thing (6@60-69): 'x' (6@60-69) +sending: END (7@70-79) +70-79: syntax error, unexpected END, expecting 'x' +Freeing nterm thing (6@60-69) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Freeing token END (7@70-79) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check destruction upon stack overflow +# ------------------------------------- +# Upon stack overflow, all symbols on the stack should be destroyed. +# Only check for yacc.c. + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:575: \$PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)'" +echo actions.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)'"; then + ( $at_traceon; $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: '(' (6@60-69) +sending: 'x' (7@70-79) +thing (7@70-79): 'x' (7@70-79) +sending: ')' (8@80-89) +line (6@60-89): '(' (6@60-69) thing (7@70-79) ')' (8@80-89) +sending: '(' (9@90-99) +sending: 'x' (10@100-109) +thing (10@100-109): 'x' (10@100-109) +sending: ')' (11@110-119) +line (9@90-119): '(' (9@90-99) thing (10@100-109) ')' (11@110-119) +sending: '(' (12@120-129) +sending: 'x' (13@130-139) +thing (13@130-139): 'x' (13@130-139) +sending: ')' (14@140-149) +line (12@120-149): '(' (12@120-129) thing (13@130-139) ')' (14@140-149) +sending: '(' (15@150-159) +sending: 'x' (16@160-169) +thing (16@160-169): 'x' (16@160-169) +sending: ')' (17@170-179) +line (15@150-179): '(' (15@150-159) thing (16@160-169) ')' (17@170-179) +sending: '(' (18@180-189) +sending: 'x' (19@190-199) +thing (19@190-199): 'x' (19@190-199) +sending: ')' (20@200-209) +200-209: memory exhausted +Freeing nterm thing (19@190-199) +Freeing nterm line (15@150-179) +Freeing nterm line (12@120-149) +Freeing nterm line (9@90-119) +Freeing nterm line (6@60-89) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Parsing FAILED (status 2). +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 2 $at_status "$at_srcdir/actions.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_87 +#AT_START_88 +# 88. actions.at:577: Printers and Destructors : %defines %skeleton "lalr1.cc" +at_setup_line='actions.at:577' +at_func_banner 8 +at_desc="Printers and Destructors : %defines %skeleton \"lalr1.cc\"" +$at_quiet $as_echo_n " 88: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "88. actions.at:577: testing ..." + $at_traceon + + + +# Make sure complex $n work. + +# Be sure to pass all the %directives to this macro to have correct +# helping macros. So don't put any directly in the Bison file. + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code requires { +#include +#include +#include +#include + +#define YYINITDEPTH 10 +#define YYMAXDEPTH 10 +#define RANGE(Location) (Location).begin.line, (Location).end.line +} + +%error-verbose +%debug +%verbose +%locations +%defines %skeleton "lalr1.cc" + +%define global_tokens_and_yystype +%code { +typedef yy::location YYLTYPE; +static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); + +} + + + +/* FIXME: This %printer isn't actually tested. */ +%printer + { + debug_stream () << $$;; + } + input line thing 'x' 'y' + +%destructor + { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } + input + +%destructor + { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } + line + +%destructor + { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } + thing + +%destructor + { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'x' + +%destructor + { printf ("Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'y' + +%token END 0 +%destructor + { printf ("Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } + END + +%% +/* + This grammar is made to exercise error recovery. + "Lines" starting with `(' support error recovery, with + ')' as synchronizing token. Lines starting with 'x' can never + be recovered from if in error. +*/ + +input: + /* Nothing. */ + { + $$ = 0; + printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); + } +| line input /* Right recursive to load the stack so that popping at + END can be exercised. */ + { + $$ = 2; + printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); + } +; + +line: + thing thing thing ';' + { + $$ = $1; + printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); + } +| '(' error ')' + { + $$ = -1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) error (@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), RANGE (@2), $3, RANGE (@3)); + } +; + +thing: + 'x' + { + $$ = $1; + printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1)); + } +; +%% +/* Alias to ARGV[1]. */ +const char *source = 0; + +static int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static unsigned int counter = 0; + + int c = (*lvalp) = counter++; + /* As in BASIC, line numbers go from 10 to 10. */ + (*llocp).begin.line = (*llocp).begin.column = 10 * c; + (*llocp).end.line = (*llocp).end.column = (*llocp).begin.line + 9; + + + if (! (0 <= c && c <= strlen (source))) + abort (); + if (source[c]) + printf ("sending: '%c'", source[c]); + else + printf ("sending: END"); + printf (" (%d@%d-%d)\n", c, RANGE ((*llocp))); + return source[c]; +} + +/* A C++ error reporting function. */ +void +yy::parser::error (const location& l, const std::string& m) +{ + printf ("%d-%d: %s\n", RANGE (l), m.c_str()); +} + +static bool yydebug; +int +yyparse () +{ + yy::parser parser; + parser.set_debug_level (yydebug); + return parser.parse (); +} + + +int +main (int argc, const char *argv[]) +{ + int status; + yydebug = !!getenv ("YYDEBUG"); + assert (argc == 2); + source = argv[1]; + status = yyparse (); + switch (status) + { + case 0: printf ("Successful parse.\n"); break; + case 1: printf ("Parsing FAILED.\n"); break; + default: printf ("Parsing FAILED (status %d).\n", status); break; + } + return status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:577: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo actions.at:577 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:577: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo actions.at:577 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:577: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:577 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:577: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:577 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:577: bison -o input.cc input.y" +echo actions.at:577 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:577: \$BISON_CXX_WORKS" +echo actions.at:577 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:577: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo actions.at:577 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check the location of "empty" +# ----------------------------- +# I.e., epsilon-reductions, as in "(x)" which ends by reducing +# an empty "line" nterm. +# FIXME: This location is not satisfying. Depend on the lookahead? +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:577: \$PREPARSER ./input '(x)'" +echo actions.at:577 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)'"; then + ( $at_traceon; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (0@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check locations in error recovery +# --------------------------------- +# '(y)' is an error, but can be recovered from. But what's the location +# of the error itself ('y'), and of the resulting reduction ('(error)'). +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:577: \$PREPARSER ./input '(y)'" +echo actions.at:577 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(y)'"; then + ( $at_traceon; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'y' (1@10-19) +10-19: syntax error, unexpected 'y', expecting 'x' +Freeing token 'y' (1@10-19) +sending: ')' (2@20-29) +line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (-1@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax errors caught by the parser +# ---------------------------------- +# Exercise the discarding of stack top and input until `error' +# can be reduced. +# +# '(', 'x', 'x', 'x', 'x', 'x', ')', +# +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'y' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:577: \$PREPARSER ./input '(xxxxx)(x)(x)y'" +echo actions.at:577 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(xxxxx)(x)(x)y'"; then + ( $at_traceon; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: 'x' (2@20-29) +thing (2@20-29): 'x' (2@20-29) +sending: 'x' (3@30-39) +30-39: syntax error, unexpected 'x', expecting ')' +Freeing nterm thing (2@20-29) +Freeing nterm thing (1@10-19) +Freeing token 'x' (3@30-39) +sending: 'x' (4@40-49) +Freeing token 'x' (4@40-49) +sending: 'x' (5@50-59) +Freeing token 'x' (5@50-59) +sending: ')' (6@60-69) +line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) +sending: '(' (7@70-79) +sending: 'x' (8@80-89) +thing (8@80-89): 'x' (8@80-89) +sending: ')' (9@90-99) +line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) +sending: '(' (10@100-109) +sending: 'x' (11@110-119) +thing (11@110-119): 'x' (11@110-119) +sending: ')' (12@120-129) +line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) +sending: 'y' (13@130-139) +input (0@129-129): /* Nothing */ +input (2@100-129): line (10@100-129) input (0@129-129) +input (2@70-129): line (7@70-99) input (2@100-129) +input (2@0-129): line (-1@0-69) input (2@70-129) +130-139: syntax error, unexpected 'y', expecting END +Freeing nterm input (2@0-129) +Freeing token 'y' (13@130-139) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax error caught by the parser where lookahead = END +# -------------------------------------------------------- +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'x' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:577: \$PREPARSER ./input '(x)(x)x'" +echo actions.at:577 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)(x)x'"; then + ( $at_traceon; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: 'x' (6@60-69) +thing (6@60-69): 'x' (6@60-69) +sending: END (7@70-79) +70-79: syntax error, unexpected END, expecting 'x' +Freeing nterm thing (6@60-69) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Freeing token END (7@70-79) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:577" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check destruction upon stack overflow +# ------------------------------------- +# Upon stack overflow, all symbols on the stack should be destroyed. +# Only check for yacc.c. + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_88 +#AT_START_89 +# 89. actions.at:578: Printers and Destructors with union: %defines %skeleton "lalr1.cc" +at_setup_line='actions.at:578' +at_func_banner 8 +at_desc="Printers and Destructors with union: %defines %skeleton \"lalr1.cc\"" +$at_quiet $as_echo_n " 89: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "89. actions.at:578: testing ..." + $at_traceon + + + +# Make sure complex $n work. + +# Be sure to pass all the %directives to this macro to have correct +# helping macros. So don't put any directly in the Bison file. + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code requires { +#include +#include +#include +#include + +#define YYINITDEPTH 10 +#define YYMAXDEPTH 10 +#define RANGE(Location) (Location).begin.line, (Location).end.line +} + +%error-verbose +%debug +%verbose +%locations +%defines %skeleton "lalr1.cc" +%union +{ + int ival; +} +%define global_tokens_and_yystype +%code provides { +typedef yy::location YYLTYPE; +static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); + +} + +%type '(' 'x' 'y' ')' ';' thing line input END + +/* FIXME: This %printer isn't actually tested. */ +%printer + { + debug_stream () << $$;; + } + input line thing 'x' 'y' + +%destructor + { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } + input + +%destructor + { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } + line + +%destructor + { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } + thing + +%destructor + { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'x' + +%destructor + { printf ("Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'y' + +%token END 0 +%destructor + { printf ("Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } + END + +%% +/* + This grammar is made to exercise error recovery. + "Lines" starting with `(' support error recovery, with + ')' as synchronizing token. Lines starting with 'x' can never + be recovered from if in error. +*/ + +input: + /* Nothing. */ + { + $$ = 0; + printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); + } +| line input /* Right recursive to load the stack so that popping at + END can be exercised. */ + { + $$ = 2; + printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); + } +; + +line: + thing thing thing ';' + { + $$ = $1; + printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); + } +| '(' error ')' + { + $$ = -1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) error (@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), RANGE (@2), $3, RANGE (@3)); + } +; + +thing: + 'x' + { + $$ = $1; + printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1)); + } +; +%% +/* Alias to ARGV[1]. */ +const char *source = 0; + +static int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static unsigned int counter = 0; + + int c = (*lvalp).ival = counter++; + /* As in BASIC, line numbers go from 10 to 10. */ + (*llocp).begin.line = (*llocp).begin.column = 10 * c; + (*llocp).end.line = (*llocp).end.column = (*llocp).begin.line + 9; + + + if (! (0 <= c && c <= strlen (source))) + abort (); + if (source[c]) + printf ("sending: '%c'", source[c]); + else + printf ("sending: END"); + printf (" (%d@%d-%d)\n", c, RANGE ((*llocp))); + return source[c]; +} + +/* A C++ error reporting function. */ +void +yy::parser::error (const location& l, const std::string& m) +{ + printf ("%d-%d: %s\n", RANGE (l), m.c_str()); +} + +static bool yydebug; +int +yyparse () +{ + yy::parser parser; + parser.set_debug_level (yydebug); + return parser.parse (); +} + + +int +main (int argc, const char *argv[]) +{ + int status; + yydebug = !!getenv ("YYDEBUG"); + assert (argc == 2); + source = argv[1]; + status = yyparse (); + switch (status) + { + case 0: printf ("Successful parse.\n"); break; + case 1: printf ("Parsing FAILED.\n"); break; + default: printf ("Parsing FAILED (status %d).\n", status); break; + } + return status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:578: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo actions.at:578 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:578: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo actions.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:578: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:578 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:578: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:578 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:578: bison -o input.cc input.y" +echo actions.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:578: \$BISON_CXX_WORKS" +echo actions.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:578: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo actions.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check the location of "empty" +# ----------------------------- +# I.e., epsilon-reductions, as in "(x)" which ends by reducing +# an empty "line" nterm. +# FIXME: This location is not satisfying. Depend on the lookahead? +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:578: \$PREPARSER ./input '(x)'" +echo actions.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)'"; then + ( $at_traceon; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (0@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check locations in error recovery +# --------------------------------- +# '(y)' is an error, but can be recovered from. But what's the location +# of the error itself ('y'), and of the resulting reduction ('(error)'). +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:578: \$PREPARSER ./input '(y)'" +echo actions.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(y)'"; then + ( $at_traceon; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'y' (1@10-19) +10-19: syntax error, unexpected 'y', expecting 'x' +Freeing token 'y' (1@10-19) +sending: ')' (2@20-29) +line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (-1@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax errors caught by the parser +# ---------------------------------- +# Exercise the discarding of stack top and input until `error' +# can be reduced. +# +# '(', 'x', 'x', 'x', 'x', 'x', ')', +# +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'y' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:578: \$PREPARSER ./input '(xxxxx)(x)(x)y'" +echo actions.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(xxxxx)(x)(x)y'"; then + ( $at_traceon; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: 'x' (2@20-29) +thing (2@20-29): 'x' (2@20-29) +sending: 'x' (3@30-39) +30-39: syntax error, unexpected 'x', expecting ')' +Freeing nterm thing (2@20-29) +Freeing nterm thing (1@10-19) +Freeing token 'x' (3@30-39) +sending: 'x' (4@40-49) +Freeing token 'x' (4@40-49) +sending: 'x' (5@50-59) +Freeing token 'x' (5@50-59) +sending: ')' (6@60-69) +line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) +sending: '(' (7@70-79) +sending: 'x' (8@80-89) +thing (8@80-89): 'x' (8@80-89) +sending: ')' (9@90-99) +line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) +sending: '(' (10@100-109) +sending: 'x' (11@110-119) +thing (11@110-119): 'x' (11@110-119) +sending: ')' (12@120-129) +line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) +sending: 'y' (13@130-139) +input (0@129-129): /* Nothing */ +input (2@100-129): line (10@100-129) input (0@129-129) +input (2@70-129): line (7@70-99) input (2@100-129) +input (2@0-129): line (-1@0-69) input (2@70-129) +130-139: syntax error, unexpected 'y', expecting END +Freeing nterm input (2@0-129) +Freeing token 'y' (13@130-139) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax error caught by the parser where lookahead = END +# -------------------------------------------------------- +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'x' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:578: \$PREPARSER ./input '(x)(x)x'" +echo actions.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)(x)x'"; then + ( $at_traceon; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: 'x' (6@60-69) +thing (6@60-69): 'x' (6@60-69) +sending: END (7@70-79) +70-79: syntax error, unexpected END, expecting 'x' +Freeing nterm thing (6@60-69) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Freeing token END (7@70-79) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check destruction upon stack overflow +# ------------------------------------- +# Upon stack overflow, all symbols on the stack should be destroyed. +# Only check for yacc.c. + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_89 +#AT_START_90 +# 90. actions.at:580: Printers and Destructors : %glr-parser +at_setup_line='actions.at:580' +at_func_banner 8 +at_desc="Printers and Destructors : %glr-parser" +$at_quiet $as_echo_n " 90: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "90. actions.at:580: testing ..." + $at_traceon + + + +# Make sure complex $n work. + +# Be sure to pass all the %directives to this macro to have correct +# helping macros. So don't put any directly in the Bison file. + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code requires { +#include +#include +#include +#include + +#define YYINITDEPTH 10 +#define YYMAXDEPTH 10 +#define RANGE(Location) (Location).first_line, (Location).last_line +} + +%error-verbose +%debug +%verbose +%locations +%glr-parser + + +%code { + +static int yylex (void); +static void yyerror (const char *msg); +} + + + +/* FIXME: This %printer isn't actually tested. */ +%printer + { + fprintf (yyoutput, "%d", $$); + } + input line thing 'x' 'y' + +%destructor + { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } + input + +%destructor + { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } + line + +%destructor + { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } + thing + +%destructor + { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'x' + +%destructor + { printf ("Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'y' + +%token END 0 +%destructor + { printf ("Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } + END + +%% +/* + This grammar is made to exercise error recovery. + "Lines" starting with `(' support error recovery, with + ')' as synchronizing token. Lines starting with 'x' can never + be recovered from if in error. +*/ + +input: + /* Nothing. */ + { + $$ = 0; + printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); + } +| line input /* Right recursive to load the stack so that popping at + END can be exercised. */ + { + $$ = 2; + printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); + } +; + +line: + thing thing thing ';' + { + $$ = $1; + printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); + } +| '(' error ')' + { + $$ = -1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) error (@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), RANGE (@2), $3, RANGE (@3)); + } +; + +thing: + 'x' + { + $$ = $1; + printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1)); + } +; +%% +/* Alias to ARGV[1]. */ +const char *source = 0; + +static int +yylex (void) +{ + static unsigned int counter = 0; + + int c = (yylval) = counter++; + /* As in BASIC, line numbers go from 10 to 10. */ + (yylloc).first_line = (yylloc).first_column = 10 * c; + (yylloc).last_line = (yylloc).last_column = (yylloc).first_line + 9; + + + if (! (0 <= c && c <= strlen (source))) + abort (); + if (source[c]) + printf ("sending: '%c'", source[c]); + else + printf ("sending: END"); + printf (" (%d@%d-%d)\n", c, RANGE ((yylloc))); + return source[c]; +} + +static void +yyerror (const char *msg) +{ + printf ("%d-%d: %s\n", RANGE (yylloc), msg); +} + +int +main (int argc, const char *argv[]) +{ + int status; + yydebug = !!getenv ("YYDEBUG"); + assert (argc == 2); + source = argv[1]; + status = yyparse (); + switch (status) + { + case 0: printf ("Successful parse.\n"); break; + case 1: printf ("Parsing FAILED.\n"); break; + default: printf ("Parsing FAILED (status %d).\n", status); break; + } + return status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:580: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:580 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:580: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:580: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:580 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:580: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:580 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:580: bison -o input.c input.y" +echo actions.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:580: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check the location of "empty" +# ----------------------------- +# I.e., epsilon-reductions, as in "(x)" which ends by reducing +# an empty "line" nterm. +# FIXME: This location is not satisfying. Depend on the lookahead? +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:580: \$PREPARSER ./input '(x)'" +echo actions.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)'"; then + ( $at_traceon; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (0@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check locations in error recovery +# --------------------------------- +# '(y)' is an error, but can be recovered from. But what's the location +# of the error itself ('y'), and of the resulting reduction ('(error)'). +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:580: \$PREPARSER ./input '(y)'" +echo actions.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(y)'"; then + ( $at_traceon; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'y' (1@10-19) +10-19: syntax error, unexpected 'y', expecting 'x' +Freeing token 'y' (1@10-19) +sending: ')' (2@20-29) +line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (-1@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax errors caught by the parser +# ---------------------------------- +# Exercise the discarding of stack top and input until `error' +# can be reduced. +# +# '(', 'x', 'x', 'x', 'x', 'x', ')', +# +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'y' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:580: \$PREPARSER ./input '(xxxxx)(x)(x)y'" +echo actions.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(xxxxx)(x)(x)y'"; then + ( $at_traceon; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: 'x' (2@20-29) +thing (2@20-29): 'x' (2@20-29) +sending: 'x' (3@30-39) +30-39: syntax error, unexpected 'x', expecting ')' +Freeing nterm thing (2@20-29) +Freeing nterm thing (1@10-19) +Freeing token 'x' (3@30-39) +sending: 'x' (4@40-49) +Freeing token 'x' (4@40-49) +sending: 'x' (5@50-59) +Freeing token 'x' (5@50-59) +sending: ')' (6@60-69) +line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) +sending: '(' (7@70-79) +sending: 'x' (8@80-89) +thing (8@80-89): 'x' (8@80-89) +sending: ')' (9@90-99) +line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) +sending: '(' (10@100-109) +sending: 'x' (11@110-119) +thing (11@110-119): 'x' (11@110-119) +sending: ')' (12@120-129) +line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) +sending: 'y' (13@130-139) +input (0@129-129): /* Nothing */ +input (2@100-129): line (10@100-129) input (0@129-129) +input (2@70-129): line (7@70-99) input (2@100-129) +input (2@0-129): line (-1@0-69) input (2@70-129) +130-139: syntax error, unexpected 'y', expecting END +Freeing nterm input (2@0-129) +Freeing token 'y' (13@130-139) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax error caught by the parser where lookahead = END +# -------------------------------------------------------- +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'x' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:580: \$PREPARSER ./input '(x)(x)x'" +echo actions.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)(x)x'"; then + ( $at_traceon; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: 'x' (6@60-69) +thing (6@60-69): 'x' (6@60-69) +sending: END (7@70-79) +70-79: syntax error, unexpected END, expecting 'x' +Freeing nterm thing (6@60-69) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Freeing token END (7@70-79) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check destruction upon stack overflow +# ------------------------------------- +# Upon stack overflow, all symbols on the stack should be destroyed. +# Only check for yacc.c. + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_90 +#AT_START_91 +# 91. actions.at:581: Printers and Destructors with union: %glr-parser +at_setup_line='actions.at:581' +at_func_banner 8 +at_desc="Printers and Destructors with union: %glr-parser" +$at_quiet $as_echo_n " 91: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "91. actions.at:581: testing ..." + $at_traceon + + + +# Make sure complex $n work. + +# Be sure to pass all the %directives to this macro to have correct +# helping macros. So don't put any directly in the Bison file. + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code requires { +#include +#include +#include +#include + +#define YYINITDEPTH 10 +#define YYMAXDEPTH 10 +#define RANGE(Location) (Location).first_line, (Location).last_line +} + +%error-verbose +%debug +%verbose +%locations +%glr-parser +%union +{ + int ival; +} + +%code provides { + +static int yylex (void); +static void yyerror (const char *msg); +} + +%type '(' 'x' 'y' ')' ';' thing line input END + +/* FIXME: This %printer isn't actually tested. */ +%printer + { + fprintf (yyoutput, "%d", $$); + } + input line thing 'x' 'y' + +%destructor + { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } + input + +%destructor + { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } + line + +%destructor + { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } + thing + +%destructor + { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'x' + +%destructor + { printf ("Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } + 'y' + +%token END 0 +%destructor + { printf ("Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } + END + +%% +/* + This grammar is made to exercise error recovery. + "Lines" starting with `(' support error recovery, with + ')' as synchronizing token. Lines starting with 'x' can never + be recovered from if in error. +*/ + +input: + /* Nothing. */ + { + $$ = 0; + printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); + } +| line input /* Right recursive to load the stack so that popping at + END can be exercised. */ + { + $$ = 2; + printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); + } +; + +line: + thing thing thing ';' + { + $$ = $1; + printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), + $3, RANGE (@3), $4, RANGE (@4)); + } +| '(' thing ')' + { + $$ = $1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) thing (%d@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); + } +| '(' error ')' + { + $$ = -1; + printf ("line (%d@%d-%d): '(' (%d@%d-%d) error (@%d-%d) ')' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1), RANGE (@2), $3, RANGE (@3)); + } +; + +thing: + 'x' + { + $$ = $1; + printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", + $$, RANGE (@$), $1, RANGE (@1)); + } +; +%% +/* Alias to ARGV[1]. */ +const char *source = 0; + +static int +yylex (void) +{ + static unsigned int counter = 0; + + int c = (yylval).ival = counter++; + /* As in BASIC, line numbers go from 10 to 10. */ + (yylloc).first_line = (yylloc).first_column = 10 * c; + (yylloc).last_line = (yylloc).last_column = (yylloc).first_line + 9; + + + if (! (0 <= c && c <= strlen (source))) + abort (); + if (source[c]) + printf ("sending: '%c'", source[c]); + else + printf ("sending: END"); + printf (" (%d@%d-%d)\n", c, RANGE ((yylloc))); + return source[c]; +} + +static void +yyerror (const char *msg) +{ + printf ("%d-%d: %s\n", RANGE (yylloc), msg); +} + +int +main (int argc, const char *argv[]) +{ + int status; + yydebug = !!getenv ("YYDEBUG"); + assert (argc == 2); + source = argv[1]; + status = yyparse (); + switch (status) + { + case 0: printf ("Successful parse.\n"); break; + case 1: printf ("Parsing FAILED.\n"); break; + default: printf ("Parsing FAILED (status %d).\n", status); break; + } + return status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:581: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:581 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:581: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:581 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:581: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:581 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:581: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:581 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:581: bison -o input.c input.y" +echo actions.at:581 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:581: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:581 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check the location of "empty" +# ----------------------------- +# I.e., epsilon-reductions, as in "(x)" which ends by reducing +# an empty "line" nterm. +# FIXME: This location is not satisfying. Depend on the lookahead? +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:581: \$PREPARSER ./input '(x)'" +echo actions.at:581 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)'"; then + ( $at_traceon; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (0@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check locations in error recovery +# --------------------------------- +# '(y)' is an error, but can be recovered from. But what's the location +# of the error itself ('y'), and of the resulting reduction ('(error)'). +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:581: \$PREPARSER ./input '(y)'" +echo actions.at:581 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(y)'"; then + ( $at_traceon; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(y)' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'y' (1@10-19) +10-19: syntax error, unexpected 'y', expecting 'x' +Freeing token 'y' (1@10-19) +sending: ')' (2@20-29) +line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) +sending: END (3@30-39) +input (0@29-29): /* Nothing */ +input (2@0-29): line (-1@0-29) input (0@29-29) +Freeing token END (3@30-39) +Freeing nterm input (2@0-29) +Successful parse. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax errors caught by the parser +# ---------------------------------- +# Exercise the discarding of stack top and input until `error' +# can be reduced. +# +# '(', 'x', 'x', 'x', 'x', 'x', ')', +# +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'y' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:581: \$PREPARSER ./input '(xxxxx)(x)(x)y'" +echo actions.at:581 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(xxxxx)(x)(x)y'"; then + ( $at_traceon; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: 'x' (2@20-29) +thing (2@20-29): 'x' (2@20-29) +sending: 'x' (3@30-39) +30-39: syntax error, unexpected 'x', expecting ')' +Freeing nterm thing (2@20-29) +Freeing nterm thing (1@10-19) +Freeing token 'x' (3@30-39) +sending: 'x' (4@40-49) +Freeing token 'x' (4@40-49) +sending: 'x' (5@50-59) +Freeing token 'x' (5@50-59) +sending: ')' (6@60-69) +line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) +sending: '(' (7@70-79) +sending: 'x' (8@80-89) +thing (8@80-89): 'x' (8@80-89) +sending: ')' (9@90-99) +line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) +sending: '(' (10@100-109) +sending: 'x' (11@110-119) +thing (11@110-119): 'x' (11@110-119) +sending: ')' (12@120-129) +line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) +sending: 'y' (13@130-139) +input (0@129-129): /* Nothing */ +input (2@100-129): line (10@100-129) input (0@129-129) +input (2@70-129): line (7@70-99) input (2@100-129) +input (2@0-129): line (-1@0-69) input (2@70-129) +130-139: syntax error, unexpected 'y', expecting END +Freeing nterm input (2@0-129) +Freeing token 'y' (13@130-139) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Syntax error caught by the parser where lookahead = END +# -------------------------------------------------------- +# Load the stack and provoke an error that cannot be caught by the +# grammar, to check that the stack is cleared. And make sure the +# lookahead is freed. +# +# '(', 'x', ')', +# '(', 'x', ')', +# 'x' +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:581: \$PREPARSER ./input '(x)(x)x'" +echo actions.at:581 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '(x)(x)x'"; then + ( $at_traceon; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '(x)(x)x' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "sending: '(' (0@0-9) +sending: 'x' (1@10-19) +thing (1@10-19): 'x' (1@10-19) +sending: ')' (2@20-29) +line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) +sending: '(' (3@30-39) +sending: 'x' (4@40-49) +thing (4@40-49): 'x' (4@40-49) +sending: ')' (5@50-59) +line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) +sending: 'x' (6@60-69) +thing (6@60-69): 'x' (6@60-69) +sending: END (7@70-79) +70-79: syntax error, unexpected END, expecting 'x' +Freeing nterm thing (6@60-69) +Freeing nterm line (3@30-59) +Freeing nterm line (0@0-29) +Freeing token END (7@70-79) +Parsing FAILED. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check destruction upon stack overflow +# ------------------------------------- +# Upon stack overflow, all symbols on the stack should be destroyed. +# Only check for yacc.c. + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_91 +#AT_START_92 +# 92. actions.at:592: Default tagless %printer and %destructor +at_setup_line='actions.at:592' +at_func_banner 8 +at_desc="Default tagless %printer and %destructor" +$at_quiet $as_echo_n " 92: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "92. actions.at:592: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%error-verbose +%debug +%locations +%initial-action { + @$.first_line = @$.last_line = 1; + @$.first_column = @$.last_column = 1; +} + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%printer { + fprintf (yyoutput, "<*> printer should not be called.\n"); +} <*> + +%printer { + fprintf (yyoutput, "<> printer for '%c' @ %d", $$, @$.first_column); +} <> +%destructor { + fprintf (stdout, "<> destructor for '%c' @ %d.\n", $$, @$.first_column); +} <> + +%printer { + fprintf (yyoutput, "'b'/'c' printer for '%c' @ %d", $$, @$.first_column); +} 'b' 'c' +%destructor { + fprintf (stdout, "'b'/'c' destructor for '%c' @ %d.\n", $$, @$.first_column); +} 'b' 'c' + +%destructor { + fprintf (yyoutput, "<*> destructor should not be called.\n"); +} <*> + +%% + +start: 'a' 'b' 'c' 'd' 'e' { $$ = 'S'; USE(($1, $2, $3, $4, $5)); } ; + +%% + +static int +yylex (void) +{ + static char const input[] = "abcd"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylval = input[toknum++]; + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = toknum; + return yylval; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:666: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:666 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:666" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:666: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:666 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:666" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:666: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:666 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:666" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:666: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:666 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:666" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:666: bison -o input.c input.y" +echo actions.at:666 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:666" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:667: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:667 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:667" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:668: \$PREPARSER ./input" +echo actions.at:668 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Starting parse +Entering state 0 +Reading a token: Next token is token 'a' (1.1-1.1: <> printer for 'a' @ 1) +Shifting token 'a' (1.1-1.1: <> printer for 'a' @ 1) +Entering state 1 +Reading a token: Next token is token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2) +Shifting token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2) +Entering state 3 +Reading a token: Next token is token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3) +Shifting token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3) +Entering state 5 +Reading a token: Next token is token 'd' (1.4-1.4: <> printer for 'd' @ 4) +Shifting token 'd' (1.4-1.4: <> printer for 'd' @ 4) +Entering state 6 +Reading a token: Now at end of input. +syntax error, unexpected \$end, expecting 'e' +Error: popping token 'd' (1.4-1.4: <> printer for 'd' @ 4) +Stack now 0 1 3 5 +Error: popping token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3) +Stack now 0 1 3 +Error: popping token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2) +Stack now 0 1 +Error: popping token 'a' (1.1-1.1: <> printer for 'a' @ 1) +Stack now 0 +Cleanup: discarding lookahead token \$end (1.5-1.5: ) +Stack now 0 +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "<> destructor for 'd' @ 4. +'b'/'c' destructor for 'c' @ 3. +'b'/'c' destructor for 'b' @ 2. +<> destructor for 'a' @ 1. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:668" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_92 +#AT_START_93 +# 93. actions.at:710: Default tagged and per-type %printer and %destructor +at_setup_line='actions.at:710' +at_func_banner 8 +at_desc="Default tagged and per-type %printer and %destructor" +$at_quiet $as_echo_n " 93: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "93. actions.at:710: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%error-verbose +%debug + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%printer { + fprintf (yyoutput, "<> printer should not be called.\n"); +} <> + +%union { int field0; int field1; int field2; } +%type start 'a' 'g' +%type 'e' +%type 'f' +%printer { + fprintf (yyoutput, "<*>//e printer"); +} <*> 'e' +%destructor { + fprintf (stdout, "<*>//e destructor.\n"); +} <*> 'e' + +%type 'b' +%printer { fprintf (yyoutput, " printer"); } +%destructor { fprintf (stdout, " destructor.\n"); } + +%type 'c' +%printer { fprintf (yyoutput, "'c' printer"); } 'c' +%destructor { fprintf (stdout, "'c' destructor.\n"); } 'c' + +%type 'd' +%printer { fprintf (yyoutput, "'d' printer"); } 'd' +%destructor { fprintf (stdout, "'d' destructor.\n"); } 'd' + +%destructor { + fprintf (yyoutput, "<> destructor should not be called.\n"); +} <> + +%% + +start: + 'a' 'b' 'c' 'd' 'e' 'f' 'g' + { + USE(($1, $2, $3, $4, $5, $6, $7)); + $$ = 'S'; + } + ; + +%% + +static int +yylex (void) +{ + static char const input[] = "abcdef"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:791: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:791 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:791" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:791: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:791 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:791" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:791: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:791 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:791" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:791: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:791 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:791" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:791: bison -o input.c input.y" +echo actions.at:791 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:791" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:792: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:792 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:792" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:793: \$PREPARSER ./input" +echo actions.at:793 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Starting parse +Entering state 0 +Reading a token: Next token is token 'a' (<*>//e printer) +Shifting token 'a' (<*>//e printer) +Entering state 1 +Reading a token: Next token is token 'b' ( printer) +Shifting token 'b' ( printer) +Entering state 3 +Reading a token: Next token is token 'c' ('c' printer) +Shifting token 'c' ('c' printer) +Entering state 5 +Reading a token: Next token is token 'd' ('d' printer) +Shifting token 'd' ('d' printer) +Entering state 6 +Reading a token: Next token is token 'e' (<*>//e printer) +Shifting token 'e' (<*>//e printer) +Entering state 7 +Reading a token: Next token is token 'f' (<*>//e printer) +Shifting token 'f' (<*>//e printer) +Entering state 8 +Reading a token: Now at end of input. +syntax error, unexpected \$end, expecting 'g' +Error: popping token 'f' (<*>//e printer) +Stack now 0 1 3 5 6 7 +Error: popping token 'e' (<*>//e printer) +Stack now 0 1 3 5 6 +Error: popping token 'd' ('d' printer) +Stack now 0 1 3 5 +Error: popping token 'c' ('c' printer) +Stack now 0 1 3 +Error: popping token 'b' ( printer) +Stack now 0 1 +Error: popping token 'a' (<*>//e printer) +Stack now 0 +Cleanup: discarding lookahead token \$end () +Stack now 0 +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "<*>//e destructor. +<*>//e destructor. +'d' destructor. +'c' destructor. + destructor. +<*>//e destructor. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:793" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_93 +#AT_START_94 +# 94. actions.at:847: Default %printer and %destructor for user-defined end token +at_setup_line='actions.at:847' +at_func_banner 8 +at_desc="Default %printer and %destructor for user-defined end token" +$at_quiet $as_echo_n " 94: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "94. actions.at:847: testing ..." + $at_traceon + + +# _AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN(TYPED) +# ----------------------------------------------------------------------------- + + + + +cat >input0.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%error-verbose +%debug +%locations +%initial-action { + @$.first_line = @$.last_line = 1; + @$.first_column = @$.last_column = 1; +} + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%destructor { + fprintf (yyoutput, "<*> destructor should not be called.\n"); +} <*> + +%token END 0 +%printer { + fprintf (yyoutput, "<> for '%c' @ %d", $$, @$.first_column); +} <> +%destructor { + fprintf (stdout, "<> for '%c' @ %d.\n", $$, @$.first_column); +} <> + +%printer { + fprintf (yyoutput, "<*> printer should not be called.\n"); +} <*> + + + + +%% + +start: { $$ = 'S'; } ; + +%% + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + yylval = 'E'; + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; + return 0; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:950: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input0.c input0.y" +echo actions.at:950 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input0.c input0.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input0.c input0.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:950" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:950: bison --xml=xml-tests/test.xml -o input0.c input0.y" +echo actions.at:950 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input0.c input0.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input0.c input0.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:950" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:950: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:950 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:950" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:950: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:950 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:950" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:950: bison -o input0.c input0.y" +echo actions.at:950 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input0.c input0.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input0.c input0.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:950" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:950: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input0 input0.c \$LIBS" +echo actions.at:950 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input0 input0.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input0 input0.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input0 input0.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:950" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:950: \$PREPARSER ./input0" +echo actions.at:950 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input0"; then + ( $at_traceon; $PREPARSER ./input0 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input0 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Starting parse +Entering state 0 +Reducing stack by rule 1 (line 46): +-> \$\$ = nterm start (1.1-1.1: <> for 'S' @ 1) +Stack now 0 +Entering state 1 +Reading a token: Now at end of input. +Shifting token END (1.1-1.1: <> for 'E' @ 1) +Entering state 2 +Stack now 0 1 2 +Cleanup: popping token END (1.1-1.1: <> for 'E' @ 1) +Cleanup: popping nterm start (1.1-1.1: <> for 'S' @ 1) +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "<> for 'E' @ 1. +<> for 'S' @ 1. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:950" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + +cat >input1.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%error-verbose +%debug +%locations +%initial-action { + @$.first_line = @$.last_line = 1; + @$.first_column = @$.last_column = 1; +} + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%destructor { + fprintf (yyoutput, "<> destructor should not be called.\n"); +} <> + +%token END 0 +%printer { + fprintf (yyoutput, "<*> for '%c' @ %d", $$, @$.first_column); +} <*> +%destructor { + fprintf (stdout, "<*> for '%c' @ %d.\n", $$, @$.first_column); +} <*> + +%printer { + fprintf (yyoutput, "<> printer should not be called.\n"); +} <> + +%union { char tag; } +%type start END + +%% + +start: { $$ = 'S'; } ; + +%% + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + yylval.tag = 'E'; + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; + return 0; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:951: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input1.c input1.y" +echo actions.at:951 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input1.c input1.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input1.c input1.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:951" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:951: bison --xml=xml-tests/test.xml -o input1.c input1.y" +echo actions.at:951 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input1.c input1.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input1.c input1.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:951" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:951: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:951 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:951" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:951: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:951 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:951" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:951: bison -o input1.c input1.y" +echo actions.at:951 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input1.c input1.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input1.c input1.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:951" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:951: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input1 input1.c \$LIBS" +echo actions.at:951 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input1 input1.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input1 input1.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input1 input1.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:951" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:951: \$PREPARSER ./input1" +echo actions.at:951 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input1"; then + ( $at_traceon; $PREPARSER ./input1 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input1 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Starting parse +Entering state 0 +Reducing stack by rule 1 (line 46): +-> \$\$ = nterm start (1.1-1.1: <*> for 'S' @ 1) +Stack now 0 +Entering state 1 +Reading a token: Now at end of input. +Shifting token END (1.1-1.1: <*> for 'E' @ 1) +Entering state 2 +Stack now 0 1 2 +Cleanup: popping token END (1.1-1.1: <*> for 'E' @ 1) +Cleanup: popping nterm start (1.1-1.1: <*> for 'S' @ 1) +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "<*> for 'E' @ 1. +<*> for 'S' @ 1. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:951" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_94 +#AT_START_95 +# 95. actions.at:961: Default %printer and %destructor are not for error or $undefined +at_setup_line='actions.at:961' +at_func_banner 8 +at_desc="Default %printer and %destructor are not for error or \$undefined" +$at_quiet $as_echo_n " 95: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "95. actions.at:961: testing ..." + $at_traceon + + +# If Bison were to apply the default %printer and %destructor to the error +# token or to $undefined: +# - For the error token: +# - It would generate warnings for unused $n. +# - It would invoke the %printer and %destructor on the error token's +# semantic value, which would be initialized from the lookahead, which +# would be destroyed separately. +# - For $undefined, who knows what the semantic value would be. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%debug + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%printer { + fprintf (yyoutput, "'%c'", $$); +} <> <*> +%destructor { + fprintf (stderr, "DESTROY '%c'\n", $$); +} <> <*> + +%% + +start: + { $$ = 'S'; } + /* In order to reveal the problems that this bug caused during parsing, add + * $2 to USE. */ + | 'a' error 'b' 'c' { USE(($1, $3, $4)); $$ = 'S'; } + ; + +%% + +static int +yylex (void) +{ + static char const input[] = "abd"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylval = input[toknum++]; + return yylval; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1026: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:1026 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1026" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1026: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:1026 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1026" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1026: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:1026 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1026" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1026: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:1026 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1026" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1026: bison -o input.c input.y" +echo actions.at:1026 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1026" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1027: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:1027 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1027" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1028: \$PREPARSER ./input" +echo actions.at:1028 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Starting parse +Entering state 0 +Reading a token: Next token is token 'a' ('a') +Shifting token 'a' ('a') +Entering state 1 +Reading a token: Next token is token 'b' ('b') +syntax error +Shifting token error () +Entering state 3 +Next token is token 'b' ('b') +Shifting token 'b' ('b') +Entering state 5 +Reading a token: Next token is token \$undefined () +Error: popping token 'b' ('b') +DESTROY 'b' +Stack now 0 1 3 +Error: popping token error () +Stack now 0 1 +Shifting token error () +Entering state 3 +Next token is token \$undefined () +Error: discarding token \$undefined () +Error: popping token error () +Stack now 0 1 +Shifting token error () +Entering state 3 +Reading a token: Now at end of input. +Cleanup: discarding lookahead token \$end () +Stack now 0 1 3 +Cleanup: popping token error () +Cleanup: popping token 'a' ('a') +DESTROY 'a' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:1028" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_95 +#AT_START_96 +# 96. actions.at:1071: Default %printer and %destructor are not for $accept +at_setup_line='actions.at:1071' +at_func_banner 8 +at_desc="Default %printer and %destructor are not for \$accept" +$at_quiet $as_echo_n " 96: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "96. actions.at:1071: testing ..." + $at_traceon + + +# If YYSTYPE is a union and Bison were to apply the default %printer and +# %destructor to $accept: +# - The %printer and %destructor code generated for $accept would always be +# dead code because $accept is currently never shifted onto the stack. +# - $$ for $accept would always be of type YYSTYPE because it's not possible +# to declare `%type $accept'. (Also true for $undefined.) +# - Thus, the compiler might complain that the user code assumes the wrong +# type for $$ since the code might assume the type associated with a +# specific union field, which is especially reasonable in C++ since that +# type may be a base type. This test case checks for this problem. (Also +# true for $undefined and the error token, so there are three warnings for +# %printer and three for %destructor.) + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%debug /* So that %printer is actually compiled. */ + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +%} + +%printer { + char chr = $$; + fprintf (yyoutput, "'%c'", chr); +} <> <*> +%destructor { + char chr = $$; + fprintf (stderr, "DESTROY '%c'\n", chr); +} <> <*> + +%union { char chr; } +%type start + +%% + +start: { USE($$); } ; + +%% + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return 0; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1137: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:1137 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1137" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1137: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:1137 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1137" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1137: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:1137 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1137" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1137: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:1137 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1137" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1137: bison -o input.c input.y" +echo actions.at:1137 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1137" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1138: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:1138 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1138" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_96 +#AT_START_97 +# 97. actions.at:1148: Default %printer and %destructor for mid-rule values +at_setup_line='actions.at:1148' +at_func_banner 8 +at_desc="Default %printer and %destructor for mid-rule values" +$at_quiet $as_echo_n " 97: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "97. actions.at:1148: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%debug /* So that %printer is actually compiled. */ + +%{ +# include +# include + static void yyerror (const char *msg); + static int yylex (void); +# define USE(SYM) +# define YYLTYPE int +# define YYLLOC_DEFAULT(Current, Rhs, N) +# define YY_LOCATION_PRINT(File, Loc) +%} + +%printer { fprintf (yyoutput, "%d", @$); } <> +%destructor { fprintf (stderr, "DESTROY %d\n", @$); } <> +%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*> +%destructor { fprintf (yyoutput, "<*> destructor should not be called"); } <*> + +%% + +start: + { @$ = 1; } // Not set or used. + { USE ($$); @$ = 2; } // Both set and used. + { USE ($$); @$ = 3; } // Only set. + { @$ = 4; } // Only used. + 'c' + { USE (($$, $2, $4, $5)); @$ = 0; } + ; + +%% + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return 0; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yydebug = 1; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1205: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:1205 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1205" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1205: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:1205 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1205" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1205: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:1205 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1205" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1205: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:1205 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1205" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1205: bison -o input.c input.y" +echo actions.at:1205 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:33.3-23: warning: unset value: \$\$ +input.y:30.3-35.37: warning: unused value: \$3 +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1205" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1210: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:1210 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1210" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1211: \$PREPARSER ./input" +echo actions.at:1211 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Starting parse +Entering state 0 +Reducing stack by rule 1 (line 30): +-> \$\$ = nterm \$@1 (: ) +Stack now 0 +Entering state 2 +Reducing stack by rule 2 (line 31): +-> \$\$ = nterm @2 (: 2) +Stack now 0 2 +Entering state 4 +Reducing stack by rule 3 (line 32): +-> \$\$ = nterm @3 (: 3) +Stack now 0 2 4 +Entering state 5 +Reducing stack by rule 4 (line 33): +-> \$\$ = nterm @4 (: 4) +Stack now 0 2 4 5 +Entering state 6 +Reading a token: Now at end of input. +syntax error +Error: popping nterm @4 (: 4) +DESTROY 4 +Stack now 0 2 4 5 +Error: popping nterm @3 (: 3) +DESTROY 3 +Stack now 0 2 4 +Error: popping nterm @2 (: 2) +DESTROY 2 +Stack now 0 2 +Error: popping nterm \$@1 (: ) +Stack now 0 +Cleanup: discarding lookahead token \$end (: ) +Stack now 0 +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/actions.at:1211" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_97 +#AT_START_98 +# 98. actions.at:1304: @$ in %initial-action implies %locations +at_setup_line='actions.at:1304' +at_func_banner 8 +at_desc="@\$ in %initial-action implies %locations" +$at_quiet $as_echo_n " 98: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "98. actions.at:1304: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code { + #include + static int yylex (void); + static void yyerror (char const *msg); +} + +%debug + +%initial-action { + printf ("%d\n", @$.first_line); +} + +%% + +start: ; + +%% + +static int +yylex (void) +{ + return 0; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1304: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:1304 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1304" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1304: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:1304 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1304" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1304: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:1304 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1304" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1304: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:1304 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1304" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1304: bison -o input.c input.y" +echo actions.at:1304 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1304" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1304: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:1304 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1304" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_98 +#AT_START_99 +# 99. actions.at:1305: @$ in %destructor implies %locations +at_setup_line='actions.at:1305' +at_func_banner 8 +at_desc="@\$ in %destructor implies %locations" +$at_quiet $as_echo_n " 99: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "99. actions.at:1305: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code { + #include + static int yylex (void); + static void yyerror (char const *msg); +} + +%debug + +%destructor { + printf ("%d\n", @$.first_line); +} start + +%% + +start: ; + +%% + +static int +yylex (void) +{ + return 0; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1305: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:1305 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1305" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1305: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:1305 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1305" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1305: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:1305 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1305" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1305: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:1305 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1305" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1305: bison -o input.c input.y" +echo actions.at:1305 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1305" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1305: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:1305 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1305" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_99 +#AT_START_100 +# 100. actions.at:1306: @$ in %printer implies %locations +at_setup_line='actions.at:1306' +at_func_banner 8 +at_desc="@\$ in %printer implies %locations" +$at_quiet $as_echo_n "100: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "100. actions.at:1306: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%code { + #include + static int yylex (void); + static void yyerror (char const *msg); +} + +%debug + +%printer { + printf ("%d\n", @$.first_line); +} start + +%% + +start: ; + +%% + +static int +yylex (void) +{ + return 0; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1306: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo actions.at:1306 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1306" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1306: bison --xml=xml-tests/test.xml -o input.c input.y" +echo actions.at:1306 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1306" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1306: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo actions.at:1306 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1306" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/actions.at:1306: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo actions.at:1306 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1306" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1306: bison -o input.c input.y" +echo actions.at:1306 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1306" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/actions.at:1306: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo actions.at:1306 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/actions.at:1306" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_100 +#AT_START_101 +# 101. conflicts.at:30: S/R in initial +at_setup_line='conflicts.at:30' +at_func_banner 9 +at_desc="S/R in initial" +$at_quiet $as_echo_n "101: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "101. conflicts.at:30: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%expect 1 +%% +exp: e 'e'; +e: 'e' | /* Nothing. */; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:39: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo conflicts.at:39 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:39" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:39: bison --xml=xml-tests/test.xml -o input.c input.y" +echo conflicts.at:39 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:39" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:39: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:39 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:39" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:39: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:39 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:39" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:39: bison -o input.c input.y" +echo conflicts.at:39 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:4.9: warning: rule useless in parser due to conflicts: e: /* empty */ +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:39" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_101 +#AT_START_102 +# 102. conflicts.at:50: %nonassoc and eof +at_setup_line='conflicts.at:50' +at_func_banner 9 +at_desc="%nonassoc and eof" +$at_quiet $as_echo_n "102: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "102. conflicts.at:50: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ +#include +#include +#include + +#define YYERROR_VERBOSE 1 +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +/* The current argument. */ +static const char *input; + +static int +yylex (void) +{ + static size_t toknum; + if (! (toknum <= strlen (input))) + abort (); + return input[toknum++]; +} + +%} + +%nonassoc '<' '>' + +%% +expr: expr '<' expr + | expr '>' expr + | '0' + ; +%% +int +main (int argc, const char *argv[]) +{ + input = argc <= 1 ? "" : argv[1]; + return yyparse (); +} +_ATEOF + + + +# Specify the output files to avoid problems on different file systems. +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:97: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo conflicts.at:97 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:97" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:97: bison --xml=xml-tests/test.xml -o input.c input.y" +echo conflicts.at:97 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:97" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:97: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:97 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:97" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:97: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:97 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:97" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:97: bison -o input.c input.y" +echo conflicts.at:97 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:97" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:98: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo conflicts.at:98 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:98" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:100: \$PREPARSER ./input '0<0'" +echo conflicts.at:100 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '0<0'"; then + ( $at_traceon; $PREPARSER ./input '0<0' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '0<0' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + +# FIXME: This is an actual bug, but a new one, in the sense that +# no one has ever spotted it! The messages are *wrong*: there should +# be nothing there, it should be expected eof. +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:104: \$PREPARSER ./input '0<0<0'" +echo conflicts.at:104 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '0<0<0'"; then + ( $at_traceon; $PREPARSER ./input '0<0<0' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '0<0<0' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected '<', expecting '<' or '>' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/conflicts.at:104" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:108: \$PREPARSER ./input '0>0'" +echo conflicts.at:108 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '0>0'"; then + ( $at_traceon; $PREPARSER ./input '0>0' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '0>0' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:108" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:109: \$PREPARSER ./input '0>0>0'" +echo conflicts.at:109 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '0>0>0'"; then + ( $at_traceon; $PREPARSER ./input '0>0>0' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '0>0>0' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected '>', expecting '<' or '>' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/conflicts.at:109" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:113: \$PREPARSER ./input '0<0>0'" +echo conflicts.at:113 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input '0<0>0'"; then + ( $at_traceon; $PREPARSER ./input '0<0>0' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input '0<0>0' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected '>', expecting '<' or '>' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/conflicts.at:113" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_102 +#AT_START_103 +# 103. conflicts.at:125: Unresolved SR Conflicts +at_setup_line='conflicts.at:125' +at_func_banner 9 +at_desc="Unresolved SR Conflicts" +$at_quiet $as_echo_n "103: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "103. conflicts.at:125: testing ..." + $at_traceon + + + + +cat >input.y <<'_ATEOF' +%token NUM OP +%% +exp: exp OP exp | NUM; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:135: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c --report=all input.y" +echo conflicts.at:135 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:135" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:135: bison --xml=xml-tests/test.xml -o input.c --report=all input.y" +echo conflicts.at:135 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:135" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:135: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:135 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:135" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:135: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:135 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:135" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:135: bison -o input.c --report=all input.y" +echo conflicts.at:135 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: conflicts: 1 shift/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:135" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Check the contents of the report. +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:140: cat input.output" +echo conflicts.at:140 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "State 5 conflicts: 1 shift/reduce + + +Grammar + + 0 \$accept: exp \$end + + 1 exp: exp OP exp + 2 | NUM + + +Terminals, with rules where they appear + +\$end (0) 0 +error (256) +NUM (258) 2 +OP (259) 1 + + +Nonterminals, with rules where they appear + +\$accept (5) + on left: 0 +exp (6) + on left: 1 2, on right: 0 1 + + +state 0 + + 0 \$accept: . exp \$end + 1 exp: . exp OP exp + 2 | . NUM + + NUM shift, and go to state 1 + + exp go to state 2 + + +state 1 + + 2 exp: NUM . + + \$default reduce using rule 2 (exp) + + +state 2 + + 0 \$accept: exp . \$end + 1 exp: exp . OP exp + + \$end shift, and go to state 3 + OP shift, and go to state 4 + + +state 3 + + 0 \$accept: exp \$end . + + \$default accept + + +state 4 + + 1 exp: . exp OP exp + 1 | exp OP . exp + 2 | . NUM + + NUM shift, and go to state 1 + + exp go to state 5 + + +state 5 + + 1 exp: exp . OP exp + 1 | exp OP exp . [\$end, OP] + + OP shift, and go to state 4 + + OP [reduce using rule 1 (exp)] + \$default reduce using rule 1 (exp) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:140" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_103 +#AT_START_104 +# 104. conflicts.at:232: Resolved SR Conflicts +at_setup_line='conflicts.at:232' +at_func_banner 9 +at_desc="Resolved SR Conflicts" +$at_quiet $as_echo_n "104: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "104. conflicts.at:232: testing ..." + $at_traceon + + + + +cat >input.y <<'_ATEOF' +%token NUM OP +%left OP +%% +exp: exp OP exp | NUM; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:243: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c --report=all input.y" +echo conflicts.at:243 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:243" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:243: bison --xml=xml-tests/test.xml -o input.c --report=all input.y" +echo conflicts.at:243 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:243" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:243: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:243 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:243" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:243: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:243 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:243" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:243: bison -o input.c --report=all input.y" +echo conflicts.at:243 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:243" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Check the contents of the report. +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:246: cat input.output" +echo conflicts.at:246 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Grammar + + 0 \$accept: exp \$end + + 1 exp: exp OP exp + 2 | NUM + + +Terminals, with rules where they appear + +\$end (0) 0 +error (256) +NUM (258) 2 +OP (259) 1 + + +Nonterminals, with rules where they appear + +\$accept (5) + on left: 0 +exp (6) + on left: 1 2, on right: 0 1 + + +state 0 + + 0 \$accept: . exp \$end + 1 exp: . exp OP exp + 2 | . NUM + + NUM shift, and go to state 1 + + exp go to state 2 + + +state 1 + + 2 exp: NUM . + + \$default reduce using rule 2 (exp) + + +state 2 + + 0 \$accept: exp . \$end + 1 exp: exp . OP exp + + \$end shift, and go to state 3 + OP shift, and go to state 4 + + +state 3 + + 0 \$accept: exp \$end . + + \$default accept + + +state 4 + + 1 exp: . exp OP exp + 1 | exp OP . exp + 2 | . NUM + + NUM shift, and go to state 1 + + exp go to state 5 + + +state 5 + + 1 exp: exp . OP exp + 1 | exp OP exp . [\$end, OP] + + \$default reduce using rule 1 (exp) + + Conflict between rule 1 and token OP resolved as reduce (%left OP). +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:246" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_104 +#AT_START_105 +# 105. conflicts.at:354: Defaulted Conflicted Reduction +at_setup_line='conflicts.at:354' +at_func_banner 9 +at_desc="Defaulted Conflicted Reduction" +$at_quiet $as_echo_n "105: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "105. conflicts.at:354: testing ..." + $at_traceon + + + +cat >input.y <<'_ATEOF' +%% +exp: num | id; +num: '0'; +id : '0'; +%% +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:365: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c --report=all input.y" +echo conflicts.at:365 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:365" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:365: bison --xml=xml-tests/test.xml -o input.c --report=all input.y" +echo conflicts.at:365 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:365" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:365: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:365 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:365" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:365: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:365 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:365" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:365: bison -o input.c --report=all input.y" +echo conflicts.at:365 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: conflicts: 1 reduce/reduce +input.y:4.6-8: warning: rule useless in parser due to conflicts: id: '0' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:365" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Check the contents of the report. +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:371: cat input.output" +echo conflicts.at:371 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Rules useless in parser due to conflicts + + 4 id: '0' + + +State 1 conflicts: 1 reduce/reduce + + +Grammar + + 0 \$accept: exp \$end + + 1 exp: num + 2 | id + + 3 num: '0' + + 4 id: '0' + + +Terminals, with rules where they appear + +\$end (0) 0 +'0' (48) 3 4 +error (256) + + +Nonterminals, with rules where they appear + +\$accept (4) + on left: 0 +exp (5) + on left: 1 2, on right: 0 +num (6) + on left: 3, on right: 1 +id (7) + on left: 4, on right: 2 + + +state 0 + + 0 \$accept: . exp \$end + 1 exp: . num + 2 | . id + 3 num: . '0' + 4 id: . '0' + + '0' shift, and go to state 1 + + exp go to state 2 + num go to state 3 + id go to state 4 + + +state 1 + + 3 num: '0' . [\$end] + 4 id: '0' . [\$end] + + \$end reduce using rule 3 (num) + \$end [reduce using rule 4 (id)] + \$default reduce using rule 3 (num) + + +state 2 + + 0 \$accept: exp . \$end + + \$end shift, and go to state 5 + + +state 3 + + 1 exp: num . + + \$default reduce using rule 1 (exp) + + +state 4 + + 2 exp: id . + + \$default reduce using rule 2 (exp) + + +state 5 + + 0 \$accept: exp \$end . + + \$default accept +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:371" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_105 +#AT_START_106 +# 106. conflicts.at:473: %expect not enough +at_setup_line='conflicts.at:473' +at_func_banner 9 +at_desc="%expect not enough" +$at_quiet $as_echo_n "106: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "106. conflicts.at:473: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%token NUM OP +%expect 0 +%% +exp: exp OP exp | NUM; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:482: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y" +echo conflicts.at:482 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: conflicts: 1 shift/reduce +input.y: expected 0 shift/reduce conflicts +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/conflicts.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_106 +#AT_START_107 +# 107. conflicts.at:493: %expect right +at_setup_line='conflicts.at:493' +at_func_banner 9 +at_desc="%expect right" +$at_quiet $as_echo_n "107: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "107. conflicts.at:493: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%token NUM OP +%expect 1 +%% +exp: exp OP exp | NUM; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:502: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo conflicts.at:502 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:502" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:502: bison --xml=xml-tests/test.xml -o input.c input.y" +echo conflicts.at:502 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:502" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:502: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:502 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:502" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:502: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:502 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:502" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:502: bison -o input.c input.y" +echo conflicts.at:502 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:502" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_107 +#AT_START_108 +# 108. conflicts.at:510: %expect too much +at_setup_line='conflicts.at:510' +at_func_banner 9 +at_desc="%expect too much" +$at_quiet $as_echo_n "108: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "108. conflicts.at:510: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%token NUM OP +%expect 2 +%% +exp: exp OP exp | NUM; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:519: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y" +echo conflicts.at:519 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: conflicts: 1 shift/reduce +input.y: expected 2 shift/reduce conflicts +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/conflicts.at:519" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_108 +#AT_START_109 +# 109. conflicts.at:530: %expect with reduce conflicts +at_setup_line='conflicts.at:530' +at_func_banner 9 +at_desc="%expect with reduce conflicts" +$at_quiet $as_echo_n "109: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "109. conflicts.at:530: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%expect 0 +%% +program: a 'a' | a a; +a: 'a'; +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:539: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y" +echo conflicts.at:539 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o input.c input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: conflicts: 1 reduce/reduce +input.y: expected 0 reduce/reduce conflicts +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/conflicts.at:539" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_109 +#AT_START_110 +# 110. conflicts.at:550: %no-default-prec without %prec +at_setup_line='conflicts.at:550' +at_func_banner 9 +at_desc="%no-default-prec without %prec" +$at_quiet $as_echo_n "110: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "110. conflicts.at:550: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%left '+' +%left '*' + +%% + +%no-default-prec; + +e: e '+' e + | e '*' e + | '0' + ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:566: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo conflicts.at:566 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:566" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:566: bison --xml=xml-tests/test.xml -o input.c input.y" +echo conflicts.at:566 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:566" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:566: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:566 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:566" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:566: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:566 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:566" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:566: bison -o input.c input.y" +echo conflicts.at:566 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: conflicts: 4 shift/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:566" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_110 +#AT_START_111 +# 111. conflicts.at:576: %no-default-prec with %prec +at_setup_line='conflicts.at:576' +at_func_banner 9 +at_desc="%no-default-prec with %prec" +$at_quiet $as_echo_n "111: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "111. conflicts.at:576: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%left '+' +%left '*' + +%% + +%no-default-prec; + +e: e '+' e %prec '+' + | e '*' e %prec '*' + | '0' + ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:592: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo conflicts.at:592 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:592: bison --xml=xml-tests/test.xml -o input.c input.y" +echo conflicts.at:592 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:592: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:592 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:592: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:592 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:592: bison -o input.c input.y" +echo conflicts.at:592 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_111 +#AT_START_112 +# 112. conflicts.at:600: %default-prec +at_setup_line='conflicts.at:600' +at_func_banner 9 +at_desc="%default-prec" +$at_quiet $as_echo_n "112: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "112. conflicts.at:600: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%left '+' +%left '*' + +%% + +%default-prec; + +e: e '+' e + | e '*' e + | '0' + ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:616: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo conflicts.at:616 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:616: bison --xml=xml-tests/test.xml -o input.c input.y" +echo conflicts.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:616: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:616 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:616: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:616 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:616: bison -o input.c input.y" +echo conflicts.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_112 +#AT_START_113 +# 113. conflicts.at:624: Unreachable States After Conflict Resolution +at_setup_line='conflicts.at:624' +at_func_banner 9 +at_desc="Unreachable States After Conflict Resolution" +$at_quiet $as_echo_n "113: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "113. conflicts.at:624: testing ..." + $at_traceon + + +# If conflict resolution makes states unreachable, remove those states, report +# rules that are then unused, and don't report conflicts in those states. Test +# what happens when a nonterminal becomes useless as a result of state removal +# since that causes lalr.o's goto map to be rewritten. + +cat >input.y <<'_ATEOF' +%output "input.c" +%left 'a' + +%% + +start: resolved_conflict 'a' reported_conflicts 'a' ; + +/* S/R conflict resolved as reduce, so the state with item + * (resolved_conflict: 'a' . unreachable1) and all it transition successors are + * unreachable, and the associated production is useless. */ +resolved_conflict: + 'a' unreachable1 + | %prec 'a' + ; + +/* S/R conflict that need not be reported since it is unreachable because of + * the previous conflict resolution. Nonterminal unreachable1 and all its + * productions are useless. */ +unreachable1: + 'a' unreachable2 + | + ; + +/* Likewise for a R/R conflict and nonterminal unreachable2. */ +unreachable2: | ; + +/* Make sure remaining S/R and R/R conflicts are still reported correctly even + * when their states are renumbered due to state removal. */ +reported_conflicts: + 'a' + | 'a' + | + ; + +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:668: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --report=all input.y" +echo conflicts.at:668 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:668" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:668: bison --xml=xml-tests/test.xml --report=all input.y" +echo conflicts.at:668 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:668" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:668: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:668 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:668" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:668: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:668 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:668" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:668: bison --report=all input.y" +echo conflicts.at:668 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: conflicts: 1 shift/reduce, 1 reduce/reduce +input.y:12.5-20: warning: rule useless in parser due to conflicts: resolved_conflict: 'a' unreachable1 +input.y:20.5-20: warning: rule useless in parser due to conflicts: unreachable1: 'a' unreachable2 +input.y:21.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ +input.y:25.13: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ +input.y:25.16: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ +input.y:31.5-7: warning: rule useless in parser due to conflicts: reported_conflicts: 'a' +input.y:32.4: warning: rule useless in parser due to conflicts: reported_conflicts: /* empty */ +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:668" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:679: cat input.output" +echo conflicts.at:679 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Rules useless in parser due to conflicts + + 2 resolved_conflict: 'a' unreachable1 + + 4 unreachable1: 'a' unreachable2 + 5 | /* empty */ + + 6 unreachable2: /* empty */ + 7 | /* empty */ + + 9 reported_conflicts: 'a' + 10 | /* empty */ + + +State 4 conflicts: 1 shift/reduce +State 5 conflicts: 1 reduce/reduce + + +Grammar + + 0 \$accept: start \$end + + 1 start: resolved_conflict 'a' reported_conflicts 'a' + + 2 resolved_conflict: 'a' unreachable1 + 3 | /* empty */ + + 4 unreachable1: 'a' unreachable2 + 5 | /* empty */ + + 6 unreachable2: /* empty */ + 7 | /* empty */ + + 8 reported_conflicts: 'a' + 9 | 'a' + 10 | /* empty */ + + +Terminals, with rules where they appear + +\$end (0) 0 +'a' (97) 1 2 4 8 9 +error (256) + + +Nonterminals, with rules where they appear + +\$accept (4) + on left: 0 +start (5) + on left: 1, on right: 0 +resolved_conflict (6) + on left: 2 3, on right: 1 +unreachable1 (7) + on left: 4 5, on right: 2 +unreachable2 (8) + on left: 6 7, on right: 4 +reported_conflicts (9) + on left: 8 9 10, on right: 1 + + +state 0 + + 0 \$accept: . start \$end + 1 start: . resolved_conflict 'a' reported_conflicts 'a' + 2 resolved_conflict: . 'a' unreachable1 + 3 | . ['a'] + + \$default reduce using rule 3 (resolved_conflict) + + start go to state 1 + resolved_conflict go to state 2 + + Conflict between rule 3 and token 'a' resolved as reduce (%left 'a'). + + +state 1 + + 0 \$accept: start . \$end + + \$end shift, and go to state 3 + + +state 2 + + 1 start: resolved_conflict . 'a' reported_conflicts 'a' + + 'a' shift, and go to state 4 + + +state 3 + + 0 \$accept: start \$end . + + \$default accept + + +state 4 + + 1 start: resolved_conflict 'a' . reported_conflicts 'a' + 8 reported_conflicts: . 'a' + 9 | . 'a' + 10 | . ['a'] + + 'a' shift, and go to state 5 + + 'a' [reduce using rule 10 (reported_conflicts)] + + reported_conflicts go to state 6 + + +state 5 + + 8 reported_conflicts: 'a' . ['a'] + 9 | 'a' . ['a'] + + 'a' reduce using rule 8 (reported_conflicts) + 'a' [reduce using rule 9 (reported_conflicts)] + \$default reduce using rule 8 (reported_conflicts) + + +state 6 + + 1 start: resolved_conflict 'a' reported_conflicts . 'a' + + 'a' shift, and go to state 7 + + +state 7 + + 1 start: resolved_conflict 'a' reported_conflicts 'a' . + + \$default reduce using rule 1 (start) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:679" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input-keep.y <<'_ATEOF' +%define lr.keep_unreachable_states +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:818: cat input.y >> input-keep.y" +echo conflicts.at:818 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input.y >> input-keep.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.y >> input-keep.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:818" + +$at_failed && at_func_log_failure +$at_traceon; } + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:820: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input-keep.y" +echo conflicts.at:820 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-keep.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input-keep.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:820" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:820: bison --xml=xml-tests/test.xml input-keep.y" +echo conflicts.at:820 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input-keep.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input-keep.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:820" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:820: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:820 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:820" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:820: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:820 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:820" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:820: bison input-keep.y" +echo conflicts.at:820 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input-keep.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input-keep.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input-keep.y: conflicts: 2 shift/reduce, 2 reduce/reduce +input-keep.y:22.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ +input-keep.y:26.16: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ +input-keep.y:32.5-7: warning: rule useless in parser due to conflicts: reported_conflicts: 'a' +input-keep.y:33.4: warning: rule useless in parser due to conflicts: reported_conflicts: /* empty */ +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:820" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_113 +#AT_START_114 +# 114. conflicts.at:835: Solved conflicts report for multiple reductions in a state +at_setup_line='conflicts.at:835' +at_func_banner 9 +at_desc="Solved conflicts report for multiple reductions in a state" +$at_quiet $as_echo_n "114: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "114. conflicts.at:835: testing ..." + $at_traceon + + +# Used to lose earlier solved conflict messages even within a single S/R/R. + +cat >input.y <<'_ATEOF' +%left 'a' +%right 'b' +%right 'c' +%right 'd' +%% +start: + 'a' + | empty_a 'a' + | 'b' + | empty_b 'b' + | 'c' + | empty_c1 'c' + | empty_c2 'c' + | empty_c3 'c' + ; +empty_a: %prec 'a' ; +empty_b: %prec 'b' ; +empty_c1: %prec 'c' ; +empty_c2: %prec 'c' ; +empty_c3: %prec 'd' ; +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:861: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --report=all -o input.c input.y" +echo conflicts.at:861 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:861" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:861: bison --xml=xml-tests/test.xml --report=all -o input.c input.y" +echo conflicts.at:861 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:861" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:861: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:861 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:861" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:861: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:861 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:861" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:861: bison --report=all -o input.c input.y" +echo conflicts.at:861 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:861" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:862: cat input.output | sed -n '/^state 0\$/,/^state 1\$/p'" +echo conflicts.at:862 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "cat input.output | sed -n '/^state 0$/,/^state 1$/p'"; then + ( $at_traceon; cat input.output | sed -n '/^state 0$/,/^state 1$/p' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.output | sed -n '/^state 0$/,/^state 1$/p' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "state 0 + + 0 \$accept: . start \$end + 1 start: . 'a' + 2 | . empty_a 'a' + 3 | . 'b' + 4 | . empty_b 'b' + 5 | . 'c' + 6 | . empty_c1 'c' + 7 | . empty_c2 'c' + 8 | . empty_c3 'c' + 9 empty_a: . ['a'] + 10 empty_b: . [] + 11 empty_c1: . [] + 12 empty_c2: . [] + 13 empty_c3: . ['c'] + + 'b' shift, and go to state 1 + + 'c' reduce using rule 13 (empty_c3) + \$default reduce using rule 9 (empty_a) + + start go to state 2 + empty_a go to state 3 + empty_b go to state 4 + empty_c1 go to state 5 + empty_c2 go to state 6 + empty_c3 go to state 7 + + Conflict between rule 9 and token 'a' resolved as reduce (%left 'a'). + Conflict between rule 10 and token 'b' resolved as shift (%right 'b'). + Conflict between rule 11 and token 'c' resolved as shift (%right 'c'). + Conflict between rule 12 and token 'c' resolved as shift (%right 'c'). + Conflict between rule 13 and token 'c' resolved as reduce ('c' < 'd'). + + +state 1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:862" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_114 +#AT_START_115 +# 115. conflicts.at:915: %nonassoc error actions for multiple reductions in a state +at_setup_line='conflicts.at:915' +at_func_banner 9 +at_desc="%nonassoc error actions for multiple reductions in a state" +$at_quiet $as_echo_n "115: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "115. conflicts.at:915: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%nonassoc 'a' 'b' 'c' +%% +start: + 'a' + | empty_a 'a' + | 'b' + | empty_b 'b' + | 'c' + | empty_c1 'c' + | empty_c2 'c' + | empty_c3 'c' + ; +empty_a: %prec 'a' ; +empty_b: %prec 'b' ; +empty_c1: %prec 'c' ; +empty_c2: %prec 'c' ; +empty_c3: %prec 'c' ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:937: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --report=all -o input.c input.y" +echo conflicts.at:937 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:937" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:937: bison --xml=xml-tests/test.xml --report=all -o input.c input.y" +echo conflicts.at:937 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:937" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:937: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo conflicts.at:937 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:937" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/conflicts.at:937: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo conflicts.at:937 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:937" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:937: bison --report=all -o input.c input.y" +echo conflicts.at:937 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:937" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/conflicts.at:938: cat input.output | sed -n '/^state 0\$/,/^state 1\$/p'" +echo conflicts.at:938 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "cat input.output | sed -n '/^state 0$/,/^state 1$/p'"; then + ( $at_traceon; cat input.output | sed -n '/^state 0$/,/^state 1$/p' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.output | sed -n '/^state 0$/,/^state 1$/p' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "state 0 + + 0 \$accept: . start \$end + 1 start: . 'a' + 2 | . empty_a 'a' + 3 | . 'b' + 4 | . empty_b 'b' + 5 | . 'c' + 6 | . empty_c1 'c' + 7 | . empty_c2 'c' + 8 | . empty_c3 'c' + 9 empty_a: . [] + 10 empty_b: . [] + 11 empty_c1: . [] + 12 empty_c2: . ['c'] + 13 empty_c3: . ['c'] + + 'a' error (nonassociative) + 'b' error (nonassociative) + 'c' error (nonassociative) + + 'c' [reduce using rule 12 (empty_c2)] + 'c' [reduce using rule 13 (empty_c3)] + + start go to state 1 + empty_a go to state 2 + empty_b go to state 3 + empty_c1 go to state 4 + empty_c2 go to state 5 + empty_c3 go to state 6 + + Conflict between rule 9 and token 'a' resolved as an error (%nonassoc 'a'). + Conflict between rule 10 and token 'b' resolved as an error (%nonassoc 'b'). + Conflict between rule 11 and token 'c' resolved as an error (%nonassoc 'c'). + + +state 1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/conflicts.at:938" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_115 +#AT_START_116 +# 116. calc.at:569: Calculator +at_setup_line='calc.at:569' +at_func_banner 10 +at_desc="Calculator " +$at_quiet $as_echo_n "116: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "116. calc.at:569: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ + + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:569: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:569 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:569: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:569 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:569 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: bison -o calc.c calc.y" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc /dev/null" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: \$PREPARSER ./calc input" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:569: cat stderr" +echo calc.at:569 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:569" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_116 +#AT_START_117 +# 117. calc.at:571: Calculator %defines +at_setup_line='calc.at:571' +at_func_banner 10 +at_desc="Calculator %defines" +$at_quiet $as_echo_n "117: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "117. calc.at:571: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%defines + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:571: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:571 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:571: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:571 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:571 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: bison -o calc.c calc.y" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc /dev/null" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: \$PREPARSER ./calc input" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:571: cat stderr" +echo calc.at:571 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:571" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_117 +#AT_START_118 +# 118. calc.at:572: Calculator %locations +at_setup_line='calc.at:572' +at_func_banner 10 +at_desc="Calculator %locations" +$at_quiet $as_echo_n "118: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "118. calc.at:572: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%locations + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (yylloc).first_line, (yylloc).first_column); + if ((yylloc).first_line != (yylloc).last_line) + fprintf (stderr, "-%d.%d", + (yylloc).last_line, (yylloc).last_column - 1); + else if ((yylloc).first_column != (yylloc).last_column - 1) + fprintf (stderr, "-%d", + (yylloc).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (void) +{ + int res = getc (input); + ; + + last_yylloc = (yylloc); + if (res == '\n') + { + (yylloc).last_line++; + (yylloc).last_column = 1; + } + else + (yylloc).last_column++; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + /* Wrong when C == `\n'. */ + (yylloc) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (yylloc).last_column = 1; + (yylloc).last_line = 1; + + } + + + (yylloc).first_column = (yylloc).last_column; + (yylloc).first_line = (yylloc).last_line; + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + (yylloc).first_column = (yylloc).last_column; + (yylloc).first_line = (yylloc).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:572: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:572 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:572: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:572 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:572 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: bison -o calc.c calc.y" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc /dev/null" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: \$PREPARSER ./calc input" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:572: cat stderr" +echo calc.at:572 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:572" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_118 +#AT_START_119 +# 119. calc.at:573: Calculator %name-prefix="calc" +at_setup_line='calc.at:573' +at_func_banner 10 +at_desc="Calculator %name-prefix=\"calc\"" +$at_quiet $as_echo_n "119: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "119. calc.at:573: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%name-prefix="calc" + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:573: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:573 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:573: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:573 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:573 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: bison -o calc.c calc.y" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc /dev/null" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: \$PREPARSER ./calc input" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:573: cat stderr" +echo calc.at:573 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_119 +#AT_START_120 +# 120. calc.at:574: Calculator %verbose +at_setup_line='calc.at:574' +at_func_banner 10 +at_desc="Calculator %verbose" +$at_quiet $as_echo_n "120: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "120. calc.at:574: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%verbose + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:574: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:574 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:574: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:574 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:574 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: bison -o calc.c calc.y" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc /dev/null" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: \$PREPARSER ./calc input" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:574: cat stderr" +echo calc.at:574 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:574" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_120 +#AT_START_121 +# 121. calc.at:575: Calculator %yacc +at_setup_line='calc.at:575' +at_func_banner 10 +at_desc="Calculator %yacc" +$at_quiet $as_echo_n "121: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "121. calc.at:575: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:575: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:575 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:575: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:575 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:575 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: bison -o calc.c calc.y" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc /dev/null" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: \$PREPARSER ./calc input" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:575: cat stderr" +echo calc.at:575 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_121 +#AT_START_122 +# 122. calc.at:576: Calculator %error-verbose +at_setup_line='calc.at:576' +at_func_banner 10 +at_desc="Calculator %error-verbose" +$at_quiet $as_echo_n "122: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "122. calc.at:576: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%error-verbose + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:576: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:576 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:576: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:576 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:576 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: bison -o calc.c calc.y" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc /dev/null" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: \$PREPARSER ./calc input" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:576: cat stderr" +echo calc.at:576 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:576" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_122 +#AT_START_123 +# 123. calc.at:578: Calculator %define api.pure %locations +at_setup_line='calc.at:578' +at_func_banner 10 +at_desc="Calculator %define api.pure %locations" +$at_quiet $as_echo_n "123: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "123. calc.at:578: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%define api.pure %locations + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:578: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:578 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:578: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:578 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:578 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: bison -o calc.c calc.y" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc /dev/null" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: \$PREPARSER ./calc input" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:578: cat stderr" +echo calc.at:578 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:578" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_123 +#AT_START_124 +# 124. calc.at:579: Calculator %define api.push_pull "both" %define api.pure %locations +at_setup_line='calc.at:579' +at_func_banner 10 +at_desc="Calculator %define api.push_pull \"both\" %define api.pure %locations" +$at_quiet $as_echo_n "124: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "124. calc.at:579: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%define api.push_pull "both" %define api.pure %locations + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:579: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:579 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:579: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:579 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:579 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: bison -o calc.c calc.y" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc /dev/null" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: \$PREPARSER ./calc input" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:579: cat stderr" +echo calc.at:579 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:579" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_124 +#AT_START_125 +# 125. calc.at:580: Calculator %error-verbose %locations +at_setup_line='calc.at:580' +at_func_banner 10 +at_desc="Calculator %error-verbose %locations" +$at_quiet $as_echo_n "125: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "125. calc.at:580: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%error-verbose %locations + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (yylloc).first_line, (yylloc).first_column); + if ((yylloc).first_line != (yylloc).last_line) + fprintf (stderr, "-%d.%d", + (yylloc).last_line, (yylloc).last_column - 1); + else if ((yylloc).first_column != (yylloc).last_column - 1) + fprintf (stderr, "-%d", + (yylloc).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (void) +{ + int res = getc (input); + ; + + last_yylloc = (yylloc); + if (res == '\n') + { + (yylloc).last_line++; + (yylloc).last_column = 1; + } + else + (yylloc).last_column++; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + /* Wrong when C == `\n'. */ + (yylloc) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (yylloc).last_column = 1; + (yylloc).last_line = 1; + + } + + + (yylloc).first_column = (yylloc).last_column; + (yylloc).first_line = (yylloc).last_line; + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + (yylloc).first_column = (yylloc).last_column; + (yylloc).first_line = (yylloc).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:580: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:580 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:580: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:580 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:580 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: bison -o calc.c calc.y" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc /dev/null" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: \$PREPARSER ./calc input" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:580: cat stderr" +echo calc.at:580 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:580" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_125 +#AT_START_126 +# 126. calc.at:582: Calculator %error-verbose %locations %defines %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:582' +at_func_banner 10 +at_desc="Calculator %error-verbose %locations %defines %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "126: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "126. calc.at:582: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (calclloc).first_line, (calclloc).first_column); + if ((calclloc).first_line != (calclloc).last_line) + fprintf (stderr, "-%d.%d", + (calclloc).last_line, (calclloc).last_column - 1); + else if ((calclloc).first_column != (calclloc).last_column - 1) + fprintf (stderr, "-%d", + (calclloc).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (void); +static int get_char (void); +static void unget_char ( int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (void) +{ + int res = getc (input); + ; + + last_yylloc = (calclloc); + if (res == '\n') + { + (calclloc).last_line++; + (calclloc).last_column = 1; + } + else + (calclloc).last_column++; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + /* Wrong when C == `\n'. */ + (calclloc) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (calclloc).last_column = 1; + (calclloc).last_line = 1; + + } + + + (calclloc).first_column = (calclloc).last_column; + (calclloc).first_line = (calclloc).last_line; + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + (calclloc).first_column = (calclloc).last_column; + (calclloc).first_line = (calclloc).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (calclval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:582: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:582 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:582: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:582 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:582 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: bison -o calc.c calc.y" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc /dev/null" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: \$PREPARSER ./calc input" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:582: cat stderr" +echo calc.at:582 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_126 +#AT_START_127 +# 127. calc.at:584: Calculator %debug +at_setup_line='calc.at:584' +at_func_banner 10 +at_desc="Calculator %debug" +$at_quiet $as_echo_n "127: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "127. calc.at:584: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%debug + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:584: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:584 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:584: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:584 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:584 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: bison -o calc.c calc.y" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc /dev/null" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: \$PREPARSER ./calc input" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:584: cat stderr" +echo calc.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_127 +#AT_START_128 +# 128. calc.at:585: Calculator %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:585' +at_func_banner 10 +at_desc="Calculator %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "128: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "128. calc.at:585: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (calclloc).first_line, (calclloc).first_column); + if ((calclloc).first_line != (calclloc).last_line) + fprintf (stderr, "-%d.%d", + (calclloc).last_line, (calclloc).last_column - 1); + else if ((calclloc).first_column != (calclloc).last_column - 1) + fprintf (stderr, "-%d", + (calclloc).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (void); +static int get_char (void); +static void unget_char ( int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (void) +{ + int res = getc (input); + ; + + last_yylloc = (calclloc); + if (res == '\n') + { + (calclloc).last_line++; + (calclloc).last_column = 1; + } + else + (calclloc).last_column++; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + /* Wrong when C == `\n'. */ + (calclloc) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (calclloc).last_column = 1; + (calclloc).last_line = 1; + + } + + + (calclloc).first_column = (calclloc).last_column; + (calclloc).first_line = (calclloc).last_line; + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + (calclloc).first_column = (calclloc).last_column; + (calclloc).first_line = (calclloc).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (calclval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:585: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:585 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:585: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:585 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:585 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: bison -o calc.c calc.y" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc /dev/null" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: \$PREPARSER ./calc input" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:585: cat stderr" +echo calc.at:585 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_128 +#AT_START_129 +# 129. calc.at:587: Calculator %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:587' +at_func_banner 10 +at_desc="Calculator %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "129: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "129. calc.at:587: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:587: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:587 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:587: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:587 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:587 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: bison -o calc.c calc.y" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc /dev/null" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: \$PREPARSER ./calc input" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:587: cat stderr" +echo calc.at:587 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_129 +#AT_START_130 +# 130. calc.at:588: Calculator %define api.push_pull "both" %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:588' +at_func_banner 10 +at_desc="Calculator %define api.push_pull \"both\" %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "130: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "130. calc.at:588: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%define api.push_pull "both" %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:588: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:588 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:588: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:588 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:588 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: bison -o calc.c calc.y" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc /dev/null" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: \$PREPARSER ./calc input" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:588: cat stderr" +echo calc.at:588 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:588" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_130 +#AT_START_131 +# 131. calc.at:590: Calculator %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} +at_setup_line='calc.at:590' +at_func_banner 10 +at_desc="Calculator %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}" +$at_quiet $as_echo_n "131: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "131. calc.at:590: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror (YYLTYPE *llocp, + semantic_value *result, int *count, + const char *s + ); +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { ++*count; ++global_count; } +; + +line: + '\n' +| exp '\n' { *result = global_result = $1; } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror (YYLTYPE *llocp, + semantic_value *result, int *count, + const char *s) +{ +(void) result; (void) count; + + fprintf (stderr, "%d.%d", + (*llocp).first_line, (*llocp).first_column); + if ((*llocp).first_line != (*llocp).last_line) + fprintf (stderr, "-%d.%d", + (*llocp).last_line, (*llocp).last_column - 1); + else if ((*llocp).first_column != (*llocp).last_column - 1) + fprintf (stderr, "-%d", + (*llocp).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (&result, &count); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:590: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:590 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:590: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:590 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:590 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: bison -o calc.c calc.y" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc /dev/null" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: \$PREPARSER ./calc input" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:590: cat stderr" +echo calc.at:590 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:590" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_131 +#AT_START_132 +# 132. calc.at:607: Calculator %glr-parser +at_setup_line='calc.at:607' +at_func_banner 11 +at_desc="Calculator %glr-parser " +$at_quiet $as_echo_n "132: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "132. calc.at:607: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:607: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:607 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:607: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:607 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:607 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: bison -o calc.c calc.y" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc /dev/null" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: \$PREPARSER ./calc input" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:607: cat stderr" +echo calc.at:607 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_132 +#AT_START_133 +# 133. calc.at:609: Calculator %glr-parser %defines +at_setup_line='calc.at:609' +at_func_banner 11 +at_desc="Calculator %glr-parser %defines" +$at_quiet $as_echo_n "133: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "133. calc.at:609: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %defines + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:609: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:609 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:609: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:609 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:609 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: bison -o calc.c calc.y" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc /dev/null" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: \$PREPARSER ./calc input" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:609: cat stderr" +echo calc.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_133 +#AT_START_134 +# 134. calc.at:610: Calculator %glr-parser %locations +at_setup_line='calc.at:610' +at_func_banner 11 +at_desc="Calculator %glr-parser %locations" +$at_quiet $as_echo_n "134: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "134. calc.at:610: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %locations + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (yylloc).first_line, (yylloc).first_column); + if ((yylloc).first_line != (yylloc).last_line) + fprintf (stderr, "-%d.%d", + (yylloc).last_line, (yylloc).last_column - 1); + else if ((yylloc).first_column != (yylloc).last_column - 1) + fprintf (stderr, "-%d", + (yylloc).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (void) +{ + int res = getc (input); + ; + + last_yylloc = (yylloc); + if (res == '\n') + { + (yylloc).last_line++; + (yylloc).last_column = 1; + } + else + (yylloc).last_column++; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + /* Wrong when C == `\n'. */ + (yylloc) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (yylloc).last_column = 1; + (yylloc).last_line = 1; + + } + + + (yylloc).first_column = (yylloc).last_column; + (yylloc).first_line = (yylloc).last_line; + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + (yylloc).first_column = (yylloc).last_column; + (yylloc).first_line = (yylloc).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:610: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:610 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:610: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:610 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:610 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: bison -o calc.c calc.y" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc /dev/null" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: \$PREPARSER ./calc input" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:610: cat stderr" +echo calc.at:610 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:610" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_134 +#AT_START_135 +# 135. calc.at:611: Calculator %glr-parser %name-prefix "calc" +at_setup_line='calc.at:611' +at_func_banner 11 +at_desc="Calculator %glr-parser %name-prefix \"calc\"" +$at_quiet $as_echo_n "135: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "135. calc.at:611: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %name-prefix "calc" + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int calclex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (calclval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:611: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:611 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:611: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:611 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:611 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: bison -o calc.c calc.y" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc /dev/null" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: \$PREPARSER ./calc input" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:611: cat stderr" +echo calc.at:611 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:611" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_135 +#AT_START_136 +# 136. calc.at:612: Calculator %glr-parser %verbose +at_setup_line='calc.at:612' +at_func_banner 11 +at_desc="Calculator %glr-parser %verbose" +$at_quiet $as_echo_n "136: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "136. calc.at:612: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %verbose + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:612: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:612 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:612: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:612 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:612 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: bison -o calc.c calc.y" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc /dev/null" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: \$PREPARSER ./calc input" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:612: cat stderr" +echo calc.at:612 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:612" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_136 +#AT_START_137 +# 137. calc.at:613: Calculator %glr-parser %yacc +at_setup_line='calc.at:613' +at_func_banner 11 +at_desc="Calculator %glr-parser %yacc" +$at_quiet $as_echo_n "137: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "137. calc.at:613: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:613: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:613 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:613: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:613 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:613 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: bison -o calc.c calc.y" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc /dev/null" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: \$PREPARSER ./calc input" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:613: cat stderr" +echo calc.at:613 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_137 +#AT_START_138 +# 138. calc.at:614: Calculator %glr-parser %error-verbose +at_setup_line='calc.at:614' +at_func_banner 11 +at_desc="Calculator %glr-parser %error-verbose" +$at_quiet $as_echo_n "138: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "138. calc.at:614: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %error-verbose + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:614: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:614 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:614: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:614 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:614 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: bison -o calc.c calc.y" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc /dev/null" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: \$PREPARSER ./calc input" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:614: cat stderr" +echo calc.at:614 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_138 +#AT_START_139 +# 139. calc.at:616: Calculator %glr-parser %define api.pure %locations +at_setup_line='calc.at:616' +at_func_banner 11 +at_desc="Calculator %glr-parser %define api.pure %locations" +$at_quiet $as_echo_n "139: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "139. calc.at:616: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %define api.pure %locations + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror (YYLTYPE *llocp, + + const char *s + ); +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror (YYLTYPE *llocp, + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (*llocp).first_line, (*llocp).first_column); + if ((*llocp).first_line != (*llocp).last_line) + fprintf (stderr, "-%d.%d", + (*llocp).last_line, (*llocp).last_column - 1); + else if ((*llocp).first_column != (*llocp).last_column - 1) + fprintf (stderr, "-%d", + (*llocp).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:616: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:616 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:616: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:616 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:616 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: bison -o calc.c calc.y" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc /dev/null" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: \$PREPARSER ./calc input" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:616: cat stderr" +echo calc.at:616 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_139 +#AT_START_140 +# 140. calc.at:617: Calculator %glr-parser %error-verbose %locations +at_setup_line='calc.at:617' +at_func_banner 11 +at_desc="Calculator %glr-parser %error-verbose %locations" +$at_quiet $as_echo_n "140: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "140. calc.at:617: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %error-verbose %locations + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (yylloc).first_line, (yylloc).first_column); + if ((yylloc).first_line != (yylloc).last_line) + fprintf (stderr, "-%d.%d", + (yylloc).last_line, (yylloc).last_column - 1); + else if ((yylloc).first_column != (yylloc).last_column - 1) + fprintf (stderr, "-%d", + (yylloc).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (void) +{ + int res = getc (input); + ; + + last_yylloc = (yylloc); + if (res == '\n') + { + (yylloc).last_line++; + (yylloc).last_column = 1; + } + else + (yylloc).last_column++; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + /* Wrong when C == `\n'. */ + (yylloc) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (yylloc).last_column = 1; + (yylloc).last_line = 1; + + } + + + (yylloc).first_column = (yylloc).last_column; + (yylloc).first_line = (yylloc).last_line; + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + (yylloc).first_column = (yylloc).last_column; + (yylloc).first_line = (yylloc).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:617: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:617 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:617: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:617 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:617 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: bison -o calc.c calc.y" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc /dev/null" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: \$PREPARSER ./calc input" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:617: cat stderr" +echo calc.at:617 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_140 +#AT_START_141 +# 141. calc.at:619: Calculator %glr-parser %error-verbose %locations %defines %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:619' +at_func_banner 11 +at_desc="Calculator %glr-parser %error-verbose %locations %defines %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "141: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "141. calc.at:619: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %error-verbose %locations %defines %name-prefix "calc" %verbose %yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (calclloc).first_line, (calclloc).first_column); + if ((calclloc).first_line != (calclloc).last_line) + fprintf (stderr, "-%d.%d", + (calclloc).last_line, (calclloc).last_column - 1); + else if ((calclloc).first_column != (calclloc).last_column - 1) + fprintf (stderr, "-%d", + (calclloc).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (void); +static int get_char (void); +static void unget_char ( int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (void) +{ + int res = getc (input); + ; + + last_yylloc = (calclloc); + if (res == '\n') + { + (calclloc).last_line++; + (calclloc).last_column = 1; + } + else + (calclloc).last_column++; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + /* Wrong when C == `\n'. */ + (calclloc) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (calclloc).last_column = 1; + (calclloc).last_line = 1; + + } + + + (calclloc).first_column = (calclloc).last_column; + (calclloc).first_line = (calclloc).last_line; + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + (calclloc).first_column = (calclloc).last_column; + (calclloc).first_line = (calclloc).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (calclval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:619: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:619 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:619: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:619 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:619 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: bison -o calc.c calc.y" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc /dev/null" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: \$PREPARSER ./calc input" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:619: cat stderr" +echo calc.at:619 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:619" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_141 +#AT_START_142 +# 142. calc.at:621: Calculator %glr-parser %debug +at_setup_line='calc.at:621' +at_func_banner 11 +at_desc="Calculator %glr-parser %debug" +$at_quiet $as_echo_n "142: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "142. calc.at:621: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %debug + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%s\n", s); +} + +#include + +int yylex (void); +static int get_char (void); +static void unget_char ( int c); + + +static int +get_char (void) +{ + int res = getc (input); + ; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + } + + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (yylval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:621: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:621 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:621: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:621 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:621 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: bison -o calc.c calc.y" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc /dev/null" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: \$PREPARSER ./calc input" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:621: cat stderr" +echo calc.at:621 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:621" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_142 +#AT_START_143 +# 143. calc.at:622: Calculator %glr-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:622' +at_func_banner 11 +at_desc="Calculator %glr-parser %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "143: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "143. calc.at:622: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror ( + + const char *s + ); +int yylex (void); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror ( + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (calclloc).first_line, (calclloc).first_column); + if ((calclloc).first_line != (calclloc).last_line) + fprintf (stderr, "-%d.%d", + (calclloc).last_line, (calclloc).last_column - 1); + else if ((calclloc).first_column != (calclloc).last_column - 1) + fprintf (stderr, "-%d", + (calclloc).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (void); +static int get_char (void); +static void unget_char ( int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (void) +{ + int res = getc (input); + ; + + last_yylloc = (calclloc); + if (res == '\n') + { + (calclloc).last_line++; + (calclloc).last_column = 1; + } + else + (calclloc).last_column++; + + return res; +} + +static void +unget_char ( int c) +{ + ; + + /* Wrong when C == `\n'. */ + (calclloc) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c = get_char (); + int sign = 1; + int n = 0; + + ; + if (c == '-') + { + c = get_char (); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (); + } + + unget_char ( c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (void) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (calclloc).last_column = 1; + (calclloc).last_line = 1; + + } + + + (calclloc).first_column = (calclloc).last_column; + (calclloc).first_line = (calclloc).last_line; + + + /* Skip white space. */ + while ((c = get_char ()) == ' ' || c == '\t') + { + (calclloc).first_column = (calclloc).last_column; + (calclloc).first_line = (calclloc).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char ( c); + (calclval).ival = read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:622: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:622 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:622: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:622 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:622 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: bison -o calc.c calc.y" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc /dev/null" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: \$PREPARSER ./calc input" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:622: cat stderr" +echo calc.at:622 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_143 +#AT_START_144 +# 144. calc.at:624: Calculator %glr-parser %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:624' +at_func_banner 11 +at_desc="Calculator %glr-parser %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "144: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "144. calc.at:624: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror (YYLTYPE *llocp, + + const char *s + ); +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror (YYLTYPE *llocp, + + const char *s) +{ + + + fprintf (stderr, "%d.%d", + (*llocp).first_line, (*llocp).first_column); + if ((*llocp).first_line != (*llocp).last_line) + fprintf (stderr, "-%d.%d", + (*llocp).last_line, (*llocp).last_column - 1); + else if ((*llocp).first_column != (*llocp).last_column - 1) + fprintf (stderr, "-%d", + (*llocp).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:624: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:624 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:624: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:624 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:624 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: bison -o calc.c calc.y" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc /dev/null" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: \$PREPARSER ./calc input" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:624: cat stderr" +echo calc.at:624 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:624" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_144 +#AT_START_145 +# 145. calc.at:626: Calculator %glr-parser %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} +at_setup_line='calc.at:626' +at_func_banner 11 +at_desc="Calculator %glr-parser %define api.pure %error-verbose %debug %locations %defines %name-prefix \"calc\" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}" +$at_quiet $as_echo_n "145: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "145. calc.at:626: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%glr-parser %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} + +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror (YYLTYPE *llocp, + semantic_value *result, int *count, + const char *s + ); +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { ++*count; ++global_count; } +; + +line: + '\n' +| exp '\n' { *result = global_result = $1; } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +static void +yyerror (YYLTYPE *llocp, + semantic_value *result, int *count, + const char *s) +{ +(void) result; (void) count; + + fprintf (stderr, "%d.%d", + (*llocp).first_line, (*llocp).first_column); + if ((*llocp).first_line != (*llocp).last_line) + fprintf (stderr, "-%d.%d", + (*llocp).last_line, (*llocp).last_column - 1); + else if ((*llocp).first_column != (*llocp).last_column - 1) + fprintf (stderr, "-%d", + (*llocp).last_column - 1); + fprintf (stderr, ": "); + fprintf (stderr, "%s\n", s); +} + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + yydebug = 1; + status = yyparse (&result, &count); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.c <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.h" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:626: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.c calc.y" +echo calc.at:626 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:626: bison --xml=xml-tests/test.xml -o calc.c calc.y" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:626 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:626 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: bison -o calc.c calc.y" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.c calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c \$LIBS" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc /dev/null" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: \$PREPARSER ./calc input" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:626: cat stderr" +echo calc.at:626 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:626" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_145 +#AT_START_146 +# 146. calc.at:636: Calculator %skeleton "lalr1.cc" %defines %locations +at_setup_line='calc.at:636' +at_func_banner 12 +at_desc="Calculator %skeleton \"lalr1.cc\" %defines %locations" +$at_quiet $as_echo_n "146: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "146. calc.at:636: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%skeleton "lalr1.cc" %defines %locations +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE yy::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +yy::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:636: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:636 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:636: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:636 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:636 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: bison -o calc.cc calc.y" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$BISON_CXX_WORKS" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc /dev/null" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: \$PREPARSER ./calc input" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:636: cat stderr" +echo calc.at:636 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:636" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_146 +#AT_START_147 +# 147. calc.at:645: Calculator %language "C++" %defines %locations +at_setup_line='calc.at:645' +at_func_banner 12 +at_desc="Calculator %language \"C++\" %defines %locations " +$at_quiet $as_echo_n "147: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "147. calc.at:645: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %defines %locations +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE yy::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +yy::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:645: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:645 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:645: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:645 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:645 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: bison -o calc.cc calc.y" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$BISON_CXX_WORKS" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc /dev/null" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: \$PREPARSER ./calc input" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:645: cat stderr" +echo calc.at:645 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:645" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_147 +#AT_START_148 +# 148. calc.at:646: Calculator %language "C++" %defines %locations %error-verbose %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:646' +at_func_banner 12 +at_desc="Calculator %language \"C++\" %defines %locations %error-verbose %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "148: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "148. calc.at:646: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %defines %locations %error-verbose %name-prefix "calc" %verbose %yacc +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE calc::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +calc::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + calc::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:646: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:646 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:646: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:646 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:646 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: bison -o calc.cc calc.y" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$BISON_CXX_WORKS" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc /dev/null" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: \$PREPARSER ./calc input" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:646: cat stderr" +echo calc.at:646 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:646" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_148 +#AT_START_149 +# 149. calc.at:648: Calculator %language "C++" %defines %locations %error-verbose %debug %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:648' +at_func_banner 12 +at_desc="Calculator %language \"C++\" %defines %locations %error-verbose %debug %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "149: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "149. calc.at:648: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %defines %locations %error-verbose %debug %name-prefix "calc" %verbose %yacc +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE calc::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +calc::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + calc::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:648: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:648 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:648: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:648 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:648 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: bison -o calc.cc calc.y" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$BISON_CXX_WORKS" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc /dev/null" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: \$PREPARSER ./calc input" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:648: cat stderr" +echo calc.at:648 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:648" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_149 +#AT_START_150 +# 150. calc.at:650: Calculator %language "C++" %defines %locations %pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:650' +at_func_banner 12 +at_desc="Calculator %language \"C++\" %defines %locations %pure-parser %error-verbose %debug %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "150: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "150. calc.at:650: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %defines %locations %pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE calc::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +calc::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + calc::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:650: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:650 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:650: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:650 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:650 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: bison -o calc.cc calc.y" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$BISON_CXX_WORKS" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc /dev/null" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: \$PREPARSER ./calc input" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:650: cat stderr" +echo calc.at:650 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:650" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_150 +#AT_START_151 +# 151. calc.at:652: Calculator %language "C++" %defines %locations %pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} +at_setup_line='calc.at:652' +at_func_banner 12 +at_desc="Calculator %language \"C++\" %defines %locations %pure-parser %error-verbose %debug %name-prefix \"calc\" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}" +$at_quiet $as_echo_n "151: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "151. calc.at:652: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %defines %locations %pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE calc::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { ++*count; ++global_count; } +; + +line: + '\n' +| exp '\n' { *result = global_result = $1; } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +calc::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse (semantic_value *result, int *count) +{ + calc::parser parser (result, count); +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (&result, &count); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:652: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:652 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:652: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:652 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:652 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: bison -o calc.cc calc.y" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$BISON_CXX_WORKS" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc /dev/null" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: \$PREPARSER ./calc input" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:652: cat stderr" +echo calc.at:652 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:652" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_151 +#AT_START_152 +# 152. calc.at:663: Calculator %skeleton "glr.cc" %defines %locations +at_setup_line='calc.at:663' +at_func_banner 13 +at_desc="Calculator %skeleton \"glr.cc\" %defines %locations" +$at_quiet $as_echo_n "152: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "152. calc.at:663: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%skeleton "glr.cc" %defines %locations +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE yy::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +yy::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:663: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:663 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:663: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:663 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:663 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: bison -o calc.cc calc.y" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$BISON_CXX_WORKS" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc /dev/null" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: \$PREPARSER ./calc input" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:663: cat stderr" +echo calc.at:663 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:663" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_152 +#AT_START_153 +# 153. calc.at:672: Calculator %language "C++" %glr-parser %defines %locations +at_setup_line='calc.at:672' +at_func_banner 13 +at_desc="Calculator %language \"C++\" %glr-parser %defines %locations " +$at_quiet $as_echo_n "153: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "153. calc.at:672: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %glr-parser %defines %locations +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE yy::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +yy::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:672: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:672 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:672: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:672 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:672 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: bison -o calc.cc calc.y" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$BISON_CXX_WORKS" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc /dev/null" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: \$PREPARSER ./calc input" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:672: cat stderr" +echo calc.at:672 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:672" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_153 +#AT_START_154 +# 154. calc.at:673: Calculator %language "C++" %glr-parser %defines %locations %error-verbose %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:673' +at_func_banner 13 +at_desc="Calculator %language \"C++\" %glr-parser %defines %locations %error-verbose %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "154: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "154. calc.at:673: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %glr-parser %defines %locations %error-verbose %name-prefix "calc" %verbose %yacc +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE calc::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +calc::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + calc::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:673: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:673 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:673: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:673 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:673 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: bison -o calc.cc calc.y" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$BISON_CXX_WORKS" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc /dev/null" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: \$PREPARSER ./calc input" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:673: cat stderr" +echo calc.at:673 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:673" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_154 +#AT_START_155 +# 155. calc.at:675: Calculator %language "C++" %glr-parser %defines %locations %debug +at_setup_line='calc.at:675' +at_func_banner 13 +at_desc="Calculator %language \"C++\" %glr-parser %defines %locations %debug" +$at_quiet $as_echo_n "155: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "155. calc.at:675: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %glr-parser %defines %locations %debug +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE yy::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +yy::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:675: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:675 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:675: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:675 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:675 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: bison -o calc.cc calc.y" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$BISON_CXX_WORKS" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc /dev/null" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: \$PREPARSER ./calc input" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:675: cat stderr" +echo calc.at:675 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:675" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_155 +#AT_START_156 +# 156. calc.at:676: Calculator %language "C++" %glr-parser %defines %locations %error-verbose %debug %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:676' +at_func_banner 13 +at_desc="Calculator %language \"C++\" %glr-parser %defines %locations %error-verbose %debug %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "156: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "156. calc.at:676: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %glr-parser %defines %locations %error-verbose %debug %name-prefix "calc" %verbose %yacc +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE calc::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +calc::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + calc::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:676: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:676 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:676: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:676 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:676 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: bison -o calc.cc calc.y" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$BISON_CXX_WORKS" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc /dev/null" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: \$PREPARSER ./calc input" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:676: cat stderr" +echo calc.at:676 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:676" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_156 +#AT_START_157 +# 157. calc.at:678: Calculator %language "C++" %glr-parser %defines %locations %pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc +at_setup_line='calc.at:678' +at_func_banner 13 +at_desc="Calculator %language \"C++\" %glr-parser %defines %locations %pure-parser %error-verbose %debug %name-prefix \"calc\" %verbose %yacc" +$at_quiet $as_echo_n "157: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "157. calc.at:678: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %glr-parser %defines %locations %pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE calc::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { } +; + +line: + '\n' +| exp '\n' { USE ($1); } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +calc::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse () +{ + calc::parser parser; +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:678: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:678 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:678: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:678 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:678 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: bison -o calc.cc calc.y" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$BISON_CXX_WORKS" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc /dev/null" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: \$PREPARSER ./calc input" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:678: cat stderr" +echo calc.at:678 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:678" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_157 +#AT_START_158 +# 158. calc.at:680: Calculator %language "C++" %glr-parser %defines %locations %pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} +at_setup_line='calc.at:680' +at_func_banner 13 +at_desc="Calculator %language \"C++\" %glr-parser %defines %locations %pure-parser %error-verbose %debug %name-prefix \"calc\" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}" +$at_quiet $as_echo_n "158: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "158. calc.at:680: testing ..." + $at_traceon + + + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + + + +cat >calc.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Infix notation calculator--calc */ +%language "C++" %glr-parser %defines %locations %pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} +%define global_tokens_and_yystype +%code requires { +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; +} + +/* Exercise %union. */ +%union +{ + semantic_value ival; +}; + +%code provides { +#include +/* The input. */ +extern FILE *input; +#ifndef YYLTYPE +# define YYLTYPE calc::location +#endif +#define first_line begin.line +#define first_column begin.column +#define last_line end.line +#define last_column end.column +} + +%code { +#include +#include +#if HAVE_UNISTD_H +# include +#else +# undef alarm +# define alarm(seconds) /* empty */ +#endif +#define USE(Var) + +FILE *input; +static semantic_value global_result = 0; +static int global_count = 0; +static int power (int base, int exponent); + +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); +} + +/* The lalr1.cc skeleton, for backward compatibility, defines + a constructor for position that initializes the filename. The + glr.cc skeleton does not (and in fact cannot: location/position + are stored in a union, from which objects with constructors are + excluded in C++. */ +%initial-action { + @$.initialize (0); +} + + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line { ++*count; ++global_count; } +; + +line: + '\n' +| exp '\n' { *result = global_result = $1; } +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1 != $3) + fprintf (stderr, "calc: error: %d != %d\n", $1, $3); + $$ = $1; + } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = power ($1, $3); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = 1111; yyerrok; } +| '!' { $$ = 0; YYERROR; } +| '-' error { $$ = 0; YYERROR; } +; +%% + +/* A C++ error reporting function. */ +void +calc::parser::error (const location& l, const std::string& m) +{ + (void) l; + std::cerr << l << ": " << m << std::endl; +} + +int +yyparse (semantic_value *result, int *count) +{ + calc::parser parser (result, count); +#if YYDEBUG + parser.set_debug_level (1); +#endif + return parser.parse (); +} + + + + +static int +power (int base, int exponent) +{ + int res = 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *= base; + return res; +} + + +int +main (int argc, const char **argv) +{ + semantic_value result = 0; + int count = 0; + int status; + + /* This used to be alarm (10), but that isn't enough time for + a July 1995 vintage DEC Alphastation 200 4/100 system, + according to Nelson H. F. Beebe. 100 seconds is enough. */ + alarm (100); + + if (argc == 2) + input = fopen (argv[1], "r"); + else + input = stdin; + + if (!input) + { + perror (argv[1]); + return 3; + } + + + status = yyparse (&result, &count); + fclose (input); + if (global_result != result) + abort (); + if (global_count != count) + abort (); + return status; +} +_ATEOF + + +cat >calc-lex.cc <<'_ATEOF' +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc + +#include "calc.hh" + +#include + +int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); +static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp); +static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c); + + +static YYLTYPE last_yylloc; + +static int +get_char (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int res = getc (input); + (void) lvalp;(void) llocp; + + last_yylloc = (*llocp); + if (res == '\n') + { + (*llocp).last_line++; + (*llocp).last_column = 1; + } + else + (*llocp).last_column++; + + return res; +} + +static void +unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) +{ + (void) lvalp;(void) llocp; + + /* Wrong when C == `\n'. */ + (*llocp) = last_yylloc; + + ungetc (c, input); +} + +static int +read_signed_integer (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + int c = get_char (lvalp, llocp); + int sign = 1; + int n = 0; + + (void) lvalp;(void) llocp; + if (c == '-') + { + c = get_char (lvalp, llocp); + sign = -1; + } + + while (isdigit (c)) + { + n = 10 * n + (c - '0'); + c = get_char (lvalp, llocp); + } + + unget_char (lvalp, llocp, c); + + return sign * n; +} + + +/*---------------------------------------------------------------. +| Lexical analyzer returns an integer on the stack and the token | +| NUM, or the ASCII character read if not a number. Skips all | +| blanks and tabs, returns 0 for EOF. | +`---------------------------------------------------------------*/ + +int +calclex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static int init = 1; + int c; + + if (init) + { + init = 0; + + (*llocp).last_column = 1; + (*llocp).last_line = 1; + + } + + + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + + /* Skip white space. */ + while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t') + { + (*llocp).first_column = (*llocp).last_column; + (*llocp).first_line = (*llocp).last_line; + + } + + /* process numbers */ + if (c == '.' || isdigit (c)) + { + unget_char (lvalp, llocp, c); + (*lvalp).ival = read_signed_integer (lvalp, llocp); + return NUM; + } + + /* Return end-of-file. */ + if (c == EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} +_ATEOF + + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/calc.at:680: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o calc.cc calc.y" +echo calc.at:680 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/calc.at:680: bison --xml=xml-tests/test.xml -o calc.cc calc.y" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo calc.at:680 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo calc.at:680 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: bison -o calc.cc calc.y" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o calc.cc calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$BISON_CXX_WORKS" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc \$LIBS" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected number +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected $undefined +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.7: syntax error, unexpected '=' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +2.1: syntax error, unexpected '+' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc /dev/null" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc /dev/null"; then + ( $at_traceon; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.1: syntax error, unexpected end of input +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.10: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.12: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +cat >input <<'_ATEOF' +(* *) + (*) + (*) +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: \$PREPARSER ./calc input" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./calc input"; then + ( $at_traceon; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./calc input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Remove the traces from observed. +sed '/^Starting/d +/^Entering/d +/^Stack/d +/^Reading/d +/^Reducing/d +/^Return/d +/^Shifting/d +/^state/d +/^Cleanup:/d +/^Error:/d +/^Next/d +/^Now/d +/^Discarding/d +/ \$[0-9$]* = /d +/^yydestructor:/d' stderr >at-stderr +mv at-stderr stderr +# 2. Create the reference error message. +cat >expout <<'_ATEOF' +1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +_ATEOF + +# 3. If locations are not used, remove them. + +# 4. If error-verbose is not used, strip the`, unexpected....' part. + +# 5. Check +{ $at_traceoff +$as_echo "$at_srcdir/calc.at:680: cat stderr" +echo calc.at:680 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/calc.at:680" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_158 +#AT_START_159 +# 159. torture.at:139: Big triangle +at_setup_line='torture.at:139' +at_func_banner 14 +at_desc="Big triangle" +$at_quiet $as_echo_n "159: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "159. torture.at:139: testing ..." + $at_traceon + + +# I have been able to go up to 2000 on my machine. +# I tried 3000, a 29Mb grammar file, but then my system killed bison. +# With 500 and the new parser, which consume far too much memory, +# it gets killed too. Of course the parser is to be cleaned. +cat >gengram.pl <<'_ATEOF' +#! /usr/bin/perl -w + +use strict; +my $max = $ARGV[0] || 10; + +print < +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%error-verbose +%debug +%{ +#include +#include + +static int yylex (void); +static void yyerror (const char *msg); +%} +%union +{ + int val; +}; + +%token END "end" +%type exp input +EOF + +for my $size (1 .. $max) + { + print "%token t$size $size \"$size\"\n"; + }; + +print < $max) + return 0; + else if (inner > outer) + { + inner = 1; + ++outer; + return END; + } + return inner++; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\\n", msg); +} + +int +main (void) +{ + yydebug = !!getenv ("YYDEBUG"); + return yyparse (); +} +EOF +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:145: perl -w ./gengram.pl 200 || exit 77" +echo torture.at:145 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; perl -w ./gengram.pl 200 || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; perl -w ./gengram.pl 200 || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + +mv stdout input.y + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:146: bison -v -o input.c input.y" +echo torture.at:146 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:146" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:147: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo torture.at:147 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:147" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:148: \$PREPARSER ./input" +echo torture.at:148 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:148" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_159 +#AT_START_160 +# 160. torture.at:232: Big horizontal +at_setup_line='torture.at:232' +at_func_banner 14 +at_desc="Big horizontal" +$at_quiet $as_echo_n "160: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "160. torture.at:232: testing ..." + $at_traceon + + +# I have been able to go up to 10000 on my machine, but I had to +# increase the maximum stack size (* 100). It gave: +# +# input.y 263k +# input.tab.c 1.3M +# input 453k +# +# gengram.pl 10000 0.70s user 0.01s sys 99% cpu 0.711 total +# bison input.y 730.56s user 0.53s sys 99% cpu 12:12.34 total +# gcc -Wall input.tab.c -o input 5.81s user 0.20s sys 100% cpu 6.01 total +# ./input 0.00s user 0.01s sys 108% cpu 0.01 total +# +cat >gengram.pl <<'_ATEOF' +#! /usr/bin/perl -w + +use strict; +my $max = $ARGV[0] || 10; + +print < +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%error-verbose +%debug +%{ +#include +#include + +static int yylex (void); +static void yyerror (const char *msg); +%} + +%token +EOF +for my $size (1 .. $max) + { + print " t$size $size \"$size\"\n"; + }; + +print <"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; perl -w ./gengram.pl 1000 || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; perl -w ./gengram.pl 1000 || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:246" + +$at_failed && at_func_log_failure +$at_traceon; } + +mv stdout input.y + + +# GNU m4 requires about 70 MiB for this test on a 32-bit host. +# Ask for 200 MiB, which should be plenty even on a 64-bit host. +data_limit=`(ulimit -S -d) 2>/dev/null` +case $data_limit in +[0-9]*) + if test "$data_limit" -lt 204000; then + { $at_traceoff +$as_echo "$at_srcdir/torture.at:250: ulimit -S -d 204000 || exit 77" +echo torture.at:250 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ulimit -S -d 204000 || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ulimit -S -d 204000 || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:250" + +$at_failed && at_func_log_failure +$at_traceon; } + + ulimit -S -d 204000 + fi +esac + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:252: bison -v -o input.c input.y" +echo torture.at:252 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:252" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:253: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo torture.at:253 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:253" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:254: \$PREPARSER ./input" +echo torture.at:254 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:254" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_160 +#AT_START_161 +# 161. torture.at:372: Many lookahead tokens +at_setup_line='torture.at:372' +at_func_banner 14 +at_desc="Many lookahead tokens" +$at_quiet $as_echo_n "161: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "161. torture.at:372: testing ..." + $at_traceon + + +cat >gengram.pl <<'_ATEOF' +#! /usr/bin/perl -w + +use strict; +use Text::Wrap; +my $max = $ARGV[0] || 10; + +print < +# include +# include + +static int yylex (void); +static void yyerror (const char *msg); +%} +%union +{ + int val; +}; + +%type input exp +%token token +EOF + +print + wrap ("%type ", + " ", + map { "n$_" } (1 .. $max)), + "\n"; + +print "%token\n"; +for my $count (1 .. $max) + { + print " t$count $count \"$count\"\n"; + }; + +print < $max) + { + if (counter++ != $max + 1) + abort (); + return 0; + } + if (return_token) + { + return_token = 0; + return token; + } + return_token = 1; + return counter++; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\\n", msg); +} + +int +main (void) +{ + yydebug = !!getenv ("YYDEBUG"); + return yyparse (); +} +EOF +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:374: perl -w ./gengram.pl 1000 || exit 77" +echo torture.at:374 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; perl -w ./gengram.pl 1000 || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; perl -w ./gengram.pl 1000 || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; tee stdout <"$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:374" + +$at_failed && at_func_log_failure +$at_traceon; } + +mv stdout input.y + + +# GNU m4 requires about 70 MiB for this test on a 32-bit host. +# Ask for 200 MiB, which should be plenty even on a 64-bit host. +data_limit=`(ulimit -S -d) 2>/dev/null` +case $data_limit in +[0-9]*) + if test "$data_limit" -lt 204000; then + { $at_traceoff +$as_echo "$at_srcdir/torture.at:378: ulimit -S -d 204000 || exit 77" +echo torture.at:378 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; ulimit -S -d 204000 || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; ulimit -S -d 204000 || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:378" + +$at_failed && at_func_log_failure +$at_traceon; } + + ulimit -S -d 204000 + fi +esac + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/torture.at:380: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -v -o input.c input.y" +echo torture.at:380 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:380" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/torture.at:380: bison --xml=xml-tests/test.xml -v -o input.c input.y" +echo torture.at:380 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:380" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:380: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo torture.at:380 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:380" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:380: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo torture.at:380 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:380" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:380: bison -v -o input.c input.y" +echo torture.at:380 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:380" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:381: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo torture.at:381 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:381" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:382: \$PREPARSER ./input" +echo torture.at:382 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:382" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_161 +#AT_START_162 +# 162. torture.at:473: Exploding the Stack Size with Alloca +at_setup_line='torture.at:473' +at_func_banner 14 +at_desc="Exploding the Stack Size with Alloca" +$at_quiet $as_echo_n "162: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "162. torture.at:473: testing ..." + $at_traceon + + + + +# A grammar of parens growing the stack thanks to right recursion. +# exp: +cat >input.y <<'_ATEOF' +%{ +#include +#include +#include +#include + +#if (defined __GNUC__ || defined __BUILTIN_VA_ARG_INCR \ + || defined _AIX || defined _MSC_VER || defined _ALLOCA_H) +# define YYSTACK_USE_ALLOCA 1 +#endif + + static int yylex (void); + static void yyerror (const char *msg); +%} + +%error-verbose +%debug +%token WAIT_FOR_EOF +%% +exp: WAIT_FOR_EOF exp | ; +%% +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + if (yylval < 0) + abort (); + if (yylval--) + return WAIT_FOR_EOF; + else + return EOF; +} + +int +main (int argc, const char **argv) +{ + char *endp; + YYSTYPE yylval_init; + if (argc != 2) + abort (); + yylval_init = strtol (argv[1], &endp, 10); + if (! (argv[1] != endp + && 0 <= yylval_init && yylval_init <= INT_MAX + && errno != ERANGE)) + abort (); + yydebug = 1; + { + int count; + int status; + for (count = 0; count < 2; ++count) + { + int new_status; + yylval = yylval_init; + new_status = yyparse (); + if (count > 0 && new_status != status) + abort (); + status = new_status; + } + return status; + } +} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/torture.at:482: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo torture.at:482 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/torture.at:482: bison --xml=xml-tests/test.xml -o input.c input.y" +echo torture.at:482 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:482: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo torture.at:482 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:482: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo torture.at:482 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:482: bison -o input.c input.y" +echo torture.at:482 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:482: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo torture.at:482 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Below the limit of 200. +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:485: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 20" +echo torture.at:485 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 20"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + +# Two enlargements: 2 * 2 * 200. +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:488: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 900" +echo torture.at:488 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 900"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + +# Fails: beyond the limit of 10,000 (which we don't reach anyway since we +# multiply by two starting at 200 => 5120 is the last possible). +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:492: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 10000" +echo torture.at:492 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 10000"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 2 $at_status "$at_srcdir/torture.at:492" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# The push parser can't use alloca since the stacks can't be locals. This test +# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect +# push parsers. +# A grammar of parens growing the stack thanks to right recursion. +# exp: +cat >input.y <<'_ATEOF' +%{ +#include +#include +#include +#include + +#if (defined __GNUC__ || defined __BUILTIN_VA_ARG_INCR \ + || defined _AIX || defined _MSC_VER || defined _ALLOCA_H) +# define YYSTACK_USE_ALLOCA 1 +#endif + + static int yylex (void); + static void yyerror (const char *msg); +%} +%define api.push_pull "both" + +%error-verbose +%debug +%token WAIT_FOR_EOF +%% +exp: WAIT_FOR_EOF exp | ; +%% +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + if (yylval < 0) + abort (); + if (yylval--) + return WAIT_FOR_EOF; + else + return EOF; +} + +int +main (int argc, const char **argv) +{ + char *endp; + YYSTYPE yylval_init; + if (argc != 2) + abort (); + yylval_init = strtol (argv[1], &endp, 10); + if (! (argv[1] != endp + && 0 <= yylval_init && yylval_init <= INT_MAX + && errno != ERANGE)) + abort (); + yydebug = 1; + { + int count; + int status; + for (count = 0; count < 2; ++count) + { + int new_status; + yylval = yylval_init; + new_status = yyparse (); + if (count > 0 && new_status != status) + abort (); + status = new_status; + } + return status; + } +} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/torture.at:498: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo torture.at:498 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:498" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/torture.at:498: bison --xml=xml-tests/test.xml -o input.c input.y" +echo torture.at:498 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:498" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:498: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo torture.at:498 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:498" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:498: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo torture.at:498 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:498" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:498: bison -o input.c input.y" +echo torture.at:498 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:498" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:498: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo torture.at:498 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:498" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:501: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 20" +echo torture.at:501 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 20"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:501" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:503: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 900" +echo torture.at:503 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 900"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:505: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 10000" +echo torture.at:505 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 10000"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 2 $at_status "$at_srcdir/torture.at:505" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_162 +#AT_START_163 +# 163. torture.at:519: Exploding the Stack Size with Malloc +at_setup_line='torture.at:519' +at_func_banner 14 +at_desc="Exploding the Stack Size with Malloc" +$at_quiet $as_echo_n "163: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "163. torture.at:519: testing ..." + $at_traceon + + + + +# A grammar of parens growing the stack thanks to right recursion. +# exp: +cat >input.y <<'_ATEOF' +%{ +#include +#include +#include +#include +#define YYSTACK_USE_ALLOCA 0 + static int yylex (void); + static void yyerror (const char *msg); +%} + +%error-verbose +%debug +%token WAIT_FOR_EOF +%% +exp: WAIT_FOR_EOF exp | ; +%% +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + if (yylval < 0) + abort (); + if (yylval--) + return WAIT_FOR_EOF; + else + return EOF; +} + +int +main (int argc, const char **argv) +{ + char *endp; + YYSTYPE yylval_init; + if (argc != 2) + abort (); + yylval_init = strtol (argv[1], &endp, 10); + if (! (argv[1] != endp + && 0 <= yylval_init && yylval_init <= INT_MAX + && errno != ERANGE)) + abort (); + yydebug = 1; + { + int count; + int status; + for (count = 0; count < 2; ++count) + { + int new_status; + yylval = yylval_init; + new_status = yyparse (); + if (count > 0 && new_status != status) + abort (); + status = new_status; + } + return status; + } +} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/torture.at:523: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo torture.at:523 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:523" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/torture.at:523: bison --xml=xml-tests/test.xml -o input.c input.y" +echo torture.at:523 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:523" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:523: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo torture.at:523 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:523" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:523: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo torture.at:523 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:523" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:523: bison -o input.c input.y" +echo torture.at:523 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:523" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:523: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo torture.at:523 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:523" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Below the limit of 200. +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:526: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 20" +echo torture.at:526 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 20"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:526" + +$at_failed && at_func_log_failure +$at_traceon; } + +# Two enlargements: 2 * 2 * 200. +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:529: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 900" +echo torture.at:529 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 900"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:529" + +$at_failed && at_func_log_failure +$at_traceon; } + +# Fails: beyond the limit of 10,000 (which we don't reach anyway since we +# multiply by two starting at 200 => 5120 is the possible). +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:533: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 10000" +echo torture.at:533 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 10000"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 2 $at_status "$at_srcdir/torture.at:533" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# A grammar of parens growing the stack thanks to right recursion. +# exp: +cat >input.y <<'_ATEOF' +%{ +#include +#include +#include +#include +#define YYSTACK_USE_ALLOCA 0 + static int yylex (void); + static void yyerror (const char *msg); +%} +%define api.push_pull "both" + +%error-verbose +%debug +%token WAIT_FOR_EOF +%% +exp: WAIT_FOR_EOF exp | ; +%% +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + if (yylval < 0) + abort (); + if (yylval--) + return WAIT_FOR_EOF; + else + return EOF; +} + +int +main (int argc, const char **argv) +{ + char *endp; + YYSTYPE yylval_init; + if (argc != 2) + abort (); + yylval_init = strtol (argv[1], &endp, 10); + if (! (argv[1] != endp + && 0 <= yylval_init && yylval_init <= INT_MAX + && errno != ERANGE)) + abort (); + yydebug = 1; + { + int count; + int status; + for (count = 0; count < 2; ++count) + { + int new_status; + yylval = yylval_init; + new_status = yyparse (); + if (count > 0 && new_status != status) + abort (); + status = new_status; + } + return status; + } +} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/torture.at:536: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo torture.at:536 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:536" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/torture.at:536: bison --xml=xml-tests/test.xml -o input.c input.y" +echo torture.at:536 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:536" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:536: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo torture.at:536 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:536" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/torture.at:536: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo torture.at:536 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:536" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:536: bison -o input.c input.y" +echo torture.at:536 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:536" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:536: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo torture.at:536 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/torture.at:536" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:539: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 20" +echo torture.at:539 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 20"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:539" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:541: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 900" +echo torture.at:541 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 900"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/torture.at:541" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/torture.at:543: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 10000" +echo torture.at:543 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 10000"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 2 $at_status "$at_srcdir/torture.at:543" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_163 +#AT_START_164 +# 164. existing.at:24: GNU AWK Grammar +at_setup_line='existing.at:24' +at_func_banner 15 +at_desc="GNU AWK Grammar" +$at_quiet $as_echo_n "164: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "164. existing.at:24: testing ..." + $at_traceon + + +# We have been careful to strip all the actions excepts the +# mid-rule actions. We rely on %expect to check that there are +# indeed 65 SR conflicts. +# +# Bison was once wrong, due to an incorrect computation of nullable. +# It reported 485 SR conflicts! + +cat >input.y <<'_ATEOF' +%expect 65 + +%token FUNC_CALL NAME REGEXP +%token ERROR +%token YNUMBER YSTRING +%token RELOP APPEND_OP +%token ASSIGNOP MATCHOP NEWLINE CONCAT_OP +%token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE +%token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE +%token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION +%token LEX_GETLINE LEX_NEXTFILE +%token LEX_IN +%token LEX_AND LEX_OR INCREMENT DECREMENT +%token LEX_BUILTIN LEX_LENGTH + +/* Lowest to highest */ +%right ASSIGNOP +%right '?' ':' +%left LEX_OR +%left LEX_AND +%left LEX_GETLINE +%nonassoc LEX_IN +%left FUNC_CALL LEX_BUILTIN LEX_LENGTH +%nonassoc ',' +%nonassoc MATCHOP +%nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO +%left CONCAT_OP +%left YSTRING YNUMBER +%left '+' '-' +%left '*' '/' '%' +%right '!' UNARY +%right '^' +%left INCREMENT DECREMENT +%left '$' +%left '(' ')' +%% + +start + : opt_nls program opt_nls + ; + +program + : rule + | program rule + | error + | program error + | /* empty */ + ; + +rule + : LEX_BEGIN {} action + | LEX_END {} action + | LEX_BEGIN statement_term + | LEX_END statement_term + | pattern action + | action + | pattern statement_term + | function_prologue function_body + ; + +func_name + : NAME + | FUNC_CALL + | lex_builtin + ; + +lex_builtin + : LEX_BUILTIN + | LEX_LENGTH + ; + +function_prologue + : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls + ; + +function_body + : l_brace statements r_brace opt_semi opt_nls + | l_brace r_brace opt_semi opt_nls + ; + +pattern + : exp + | exp ',' exp + ; + +regexp + /* + * In this rule, want_regexp tells yylex that the next thing + * is a regexp so it should read up to the closing slash. + */ + : '/' {} REGEXP '/' + ; + +action + : l_brace statements r_brace opt_semi opt_nls + | l_brace r_brace opt_semi opt_nls + ; + +statements + : statement + | statements statement + | error + | statements error + ; + +statement_term + : nls + | semi opt_nls + ; + +statement + : semi opt_nls + | l_brace r_brace + | l_brace statements r_brace + | if_statement + | LEX_WHILE '(' exp r_paren opt_nls statement + | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls + | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement + | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement + | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement + | LEX_BREAK statement_term + | LEX_CONTINUE statement_term + | print '(' expression_list r_paren output_redir statement_term + | print opt_rexpression_list output_redir statement_term + | LEX_NEXT statement_term + | LEX_NEXTFILE statement_term + | LEX_EXIT opt_exp statement_term + | LEX_RETURN {} opt_exp statement_term + | LEX_DELETE NAME '[' expression_list ']' statement_term + | LEX_DELETE NAME statement_term + | exp statement_term + ; + +print + : LEX_PRINT + | LEX_PRINTF + ; + +if_statement + : LEX_IF '(' exp r_paren opt_nls statement + | LEX_IF '(' exp r_paren opt_nls statement + LEX_ELSE opt_nls statement + ; + +nls + : NEWLINE + | nls NEWLINE + ; + +opt_nls + : /* empty */ + | nls + ; + +input_redir + : /* empty */ + | '<' simp_exp + ; + +output_redir + : /* empty */ + | '>' exp + | APPEND_OP exp + | '|' exp + | TWOWAYIO exp + ; + +opt_param_list + : /* empty */ + | param_list + ; + +param_list + : NAME + | param_list comma NAME + | error + | param_list error + | param_list comma error + ; + +/* optional expression, as in for loop */ +opt_exp + : /* empty */ + | exp + ; + +opt_rexpression_list + : /* empty */ + | rexpression_list + ; + +rexpression_list + : rexp + | rexpression_list comma rexp + | error + | rexpression_list error + | rexpression_list error rexp + | rexpression_list comma error + ; + +opt_expression_list + : /* empty */ + | expression_list + ; + +expression_list + : exp + | expression_list comma exp + | error + | expression_list error + | expression_list error exp + | expression_list comma error + ; + +/* Expressions, not including the comma operator. */ +exp : variable ASSIGNOP {} exp + | '(' expression_list r_paren LEX_IN NAME + | exp '|' LEX_GETLINE opt_variable + | exp TWOWAYIO LEX_GETLINE opt_variable + | LEX_GETLINE opt_variable input_redir + | exp LEX_AND exp + | exp LEX_OR exp + | exp MATCHOP exp + | regexp + | '!' regexp %prec UNARY + | exp LEX_IN NAME + | exp RELOP exp + | exp '<' exp + | exp '>' exp + | exp '?' exp ':' exp + | simp_exp + | exp simp_exp %prec CONCAT_OP + ; + +rexp + : variable ASSIGNOP {} rexp + | rexp LEX_AND rexp + | rexp LEX_OR rexp + | LEX_GETLINE opt_variable input_redir + | regexp + | '!' regexp %prec UNARY + | rexp MATCHOP rexp + | rexp LEX_IN NAME + | rexp RELOP rexp + | rexp '?' rexp ':' rexp + | simp_exp + | rexp simp_exp %prec CONCAT_OP + ; + +simp_exp + : non_post_simp_exp + /* Binary operators in order of decreasing precedence. */ + | simp_exp '^' simp_exp + | simp_exp '*' simp_exp + | simp_exp '/' simp_exp + | simp_exp '%' simp_exp + | simp_exp '+' simp_exp + | simp_exp '-' simp_exp + | variable INCREMENT + | variable DECREMENT + ; + +non_post_simp_exp + : '!' simp_exp %prec UNARY + | '(' exp r_paren + | LEX_BUILTIN + '(' opt_expression_list r_paren + | LEX_LENGTH '(' opt_expression_list r_paren + | LEX_LENGTH + | FUNC_CALL '(' opt_expression_list r_paren + | variable + | INCREMENT variable + | DECREMENT variable + | YNUMBER + | YSTRING + | '-' simp_exp %prec UNARY + | '+' simp_exp %prec UNARY + ; + +opt_variable + : /* empty */ + | variable + ; + +variable + : NAME + | NAME '[' expression_list ']' + | '$' non_post_simp_exp + ; + +l_brace + : '{' opt_nls + ; + +r_brace + : '}' opt_nls + ; + +r_paren + : ')' + ; + +opt_semi + : /* empty */ + | semi + ; + +semi + : ';' + ; + +comma : ',' opt_nls + ; + +%% +_ATEOF + + +# Pass plenty of options, to exercise plenty of code, even if we +# don't actually check the output. But SEGV is watching us, and +# so might do dmalloc. +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/existing.at:354: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --verbose --defines input.y" +echo existing.at:354 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/existing.at:354" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/existing.at:354: bison --xml=xml-tests/test.xml --verbose --defines input.y" +echo existing.at:354 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/existing.at:354" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/existing.at:354: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo existing.at:354 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:354" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/existing.at:354: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo existing.at:354 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:354" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/existing.at:354: bison --verbose --defines input.y" +echo existing.at:354 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:354" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_164 +#AT_START_165 +# 165. existing.at:362: GNU Cim Grammar +at_setup_line='existing.at:362' +at_func_banner 15 +at_desc="GNU Cim Grammar" +$at_quiet $as_echo_n "165: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "165. existing.at:362: testing ..." + $at_traceon + + +# GNU Cim, the GNU Simula 87 Compiler. + +# Bison was once wrong, due to an incorrect computation of the RR conflicts. +# It reported 80 SR && 99 RR conflicts instead of 78/10!!! + +cat >input.y <<'_ATEOF' +%union {} + +%token + HACTIVATE HAFTER /*HAND*/ HARRAY HAT + HBEFORE HBEGIN HBOOLEAN + HCHARACTER HCLASS /*HCOMMENT*/ HCONC + HDELAY HDO + HELSE HEND HEQ /*HEQV*/ HEXTERNAL + HFOR + HGE HGO HGOTO HGT + HHIDDEN + HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS + HLABEL HLE HLONG HLT + HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT + /*HOR*/ HOTHERWISE + HPRIOR HPROCEDURE HPROTECTED + HQUA + HREACTIVATE HREAL HREF + HSHORT HSTEP HSWITCH + HTEXT HTHEN HTHIS HTO + HUNTIL + HVALUE HVAR HVIRTUAL + HWHEN HWHILE + + HASSIGNVALUE HASSIGNREF + /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR + HBEGPAR HENDPAR + HEQR HNER + HADD HSUB HMUL HDIV HINTDIV HEXP + HDOTDOTDOT + +%token HIDENTIFIER +%token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST +%token HREALKONST +%token HTEXTKONST + + +%right HASSIGN +%left HORELSE +%left HANDTHEN +%left HEQV +%left HIMP +%left HOR +%left HAND + +%left HNOT + +%left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR + +%left HCONC + +%left HTERMOPERATOR +%left UNEAR +%left HFACTOROPERATOR +%left HPRIMARYOPERATOR + +%left HQUA + +%left HDOT + +%start MAIN_MODULE +%% +/* GRAMATIKK FOR PROGRAM MODULES */ +MAIN_MODULE : {} + MODULS + | error HSTATEMENTSEPARATOR MBEE_DECLSTMS + ; +EXT_DECLARATION : HEXTERNAL + MBEE_TYPE + HPROCEDURE + {} + EXT_LIST + | + HEXTERNAL + HIDENTIFIER + HPROCEDURE + {} + HIDENTIFIER {} + EXTERNAL_KIND_ITEM + | HEXTERNAL + HCLASS + {} + EXT_LIST + + ; +EXTERNAL_KIND_ITEM: EXT_IDENT + HOBJRELOPERATOR + {} + MBEE_TYPE HPROCEDURE + HIDENTIFIER + {} + HEADING EMPTY_BLOCK + {} +/* | + EXT_IDENT + {} + MBEE_REST_EXT_LIST + ; +MBEE_REST_EXT_LIST: /* EMPTY + | HPAREXPSEPARATOR EXT_KIND_LIST + ; +EXT_KIND_LIST : EXT_KIND_ITEM + | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM + ; +EXT_KIND_ITEM : HIDENTIFIER + EXT_IDENT + {}*/ + ; +EMPTY_BLOCK : /*EMPT*/ + | HBEGIN HEND + ; +EXT_LIST : EXT_ITEM + | EXT_LIST HPAREXPSEPARATOR EXT_ITEM + ; +EXT_ITEM : HIDENTIFIER + EXT_IDENT + ; +EXT_IDENT : /* EMPTY */ + | HVALRELOPERATOR {} + HTEXTKONST + ; +/* GRAMATIKK FOR TYPER */ +NO_TYPE : /*EMPT*/ + ; +MBEE_TYPE : NO_TYPE + | TYPE + ; +TYPE : HREF HBEGPAR + HIDENTIFIER + {} + HENDPAR + | HTEXT + | HBOOLEAN + | HCHARACTER + | HSHORT HINTEGER + | HINTEGER + | HREAL + | HLONG HREAL + ; + +/* GRAMATIKK FOR DEL AV SETNINGER */ +MBEE_ELSE_PART : /*EMPT*/ +/* | HELSE + HIF + EXPRESSION + HTHEN {} + BLOCK {} + MBEE_ELSE_PART {}*/ + | HELSE {} + BLOCK + ; +FOR_LIST : FOR_LIST_ELEMENT + | FOR_LIST_ELEMENT + HPAREXPSEPARATOR + FOR_LIST + ; +FOR_LIST_ELEMENT: EXPRESSION + MBEE_F_L_EL_R_PT + ; +MBEE_F_L_EL_R_PT: /*EMPT*/ + | HWHILE + EXPRESSION + | HSTEP + EXPRESSION + HUNTIL + EXPRESSION + ; +GOTO : HGO + HTO + | HGOTO + ; +CONN_STATE_R_PT : WHEN_CLAUSE_LIST + | HDO {} + BLOCK + ; +WHEN_CLAUSE_LIST: HWHEN + HIDENTIFIER + HDO {} + BLOCK + | WHEN_CLAUSE_LIST + HWHEN + HIDENTIFIER + HDO {} + BLOCK + ; +MBEE_OTWI_CLAUS : /*EMPT*/ + | HOTHERWISE {} + + BLOCK + ; +ACTIVATOR : HACTIVATE + | HREACTIVATE + ; +SCHEDULE : /*EMPT*/ + | ATDELAY EXPRESSION {} + PRIOR + | BEFOREAFTER {} + EXPRESSION + ; +ATDELAY : HAT + | HDELAY + ; +BEFOREAFTER : HBEFORE + | HAFTER + ; +PRIOR : /*EMPT*/ + | HPRIOR + ; +/* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */ +MODULSTATEMENT : HWHILE + EXPRESSION + HDO {} + BLOCK + | HIF + EXPRESSION + HTHEN {} + BLOCK {} + MBEE_ELSE_PART + | HFOR + HIDENTIFIER + HASSIGN {} + FOR_LIST + HDO {} + BLOCK + | GOTO + EXPRESSION + | HINSPECT + EXPRESSION {} + CONN_STATE_R_PT + {} + MBEE_OTWI_CLAUS + | HINNER + | HIDENTIFIER + HLABELSEPARATOR + {} + DECLSTATEMENT + | EXPRESSION_SIMP + HBEGIN + {} + IMPORT_SPEC_MODULE + {} + MBEE_DECLSTMS + HEND + | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR + MBEE_DECLSTMS HEND + | EXPRESSION_SIMP HBEGIN error HEND + | EXPRESSION_SIMP + | ACTIVATOR EXPRESSION SCHEDULE + | HBEGIN + {} + MBEE_DECLSTMS + HEND + | MBEE_TYPE HPROCEDURE + HIDENTIFIER + {} + HEADING BLOCK + | HIDENTIFIER + HCLASS + NO_TYPE + {} + IMPORT_SPEC_MODULE + HIDENTIFIER + {} + HEADING + BLOCK + | HCLASS + NO_TYPE + HIDENTIFIER + {} + HEADING + BLOCK + | EXT_DECLARATION + | /*EMPT*/ + ; +IMPORT_SPEC_MODULE: + ; +DECLSTATEMENT : MODULSTATEMENT + | TYPE + HIDENTIFIER + MBEE_CONSTANT + HPAREXPSEPARATOR + {} + IDENTIFIER_LISTC + | TYPE + HIDENTIFIER + MBEE_CONSTANT + | MBEE_TYPE + HARRAY {} + ARR_SEGMENT_LIST + | HSWITCH + HIDENTIFIER + HASSIGN {} + SWITCH_LIST + ; +BLOCK : DECLSTATEMENT + | HBEGIN MBEE_DECLSTMS HEND + | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND + | HBEGIN error HEND + ; +MBEE_DECLSTMS : MBEE_DECLSTMSU + ; +MBEE_DECLSTMSU : DECLSTATEMENT + | MBEE_DECLSTMSU + HSTATEMENTSEPARATOR + DECLSTATEMENT + ; +MODULS : MODULSTATEMENT + | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT + ; +/* GRAMATIKK FOR DEL AV DEKLARASJONER */ +ARR_SEGMENT_LIST: ARR_SEGMENT + | ARR_SEGMENT_LIST + HPAREXPSEPARATOR + ARR_SEGMENT + ; +ARR_SEGMENT : ARRAY_SEGMENT + HBEGPAR + BAUND_PAIR_LIST HENDPAR + ; +ARRAY_SEGMENT : ARRAY_SEGMENT_EL {} + + | ARRAY_SEGMENT_EL + HPAREXPSEPARATOR + ARRAY_SEGMENT + ; +ARRAY_SEGMENT_EL: HIDENTIFIER + ; +BAUND_PAIR_LIST : BAUND_PAIR + | BAUND_PAIR + HPAREXPSEPARATOR + BAUND_PAIR_LIST + ; +BAUND_PAIR : EXPRESSION + HLABELSEPARATOR + EXPRESSION + ; +SWITCH_LIST : EXPRESSION + | EXPRESSION + HPAREXPSEPARATOR + SWITCH_LIST + ; +HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {} + MBEE_MODE_PART {} + MBEE_SPEC_PART {} + MBEE_PROT_PART {} + MBEE_VIRT_PART + ; +MBEE_FMAL_PAR_P : /*EMPT*/ + | FMAL_PAR_PART + ; +FMAL_PAR_PART : HBEGPAR NO_TYPE + MBEE_LISTV HENDPAR + ; +MBEE_LISTV : /*EMPT*/ + | LISTV + ; +LISTV : HIDENTIFIER + | FPP_CATEG HDOTDOTDOT + | HIDENTIFIER {} + HPAREXPSEPARATOR LISTV + | FPP_SPEC + | FPP_SPEC + HPAREXPSEPARATOR LISTV + ; +FPP_HEADING : HBEGPAR NO_TYPE + FPP_MBEE_LISTV HENDPAR + ; +FPP_MBEE_LISTV : /*EMPT*/ + | FPP_LISTV + ; +FPP_LISTV : FPP_CATEG HDOTDOTDOT + | FPP_SPEC + | FPP_SPEC + HPAREXPSEPARATOR LISTV + ; +FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER + | FPP_CATEG FPP_PROC_DECL_IN_SPEC + ; +FPP_CATEG : HNAME HLABELSEPARATOR + | HVALUE HLABELSEPARATOR + | HVAR HLABELSEPARATOR + | /*EMPT*/ + ; +FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE + HIDENTIFIER + {} + FPP_HEADING {} { /* Yes, two "final" actions. */ } + ; +IDENTIFIER_LISTV: HIDENTIFIER + | HDOTDOTDOT + | HIDENTIFIER {} + HPAREXPSEPARATOR IDENTIFIER_LISTV + ; +MBEE_MODE_PART : /*EMPT*/ + | MODE_PART + ; +MODE_PART : NAME_PART + | VALUE_PART + | VAR_PART + | NAME_PART VALUE_PART + | VALUE_PART NAME_PART + | NAME_PART VAR_PART + | VAR_PART NAME_PART + | VALUE_PART VAR_PART + | VAR_PART VALUE_PART + | VAR_PART NAME_PART VALUE_PART + | NAME_PART VAR_PART VALUE_PART + | NAME_PART VALUE_PART VAR_PART + | VAR_PART VALUE_PART NAME_PART + | VALUE_PART VAR_PART NAME_PART + | VALUE_PART NAME_PART VAR_PART + ; +NAME_PART : HNAME {} + IDENTIFIER_LISTV + HSTATEMENTSEPARATOR + ; +VAR_PART : HVAR {} + IDENTIFIER_LISTV + HSTATEMENTSEPARATOR + ; +VALUE_PART : HVALUE {} + IDENTIFIER_LISTV HSTATEMENTSEPARATOR + ; +MBEE_SPEC_PART : /*EMPT*/ + | SPEC_PART + ; +SPEC_PART : ONE_SPEC + | SPEC_PART ONE_SPEC + ; +ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR + | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR + {} + PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR + | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR + | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR + | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR + IDENTIFIER_LIST HSTATEMENTSEPARATOR + ; +SPECIFIER : TYPE + | MBEE_TYPE + HARRAY + | HLABEL + | HSWITCH + ; +PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE + HIDENTIFIER + {} + HEADING + {} + MBEE_BEGIN_END + ; +MBEE_BEGIN_END : /* EMPTY */ + | HBEGIN HEND + ; +MBEE_PROT_PART : /*EMPT*/ + | PROTECTION_PART + ; +PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST + HSTATEMENTSEPARATOR + | PROTECTION_PART PROT_SPECIFIER + IDENTIFIER_LIST HSTATEMENTSEPARATOR + ; +PROT_SPECIFIER : HHIDDEN + | HPROTECTED + | HHIDDEN + HPROTECTED + | HPROTECTED + HHIDDEN + ; +MBEE_VIRT_PART : /*EMPT*/ + | VIRTUAL_PART + ; +VIRTUAL_PART : HVIRTUAL + HLABELSEPARATOR + MBEE_SPEC_PART + ; +IDENTIFIER_LIST : HIDENTIFIER + | IDENTIFIER_LIST HPAREXPSEPARATOR + HIDENTIFIER + ; +IDENTIFIER_LISTC: HIDENTIFIER + MBEE_CONSTANT + | IDENTIFIER_LISTC HPAREXPSEPARATOR + HIDENTIFIER + MBEE_CONSTANT + ; +MBEE_CONSTANT : /* EMPTY */ + | HVALRELOPERATOR + {} + EXPRESSION + ; + +/* GRAMATIKK FOR UTTRYKK */ +EXPRESSION : EXPRESSION_SIMP + | HIF + EXPRESSION + HTHEN + EXPRESSION + HELSE + EXPRESSION + ; +EXPRESSION_SIMP : EXPRESSION_SIMP + HASSIGN + EXPRESSION + | + + EXPRESSION_SIMP + HCONC + EXPRESSION_SIMP + | EXPRESSION_SIMP HOR + HELSE + EXPRESSION_SIMP + %prec HORELSE + | EXPRESSION_SIMP HAND + HTHEN + EXPRESSION_SIMP + %prec HANDTHEN + | EXPRESSION_SIMP + HEQV EXPRESSION_SIMP + | EXPRESSION_SIMP + HIMP EXPRESSION_SIMP + | EXPRESSION_SIMP + HOR EXPRESSION_SIMP + | EXPRESSION_SIMP + HAND EXPRESSION_SIMP + | HNOT EXPRESSION_SIMP + | EXPRESSION_SIMP + HVALRELOPERATOR + EXPRESSION_SIMP + | EXPRESSION_SIMP + HREFRELOPERATOR + EXPRESSION_SIMP + | EXPRESSION_SIMP + HOBJRELOPERATOR + EXPRESSION_SIMP + | HTERMOPERATOR + EXPRESSION_SIMP %prec UNEAR + | EXPRESSION_SIMP + HTERMOPERATOR + EXPRESSION_SIMP + | EXPRESSION_SIMP + HFACTOROPERATOR + EXPRESSION_SIMP + | EXPRESSION_SIMP + HPRIMARYOPERATOR + EXPRESSION_SIMP + | HBEGPAR + EXPRESSION HENDPAR + | HTEXTKONST + | HCHARACTERKONST + | HREALKONST + | HINTEGERKONST + | HBOOLEANKONST + | HNONE + | HIDENTIFIER + {} + MBEE_ARG_R_PT + | HTHIS HIDENTIFIER + | HNEW + HIDENTIFIER + ARG_R_PT + | EXPRESSION_SIMP + HDOT + EXPRESSION_SIMP + | EXPRESSION_SIMP + HQUA HIDENTIFIER + ; +ARG_R_PT : /*EMPTY*/ + | HBEGPAR + ARGUMENT_LIST HENDPAR + ; +MBEE_ARG_R_PT : /*EMPTY*/ + | HBEGPAR + ARGUMENT_LIST HENDPAR + ; +ARGUMENT_LIST : EXPRESSION + | EXPRESSION + HPAREXPSEPARATOR + ARGUMENT_LIST + ; +%% +_ATEOF + + +# Pass plenty of options, to exercise plenty of code, even if we +# don't actually check the output. But SEGV is watching us, and +# so might do dmalloc. +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/existing.at:956: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --verbose --defines input.y" +echo existing.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/existing.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/existing.at:956: bison --xml=xml-tests/test.xml --verbose --defines input.y" +echo existing.at:956 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/existing.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/existing.at:956: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo existing.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/existing.at:956: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo existing.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/existing.at:956: bison --verbose --defines input.y" +echo existing.at:956 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y: conflicts: 78 shift/reduce, 10 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/existing.at:960: grep '^State.*conflicts:' input.output" +echo existing.at:960 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep '^State.*conflicts:' input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep '^State.*conflicts:' input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "State 64 conflicts: 14 shift/reduce +State 164 conflicts: 1 shift/reduce +State 201 conflicts: 33 shift/reduce, 4 reduce/reduce +State 206 conflicts: 1 shift/reduce +State 240 conflicts: 1 shift/reduce +State 335 conflicts: 9 shift/reduce, 2 reduce/reduce +State 356 conflicts: 1 shift/reduce +State 360 conflicts: 9 shift/reduce, 2 reduce/reduce +State 427 conflicts: 9 shift/reduce, 2 reduce/reduce +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:960" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_165 +#AT_START_166 +# 166. existing.at:978: GNU pic Grammar +at_setup_line='existing.at:978' +at_func_banner 15 +at_desc="GNU pic Grammar" +$at_quiet $as_echo_n "166: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "166. existing.at:978: testing ..." + $at_traceon + + +# GNU pic, part of groff. + +# Bison once reported shift/reduce conflicts that it shouldn't have. + +cat >input.y <<'_ATEOF' +%union {} + +%token LABEL +%token VARIABLE +%token NUMBER +%token TEXT +%token COMMAND_LINE +%token DELIMITED +%token ORDINAL +%token TH +%token LEFT_ARROW_HEAD +%token RIGHT_ARROW_HEAD +%token DOUBLE_ARROW_HEAD +%token LAST +%token UP +%token DOWN +%token LEFT +%token RIGHT +%token BOX +%token CIRCLE +%token ELLIPSE +%token ARC +%token LINE +%token ARROW +%token MOVE +%token SPLINE +%token HEIGHT +%token RADIUS +%token WIDTH +%token DIAMETER +%token FROM +%token TO +%token AT +%token WITH +%token BY +%token THEN +%token SOLID +%token DOTTED +%token DASHED +%token CHOP +%token SAME +%token INVISIBLE +%token LJUST +%token RJUST +%token ABOVE +%token BELOW +%token OF +%token THE +%token WAY +%token BETWEEN +%token AND +%token HERE +%token DOT_N +%token DOT_E +%token DOT_W +%token DOT_S +%token DOT_NE +%token DOT_SE +%token DOT_NW +%token DOT_SW +%token DOT_C +%token DOT_START +%token DOT_END +%token DOT_X +%token DOT_Y +%token DOT_HT +%token DOT_WID +%token DOT_RAD +%token SIN +%token COS +%token ATAN2 +%token LOG +%token EXP +%token SQRT +%token K_MAX +%token K_MIN +%token INT +%token RAND +%token SRAND +%token COPY +%token THRU +%token TOP +%token BOTTOM +%token UPPER +%token LOWER +%token SH +%token PRINT +%token CW +%token CCW +%token FOR +%token DO +%token IF +%token ELSE +%token ANDAND +%token OROR +%token NOTEQUAL +%token EQUALEQUAL +%token LESSEQUAL +%token GREATEREQUAL +%token LEFT_CORNER +%token RIGHT_CORNER +%token NORTH +%token SOUTH +%token EAST +%token WEST +%token CENTER +%token END +%token START +%token RESET +%token UNTIL +%token PLOT +%token THICKNESS +%token FILL +%token COLORED +%token OUTLINED +%token SHADED +%token ALIGNED +%token SPRINTF +%token COMMAND + +%left '.' + +/* this ensures that plot 17 "%g" parses as (plot 17 "%g") */ +%left PLOT +%left TEXT SPRINTF + +/* give text adjustments higher precedence than TEXT, so that +box "foo" above ljust == box ("foo" above ljust) +*/ + +%left LJUST RJUST ABOVE BELOW + +%left LEFT RIGHT +/* Give attributes that take an optional expression a higher +precedence than left and right, so that eg `line chop left' +parses properly. */ +%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED +%left LABEL + +%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST +%left ORDINAL HERE '`' + +%left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */ + +/* these need to be lower than '-' */ +%left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS + +/* these must have higher precedence than CHOP so that `label %prec CHOP' +works */ +%left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C +%left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER +%left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END + +%left ',' +%left OROR +%left ANDAND +%left EQUALEQUAL NOTEQUAL +%left '<' '>' LESSEQUAL GREATEREQUAL + +%left BETWEEN OF +%left AND + +%left '+' '-' +%left '*' '/' '%' +%right '!' +%right '^' + +%% + +top: + optional_separator + | element_list + ; + +element_list: + optional_separator middle_element_list optional_separator + ; + +middle_element_list: + element + | middle_element_list separator element + ; + +optional_separator: + /* empty */ + | separator + ; + +separator: + ';' + | separator ';' + ; + +placeless_element: + VARIABLE '=' any_expr + | VARIABLE ':' '=' any_expr + | UP + | DOWN + | LEFT + | RIGHT + | COMMAND_LINE + | COMMAND print_args + | PRINT print_args + | SH + {} + DELIMITED + | COPY TEXT + | COPY TEXT THRU + {} + DELIMITED + {} + until + | COPY THRU + {} + DELIMITED + {} + until + | FOR VARIABLE '=' expr TO expr optional_by DO + {} + DELIMITED + | simple_if + | simple_if ELSE + {} + DELIMITED + | reset_variables + | RESET + ; + +reset_variables: + RESET VARIABLE + | reset_variables VARIABLE + | reset_variables ',' VARIABLE + ; + +print_args: + print_arg + | print_args print_arg + ; + +print_arg: + expr %prec ',' + | text + | position %prec ',' + ; + +simple_if: + IF any_expr THEN + {} + DELIMITED + ; + +until: + /* empty */ + | UNTIL TEXT + ; + +any_expr: + expr + | text_expr + ; + +text_expr: + text EQUALEQUAL text + | text NOTEQUAL text + | text_expr ANDAND text_expr + | text_expr ANDAND expr + | expr ANDAND text_expr + | text_expr OROR text_expr + | text_expr OROR expr + | expr OROR text_expr + | '!' text_expr + ; + +optional_by: + /* empty */ + | BY expr + | BY '*' expr + ; + +element: + object_spec + | LABEL ':' optional_separator element + | LABEL ':' optional_separator position_not_place + | LABEL ':' optional_separator place + | '{' {} element_list '}' + {} + optional_element + | placeless_element + ; + +optional_element: + /* empty */ + | element + ; + +object_spec: + BOX + | CIRCLE + | ELLIPSE + | ARC + | LINE + | ARROW + | MOVE + | SPLINE + | text %prec TEXT + | PLOT expr + | PLOT expr text + | '[' + {} + element_list ']' + | object_spec HEIGHT expr + | object_spec RADIUS expr + | object_spec WIDTH expr + | object_spec DIAMETER expr + | object_spec expr %prec HEIGHT + | object_spec UP + | object_spec UP expr + | object_spec DOWN + | object_spec DOWN expr + | object_spec RIGHT + | object_spec RIGHT expr + | object_spec LEFT + | object_spec LEFT expr + | object_spec FROM position + | object_spec TO position + | object_spec AT position + | object_spec WITH path + | object_spec WITH position %prec ',' + | object_spec BY expr_pair + | object_spec THEN + | object_spec SOLID + | object_spec DOTTED + | object_spec DOTTED expr + | object_spec DASHED + | object_spec DASHED expr + | object_spec FILL + | object_spec FILL expr + | object_spec SHADED text + | object_spec COLORED text + | object_spec OUTLINED text + | object_spec CHOP + | object_spec CHOP expr + | object_spec SAME + | object_spec INVISIBLE + | object_spec LEFT_ARROW_HEAD + | object_spec RIGHT_ARROW_HEAD + | object_spec DOUBLE_ARROW_HEAD + | object_spec CW + | object_spec CCW + | object_spec text %prec TEXT + | object_spec LJUST + | object_spec RJUST + | object_spec ABOVE + | object_spec BELOW + | object_spec THICKNESS expr + | object_spec ALIGNED + ; + +text: + TEXT + | SPRINTF '(' TEXT sprintf_args ')' + ; + +sprintf_args: + /* empty */ + | sprintf_args ',' expr + ; + +position: + position_not_place + | place + ; + +position_not_place: + expr_pair + | position '+' expr_pair + | position '-' expr_pair + | '(' position ',' position ')' + | expr between position AND position + | expr '<' position ',' position '>' + ; + +between: + BETWEEN + | OF THE WAY BETWEEN + ; + +expr_pair: + expr ',' expr + | '(' expr_pair ')' + ; + +place: + /* line at A left == line (at A) left */ + label %prec CHOP + | label corner + | corner label + | corner OF label + | HERE + ; + +label: + LABEL + | nth_primitive + | label '.' LABEL + ; + +ordinal: + ORDINAL + | '`' any_expr TH + ; + +optional_ordinal_last: + LAST + | ordinal LAST + ; + +nth_primitive: + ordinal object_type + | optional_ordinal_last object_type + ; + +object_type: + BOX + | CIRCLE + | ELLIPSE + | ARC + | LINE + | ARROW + | SPLINE + | '[' ']' + | TEXT + ; + +label_path: + '.' LABEL + | label_path '.' LABEL + ; + +relative_path: + corner %prec CHOP + /* give this a lower precedence than LEFT and RIGHT so that + [A: box] with .A left == [A: box] with (.A left) */ + | label_path %prec TEXT + | label_path corner + ; + +path: + relative_path + | '(' relative_path ',' relative_path ')' + {} + /* The rest of these rules are a compatibility sop. */ + | ORDINAL LAST object_type relative_path + | LAST object_type relative_path + | ORDINAL object_type relative_path + | LABEL relative_path + ; + +corner: + DOT_N + | DOT_E + | DOT_W + | DOT_S + | DOT_NE + | DOT_SE + | DOT_NW + | DOT_SW + | DOT_C + | DOT_START + | DOT_END + | TOP + | BOTTOM + | LEFT + | RIGHT + | UPPER LEFT + | LOWER LEFT + | UPPER RIGHT + | LOWER RIGHT + | LEFT_CORNER + | RIGHT_CORNER + | UPPER LEFT_CORNER + | LOWER LEFT_CORNER + | UPPER RIGHT_CORNER + | LOWER RIGHT_CORNER + | NORTH + | SOUTH + | EAST + | WEST + | CENTER + | START + | END + ; + +expr: + VARIABLE + | NUMBER + | place DOT_X + | place DOT_Y + | place DOT_HT + | place DOT_WID + | place DOT_RAD + | expr '+' expr + | expr '-' expr + | expr '*' expr + | expr '/' expr + | expr '%' expr + | expr '^' expr + | '-' expr %prec '!' + | '(' any_expr ')' + | SIN '(' any_expr ')' + | COS '(' any_expr ')' + | ATAN2 '(' any_expr ',' any_expr ')' + | LOG '(' any_expr ')' + | EXP '(' any_expr ')' + | SQRT '(' any_expr ')' + | K_MAX '(' any_expr ',' any_expr ')' + | K_MIN '(' any_expr ',' any_expr ')' + | INT '(' any_expr ')' + | RAND '(' any_expr ')' + | RAND '(' ')' + | SRAND '(' any_expr ')' + | expr '<' expr + | expr LESSEQUAL expr + | expr '>' expr + | expr GREATEREQUAL expr + | expr EQUALEQUAL expr + | expr NOTEQUAL expr + | expr ANDAND expr + | expr OROR expr + | '!' expr + ; +_ATEOF + + +# Pass plenty of options, to exercise plenty of code, even if we +# don't actually check the output. But SEGV is watching us, and +# so might do dmalloc. +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/existing.at:1521: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --verbose --defines input.y" +echo existing.at:1521 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/existing.at:1521" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/existing.at:1521: bison --xml=xml-tests/test.xml --verbose --defines input.y" +echo existing.at:1521 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/existing.at:1521" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/existing.at:1521: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo existing.at:1521 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:1521" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/existing.at:1521: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo existing.at:1521 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:1521" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/existing.at:1521: bison --verbose --defines input.y" +echo existing.at:1521 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --verbose --defines input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --verbose --defines input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:453.11-48: warning: rule useless in parser due to conflicts: path: ORDINAL LAST object_type relative_path +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/existing.at:1521" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_166 +#AT_START_167 +# 167. regression.at:26: Trivial grammars +at_setup_line='regression.at:26' +at_func_banner 16 +at_desc="Trivial grammars" +$at_quiet $as_echo_n "167: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "167. regression.at:26: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +void yyerror (char const *); +int yylex (void); +#define YYSTYPE int * +%} + +%error-verbose + +%% + +program: 'x'; +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:42: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo regression.at:42 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:42" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:42: bison --xml=xml-tests/test.xml -o input.c input.y" +echo regression.at:42 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:42" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:42: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:42 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:42" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:42: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:42 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:42" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:42: bison -o input.c input.y" +echo regression.at:42 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:42" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:43: \$CC \$CFLAGS \$CPPFLAGS -o input.o -c input.c" +echo regression.at:43 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o input.o -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:43" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:44: \$CC \$CFLAGS \$CPPFLAGS -o input.o -DYYDEBUG -c input.c" +echo regression.at:44 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o input.o -DYYDEBUG -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o input.o -DYYDEBUG -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o input.o -DYYDEBUG -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:44" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_167 +#AT_START_168 +# 168. regression.at:54: YYSTYPE typedef +at_setup_line='regression.at:54' +at_func_banner 16 +at_desc="YYSTYPE typedef" +$at_quiet $as_echo_n "168: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "168. regression.at:54: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +void yyerror (char const *); +int yylex (void); +typedef union { char const *val; } YYSTYPE; +%} + +%type program + +%% + +program: { $$ = ""; }; +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:70: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo regression.at:70 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:70" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:70: bison --xml=xml-tests/test.xml -o input.c input.y" +echo regression.at:70 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:70" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:70: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:70 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:70" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:70: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:70 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:70" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:70: bison -o input.c input.y" +echo regression.at:70 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:70" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:71: \$CC \$CFLAGS \$CPPFLAGS -o input.o -c input.c" +echo regression.at:71 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o input.o -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:71" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_168 +#AT_START_169 +# 169. regression.at:82: Early token definitions with --yacc +at_setup_line='regression.at:82' +at_func_banner 16 +at_desc="Early token definitions with --yacc" +$at_quiet $as_echo_n "169: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "169. regression.at:82: testing ..." + $at_traceon + + +# Found in GCJ: they expect the tokens to be defined before the user +# prologue, so that they can use the token definitions in it. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +void yyerror (const char *s); +int yylex (void); +%} + +%union +{ + int val; +}; +%{ +#ifndef MY_TOKEN +# error "MY_TOKEN not defined." +#endif +%} +%token MY_TOKEN +%% +exp: MY_TOKEN; +%% +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:108: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -y -o input.c input.y" +echo regression.at:108 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -y -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -y -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:108" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:108: bison --xml=xml-tests/test.xml -y -o input.c input.y" +echo regression.at:108 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -y -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -y -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:108" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:108: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:108 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:108" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:108: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:108 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:108" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:108: bison -y -o input.c input.y" +echo regression.at:108 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -y -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -y -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:108" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:109: \$CC \$CFLAGS \$CPPFLAGS -o input.o -c input.c" +echo regression.at:109 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o input.o -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:109" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_169 +#AT_START_170 +# 170. regression.at:120: Early token definitions without --yacc +at_setup_line='regression.at:120' +at_func_banner 16 +at_desc="Early token definitions without --yacc" +$at_quiet $as_echo_n "170: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "170. regression.at:120: testing ..." + $at_traceon + + +# Found in GCJ: they expect the tokens to be defined before the user +# prologue, so that they can use the token definitions in it. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +#include +void yyerror (const char *s); +int yylex (void); +void print_my_token (void); +%} + +%union +{ + int val; +}; +%{ +void +print_my_token (void) +{ + enum yytokentype my_token = MY_TOKEN; + printf ("%d\n", my_token); +} +%} +%token MY_TOKEN +%% +exp: MY_TOKEN; +%% +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:151: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo regression.at:151 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:151" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:151: bison --xml=xml-tests/test.xml -o input.c input.y" +echo regression.at:151 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:151" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:151: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:151 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:151" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:151: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:151 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:151" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:151: bison -o input.c input.y" +echo regression.at:151 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:151" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:152: \$CC \$CFLAGS \$CPPFLAGS -o input.o -c input.c" +echo regression.at:152 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o input.o -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:152" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_170 +#AT_START_171 +# 171. regression.at:163: Braces parsing +at_setup_line='regression.at:163' +at_func_banner 16 +at_desc="Braces parsing" +$at_quiet $as_echo_n "171: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "171. regression.at:163: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +/* Bison used to swallow the character after `}'. */ + +%% +exp: { tests = {{{{{{{{{{}}}}}}}}}}; }; +%% +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:173: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -v -o input.c input.y" +echo regression.at:173 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:173: bison --xml=xml-tests/test.xml -v -o input.c input.y" +echo regression.at:173 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:173: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:173 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:173: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:173 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:173: bison -v -o input.c input.y" +echo regression.at:173 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:173" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:175: grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c" +echo regression.at:175 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:175" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_171 +#AT_START_172 +# 172. regression.at:185: Duplicate string +at_setup_line='regression.at:185' +at_func_banner 16 +at_desc="Duplicate string" +$at_quiet $as_echo_n "172: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "172. regression.at:185: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +/* `Bison -v' used to dump core when two tokens are defined with the same + string, as LE and GE below. */ + +%token NUM +%token LE "<=" +%token GE "<=" + +%% +exp: '(' exp ')' | NUM ; +%% +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:200: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -v -o input.c input.y" +echo regression.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:200: bison --xml=xml-tests/test.xml -v -o input.c input.y" +echo regression.at:200 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:200: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:200: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:200 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:200: bison -v -o input.c input.y" +echo regression.at:200 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:6.8-14: warning: symbol \`\"<=\"' used more than once as a literal string +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:200" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_172 +#AT_START_173 +# 173. regression.at:211: Rule Line Numbers +at_setup_line='regression.at:211' +at_func_banner 16 +at_desc="Rule Line Numbers" +$at_quiet $as_echo_n "173: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "173. regression.at:211: testing ..." + $at_traceon + + + + +cat >input.y <<'_ATEOF' +%% +expr: +'a' + +{ + +} + +'b' + +{ + +} + +| + + +{ + + +} + +'c' + +{ + +}; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:245: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c -v input.y" +echo regression.at:245 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c -v input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c -v input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:245" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:245: bison --xml=xml-tests/test.xml -o input.c -v input.y" +echo regression.at:245 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c -v input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c -v input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:245" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:245: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:245 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:245" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:245: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:245 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:245" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:245: bison -o input.c -v input.y" +echo regression.at:245 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c -v input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c -v input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:245" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Check the contents of the report. +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:248: cat input.output" +echo regression.at:248 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Grammar + + 0 \$accept: expr \$end + + 1 \$@1: /* empty */ + + 2 expr: 'a' \$@1 'b' + + 3 \$@2: /* empty */ + + 4 expr: \$@2 'c' + + +Terminals, with rules where they appear + +\$end (0) 0 +'a' (97) 2 +'b' (98) 2 +'c' (99) 4 +error (256) + + +Nonterminals, with rules where they appear + +\$accept (6) + on left: 0 +expr (7) + on left: 2 4, on right: 0 +\$@1 (8) + on left: 1, on right: 2 +\$@2 (9) + on left: 3, on right: 4 + + +state 0 + + 0 \$accept: . expr \$end + + 'a' shift, and go to state 1 + + \$default reduce using rule 3 (\$@2) + + expr go to state 2 + \$@2 go to state 3 + + +state 1 + + 2 expr: 'a' . \$@1 'b' + + \$default reduce using rule 1 (\$@1) + + \$@1 go to state 4 + + +state 2 + + 0 \$accept: expr . \$end + + \$end shift, and go to state 5 + + +state 3 + + 4 expr: \$@2 . 'c' + + 'c' shift, and go to state 6 + + +state 4 + + 2 expr: 'a' \$@1 . 'b' + + 'b' shift, and go to state 7 + + +state 5 + + 0 \$accept: expr \$end . + + \$default accept + + +state 6 + + 4 expr: \$@2 'c' . + + \$default reduce using rule 4 (expr) + + +state 7 + + 2 expr: 'a' \$@1 'b' . + + \$default reduce using rule 2 (expr) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:248" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_173 +#AT_START_174 +# 174. regression.at:355: Mixing %token styles +at_setup_line='regression.at:355' +at_func_banner 16 +at_desc="Mixing %token styles" +$at_quiet $as_echo_n "174: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "174. regression.at:355: testing ..." + $at_traceon + + +# Taken from the documentation. +cat >input.y <<'_ATEOF' +%token OR "||" +%token LE 134 "<=" +%left OR "<=" +%% +exp: ; +%% +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:367: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -v -o input.c input.y" +echo regression.at:367 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:367" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:367: bison --xml=xml-tests/test.xml -v -o input.c input.y" +echo regression.at:367 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:367" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:367: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:367 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:367" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:367: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:367 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:367" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:367: bison -v -o input.c input.y" +echo regression.at:367 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:367" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_174 +#AT_START_175 +# 175. regression.at:378: Invalid inputs +at_setup_line='regression.at:378' +at_func_banner 16 +at_desc="Invalid inputs" +$at_quiet $as_echo_n "175: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "175. regression.at:378: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%% +? +default: 'a' } +%& +%a-does-not-exist +%- +%{ +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:390: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo regression.at:390 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:2.1: invalid character: \`?' +input.y:3.14: invalid character: \`}' +input.y:4.1: invalid character: \`%' +input.y:4.2: invalid character: \`&' +input.y:5.1-17: invalid directive: \`%a-does-not-exist' +input.y:6.1: invalid character: \`%' +input.y:6.2: invalid character: \`-' +input.y:7.1-8.0: missing \`%}' at end of file +input.y:7.1-8.0: syntax error, unexpected %{...%} +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:390" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_175 +#AT_START_176 +# 176. regression.at:405: Invalid inputs with {} +at_setup_line='regression.at:405' +at_func_banner 16 +at_desc="Invalid inputs with {}" +$at_quiet $as_echo_n "176: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "176. regression.at:405: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' + +%destructor +%initial-action +%lex-param +%parse-param +%printer +%union +_ATEOF + + + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:417: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y" +echo regression.at:417 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison input.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:3.1-15: syntax error, unexpected %initial-action, expecting {...} +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:417" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_176 +#AT_START_177 +# 177. regression.at:430: Token definitions +at_setup_line='regression.at:430' +at_func_banner 16 +at_desc="Token definitions" +$at_quiet $as_echo_n "177: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "177. regression.at:430: testing ..." + $at_traceon + + +# Bison managed, when fed with `%token 'f' "f"' to #define 'f'! +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +#include +#include +void yyerror (const char *s); +int yylex (void); +%} +%error-verbose +%token MYEOF 0 "end of file" +%token 'a' "a" +%token B_TOKEN "b" +%token C_TOKEN 'c' +%token 'd' D_TOKEN +%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" +%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" +%% +exp: "a" "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"; +%% +void +yyerror (char const *s) +{ + fprintf (stderr, "%s\n", s); +} + +int +yylex (void) +{ + static int called; + if (called++) + abort (); + return SPECIAL; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +# Checking the warning message guarantees that the trigraph "??!" isn't +# unnecessarily escaped here even though it would need to be if encoded in a +# C-string literal. Also notice that unnecessary escaping, such as "\?", from +# the user specification is eliminated. +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:477: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo regression.at:477 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:477" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:477: bison --xml=xml-tests/test.xml -o input.c input.y" +echo regression.at:477 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:477" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:477: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:477 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:477" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:477: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:477 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:477" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:477: bison -o input.c input.y" +echo regression.at:477 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:22.8-14: warning: symbol SPECIAL redeclared +input.y:22.8-63: warning: symbol \`\"\\\\'?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\001\\201??!\"' used more than once as a literal string +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:477" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:481: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo regression.at:481 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:481" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Checking the error message here guarantees that yytname, which does contain +# C-string literals, does have the trigraph escaped correctly. Thus, the +# symbol name reported by the parser is exactly the same as that reported by +# Bison itself. +cat >experr <<'_ATEOF' +syntax error, unexpected "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!", expecting a +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:490: \$PREPARSER ./input" +echo regression.at:490 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +$at_diff experr "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:490" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_177 +#AT_START_178 +# 178. regression.at:500: Characters Escapes +at_setup_line='regression.at:500' +at_func_banner 16 +at_desc="Characters Escapes" +$at_quiet $as_echo_n "178: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "178. regression.at:500: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +void yyerror (const char *s); +int yylex (void); +%} +%% +exp: + '\'' "\'" +| '\"' "\"" +| '"' "'" +; +_ATEOF + + +# Pacify font-lock-mode: " + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:516: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo regression.at:516 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:516" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:516: bison --xml=xml-tests/test.xml -o input.c input.y" +echo regression.at:516 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:516" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:516: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:516 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:516" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:516: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:516 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:516" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:516: bison -o input.c input.y" +echo regression.at:516 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:516" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:517: \$CC \$CFLAGS \$CPPFLAGS -o input.o -c input.c" +echo regression.at:517 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS -o input.o -c input.c"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS -o input.o -c input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_178 +#AT_START_179 +# 179. regression.at:531: Web2c Report +at_setup_line='regression.at:531' +at_func_banner 16 +at_desc="Web2c Report" +$at_quiet $as_echo_n "179: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "179. regression.at:531: testing ..." + $at_traceon + + + + +cat >input.y <<'_ATEOF' +%token undef_id_tok const_id_tok + +%start CONST_DEC_PART + +%% +CONST_DEC_PART: + CONST_DEC_LIST + ; + +CONST_DEC_LIST: + CONST_DEC + | CONST_DEC_LIST CONST_DEC + ; + +CONST_DEC: + { } undef_id_tok '=' const_id_tok ';' + ; +%% +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:556: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -v input.y" +echo regression.at:556 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:556" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:556: bison --xml=xml-tests/test.xml -v input.y" +echo regression.at:556 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -v input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -v input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:556" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:556: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:556 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:556" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:556: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:556 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:556" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:556: bison -v input.y" +echo regression.at:556 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:556" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:557: cat input.output" +echo regression.at:557 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Grammar + + 0 \$accept: CONST_DEC_PART \$end + + 1 CONST_DEC_PART: CONST_DEC_LIST + + 2 CONST_DEC_LIST: CONST_DEC + 3 | CONST_DEC_LIST CONST_DEC + + 4 \$@1: /* empty */ + + 5 CONST_DEC: \$@1 undef_id_tok '=' const_id_tok ';' + + +Terminals, with rules where they appear + +\$end (0) 0 +';' (59) 5 +'=' (61) 5 +error (256) +undef_id_tok (258) 5 +const_id_tok (259) 5 + + +Nonterminals, with rules where they appear + +\$accept (7) + on left: 0 +CONST_DEC_PART (8) + on left: 1, on right: 0 +CONST_DEC_LIST (9) + on left: 2 3, on right: 1 3 +CONST_DEC (10) + on left: 5, on right: 2 3 +\$@1 (11) + on left: 4, on right: 5 + + +state 0 + + 0 \$accept: . CONST_DEC_PART \$end + + \$default reduce using rule 4 (\$@1) + + CONST_DEC_PART go to state 1 + CONST_DEC_LIST go to state 2 + CONST_DEC go to state 3 + \$@1 go to state 4 + + +state 1 + + 0 \$accept: CONST_DEC_PART . \$end + + \$end shift, and go to state 5 + + +state 2 + + 1 CONST_DEC_PART: CONST_DEC_LIST . + 3 CONST_DEC_LIST: CONST_DEC_LIST . CONST_DEC + + undef_id_tok reduce using rule 4 (\$@1) + \$default reduce using rule 1 (CONST_DEC_PART) + + CONST_DEC go to state 6 + \$@1 go to state 4 + + +state 3 + + 2 CONST_DEC_LIST: CONST_DEC . + + \$default reduce using rule 2 (CONST_DEC_LIST) + + +state 4 + + 5 CONST_DEC: \$@1 . undef_id_tok '=' const_id_tok ';' + + undef_id_tok shift, and go to state 7 + + +state 5 + + 0 \$accept: CONST_DEC_PART \$end . + + \$default accept + + +state 6 + + 3 CONST_DEC_LIST: CONST_DEC_LIST CONST_DEC . + + \$default reduce using rule 3 (CONST_DEC_LIST) + + +state 7 + + 5 CONST_DEC: \$@1 undef_id_tok . '=' const_id_tok ';' + + '=' shift, and go to state 8 + + +state 8 + + 5 CONST_DEC: \$@1 undef_id_tok '=' . const_id_tok ';' + + const_id_tok shift, and go to state 9 + + +state 9 + + 5 CONST_DEC: \$@1 undef_id_tok '=' const_id_tok . ';' + + ';' shift, and go to state 10 + + +state 10 + + 5 CONST_DEC: \$@1 undef_id_tok '=' const_id_tok ';' . + + \$default reduce using rule 5 (CONST_DEC) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:557" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_179 +#AT_START_180 +# 180. regression.at:708: Web2c Actions +at_setup_line='regression.at:708' +at_func_banner 16 +at_desc="Web2c Actions" +$at_quiet $as_echo_n "180: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "180. regression.at:708: testing ..." + $at_traceon + + + + +cat >input.y <<'_ATEOF' +%% +statement: struct_stat; +struct_stat: /* empty. */ | if else; +if: "if" "const" "then" statement; +else: "else" statement; +%% +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:721: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -v -o input.c input.y" +echo regression.at:721 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:721" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:721: bison --xml=xml-tests/test.xml -v -o input.c input.y" +echo regression.at:721 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:721" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:721: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:721 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:721" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:721: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:721 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:721" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:721: bison -v -o input.c input.y" +echo regression.at:721 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -v -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:721" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Check only the tables. +sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:726: cat tables.c" +echo regression.at:726 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat tables.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat tables.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6 +}; +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 5, 6, 9, 14 +}; +static const yytype_int8 yyrhs[] = +{ + 8, 0, -1, 9, -1, -1, 10, 11, -1, 3, + 4, 5, 8, -1, 6, 8, -1 +}; +static const yytype_uint8 yyrline[] = +{ + 0, 2, 2, 3, 3, 4, 5 +}; +static const char *const yytname[] = +{ + \"\$end\", \"error\", \"\$undefined\", \"\\\"if\\\"\", \"\\\"const\\\"\", \"\\\"then\\\"\", + \"\\\"else\\\"\", \"\$accept\", \"statement\", \"struct_stat\", \"if\", \"else\", 0 +}; +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261 +}; +static const yytype_uint8 yyr1[] = +{ + 0, 7, 8, 9, 9, 10, 11 +}; +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 0, 2, 4, 2 +}; +static const yytype_uint8 yydefact[] = +{ + 3, 0, 0, 2, 0, 0, 1, 3, 4, 3, + 6, 5 +}; +static const yytype_int8 yydefgoto[] = +{ + -1, 2, 3, 4, 8 +}; +static const yytype_int8 yypact[] = +{ + -2, -1, 4, -8, 0, 2, -8, -2, -8, -2, + -8, -8 +}; +static const yytype_int8 yypgoto[] = +{ + -8, -7, -8, -8, -8 +}; +static const yytype_uint8 yytable[] = +{ + 10, 1, 11, 5, 6, 0, 7, 9 +}; +static const yytype_int8 yycheck[] = +{ + 7, 3, 9, 4, 0, -1, 6, 5 +}; +static const yytype_uint8 yystos[] = +{ + 0, 3, 8, 9, 10, 4, 0, 6, 11, 5, + 8, 8 +}; +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:726" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_180 +#AT_START_181 +# 181. regression.at:954: Dancer +at_setup_line='regression.at:954' +at_func_banner 16 +at_desc="Dancer " +$at_quiet $as_echo_n "181: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "181. regression.at:954: testing ..." + $at_traceon + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >dancer.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +static int yylex (void); +#include +#include +static void yyerror (const char *); +%} + +%token ARROW INVALID NUMBER STRING DATA +%defines +%verbose +%error-verbose +/* Grammar follows */ +%% +line: header body + ; + +header: '<' from ARROW to '>' type ':' + | '<' ARROW to '>' type ':' + | ARROW to type ':' + | type ':' + | '<' '>' + ; + +from: DATA + | STRING + | INVALID + ; + +to: DATA + | STRING + | INVALID + ; + +type: DATA + | STRING + | INVALID + ; + +body: /* empty */ + | body member + ; + +member: STRING + | DATA + | '+' NUMBER + | '-' NUMBER + | NUMBER + | INVALID + ; +%% +static void +yyerror (const char *s) +{ + fprintf (stderr, "%s\n", s); +} + +static int +yylex (void) +{ + static int const tokens[] = + { + ':', -1 + }; + static size_t toknum; + + if (! (toknum < sizeof tokens / sizeof *tokens)) + abort (); + return tokens[toknum++]; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o dancer.c dancer.y" +echo regression.at:954 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: bison --xml=xml-tests/test.xml -o dancer.c dancer.y" +echo regression.at:954 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:954 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:954 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:954: bison -o dancer.c dancer.y" +echo regression.at:954 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o dancer.c dancer.y" +echo regression.at:954 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: bison --xml=xml-tests/test.xml -o dancer.c dancer.y" +echo regression.at:954 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:954 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:954 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:954: bison -o dancer.c dancer.y" +echo regression.at:954 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:954: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o dancer dancer.c \$LIBS" +echo regression.at:954 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:954: \$PREPARSER ./dancer" +echo regression.at:954 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./dancer"; then + ( $at_traceon; $PREPARSER ./dancer ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./dancer ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected ':' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:954" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_181 +#AT_START_182 +# 182. regression.at:955: Dancer %glr-parser +at_setup_line='regression.at:955' +at_func_banner 16 +at_desc="Dancer %glr-parser" +$at_quiet $as_echo_n "182: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "182. regression.at:955: testing ..." + $at_traceon + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >dancer.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +static int yylex (void); +#include +#include +static void yyerror (const char *); +%} +%glr-parser +%token ARROW INVALID NUMBER STRING DATA +%defines +%verbose +%error-verbose +/* Grammar follows */ +%% +line: header body + ; + +header: '<' from ARROW to '>' type ':' + | '<' ARROW to '>' type ':' + | ARROW to type ':' + | type ':' + | '<' '>' + ; + +from: DATA + | STRING + | INVALID + ; + +to: DATA + | STRING + | INVALID + ; + +type: DATA + | STRING + | INVALID + ; + +body: /* empty */ + | body member + ; + +member: STRING + | DATA + | '+' NUMBER + | '-' NUMBER + | NUMBER + | INVALID + ; +%% +static void +yyerror (const char *s) +{ + fprintf (stderr, "%s\n", s); +} + +static int +yylex (void) +{ + static int const tokens[] = + { + ':', -1 + }; + static size_t toknum; + + if (! (toknum < sizeof tokens / sizeof *tokens)) + abort (); + return tokens[toknum++]; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o dancer.c dancer.y" +echo regression.at:955 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: bison --xml=xml-tests/test.xml -o dancer.c dancer.y" +echo regression.at:955 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:955 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:955 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:955: bison -o dancer.c dancer.y" +echo regression.at:955 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o dancer.c dancer.y" +echo regression.at:955 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: bison --xml=xml-tests/test.xml -o dancer.c dancer.y" +echo regression.at:955 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:955 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:955 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:955: bison -o dancer.c dancer.y" +echo regression.at:955 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:955: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o dancer dancer.c \$LIBS" +echo regression.at:955 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:955: \$PREPARSER ./dancer" +echo regression.at:955 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./dancer"; then + ( $at_traceon; $PREPARSER ./dancer ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./dancer ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected ':' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:955" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_182 +#AT_START_183 +# 183. regression.at:956: Dancer %skeleton "lalr1.cc" +at_setup_line='regression.at:956' +at_func_banner 16 +at_desc="Dancer %skeleton \"lalr1.cc\"" +$at_quiet $as_echo_n "183: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "183. regression.at:956: testing ..." + $at_traceon + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >dancer.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +static int yylex (int *); + +%} +%skeleton "lalr1.cc" +%token ARROW INVALID NUMBER STRING DATA +%defines +%verbose +%error-verbose +/* Grammar follows */ +%% +line: header body + ; + +header: '<' from ARROW to '>' type ':' + | '<' ARROW to '>' type ':' + | ARROW to type ':' + | type ':' + | '<' '>' + ; + +from: DATA + | STRING + | INVALID + ; + +to: DATA + | STRING + | INVALID + ; + +type: DATA + | STRING + | INVALID + ; + +body: /* empty */ + | body member + ; + +member: STRING + | DATA + | '+' NUMBER + | '-' NUMBER + | NUMBER + | INVALID + ; +%% +/* A C++ error reporting function. */ +void +yy::parser::error (const location&, const std::string& m) +{ + std::cerr << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; +#if YYDEBUG + parser.set_debug_level (YYDEBUG); +#endif + return parser.parse (); +} + + +static int +yylex (int *lval) +{ + static int const tokens[] = + { + ':', -1 + }; + static size_t toknum; + *lval = 0; /* Pacify GCC. */ + if (! (toknum < sizeof tokens / sizeof *tokens)) + abort (); + return tokens[toknum++]; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:956: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o dancer.c dancer.y" +echo regression.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:956: bison --xml=xml-tests/test.xml -o dancer.c dancer.y" +echo regression.at:956 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:956: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:956: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:956: bison -o dancer.c dancer.y" +echo regression.at:956 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o dancer.c dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:956: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o dancer.cc dancer.y" +echo regression.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.cc dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o dancer.cc dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:956: bison --xml=xml-tests/test.xml -o dancer.cc dancer.y" +echo regression.at:956 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o dancer.cc dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o dancer.cc dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:956: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:956: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:956 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:956: bison -o dancer.cc dancer.y" +echo regression.at:956 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o dancer.cc dancer.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o dancer.cc dancer.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:956: \$BISON_CXX_WORKS" +echo regression.at:956 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:956: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o dancer dancer.cc \$LIBS" +echo regression.at:956 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:956: \$PREPARSER ./dancer" +echo regression.at:956 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./dancer"; then + ( $at_traceon; $PREPARSER ./dancer ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./dancer ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected ':' +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:956" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_183 +#AT_START_184 +# 184. regression.at:1054: Expecting two tokens +at_setup_line='regression.at:1054' +at_func_banner 16 +at_desc="Expecting two tokens " +$at_quiet $as_echo_n "184: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "184. regression.at:1054: testing ..." + $at_traceon + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >expect2.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +static int yylex (void); +#include +#include +static void yyerror (const char *); +%} + +%defines +%error-verbose +%token A 1000 +%token B + +%% +program: /* empty */ + | program e ';' + | program error ';'; + +e: e '+' t | t; +t: A | B; + +%% +static void +yyerror (const char *s) +{ + fprintf (stderr, "%s\n", s); +} + +static int +yylex (void) +{ + static int const tokens[] = + { + 1000, '+', '+', -1 + }; + static size_t toknum; + + if (! (toknum < sizeof tokens / sizeof *tokens)) + abort (); + return tokens[toknum++]; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o expect2.c expect2.y" +echo regression.at:1054 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: bison --xml=xml-tests/test.xml -o expect2.c expect2.y" +echo regression.at:1054 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1054 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1054 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: bison -o expect2.c expect2.y" +echo regression.at:1054 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o expect2.c expect2.y" +echo regression.at:1054 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: bison --xml=xml-tests/test.xml -o expect2.c expect2.y" +echo regression.at:1054 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1054 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1054 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: bison -o expect2.c expect2.y" +echo regression.at:1054 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o expect2 expect2.c \$LIBS" +echo regression.at:1054 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1054: \$PREPARSER ./expect2" +echo regression.at:1054 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./expect2"; then + ( $at_traceon; $PREPARSER ./expect2 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./expect2 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected '+', expecting A or B +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:1054" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_184 +#AT_START_185 +# 185. regression.at:1055: Expecting two tokens %glr-parser +at_setup_line='regression.at:1055' +at_func_banner 16 +at_desc="Expecting two tokens %glr-parser" +$at_quiet $as_echo_n "185: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "185. regression.at:1055: testing ..." + $at_traceon + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >expect2.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +static int yylex (void); +#include +#include +static void yyerror (const char *); +%} +%glr-parser +%defines +%error-verbose +%token A 1000 +%token B + +%% +program: /* empty */ + | program e ';' + | program error ';'; + +e: e '+' t | t; +t: A | B; + +%% +static void +yyerror (const char *s) +{ + fprintf (stderr, "%s\n", s); +} + +static int +yylex (void) +{ + static int const tokens[] = + { + 1000, '+', '+', -1 + }; + static size_t toknum; + + if (! (toknum < sizeof tokens / sizeof *tokens)) + abort (); + return tokens[toknum++]; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o expect2.c expect2.y" +echo regression.at:1055 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: bison --xml=xml-tests/test.xml -o expect2.c expect2.y" +echo regression.at:1055 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1055 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1055 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: bison -o expect2.c expect2.y" +echo regression.at:1055 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o expect2.c expect2.y" +echo regression.at:1055 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: bison --xml=xml-tests/test.xml -o expect2.c expect2.y" +echo regression.at:1055 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1055 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1055 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: bison -o expect2.c expect2.y" +echo regression.at:1055 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o expect2 expect2.c \$LIBS" +echo regression.at:1055 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1055: \$PREPARSER ./expect2" +echo regression.at:1055 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./expect2"; then + ( $at_traceon; $PREPARSER ./expect2 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./expect2 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected '+', expecting A or B +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:1055" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_185 +#AT_START_186 +# 186. regression.at:1056: Expecting two tokens %skeleton "lalr1.cc" +at_setup_line='regression.at:1056' +at_func_banner 16 +at_desc="Expecting two tokens %skeleton \"lalr1.cc\"" +$at_quiet $as_echo_n "186: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "186. regression.at:1056: testing ..." + $at_traceon + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + +cat >expect2.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +static int yylex (int *); + +%} +%skeleton "lalr1.cc" +%defines +%error-verbose +%token A 1000 +%token B + +%% +program: /* empty */ + | program e ';' + | program error ';'; + +e: e '+' t | t; +t: A | B; + +%% +/* A C++ error reporting function. */ +void +yy::parser::error (const location&, const std::string& m) +{ + std::cerr << m << std::endl; +} + +int +yyparse () +{ + yy::parser parser; + return parser.parse (); +} + + +static int +yylex (int *lval) +{ + static int const tokens[] = + { + 1000, '+', '+', -1 + }; + static size_t toknum; + *lval = 0; /* Pacify GCC. */ + if (! (toknum < sizeof tokens / sizeof *tokens)) + abort (); + return tokens[toknum++]; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o expect2.c expect2.y" +echo regression.at:1056 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: bison --xml=xml-tests/test.xml -o expect2.c expect2.y" +echo regression.at:1056 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1056 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1056 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: bison -o expect2.c expect2.y" +echo regression.at:1056 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o expect2.c expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o expect2.cc expect2.y" +echo regression.at:1056 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.cc expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o expect2.cc expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: bison --xml=xml-tests/test.xml -o expect2.cc expect2.y" +echo regression.at:1056 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o expect2.cc expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o expect2.cc expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1056 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1056 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: bison -o expect2.cc expect2.y" +echo regression.at:1056 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o expect2.cc expect2.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o expect2.cc expect2.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: \$BISON_CXX_WORKS" +echo regression.at:1056 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o expect2 expect2.cc \$LIBS" +echo regression.at:1056 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1056: \$PREPARSER ./expect2" +echo regression.at:1056 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./expect2"; then + ( $at_traceon; $PREPARSER ./expect2 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./expect2 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected '+', expecting A or B +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/regression.at:1056" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_186 +#AT_START_187 +# 187. regression.at:1064: Braced code in declaration in rules section +at_setup_line='regression.at:1064' +at_func_banner 16 +at_desc="Braced code in declaration in rules section" +$at_quiet $as_echo_n "187: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "187. regression.at:1064: testing ..." + $at_traceon + + +# Bison once mistook braced code in a declaration in the rules section to be a +# rule action. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ +#include +static void yyerror (char const *msg); +static int yylex (void); +%} + +%error-verbose + +%% + +start: + { + printf ("Bison would once convert this action to a midrule because of the" + " subsequent braced code.\n"); + } + ; + +%destructor { fprintf (stderr, "DESTRUCTOR\n"); } 'a'; +%printer { fprintf (yyoutput, "PRINTER"); } 'a'; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + return 'a'; +} + +int +main (void) +{ + yydebug = 1; + return !yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1112: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -t -o input.c input.y" +echo regression.at:1112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -t -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -t -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1112" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1112: bison --xml=xml-tests/test.xml -t -o input.c input.y" +echo regression.at:1112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -t -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -t -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1112" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1112: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1112" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1112: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1112 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1112" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1112: bison -t -o input.c input.y" +echo regression.at:1112 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -t -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -t -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1112" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1113: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo regression.at:1113 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1113" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1114: \$PREPARSER ./input" +echo regression.at:1114 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Starting parse +Entering state 0 +Reducing stack by rule 1 (line 20): +-> \$\$ = nterm start () +Stack now 0 +Entering state 1 +Reading a token: Next token is token 'a' (PRINTER) +syntax error, unexpected 'a', expecting \$end +Error: popping nterm start () +Stack now 0 +Cleanup: discarding lookahead token 'a' (PRINTER) +DESTRUCTOR +Stack now 0 +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Bison would once convert this action to a midrule because of the subsequent braced code. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1114" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_187 +#AT_START_188 +# 188. regression.at:1140: String alias declared after use +at_setup_line='regression.at:1140' +at_func_banner 16 +at_desc="String alias declared after use" +$at_quiet $as_echo_n "188: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "188. regression.at:1140: testing ..." + $at_traceon + + +# Bison once incorrectly asserted that the symbol number for either a token or +# its alias was the highest symbol number so far at the point of the alias +# declaration. That was true unless the declaration appeared after their first +# uses and other tokens appeared in between. + +cat >input.y <<'_ATEOF' +%% +start: 'a' "A" 'b'; +%token 'a' "A"; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1153: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -t -o input.c input.y" +echo regression.at:1153 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -t -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -t -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1153" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1153: bison --xml=xml-tests/test.xml -t -o input.c input.y" +echo regression.at:1153 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -t -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -t -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1153" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1153: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1153 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1153" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1153: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1153 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1153" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1153: bison -t -o input.c input.y" +echo regression.at:1153 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -t -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -t -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1153" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_188 +#AT_START_189 +# 189. regression.at:1163: Extra lookahead sets in report +at_setup_line='regression.at:1163' +at_func_banner 16 +at_desc="Extra lookahead sets in report" +$at_quiet $as_echo_n "189: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "189. regression.at:1163: testing ..." + $at_traceon + + +# Bison prints each reduction's lookahead set only next to the associated +# state's one item that (1) is associated with the same rule as the reduction +# and (2) has its dot at the end of its RHS. Previously, Bison also +# erroneously printed the lookahead set next to all of the state's other items +# associated with the same rule. This bug affected only the `.output' file and +# not the generated parser source code. + +cat >input.y <<'_ATEOF' +%% +start: a | 'a' a 'a' ; +a: 'a' ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1178: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot --report=all input.y" +echo regression.at:1178 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1178" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1178: bison --xml=xml-tests/test.xml --report=all input.y" +echo regression.at:1178 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1178" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1178: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1178 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1178" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1178: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1178 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1178" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1178: bison --report=all input.y" +echo regression.at:1178 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --report=all input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1178" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1179: sed -n '/^state 1\$/,/^state 2\$/p' input.output" +echo regression.at:1179 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "sed -n '/^state 1$/,/^state 2$/p' input.output"; then + ( $at_traceon; sed -n '/^state 1$/,/^state 2$/p' input.output ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n '/^state 1$/,/^state 2$/p' input.output ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "state 1 + + 2 start: 'a' . a 'a' + 3 a: . 'a' + 3 | 'a' . [\$end] + + 'a' shift, and go to state 4 + + \$default reduce using rule 3 (a) + + a go to state 5 + + +state 2 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1179" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_189 +#AT_START_190 +# 190. regression.at:1204: Token number in precedence declaration +at_setup_line='regression.at:1204' +at_func_banner 16 +at_desc="Token number in precedence declaration" +$at_quiet $as_echo_n "190: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "190. regression.at:1204: testing ..." + $at_traceon + + +# POSIX says token numbers can be declared in %left, %right, and %nonassoc, but +# we lost this in Bison 1.50. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%{ + #include + void yyerror (char const *); + int yylex (void); +%} + +%error-verbose +%left TK1 1 TK2 2 "tok alias" 3 + +%% + +start: TK1 sr_conflict "tok alias" ; + +sr_conflict: + TK2 + | TK2 "tok alias" + ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +yylex (void) +{ + static int const input[] = { 1, 2, 3, 0 }; + static int const *inputp = input; + return *inputp++; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1251: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo regression.at:1251 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1251" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1251: bison --xml=xml-tests/test.xml -o input.c input.y" +echo regression.at:1251 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1251" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1251: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1251 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1251" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1251: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1251 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1251" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1251: bison -o input.c input.y" +echo regression.at:1251 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:24.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 \"tok alias\" +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1251" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1254: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo regression.at:1254 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1254" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1255: \$PREPARSER ./input" +echo regression.at:1255 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1255" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_190 +#AT_START_191 +# 191. regression.at:1265: Fix user actions without a trailing semicolon +at_setup_line='regression.at:1265' +at_func_banner 16 +at_desc="Fix user actions without a trailing semicolon" +$at_quiet $as_echo_n "191: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "191. regression.at:1265: testing ..." + $at_traceon + + +# This feature is undocumented, but we accidentally broke it in 2.3a, and there +# was a complaint at: +# . + +cat >input.y <<'_ATEOF' +%% +start: {asdffdsa} ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1276: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo regression.at:1276 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1276" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1276: bison --xml=xml-tests/test.xml -o input.c input.y" +echo regression.at:1276 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1276" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1276: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo regression.at:1276 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1276" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/regression.at:1276: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo regression.at:1276 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1276" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1276: bison -o input.c input.y" +echo regression.at:1276 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1276" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/regression.at:1277: sed -n '/asdffdsa/s/^ *//p' input.c" +echo regression.at:1277 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; sed -n '/asdffdsa/s/^ *//p' input.c ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; sed -n '/asdffdsa/s/^ *//p' input.c ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "{asdffdsa;} +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/regression.at:1277" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_191 +#AT_START_192 +# 192. c++.at:100: Doxygen Public Documentation +at_setup_line='c++.at:100' +at_func_banner 17 +at_desc="Doxygen Public Documentation" +$at_quiet $as_echo_n "192: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "192. c++.at:100: testing ..." + $at_traceon + + +cat >input.yy <<'_ATEOF' +%skeleton "lalr1.cc" +%locations +%debug +%defines +%% +exp:; +%% +yy::parser::error (const location& l, const std::string& m) +{ + std::cerr << l << s << std::endl; +} +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:100: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.yy" +echo c++.at:100 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:100: bison --xml=xml-tests/test.xml -o input.cc input.yy" +echo c++.at:100 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:100: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:100 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:100: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:100 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:100: bison -o input.cc input.yy" +echo c++.at:100 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >Doxyfile <<'_ATEOF' +# The PROJECT_NAME tag is a single word (or a sequence of words +# surrounded by quotes) that should identify the project. +PROJECT_NAME = "Bison C++ Parser" + +# The QUIET tag can be used to turn on/off the messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages +# that are generated by doxygen. Possible values are YES and NO. If +# left blank NO is used. +WARNINGS = YES +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then +# this flag will automatically be disabled. +WARN_IF_UNDOCUMENTED = YES +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings +# for potential errors in the documentation, such as not documenting +# some parameters in a documented function, or documenting parameters +# that don't exist or using markup commands wrongly. +WARN_IF_DOC_ERROR = YES +# The WARN_FORMAT tag determines the format of the warning messages +# that doxygen can produce. The string should contain the $file, +# $line, and $text tags, which will be replaced by the file and line +# number from which the warning originated and the warning text. +WARN_FORMAT = "$file:$line: $text" + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all +# entities in documentation are documented, even if no documentation +# was available. Private class members and static file members will +# be hidden unless the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set +# to YES +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a +# class will be included in the documentation. +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. +EXTRACT_STATIC = NO +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:100: doxygen --version || exit 77" +echo c++.at:100 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; doxygen --version || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; doxygen --version || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:100: doxygen" +echo c++.at:100 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; doxygen ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; doxygen ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_192 +#AT_START_193 +# 193. c++.at:101: Doxygen Private Documentation +at_setup_line='c++.at:101' +at_func_banner 17 +at_desc="Doxygen Private Documentation" +$at_quiet $as_echo_n "193: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "193. c++.at:101: testing ..." + $at_traceon + + +cat >input.yy <<'_ATEOF' +%skeleton "lalr1.cc" +%locations +%debug +%defines +%% +exp:; +%% +yy::parser::error (const location& l, const std::string& m) +{ + std::cerr << l << s << std::endl; +} +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:101: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.yy" +echo c++.at:101 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:101" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:101: bison --xml=xml-tests/test.xml -o input.cc input.yy" +echo c++.at:101 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:101" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:101: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:101 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:101" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:101: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:101 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:101" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:101: bison -o input.cc input.yy" +echo c++.at:101 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.yy ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.yy ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:101" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >Doxyfile <<'_ATEOF' +# The PROJECT_NAME tag is a single word (or a sequence of words +# surrounded by quotes) that should identify the project. +PROJECT_NAME = "Bison C++ Parser" + +# The QUIET tag can be used to turn on/off the messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages +# that are generated by doxygen. Possible values are YES and NO. If +# left blank NO is used. +WARNINGS = YES +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then +# this flag will automatically be disabled. +WARN_IF_UNDOCUMENTED = YES +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings +# for potential errors in the documentation, such as not documenting +# some parameters in a documented function, or documenting parameters +# that don't exist or using markup commands wrongly. +WARN_IF_DOC_ERROR = YES +# The WARN_FORMAT tag determines the format of the warning messages +# that doxygen can produce. The string should contain the $file, +# $line, and $text tags, which will be replaced by the file and line +# number from which the warning originated and the warning text. +WARN_FORMAT = "$file:$line: $text" + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all +# entities in documentation are documented, even if no documentation +# was available. Private class members and static file members will +# be hidden unless the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set +# to YES +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a +# class will be included in the documentation. +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. +EXTRACT_STATIC = YES +_ATEOF + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:101: doxygen --version || exit 77" +echo c++.at:101 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; doxygen --version || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; doxygen --version || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:101" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:101: doxygen" +echo c++.at:101 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; doxygen ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; doxygen ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:101" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_193 +#AT_START_194 +# 194. c++.at:159: Relative namespace references +at_setup_line='c++.at:159' +at_func_banner 17 +at_desc="Relative namespace references" +$at_quiet $as_echo_n "194: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "194. c++.at:159: testing ..." + $at_traceon + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "foo" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +foo::parser::error (const foo::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + foo::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:160: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:160 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:160: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:160 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:160: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:160 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:160: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:160 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:160: bison -o input.cc input.y" +echo c++.at:160 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:160: \$BISON_CXX_WORKS" +echo c++.at:160 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:160: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:160 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:160: \$PREPARSER ./input" +echo c++.at:160 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:160" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "foo::bar" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +foo::bar::parser::error (const foo::bar::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + foo::bar::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:161: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:161 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:161: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:161 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:161: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:161 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:161: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:161 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:161: bison -o input.cc input.y" +echo c++.at:161 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:161: \$BISON_CXX_WORKS" +echo c++.at:161 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:161: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:161 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:161: \$PREPARSER ./input" +echo c++.at:161 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:161" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "foo::bar::baz" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +foo::bar::baz::parser::error (const foo::bar::baz::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + foo::bar::baz::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:162: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:162: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:162 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:162: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:162: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:162 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:162: bison -o input.cc input.y" +echo c++.at:162 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:162: \$BISON_CXX_WORKS" +echo c++.at:162 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:162: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:162 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:162: \$PREPARSER ./input" +echo c++.at:162 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:162" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_194 +#AT_START_195 +# 195. c++.at:165: Absolute namespace references +at_setup_line='c++.at:165' +at_func_banner 17 +at_desc="Absolute namespace references" +$at_quiet $as_echo_n "195: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "195. c++.at:165: testing ..." + $at_traceon + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "::foo" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +::foo::parser::error (const ::foo::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + ::foo::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:166: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:166 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:166" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:166: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:166 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:166" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:166: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:166 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:166" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:166: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:166 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:166" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:166: bison -o input.cc input.y" +echo c++.at:166 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:166" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:166: \$BISON_CXX_WORKS" +echo c++.at:166 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:166" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:166: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:166 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:166" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:166: \$PREPARSER ./input" +echo c++.at:166 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:166" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "::foo::bar" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +::foo::bar::parser::error (const ::foo::bar::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + ::foo::bar::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:167: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:167 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:167: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:167 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:167: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:167 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:167: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:167 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:167: bison -o input.cc input.y" +echo c++.at:167 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:167: \$BISON_CXX_WORKS" +echo c++.at:167 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:167: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:167 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:167: \$PREPARSER ./input" +echo c++.at:167 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:167" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "::foo::bar::baz" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +::foo::bar::baz::parser::error (const ::foo::bar::baz::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + ::foo::bar::baz::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:168: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:168 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:168" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:168: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:168 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:168" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:168: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:168 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:168" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:168: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:168 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:168" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:168: bison -o input.cc input.y" +echo c++.at:168 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:168" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:168: \$BISON_CXX_WORKS" +echo c++.at:168 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:168" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:168: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:168 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:168" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:168: \$PREPARSER ./input" +echo c++.at:168 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:168" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace " ::foo" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void + ::foo::parser::error (const ::foo::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + ::foo::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:169: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:169 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:169" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:169: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:169 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:169" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:169: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:169 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:169" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:169: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:169 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:169" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:169: bison -o input.cc input.y" +echo c++.at:169 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:169" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:169: \$BISON_CXX_WORKS" +echo c++.at:169 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:169" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:169: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:169 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:169" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:169: \$PREPARSER ./input" +echo c++.at:169 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:169" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace " ::foo::bar" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void + ::foo::bar::parser::error (const ::foo::bar::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + ::foo::bar::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:170: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:170 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:170" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:170: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:170 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:170" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:170: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:170 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:170" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:170: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:170 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:170" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:170: bison -o input.cc input.y" +echo c++.at:170 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:170" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:170: \$BISON_CXX_WORKS" +echo c++.at:170 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:170" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:170: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:170 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:170" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:170: \$PREPARSER ./input" +echo c++.at:170 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:170" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace " ::foo::bar::baz" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void + ::foo::bar::baz::parser::error (const ::foo::bar::baz::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + ::foo::bar::baz::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:171: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:171 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:171" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:171: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:171 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:171" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:171: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:171 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:171" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:171: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:171 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:171" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:171: bison -o input.cc input.y" +echo c++.at:171 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:171" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:171: \$BISON_CXX_WORKS" +echo c++.at:171 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$BISON_CXX_WORKS"; then + ( $at_traceon; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $BISON_CXX_WORKS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:171" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:171: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS -o input input.cc \$LIBS" +echo c++.at:171 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS"; then + ( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:171" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:171: \$PREPARSER ./input" +echo c++.at:171 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:171" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_195 +#AT_START_196 +# 196. c++.at:174: Syntactically invalid namespace references +at_setup_line='c++.at:174' +at_func_banner 17 +at_desc="Syntactically invalid namespace references" +$at_quiet $as_echo_n "196: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "196. c++.at:174: testing ..." + $at_traceon + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace ":foo:bar" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +:foo:bar::parser::error (const :foo:bar::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + :foo:bar::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:175: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:175 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:175" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:175: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:175 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:175" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:175: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:175 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:175" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:175: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:175 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:175" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:175: bison -o input.cc input.y" +echo c++.at:175 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:175" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "foo: :bar" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +foo: :bar::parser::error (const foo: :bar::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + foo: :bar::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:176: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:176 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:176" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:176: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:176 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:176" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:176: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:176 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:176" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:176: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:176 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:176" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:176: bison -o input.cc input.y" +echo c++.at:176 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:176" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + +# This one is interesting because `[3]' is encoded as `[3]', which +# contains single occurrences of `:'. + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "foo[3]::bar::baz" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +foo[3]::bar::baz::parser::error (const foo[3]::bar::baz::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + foo[3]::bar::baz::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:179: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:179 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:179" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:179: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:179 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:179" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:179: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:179 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:179" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:179: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:179 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:179" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:179: bison -o input.cc input.y" +echo c++.at:179 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:179" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "foo::bar,baz" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +foo::bar,baz::parser::error (const foo::bar,baz::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + foo::bar,baz::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:180: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:180 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:180" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:180: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:180 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:180" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:180: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:180 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:180" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:180: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:180 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:180" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:180: bison -o input.cc input.y" +echo c++.at:180 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:180" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%language "C++" +%defines +%define namespace "foo::bar::(baz" +%union { int i; } +%define global_tokens_and_yystype + +%code { + // YYSTYPE contains a namespace reference. + int yylex (YYSTYPE *lval) { + lval->i = 3; + return 0; + } +} + +%% + +start: ; + +%% + +void +foo::bar::(baz::parser::error (const foo::bar::(baz::parser::location_type &loc, + const std::string &msg) +{ + std::cerr << "At " << loc << ": " << msg << std::endl; +} + +int +main (void) +{ + foo::bar::(baz::parser p; + return p.parse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/c++.at:181: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.cc input.y" +echo c++.at:181 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:181" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/c++.at:181: bison --xml=xml-tests/test.xml -o input.cc input.y" +echo c++.at:181 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/c++.at:181" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:181: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo c++.at:181 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:181" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/c++.at:181: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo c++.at:181 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:181" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/c++.at:181: bison -o input.cc input.y" +echo c++.at:181 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.cc input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/c++.at:181" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_196 +#AT_START_197 +# 197. java.at:385: Calculator +at_setup_line='java.at:385' +at_func_banner 18 +at_desc="Calculator " +$at_quiet $as_echo_n "197: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "197. java.at:385: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >Calc.y <<'_ATEOF' +/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + + +%code { + + public static void main (String args[]) throws IOException + { + CalcLexer l = new CalcLexer (System.in); + Calc p = new Calc (l); + p.parse (); + } + +} + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + + +%% +class CalcLexer implements Calc.Lexer { + + StreamTokenizer st; + + public CalcLexer (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + + + public void yyerror (String s) + { + System.err.println (s); + } + + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + + +} + + +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +_ATEOF + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison --xml=xml-tests/test.xml -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javacomp.sh Calc.java" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh Calc.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected $undefined +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '=' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +2: syntax error, unexpected '+' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < /dev/null" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < /dev/null"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected end of input +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_197 +#AT_START_198 +# 198. java.at:385: Calculator %error-verbose +at_setup_line='java.at:385' +at_func_banner 18 +at_desc="Calculator %error-verbose " +$at_quiet $as_echo_n "198: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "198. java.at:385: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >Calc.y <<'_ATEOF' +/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + +%error-verbose +%code { + + public static void main (String args[]) throws IOException + { + CalcLexer l = new CalcLexer (System.in); + Calc p = new Calc (l); + p.parse (); + } + +} + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + + +%% +class CalcLexer implements Calc.Lexer { + + StreamTokenizer st; + + public CalcLexer (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + + + public void yyerror (String s) + { + System.err.println (s); + } + + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + + +} + + +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +_ATEOF + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison --xml=xml-tests/test.xml -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javacomp.sh Calc.java" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh Calc.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected $undefined +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '=' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +2: syntax error, unexpected '+' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < /dev/null" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < /dev/null"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected end of input +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_198 +#AT_START_199 +# 199. java.at:385: Calculator %locations +at_setup_line='java.at:385' +at_func_banner 18 +at_desc="Calculator %locations " +$at_quiet $as_echo_n "199: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "199. java.at:385: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >Calc.y <<'_ATEOF' +/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + +%locations +%code { + + public static void main (String args[]) throws IOException + { + CalcLexer l = new CalcLexer (System.in); + Calc p = new Calc (l); + p.parse (); + } + +} + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + + +%% +class CalcLexer implements Calc.Lexer { + + StreamTokenizer st; + + public CalcLexer (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + + + Position yystartpos; + Position yyendpos = new Position (1); + + public Position getStartPos() { + return yystartpos; + } + + public Position getEndPos() { + return yyendpos; + } + + public void yyerror (Calc.Location l, String s) + { + if (l == null) + System.err.println (s); + else + System.err.println (l.begin + ": " + s); + } + + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + yystartpos = yyendpos; + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + yyendpos = new Position (yyendpos.lineno () + 1); + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + + +} + + +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +_ATEOF + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison --xml=xml-tests/test.xml -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javacomp.sh Calc.java" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh Calc.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected $undefined +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '=' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +2: syntax error, unexpected '+' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < /dev/null" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < /dev/null"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected end of input +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_199 +#AT_START_200 +# 200. java.at:385: Calculator %error-verbose %locations +at_setup_line='java.at:385' +at_func_banner 18 +at_desc="Calculator %error-verbose %locations " +$at_quiet $as_echo_n "200: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "200. java.at:385: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >Calc.y <<'_ATEOF' +/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + +%error-verbose %locations +%code { + + public static void main (String args[]) throws IOException + { + CalcLexer l = new CalcLexer (System.in); + Calc p = new Calc (l); + p.parse (); + } + +} + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + + +%% +class CalcLexer implements Calc.Lexer { + + StreamTokenizer st; + + public CalcLexer (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + + + Position yystartpos; + Position yyendpos = new Position (1); + + public Position getStartPos() { + return yystartpos; + } + + public Position getEndPos() { + return yyendpos; + } + + public void yyerror (Calc.Location l, String s) + { + if (l == null) + System.err.println (s); + else + System.err.println (l.begin + ": " + s); + } + + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + yystartpos = yyendpos; + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + yyendpos = new Position (yyendpos.lineno () + 1); + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + + +} + + +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +_ATEOF + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison --xml=xml-tests/test.xml -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: bison -o Calc.java Calc.y" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:385 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javacomp.sh Calc.java" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh Calc.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected $undefined +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '=' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +2: syntax error, unexpected '+' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < /dev/null" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < /dev/null"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected end of input +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:385: cat stderr" +echo java.at:385 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:385" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_200 +#AT_START_201 +# 201. java.at:394: Calculator %lex-param { InputStream is } +at_setup_line='java.at:394' +at_func_banner 18 +at_desc="Calculator %lex-param { InputStream is } " +$at_quiet $as_echo_n "201: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "201. java.at:394: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >Calc.y <<'_ATEOF' +/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + +%lex-param { InputStream is } +%code { + + public static void main (String args[]) throws IOException + { + new Calc (System.in).parse (); + } + +} + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + + +%code lexer { + + StreamTokenizer st; + + public YYLexer (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + + + public void yyerror (String s) + { + System.err.println (s); + } + + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + + +}; +%% + + +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +_ATEOF + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison --xml=xml-tests/test.xml -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javacomp.sh Calc.java" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh Calc.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected $undefined +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '=' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +2: syntax error, unexpected '+' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < /dev/null" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < /dev/null"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected end of input +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_201 +#AT_START_202 +# 202. java.at:394: Calculator %error-verbose %lex-param { InputStream is } +at_setup_line='java.at:394' +at_func_banner 18 +at_desc="Calculator %error-verbose %lex-param { InputStream is } " +$at_quiet $as_echo_n "202: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "202. java.at:394: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >Calc.y <<'_ATEOF' +/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + +%error-verbose %lex-param { InputStream is } +%code { + + public static void main (String args[]) throws IOException + { + new Calc (System.in).parse (); + } + +} + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + + +%code lexer { + + StreamTokenizer st; + + public YYLexer (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + + + public void yyerror (String s) + { + System.err.println (s); + } + + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + + +}; +%% + + +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +_ATEOF + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison --xml=xml-tests/test.xml -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javacomp.sh Calc.java" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh Calc.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected $undefined +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '=' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +2: syntax error, unexpected '+' +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < /dev/null" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < /dev/null"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected end of input +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. +sed 's/^[-0-9.]*: //' expout >at-expout +mv at-expout expout +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_202 +#AT_START_203 +# 203. java.at:394: Calculator %locations %lex-param { InputStream is } +at_setup_line='java.at:394' +at_func_banner 18 +at_desc="Calculator %locations %lex-param { InputStream is } " +$at_quiet $as_echo_n "203: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "203. java.at:394: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >Calc.y <<'_ATEOF' +/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + +%locations %lex-param { InputStream is } +%code { + + public static void main (String args[]) throws IOException + { + new Calc (System.in).parse (); + } + +} + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + + +%code lexer { + + StreamTokenizer st; + + public YYLexer (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + + + Position yystartpos; + Position yyendpos = new Position (1); + + public Position getStartPos() { + return yystartpos; + } + + public Position getEndPos() { + return yyendpos; + } + + public void yyerror (Calc.Location l, String s) + { + if (l == null) + System.err.println (s); + else + System.err.println (l.begin + ": " + s); + } + + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + yystartpos = yyendpos; + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + yyendpos = new Position (yyendpos.lineno () + 1); + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + + +}; +%% + + +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +_ATEOF + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison --xml=xml-tests/test.xml -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javacomp.sh Calc.java" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh Calc.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected $undefined +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '=' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +2: syntax error, unexpected '+' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < /dev/null" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < /dev/null"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected end of input +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. +sed 's/syntax error, .*$/syntax error/' expout >at-expout +mv at-expout expout +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_203 +#AT_START_204 +# 204. java.at:394: Calculator %error-verbose %locations %lex-param { InputStream is } +at_setup_line='java.at:394' +at_func_banner 18 +at_desc="Calculator %error-verbose %locations %lex-param { InputStream is } " +$at_quiet $as_echo_n "204: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "204. java.at:394: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >Calc.y <<'_ATEOF' +/* Infix notation calculator--calc */ +%language "Java" +%name-prefix "Calc" +%define parser_class_name "Calc" +%define public + +%error-verbose %locations %lex-param { InputStream is } +%code { + + public static void main (String args[]) throws IOException + { + new Calc (System.in).parse (); + } + +} + +%code imports { + import java.io.StreamTokenizer; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.Reader; + import java.io.IOException; +} + +/* Bison Declarations */ +%token NUM "number" +%type exp + +%nonassoc '=' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\n' +| exp '\n' +| error '\n' +; + +exp: + NUM { $$ = $1; } +| exp '=' exp + { + if ($1.intValue () != $3.intValue ()) + yyerror ("calc: error: " + $1 + " != " + $3); + } +| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); } +| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); } +| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); } +| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); } +| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); } +| exp '^' exp { $$ = new Integer ((int) + Math.pow ($1.intValue (), + $3.intValue ())); } +| '(' exp ')' { $$ = $2; } +| '(' error ')' { $$ = new Integer (1111); } +| '!' { $$ = new Integer (0); return YYERROR; } +| '-' error { $$ = new Integer (0); return YYERROR; } +; + + +%code lexer { + + StreamTokenizer st; + + public YYLexer (InputStream is) + { + st = new StreamTokenizer (new InputStreamReader (is)); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars (9, 9); + st.whitespaceChars (32, 32); + st.wordChars (48, 57); + } + + + Position yystartpos; + Position yyendpos = new Position (1); + + public Position getStartPos() { + return yystartpos; + } + + public Position getEndPos() { + return yyendpos; + } + + public void yyerror (Calc.Location l, String s) + { + if (l == null) + System.err.println (s); + else + System.err.println (l.begin + ": " + s); + } + + + Integer yylval; + + public Object getLVal() { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + yystartpos = yyendpos; + if (ttype == st.TT_EOF) + return Calc.EOF; + + else if (ttype == st.TT_EOL) + { + yyendpos = new Position (yyendpos.lineno () + 1); + return (int) '\n'; + } + + else if (ttype == st.TT_WORD) + { + yylval = new Integer (st.sval); + return Calc.NUM; + } + + else + return st.ttype; + } + + + +}; +%% + + +class Position { + public int line; + + public Position () + { + line = 0; + } + + public Position (int l) + { + line = l; + } + + public long getHashCode () + { + return line; + } + + public boolean equals (Position l) + { + return l.line == line; + } + + public String toString () + { + return Integer.toString (line); + } + + public int lineno () + { + return line; + } +} + +_ATEOF + + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison --xml=xml-tests/test.xml -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: bison -o Calc.java Calc.y" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o Calc.java Calc.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:394 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javacomp.sh Calc.java" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh Calc.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh Calc.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Test the priorities. +cat >input <<'_ATEOF' +1 + 2 * 3 = 7 +1 + 2 * -3 = -5 + +-1^2 = -1 +(-1)^2 = 1 + +---1 = -1 + +1 - 2 - 3 = -4 +1 - (2 - 3) = 2 + +2^2^3 = 256 +(2^2)^3 = 64 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Some syntax errors. +cat >input <<'_ATEOF' +0 0 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1//2 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '/', expecting number or '-' or '(' or '!' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +error +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected $undefined +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +1 = 2 = 3 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '=' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' + ++1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +2: syntax error, unexpected '+' +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Exercise error messages with EOF: work on an empty file. +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < /dev/null" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < /dev/null"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < /dev/null ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected end of input +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# Exercise the error token: without it, we die at the first error, +# hence be sure to +# +# - have several errors which exercise different shift/discardings +# - (): nothing to pop, nothing to discard +# - (1 + 1 + 1 +): a lot to pop, nothing to discard +# - (* * *): nothing to pop, a lot to discard +# - (1 + 2 * *): some to pop and discard +# +# - test the action associated to `error' +# +# - check the lookahead that triggers an error is not discarded +# when we enter error recovery. Below, the lookahead causing the +# first error is ")", which is needed to recover from the error and +# produce the "0" that triggers the "0 != 1" error. +# +cat >input <<'_ATEOF' +() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected ')', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +calc: error: 4444 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +# The same, but this time exercising explicitly triggered syntax errors. +# POSIX says the lookahead causing the error should not be discarded. +cat >input <<'_ATEOF' +(!) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +cat >input <<'_ATEOF' +(- *) + (0 0) = 1 +_ATEOF + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: \$SHELL ../../../javaexec.sh Calc < input" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $SHELL ../../../javaexec.sh Calc < input"; then + ( $at_traceon; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javaexec.sh Calc < input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; tee stderr <"$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + +# Normalize the observed and expected error messages, depending upon the +# options. +# 1. Create the reference error message. +cat >expout <<'_ATEOF' +1: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1: syntax error, unexpected number +calc: error: 2222 != 1 +_ATEOF + +# 2. If locations are not used, remove them. + +# 3. If error-verbose is not used, strip the`, unexpected....' part. + +# 4. Check +{ $at_traceoff +$as_echo "$at_srcdir/java.at:394: cat stderr" +echo java.at:394 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; cat stderr ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; cat stderr ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:394" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_204 +#AT_START_205 +# 205. java.at:480: Java parser class and package names +at_setup_line='java.at:480' +at_func_banner 19 +at_desc="Java parser class and package names" +$at_quiet $as_echo_n "205: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "205. java.at:480: testing ..." + $at_traceon + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:482: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:482 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:482: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:482 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:482: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:482 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:482: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:482 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:482: bison YYParser.y" +echo java.at:482 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:482: grep -q '[mb]4_' YYParser.y" +echo java.at:482 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:482: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:482 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:482: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:482 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:482" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:483: grep -c '^class YYParser\$' YYParser.java" +echo java.at:483 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:483" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%name-prefix "Prefix" +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:485: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:485 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:485: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:485 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:485: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:485 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:485: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:485 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:485: bison YYParser.y" +echo java.at:485 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:485: grep -q '[mb]4_' YYParser.y" +echo java.at:485 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:485: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:485 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:485: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:485 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:485" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:486: grep -c '^class PrefixParser\$' YYParser.java" +echo java.at:486 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^class PrefixParser$' YYParser.java"; then + ( $at_traceon; grep -c '^class PrefixParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^class PrefixParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:486" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%define parser_class_name "ParserClassName" +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:488: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:488 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:488: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:488 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:488: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:488 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:488: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:488 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:488: bison YYParser.y" +echo java.at:488 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:488: grep -q '[mb]4_' YYParser.y" +echo java.at:488 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:488: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:488 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:488: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:488 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:488" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:489: grep -c '^class ParserClassName\$' YYParser.java" +echo java.at:489 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^class ParserClassName$' YYParser.java"; then + ( $at_traceon; grep -c '^class ParserClassName$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^class ParserClassName$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:489" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%define package "user_java_package" +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:491: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:491 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:491" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:491: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:491 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:491" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:491: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:491 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:491" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:491: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:491 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:491" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:491: bison YYParser.y" +echo java.at:491 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:491" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:491: grep -q '[mb]4_' YYParser.y" +echo java.at:491 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:491" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:491: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:491 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:491" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:491: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:491 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:491" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:492: grep -c '^package user_java_package;\$' YYParser.java" +echo java.at:492 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^package user_java_package;$' YYParser.java"; then + ( $at_traceon; grep -c '^package user_java_package;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^package user_java_package;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:492" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_205 +#AT_START_206 +# 206. java.at:501: Java parser class modifiers +at_setup_line='java.at:501' +at_func_banner 19 +at_desc="Java parser class modifiers" +$at_quiet $as_echo_n "206: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "206. java.at:501: testing ..." + $at_traceon + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%define abstract +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:503: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:503 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:503: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:503 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:503: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:503 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:503: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:503 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:503: bison YYParser.y" +echo java.at:503 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:503: grep -q '[mb]4_' YYParser.y" +echo java.at:503 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:503: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:503 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:503: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:503 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:503" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:504: grep -c '^abstract class YYParser\$' YYParser.java" +echo java.at:504 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^abstract class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^abstract class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^abstract class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:504" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%define final +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:506: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:506 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:506" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:506: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:506 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:506" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:506: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:506 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:506" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:506: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:506 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:506" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:506: bison YYParser.y" +echo java.at:506 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:506" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:506: grep -q '[mb]4_' YYParser.y" +echo java.at:506 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:506" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:506: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:506 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:506" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:506: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:506 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:506" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:507: grep -c '^final class YYParser\$' YYParser.java" +echo java.at:507 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^final class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^final class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^final class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:507" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%define strictfp +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:509: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:509 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:509" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:509: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:509 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:509" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:509: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:509 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:509" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:509: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:509 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:509" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:509: bison YYParser.y" +echo java.at:509 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:509" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:509: grep -q '[mb]4_' YYParser.y" +echo java.at:509 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:509" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:509: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:509 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:509" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:509: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:509 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:509" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:510: grep -c '^strictfp class YYParser\$' YYParser.java" +echo java.at:510 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^strictfp class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:510" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define abstract +%define strictfp +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:512: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:512 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:512" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:512: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:512 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:512" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:512: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:512 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:512" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:512: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:512 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:512" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:512: bison YYParser.y" +echo java.at:512 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:512" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:512: grep -q '[mb]4_' YYParser.y" +echo java.at:512 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:512" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:512: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:512 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:512" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:512: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:512 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:512" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:515: grep -c '^abstract strictfp class YYParser\$' YYParser.java" +echo java.at:515 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^abstract strictfp class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^abstract strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^abstract strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:515" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define final +%define strictfp +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:517: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:517 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:517: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:517 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:517: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:517 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:517: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:517 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:517: bison YYParser.y" +echo java.at:517 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:517: grep -q '[mb]4_' YYParser.y" +echo java.at:517 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:517: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:517 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:517: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:517 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:517" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:520: grep -c '^final strictfp class YYParser\$' YYParser.java" +echo java.at:520 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^final strictfp class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^final strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^final strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:520" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%define public +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:522: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:522 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:522" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:522: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:522 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:522" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:522: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:522 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:522" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:522: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:522 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:522" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:522: bison YYParser.y" +echo java.at:522 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:522" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:522: grep -q '[mb]4_' YYParser.y" +echo java.at:522 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:522" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:522: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:522 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:522" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:522: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:522 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:522" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:523: grep -c '^public class YYParser\$' YYParser.java" +echo java.at:523 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^public class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^public class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^public class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:523" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define public +%define abstract +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:525: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:525 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:525" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:525: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:525 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:525" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:525: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:525 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:525" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:525: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:525 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:525" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:525: bison YYParser.y" +echo java.at:525 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:525" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:525: grep -q '[mb]4_' YYParser.y" +echo java.at:525 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:525" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:525: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:525 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:525" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:525: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:525 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:525" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:528: grep -c '^public abstract class YYParser\$' YYParser.java" +echo java.at:528 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^public abstract class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^public abstract class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^public abstract class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:528" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define public +%define final +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:530: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:530 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:530" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:530: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:530 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:530" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:530: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:530 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:530" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:530: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:530 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:530" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:530: bison YYParser.y" +echo java.at:530 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:530" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:530: grep -q '[mb]4_' YYParser.y" +echo java.at:530 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:530" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:530: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:530 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:530" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:530: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:530 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:530" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:533: grep -c '^public final class YYParser\$' YYParser.java" +echo java.at:533 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^public final class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^public final class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^public final class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:533" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define public +%define strictfp +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:535: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:535 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:535" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:535: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:535 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:535" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:535: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:535 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:535" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:535: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:535 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:535" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:535: bison YYParser.y" +echo java.at:535 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:535" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:535: grep -q '[mb]4_' YYParser.y" +echo java.at:535 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:535" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:535: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:535 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:535" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:535: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:535 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:535" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:538: grep -c '^public strictfp class YYParser\$' YYParser.java" +echo java.at:538 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^public strictfp class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^public strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^public strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:538" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define public +%define abstract +%define strictfp +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:540: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:540 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:540: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:540 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:540: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:540 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:540: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:540 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:540: bison YYParser.y" +echo java.at:540 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:540: grep -q '[mb]4_' YYParser.y" +echo java.at:540 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:540: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:540 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:540: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:540 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:540" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:544: grep -c '^public abstract strictfp class YYParser\$' YYParser.java" +echo java.at:544 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^public abstract strictfp class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^public abstract strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^public abstract strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:544" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define public +%define final +%define strictfp +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:546: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:546 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:546" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:546: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:546 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:546" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:546: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:546 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:546" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:546: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:546 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:546" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:546: bison YYParser.y" +echo java.at:546 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:546" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:546: grep -q '[mb]4_' YYParser.y" +echo java.at:546 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:546" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:546: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:546 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:546" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:546: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:546 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:546" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:550: grep -c '^public final strictfp class YYParser\$' YYParser.java" +echo java.at:550 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^public final strictfp class YYParser$' YYParser.java"; then + ( $at_traceon; grep -c '^public final strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^public final strictfp class YYParser$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:550" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_206 +#AT_START_207 +# 207. java.at:559: Java parser class extends and implements +at_setup_line='java.at:559' +at_func_banner 19 +at_desc="Java parser class extends and implements" +$at_quiet $as_echo_n "207: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "207. java.at:559: testing ..." + $at_traceon + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%define extends "Thread" +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:561: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:561 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:561" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:561: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:561 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:561" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:561: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:561 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:561" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:561: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:561 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:561" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:561: bison YYParser.y" +echo java.at:561 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:561" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:561: grep -q '[mb]4_' YYParser.y" +echo java.at:561 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:561" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:561: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:561 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:561" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:561: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:561 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:561" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:562: grep -c '^class YYParser extends Thread\$' YYParser.java" +echo java.at:562 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^class YYParser extends Thread$' YYParser.java"; then + ( $at_traceon; grep -c '^class YYParser extends Thread$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^class YYParser extends Thread$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:562" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%define implements "Cloneable" +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:564: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:564 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:564" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:564: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:564 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:564" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:564: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:564 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:564" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:564: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:564 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:564" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:564: bison YYParser.y" +echo java.at:564 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:564" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:564: grep -q '[mb]4_' YYParser.y" +echo java.at:564 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:564" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:564: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:564 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:564" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:564: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:564 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:564" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:565: grep -c '^class YYParser implements Cloneable\$' YYParser.java" +echo java.at:565 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^class YYParser implements Cloneable$' YYParser.java"; then + ( $at_traceon; grep -c '^class YYParser implements Cloneable$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^class YYParser implements Cloneable$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:565" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define extends "Thread" +%define implements "Cloneable" +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:567: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:567 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:567" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:567: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:567 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:567" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:567: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:567 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:567" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:567: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:567 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:567" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:567: bison YYParser.y" +echo java.at:567 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:567" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:567: grep -q '[mb]4_' YYParser.y" +echo java.at:567 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:567" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:567: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:567 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:567" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:567: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:567 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:567" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:570: grep -c '^class YYParser extends Thread implements Cloneable\$' YYParser.java" +echo java.at:570 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^class YYParser extends Thread implements Cloneable$' YYParser.java"; then + ( $at_traceon; grep -c '^class YYParser extends Thread implements Cloneable$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^class YYParser extends Thread implements Cloneable$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:570" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_207 +#AT_START_208 +# 208. java.at:579: Java %parse-param and %lex-param +at_setup_line='java.at:579' +at_func_banner 19 +at_desc="Java %parse-param and %lex-param" +$at_quiet $as_echo_n "208: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "208. java.at:579: testing ..." + $at_traceon + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:581: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:581 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:581: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:581 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:581: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:581 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:581: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:581 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:581: bison YYParser.y" +echo java.at:581 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:581: grep -q '[mb]4_' YYParser.y" +echo java.at:581 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:581: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:581 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:581: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:581 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:581" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:582: grep -c '^ *public YYParser (Lexer yylexer) {\$' YYParser.java" +echo java.at:582 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser (Lexer yylexer) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser (Lexer yylexer) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser (Lexer yylexer) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:582" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%parse-param {int parse_param1} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:584: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:584 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:584: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:584: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:584 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:584: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:584 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:584: bison YYParser.y" +echo java.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:584: grep -q '[mb]4_' YYParser.y" +echo java.at:584 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:584: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:584 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:584: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:584 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:584" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:585: grep -c '^ *protected final int parse_param1;\$' YYParser.java" +echo java.at:585 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected final int parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:585" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:586: grep -c '^ *public YYParser (Lexer yylexer, *int parse_param1) {\$' YYParser.java" +echo java.at:586 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser (Lexer yylexer, *int parse_param1) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser (Lexer yylexer, *int parse_param1) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser (Lexer yylexer, *int parse_param1) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:586" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:587: grep -c '^[ ]*this.parse_param1 = parse_param1;\$' YYParser.java" +echo java.at:587 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:587" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%parse-param {int parse_param1} +%parse-param {long parse_param2} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:589: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:589 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:589" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:589: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:589 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:589" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:589: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:589 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:589" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:589: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:589 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:589" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:589: bison YYParser.y" +echo java.at:589 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:589" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:589: grep -q '[mb]4_' YYParser.y" +echo java.at:589 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:589" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:589: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:589 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:589" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:589: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:589 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:589" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:592: grep -c '^ *protected final int parse_param1;\$' YYParser.java" +echo java.at:592 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected final int parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:592" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:593: grep -c '^ *protected final long parse_param2;\$' YYParser.java" +echo java.at:593 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected final long parse_param2;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:593" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:594: grep -c '^ *public YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {\$' YYParser.java" +echo java.at:594 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:594" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:595: grep -c '^[ ]*this.parse_param1 = parse_param1;\$' YYParser.java" +echo java.at:595 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:595" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:596: grep -c '^[ ]*this.parse_param2 = parse_param2;\$' YYParser.java" +echo java.at:596 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java"; then + ( $at_traceon; grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:596" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:598: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:598 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:598" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:598: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:598 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:598" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:598: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:598 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:598" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:598: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:598 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:598" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:598: bison YYParser.y" +echo java.at:598 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:598" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:598: grep -q '[mb]4_' YYParser.y" +echo java.at:598 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:598" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:598: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:598 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:598" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:598: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:598 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:598" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:599: grep -c '^ *public YYParser () {\$' YYParser.java" +echo java.at:599 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser () {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser () {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser () {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:599" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:600: grep -c '^ *protected YYParser (Lexer yylexer) {\$' YYParser.java" +echo java.at:600 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected YYParser (Lexer yylexer) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected YYParser (Lexer yylexer) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected YYParser (Lexer yylexer) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:600" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%parse-param {int parse_param1} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:602: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:602 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:602" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:602: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:602 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:602" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:602: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:602 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:602" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:602: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:602 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:602" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:602: bison YYParser.y" +echo java.at:602 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:602" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:602: grep -q '[mb]4_' YYParser.y" +echo java.at:602 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:602" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:602: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:602 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:602" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:602: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:602 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:602" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:604: grep -c '^ *protected final int parse_param1;\$' YYParser.java" +echo java.at:604 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected final int parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:604" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:605: grep -c '^ *public YYParser (int parse_param1) {\$' YYParser.java" +echo java.at:605 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser (int parse_param1) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser (int parse_param1) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser (int parse_param1) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:605" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:606: grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1) {\$' YYParser.java" +echo java.at:606 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:606" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:607: grep -c '^[ ]*this.parse_param1 = parse_param1;\$' YYParser.java" +echo java.at:607 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "2 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:607" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%parse-param {int parse_param1} +%parse-param {long parse_param2} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:609: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:609 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:609: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:609: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:609 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:609: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:609 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:609: bison YYParser.y" +echo java.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:609: grep -q '[mb]4_' YYParser.y" +echo java.at:609 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:609: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:609 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:609: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:609 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:609" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:613: grep -c '^ *protected final int parse_param1;\$' YYParser.java" +echo java.at:613 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected final int parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:613" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:614: grep -c '^ *protected final long parse_param2;\$' YYParser.java" +echo java.at:614 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected final long parse_param2;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:614" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:615: grep -c '^ *public YYParser (int parse_param1, *long parse_param2) {\$' YYParser.java" +echo java.at:615 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser (int parse_param1, *long parse_param2) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser (int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser (int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:615" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:616: grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {\$' YYParser.java" +echo java.at:616 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:616" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:617: grep -c '^[ ]*this.parse_param1 = parse_param1;\$' YYParser.java" +echo java.at:617 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "2 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:617" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:618: grep -c '^[ ]*this.parse_param2 = parse_param2;\$' YYParser.java" +echo java.at:618 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java"; then + ( $at_traceon; grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "2 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:618" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table +%lex-param {char lex_param1} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + YYLexer (char lex_param1) {} +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:620: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:620 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:620" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:620: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:620 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:620" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:620: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:620 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:620" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:620: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:620 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:620" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:620: bison YYParser.y" +echo java.at:620 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:620" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:620: grep -q '[mb]4_' YYParser.y" +echo java.at:620 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:620" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:620: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:620 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:620" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:620: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:620 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:620" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:622: grep -c '^ *public YYParser (char lex_param1) {\$' YYParser.java" +echo java.at:622 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser (char lex_param1) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser (char lex_param1) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser (char lex_param1) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:622" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:623: grep -c '^.* = new YYLexer *(lex_param1);\$' YYParser.java" +echo java.at:623 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^.* = new YYLexer *(lex_param1);$' YYParser.java"; then + ( $at_traceon; grep -c '^.* = new YYLexer *(lex_param1);$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^.* = new YYLexer *(lex_param1);$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:623" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%lex-param {char lex_param1} +%lex-param {short lex_param2} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + YYLexer (char lex_param1, short lex_param2) {} +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:625: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:625 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:625" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:625: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:625 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:625" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:625: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:625 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:625" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:625: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:625 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:625" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:625: bison YYParser.y" +echo java.at:625 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:625" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:625: grep -q '[mb]4_' YYParser.y" +echo java.at:625 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:625" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:625: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:625 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:625" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:625: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:625 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:625" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:629: grep -c '^ *public YYParser (char lex_param1, *short lex_param2) {\$' YYParser.java" +echo java.at:629 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser (char lex_param1, *short lex_param2) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser (char lex_param1, *short lex_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser (char lex_param1, *short lex_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:629" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:630: grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);\$' YYParser.java" +echo java.at:630 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java"; then + ( $at_traceon; grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:630" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%parse-param {int parse_param1} +%parse-param {long parse_param2} +%lex-param {char lex_param1} +%lex-param {short lex_param2} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + YYLexer (char lex_param1, short lex_param2) {} +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:632: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:632 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:632" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:632: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:632 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:632" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:632: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:632 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:632" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:632: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:632 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:632" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:632: bison YYParser.y" +echo java.at:632 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:632" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:632: grep -q '[mb]4_' YYParser.y" +echo java.at:632 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:632" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:632: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:632 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:632" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:632: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:632 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:632" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:638: grep -c '^ *protected final int parse_param1;\$' YYParser.java" +echo java.at:638 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected final int parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:638" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:639: grep -c '^ *protected final long parse_param2;\$' YYParser.java" +echo java.at:639 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected final long parse_param2;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:639" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:640: grep -c '^ *public YYParser (char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) {\$' YYParser.java" +echo java.at:640 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public YYParser (char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public YYParser (char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public YYParser (char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:640" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:641: grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);\$' YYParser.java" +echo java.at:641 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java"; then + ( $at_traceon; grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:641" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:642: grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {\$' YYParser.java" +echo java.at:642 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java"; then + ( $at_traceon; grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:642" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:643: grep -c '^[ ]*this.parse_param1 = parse_param1;\$' YYParser.java" +echo java.at:643 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java"; then + ( $at_traceon; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^[ ]*this.parse_param1 = parse_param1;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "2 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:643" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:644: grep -c '^[ ]*this.parse_param2 = parse_param2;\$' YYParser.java" +echo java.at:644 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java"; then + ( $at_traceon; grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^[ ]*this.parse_param2 = parse_param2;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "2 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:644" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_208 +#AT_START_209 +# 209. java.at:653: Java throws specifications +at_setup_line='java.at:653' +at_func_banner 19 +at_desc="Java throws specifications" +$at_quiet $as_echo_n "209: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "209. java.at:653: testing ..." + $at_traceon + + +# %define throws - 0 1 2 +# %define lex-throws - 0 1 2 +# %code lexer 0 1 + + + + + + + + + + + + + + + + + + + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + + + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws java.io.IOException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws java.io.IOException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "" + + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws java.io.IOException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws java.io.IOException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException" + +%initial-action {if (true) throw new ClassNotFoundException();} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws java.io.IOException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException, InstantiationException" + +%initial-action {if (true) throw new InstantiationException();} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws java.io.IOException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + +%define lex_throws "" + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "" +%define lex_throws "" + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException" +%define lex_throws "" +%initial-action {if (true) throw new ClassNotFoundException();} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException, InstantiationException" +%define lex_throws "" +%initial-action {if (true) throw new InstantiationException();} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + +%define lex_throws "InterruptedException" + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "" +%define lex_throws "InterruptedException" + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException" +%define lex_throws "InterruptedException" +%initial-action {if (true) throw new ClassNotFoundException();} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException, InstantiationException" +%define lex_throws "InterruptedException" +%initial-action {if (true) throw new InstantiationException();} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + +%define lex_throws "InterruptedException, IllegalAccessException" + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "" +%define lex_throws "InterruptedException, IllegalAccessException" + +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException" +%define lex_throws "InterruptedException, IllegalAccessException" +%initial-action {if (true) throw new ClassNotFoundException();} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException, InstantiationException" +%define lex_throws "InterruptedException, IllegalAccessException" +%initial-action {if (true) throw new InstantiationException();} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + + + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws java.io.IOException + { + throw new java.io.IOException(); + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws java.io.IOException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws java.io.IOException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "" + + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws java.io.IOException + { + throw new java.io.IOException(); + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws java.io.IOException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws java.io.IOException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws java.io.IOException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException" + +%initial-action {if (true) throw new ClassNotFoundException();} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws java.io.IOException + { + throw new java.io.IOException(); + } + + +} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws java.io.IOException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException, InstantiationException" + +%initial-action {if (true) throw new InstantiationException();} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws java.io.IOException + { + throw new java.io.IOException(); + } + + +} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws java.io.IOException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws java.io.IOException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + +%define lex_throws "" + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "" +%define lex_throws "" + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException" +%define lex_throws "" +%initial-action {if (true) throw new ClassNotFoundException();} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + +} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException, InstantiationException" +%define lex_throws "" +%initial-action {if (true) throw new InstantiationException();} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + +} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + +%define lex_throws "InterruptedException" + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws InterruptedException + { + throw new InterruptedException(); + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "" +%define lex_throws "InterruptedException" + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws InterruptedException + { + throw new InterruptedException(); + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException" +%define lex_throws "InterruptedException" +%initial-action {if (true) throw new ClassNotFoundException();} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws InterruptedException + { + throw new InterruptedException(); + } + + +} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException, InstantiationException" +%define lex_throws "InterruptedException" +%initial-action {if (true) throw new InstantiationException();} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws InterruptedException + { + throw new InterruptedException(); + } + + +} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + + +%define lex_throws "InterruptedException, IllegalAccessException" + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws InterruptedException, IllegalAccessException + { + throw new IllegalAccessException(); + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "" +%define lex_throws "InterruptedException, IllegalAccessException" + + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws InterruptedException, IllegalAccessException + { + throw new IllegalAccessException(); + } + + +} +%% +start: "end" {}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException" +%define lex_throws "InterruptedException, IllegalAccessException" +%initial-action {if (true) throw new ClassNotFoundException();} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws InterruptedException, IllegalAccessException + { + throw new IllegalAccessException(); + } + + +} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define throws "ClassNotFoundException, InstantiationException" +%define lex_throws "InterruptedException, IllegalAccessException" +%initial-action {if (true) throw new InstantiationException();} + +%code lexer +{ + Object yylval; + public Object getLVal() { return yylval; } + + public Position getStartPos() { return null; } + public Position getEndPos() { return null; } + + public void yyerror (Location loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () throws InterruptedException, IllegalAccessException + { + throw new IllegalAccessException(); + } + + +} +%% +start: "end" {throw new ClassNotFoundException();}; +%% +class Position {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: bison YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -q '[mb]4_' YYParser.y" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:713 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java"; then + ( $at_traceon; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *int yylex () throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *private int yyaction ([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:713: grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *\$' YYParser.java" +echo java.at:713 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java"; then + ( $at_traceon; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -c '^ *public boolean parse () throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "1 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:713" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_209 +#AT_START_210 +# 210. java.at:742: Java stype, position_class and location_class +at_setup_line='java.at:742' +at_func_banner 19 +at_desc="Java stype, position_class and location_class" +$at_quiet $as_echo_n "210: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "210. java.at:742: testing ..." + $at_traceon + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define stype "java.awt.Color" +%type start; +%define location_type "MyLoc" +%define position_type "MyPos" +%code { class MyPos {} } +%% +start: "end" {$$ = $1;}; +%% +class MyPos {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:744: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:744 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:744" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:744: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:744 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:744" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:744: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:744 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:744" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:744: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:744 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:744" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:744: bison YYParser.y" +echo java.at:744 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:744" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:744: grep -q '[mb]4_' YYParser.y" +echo java.at:744 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:744" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:744: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:744 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:744" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:744: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:744 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:744" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:750: grep -q 'java.awt.Color' YYParser.java" +echo java.at:750 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q 'java.awt.Color' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q 'java.awt.Color' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:750" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:751: egrep -v ' */?\\*' YYParser.java | grep -q 'Position'" +echo java.at:751 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; egrep -v ' */?\*' YYParser.java | grep -q 'Position' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; egrep -v ' */?\*' YYParser.java | grep -q 'Position' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:751" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:752: egrep -v ' */?\\*' YYParser.java | grep -q 'Location'" +echo java.at:752 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; egrep -v ' */?\*' YYParser.java | grep -q 'Location' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; egrep -v ' */?\*' YYParser.java | grep -q 'Location' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:752" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >YYParser.y <<'_ATEOF' + +%language "Java" +%locations +%debug +%error-verbose +%token-table + +%define stype "java.awt.Color" +%type start; +%define location_type "MyLoc" +%define position_type "MyPos" +%code { class MyPos {} } + +%code lexer +{ + java.awt.Color yylval; + public java.awt.Color getLVal() { return yylval; } + + public MyPos getStartPos() { return null; } + public MyPos getEndPos() { return null; } + + public void yyerror (MyLoc loc, String s) + { + System.err.println (loc + ": " + s); + } + + public int yylex () + { + return EOF; + } + + +} +%% +start: "end" {$$ = $1;}; +%% +class MyPos {} +_ATEOF + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/java.at:754: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot YYParser.y" +echo java.at:754 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:754" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/java.at:754: bison --xml=xml-tests/test.xml YYParser.y" +echo java.at:754 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:754" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:754: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo java.at:754 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:754" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/java.at:754: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo java.at:754 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:754" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/java.at:754: bison YYParser.y" +echo java.at:754 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:754" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:754: grep -q '[mb]4_' YYParser.y" +echo java.at:754 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q '[mb]4_' YYParser.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:754" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:754: test -n \"\$CONF_JAVA\" || exit 77 +test -n \"\$CONF_JAVAC\" || exit 77" +echo java.at:754 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; test -n "$CONF_JAVA" || exit 77 +test -n "$CONF_JAVAC" || exit 77 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:754" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:754: \$SHELL ../../../javacomp.sh YYParser.java" +echo java.at:754 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$SHELL ../../../javacomp.sh YYParser.java"; then + ( $at_traceon; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $SHELL ../../../javacomp.sh YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/java.at:754" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:762: grep -q 'java.awt.Color' YYParser.java" +echo java.at:762 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; grep -q 'java.awt.Color' YYParser.java ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; grep -q 'java.awt.Color' YYParser.java ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/java.at:762" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:763: egrep -v ' */?\\*' YYParser.java | grep -q 'Position'" +echo java.at:763 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; egrep -v ' */?\*' YYParser.java | grep -q 'Position' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; egrep -v ' */?\*' YYParser.java | grep -q 'Position' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:763" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/java.at:764: egrep -v ' */?\\*' YYParser.java | grep -q 'Location'" +echo java.at:764 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; egrep -v ' */?\*' YYParser.java | grep -q 'Location' ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; egrep -v ' */?\*' YYParser.java | grep -q 'Location' ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/java.at:764" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_210 +#AT_START_211 +# 211. cxx-type.at:413: GLR: Resolve ambiguity, impure, no locations +at_setup_line='cxx-type.at:413' +at_func_banner 20 +at_desc="GLR: Resolve ambiguity, impure, no locations" +$at_quiet $as_echo_n "211: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "211. cxx-type.at:413: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + + + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %dprec 1 { $$ = $1; } + | decl %dprec 2 + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:414: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:414 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:414" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:414: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:414 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:414" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:414: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:414 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:414" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:414: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:414 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:414" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:414: bison -o types.c types.y" +echo cxx-type.at:414 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:414" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:414: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:414 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:414" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:416: \$PREPARSER ./types test-input" +echo cxx-type.at:416 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "+(z,q) +(T,x) +(T,x,y) +=(x,y) ++((x,T),y) +(T,x) +(T,y,+(z,q)) + ++(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:416" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_211 +#AT_START_212 +# 212. cxx-type.at:420: GLR: Resolve ambiguity, impure, locations +at_setup_line='cxx-type.at:420' +at_func_banner 20 +at_desc="GLR: Resolve ambiguity, impure, locations" +$at_quiet $as_echo_n "212: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "212. cxx-type.at:420: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + +%locations + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + printf ("%d.%d-%d.%d: ", + @2.first_line, @2.first_column, + @2.last_line, @2.last_column); + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %dprec 1 { $$ = $1; } + | decl %dprec 2 + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:421: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:421 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:421: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:421 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:421: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:421 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:421: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:421 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:421: bison -o types.c types.y" +echo cxx-type.at:421 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:421: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:421 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:422: \$PREPARSER ./types test-input" +echo cxx-type.at:422 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "3.0-3.5: +(z,q) +5.0-5.3: (T,x) +7.0-7.7: (T,x,y) +9.0-9.5: =(x,y) +11.0-11.9: +((x,T),y) +13.0-13.5: (T,x) +15.0-15.13: (T,y,+(z,q)) +17.0-17.15: +19.0-19.5: +(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:422" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_212 +#AT_START_213 +# 213. cxx-type.at:426: GLR: Resolve ambiguity, pure, no locations +at_setup_line='cxx-type.at:426' +at_func_banner 20 +at_desc="GLR: Resolve ambiguity, pure, no locations" +$at_quiet $as_echo_n "213: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "213. cxx-type.at:426: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + +%define api.pure + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %dprec 1 { $$ = $1; } + | decl %dprec 2 + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:427: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:427 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:427: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:427 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:427: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:427 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:427: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:427 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:427: bison -o types.c types.y" +echo cxx-type.at:427 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:427: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:427 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:429: \$PREPARSER ./types test-input" +echo cxx-type.at:429 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "+(z,q) +(T,x) +(T,x,y) +=(x,y) ++((x,T),y) +(T,x) +(T,y,+(z,q)) + ++(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:429" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_213 +#AT_START_214 +# 214. cxx-type.at:433: GLR: Resolve ambiguity, pure, locations +at_setup_line='cxx-type.at:433' +at_func_banner 20 +at_desc="GLR: Resolve ambiguity, pure, locations" +$at_quiet $as_echo_n "214: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "214. cxx-type.at:433: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + +%define api.pure %locations + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + printf ("%d.%d-%d.%d: ", + @2.first_line, @2.first_column, + @2.last_line, @2.last_column); + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %dprec 1 { $$ = $1; } + | decl %dprec 2 + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:434: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:434 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:434" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:434: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:434 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:434" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:434: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:434 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:434" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:434: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:434 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:434" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:434: bison -o types.c types.y" +echo cxx-type.at:434 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:434" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:434: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:434 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:434" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:436: \$PREPARSER ./types test-input" +echo cxx-type.at:436 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "3.0-3.5: +(z,q) +5.0-5.3: (T,x) +7.0-7.7: (T,x,y) +9.0-9.5: =(x,y) +11.0-11.9: +((x,T),y) +13.0-13.5: (T,x) +15.0-15.13: (T,y,+(z,q)) +17.0-17.15: +19.0-19.5: +(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:436" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_214 +#AT_START_215 +# 215. cxx-type.at:440: GLR: Merge conflicting parses, impure, no locations +at_setup_line='cxx-type.at:440' +at_func_banner 20 +at_desc="GLR: Merge conflicting parses, impure, no locations" +$at_quiet $as_echo_n "215: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "215. cxx-type.at:440: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + + + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %merge { $$ = $1; } + | decl %merge + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + +static YYSTYPE +stmtMerge (YYSTYPE x0, YYSTYPE x1) +{ + return new_nterm ("(%s,%s)", x0, x1, 0); +} + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:441: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:441 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:441: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:441 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:441: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:441 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:441: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:441 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:441: bison -o types.c types.y" +echo cxx-type.at:441 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:441: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:441 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:443: \$PREPARSER ./types test-input" +echo cxx-type.at:443 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "+(z,q) +(T,x) +(T,x,y) +=(x,y) ++((x,T),y) +((T,x),(x,T)) +((T,y,+(z,q)),=((y,T),+(z,q))) + ++(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:443" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_215 +#AT_START_216 +# 216. cxx-type.at:447: GLR: Merge conflicting parses, impure, locations +at_setup_line='cxx-type.at:447' +at_func_banner 20 +at_desc="GLR: Merge conflicting parses, impure, locations" +$at_quiet $as_echo_n "216: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "216. cxx-type.at:447: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + +%locations + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + printf ("%d.%d-%d.%d: ", + @2.first_line, @2.first_column, + @2.last_line, @2.last_column); + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %merge { $$ = $1; } + | decl %merge + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + +static YYSTYPE +stmtMerge (YYSTYPE x0, YYSTYPE x1) +{ + return new_nterm ("(%s,%s)", x0, x1, 0); +} + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:448: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:448 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:448" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:448: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:448 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:448" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:448: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:448 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:448" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:448: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:448 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:448" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:448: bison -o types.c types.y" +echo cxx-type.at:448 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:448" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:448: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:448 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:448" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:450: \$PREPARSER ./types test-input" +echo cxx-type.at:450 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "3.0-3.5: +(z,q) +5.0-5.3: (T,x) +7.0-7.7: (T,x,y) +9.0-9.5: =(x,y) +11.0-11.9: +((x,T),y) +13.0-13.5: ((T,x),(x,T)) +15.0-15.13: ((T,y,+(z,q)),=((y,T),+(z,q))) +17.0-17.15: +19.0-19.5: +(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:450" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_216 +#AT_START_217 +# 217. cxx-type.at:454: GLR: Merge conflicting parses, pure, no locations +at_setup_line='cxx-type.at:454' +at_func_banner 20 +at_desc="GLR: Merge conflicting parses, pure, no locations" +$at_quiet $as_echo_n "217: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "217. cxx-type.at:454: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + +%define api.pure + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %merge { $$ = $1; } + | decl %merge + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + +static YYSTYPE +stmtMerge (YYSTYPE x0, YYSTYPE x1) +{ + return new_nterm ("(%s,%s)", x0, x1, 0); +} + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:455: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:455 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:455" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:455: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:455 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:455" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:455: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:455 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:455" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:455: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:455 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:455" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:455: bison -o types.c types.y" +echo cxx-type.at:455 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:455" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:455: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:455 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:455" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:457: \$PREPARSER ./types test-input" +echo cxx-type.at:457 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "+(z,q) +(T,x) +(T,x,y) +=(x,y) ++((x,T),y) +((T,x),(x,T)) +((T,y,+(z,q)),=((y,T),+(z,q))) + ++(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:457" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_217 +#AT_START_218 +# 218. cxx-type.at:460: GLR: Merge conflicting parses, pure, locations +at_setup_line='cxx-type.at:460' +at_func_banner 20 +at_desc="GLR: Merge conflicting parses, pure, locations" +$at_quiet $as_echo_n "218: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "218. cxx-type.at:460: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + +%define api.pure %locations + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + printf ("%d.%d-%d.%d: ", + @2.first_line, @2.first_column, + @2.last_line, @2.last_column); + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %merge { $$ = $1; } + | decl %merge + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + +static YYSTYPE +stmtMerge (YYSTYPE x0, YYSTYPE x1) +{ + return new_nterm ("(%s,%s)", x0, x1, 0); +} + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:461: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:461 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:461" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:461: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:461 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:461" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:461: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:461 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:461" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:461: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:461 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:461" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:461: bison -o types.c types.y" +echo cxx-type.at:461 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:461" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:461: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:461 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:461" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:463: \$PREPARSER ./types test-input" +echo cxx-type.at:463 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "3.0-3.5: +(z,q) +5.0-5.3: (T,x) +7.0-7.7: (T,x,y) +9.0-9.5: =(x,y) +11.0-11.9: +((x,T),y) +13.0-13.5: ((T,x),(x,T)) +15.0-15.13: ((T,y,+(z,q)),=((y,T),+(z,q))) +17.0-17.15: +19.0-19.5: +(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:463" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_218 +#AT_START_219 +# 219. cxx-type.at:467: GLR: Verbose messages, resolve ambiguity, impure, no locations +at_setup_line='cxx-type.at:467' +at_func_banner 20 +at_desc="GLR: Verbose messages, resolve ambiguity, impure, no locations" +$at_quiet $as_echo_n "219: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "219. cxx-type.at:467: testing ..." + $at_traceon + + + + + + + +# Using yacc.c? + + + + + + + + +# yyerror receives the location if %location & %pure & (%glr or %parse-param). + +# yyerror always sees the locations (when activated), except if +# (yacc & pure & !param). FIXME: This is wrong. See the manual. + + +# The interface is pure: either because %define api.pure, or because we +# are using the C++ parsers. + + + + + + + + + + + + +cat >types.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Simplified C++ Type and Expression Grammar. */ + +%error-verbose + +%{ + #include + union Node { + struct { + int isNterm; + int parents; + } nodeInfo; + struct { + int isNterm; /* 1 */ + int parents; + char const *form; + union Node *children[3]; + } nterm; + struct { + int isNterm; /* 0 */ + int parents; + char *text; + } term; + }; + typedef union Node Node; + static Node *new_nterm (char const *, Node *, Node *, Node *); + static Node *new_term (char *); + static void free_node (Node *); + static char *node_to_string (Node *); + #define YYSTYPE Node * + static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); + #define YYINITDEPTH 10 + #define YYSTACKEXPANDABLE 1 + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + void yyerror (ERROR_PARAMETERS); +%} + +%token TYPENAME ID + +%right '=' +%left '+' + +%glr-parser + +%destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID + +%% + +prog : + | prog stmt { + char *output; + output = node_to_string ($2); + printf ("%s\n", output); + free (output); + free_node ($2); + } + ; + +stmt : expr ';' %merge { $$ = $1; } + | decl %merge + | error ';' { $$ = new_nterm ("", 0, 0, 0); } + | '@' { YYACCEPT; } + ; + +expr : ID + | TYPENAME '(' expr ')' + { $$ = new_nterm ("(%s,%s)", $3, $1, 0); } + | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, 0); } + | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, 0); } + ; + +decl : TYPENAME declarator ';' + { $$ = new_nterm ("(%s,%s)", $1, $2, 0); } + | TYPENAME declarator '=' expr ';' + { $$ = new_nterm ("(%s,%s,%s)", $1, + $2, $4); } + ; + +declarator : ID + | '(' declarator ')' { $$ = $2; } + ; + +%% + +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + if (!freopen (argv[1], "r", stdin)) + return 3; + return yyparse (); +} + +int +yylex (LEX_PARAMETERS) +{ + char buffer[256]; + int c; + unsigned int i; + static int lineNum = 1; + static int colNum = 0; + +#if YYPURE +# undef yylloc +# define yylloc (*llocp) +# undef yylval +# define yylval (*lvalp) +#endif + + while (1) + { + if (feof (stdin)) + abort (); + c = getchar (); + switch (c) + { + case EOF: + return 0; + case '\t': + colNum = (colNum + 7) & ~7; + break; + case ' ': case '\f': + colNum += 1; + break; + case '\n': + lineNum += 1; + colNum = 0; + break; + default: + { + int tok; +#if YYLSP_NEEDED + yylloc.first_line = yylloc.last_line = lineNum; + yylloc.first_column = colNum; +#endif + if (isalpha (c)) + { + i = 0; + + do + { + buffer[i++] = c; + colNum += 1; + if (i == sizeof buffer - 1) + abort (); + c = getchar (); + } + while (isalnum (c) || c == '_'); + + ungetc (c, stdin); + buffer[i++] = 0; + tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; + yylval = new_term (strcpy ((char *) malloc (i), buffer)); + } + else + { + colNum += 1; + tok = c; + yylval = 0; + } +#if YYLSP_NEEDED + yylloc.last_column = colNum-1; +#endif + return tok; + } + } + } +} + +void +yyerror (ERROR_PARAMETERS) +{ +#if YYPURE && YYLSP_NEEDED + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); +#endif + fprintf (stderr, "%s\n", s); +} + +static Node * +new_nterm (char const *form, Node *child0, Node *child1, Node *child2) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->nterm.isNterm = 1; + node->nterm.parents = 0; + node->nterm.form = form; + node->nterm.children[0] = child0; + if (child0) + child0->nodeInfo.parents += 1; + node->nterm.children[1] = child1; + if (child1) + child1->nodeInfo.parents += 1; + node->nterm.children[2] = child2; + if (child2) + child2->nodeInfo.parents += 1; + return node; +} + +static Node * +new_term (char *text) +{ + Node *node = (Node *) malloc (sizeof (Node)); + node->term.isNterm = 0; + node->term.parents = 0; + node->term.text = text; + return node; +} + +static void +free_node (Node *node) +{ + if (!node) + return; + node->nodeInfo.parents -= 1; + /* Free only if 0 (last parent) or -1 (no parents). */ + if (node->nodeInfo.parents > 0) + return; + if (node->nodeInfo.isNterm == 1) + { + free_node (node->nterm.children[0]); + free_node (node->nterm.children[1]); + free_node (node->nterm.children[2]); + } + else + free (node->term.text); + free (node); +} + +static char * +node_to_string (Node *node) +{ + char *child0; + char *child1; + char *child2; + char *buffer; + if (!node) + { + buffer = (char *) malloc (1); + buffer[0] = 0; + } + else if (node->nodeInfo.isNterm == 1) + { + child0 = node_to_string (node->nterm.children[0]); + child1 = node_to_string (node->nterm.children[1]); + child2 = node_to_string (node->nterm.children[2]); + buffer = (char *) malloc (strlen (node->nterm.form) + strlen (child0) + + strlen (child1) + strlen (child2) + 1); + sprintf (buffer, node->nterm.form, child0, child1, child2); + free (child0); + free (child1); + free (child2); + } + else + buffer = strdup (node->term.text); + return buffer; +} + + +static YYSTYPE +stmtMerge (YYSTYPE x0, YYSTYPE x1) +{ + return new_nterm ("(%s,%s)", x0, x1, 0); +} + +_ATEOF + + + +cat >test-input <<'_ATEOF' + + +z + q; + +T x; + +T x = y; + +x = y; + +T (x) + y; + +T (x); + +T (y) = z + q; + +T (y y) = z + q; + +z + q; + +@ + +This is total garbage, but it should be ignored. +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:468: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o types.c types.y" +echo cxx-type.at:468 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:468" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:468: bison --xml=xml-tests/test.xml -o types.c types.y" +echo cxx-type.at:468 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:468" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:468: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:468 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:468" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:468: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo cxx-type.at:468 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:468" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:468: bison -o types.c types.y" +echo cxx-type.at:468 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o types.c types.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:468" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:468: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" +echo cxx-type.at:468 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:468" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + + + + + + + + + + + + + + + + + + + + +{ $at_traceoff +$as_echo "$at_srcdir/cxx-type.at:470: \$PREPARSER ./types test-input" +echo cxx-type.at:470 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./types test-input"; then + ( $at_traceon; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./types test-input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error, unexpected ID, expecting '=' or '+' or ')' +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "+(z,q) +(T,x) +(T,x,y) +=(x,y) ++((x,T),y) +((T,x),(x,T)) +((T,y,+(z,q)),=((y,T),+(z,q))) + ++(z,q) +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/cxx-type.at:470" + +$at_failed && at_func_log_failure +$at_traceon; } + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_219 +#AT_START_220 +# 220. glr-regression.at:23: Badly Collapsed GLR States +at_setup_line='glr-regression.at:23' +at_func_banner 21 +at_desc="Badly Collapsed GLR States" +$at_quiet $as_echo_n "220: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "220. glr-regression.at:23: testing ..." + $at_traceon + + +cat >glr-regr1.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Regression Test: Improper state compression */ +/* Reported by Scott McPeak */ + +%{ +#include +#include + +#define YYSTYPE int +static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1); +int yylex (void); +void yyerror (char const *msg); +%} + + +%glr-parser + + +/* -------- productions ------ */ +%% + +StartSymbol: E { $$=0; } %merge + ; + +E: E 'P' E { $$=1; printf("E -> E 'P' E\n"); } %merge + | 'B' { $$=2; printf("E -> 'B'\n"); } %merge + ; + + + +/* ---------- C code ----------- */ +%% + +static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1) +{ + (void) x0; + (void) x1; + printf ("\n"); + return 0; +} + +int +main (void) +{ + return yyparse (); +} + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + + +int +yylex (void) +{ + for (;;) + { + int ch; + if (feof (stdin)) + abort (); + ch = getchar (); + if (ch == EOF) + return 0; + else if (ch == 'B' || ch == 'P') + return ch; + } +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:96: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr1.c glr-regr1.y" +echo glr-regression.at:96 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr1.c glr-regr1.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr1.c glr-regr1.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:96" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:96: bison --xml=xml-tests/test.xml -o glr-regr1.c glr-regr1.y" +echo glr-regression.at:96 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr1.c glr-regr1.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr1.c glr-regr1.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:96" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:96: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:96 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:96" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:96: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:96 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:96" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:96: bison -o glr-regr1.c glr-regr1.y" +echo glr-regression.at:96 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr1.c glr-regr1.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr1.c glr-regr1.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr1.y: conflicts: 1 shift/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:96" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:99: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr1 glr-regr1.c \$LIBS" +echo glr-regression.at:99 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr1 glr-regr1.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr1 glr-regr1.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr1 glr-regr1.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:99" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:100: \$PREPARSER echo BPBPB | ./glr-regr1" +echo glr-regression.at:100 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER echo BPBPB | ./glr-regr1"; then + ( $at_traceon; $PREPARSER echo BPBPB | ./glr-regr1 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER echo BPBPB | ./glr-regr1 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "E -> 'B' +E -> 'B' +E -> E 'P' E +E -> 'B' +E -> E 'P' E +E -> 'B' +E -> E 'P' E +E -> E 'P' E + +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:100" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_220 +#AT_START_221 +# 221. glr-regression.at:118: Improper handling of embedded actions and dollar(-N) in GLR parsers +at_setup_line='glr-regression.at:118' +at_func_banner 21 +at_desc="Improper handling of embedded actions and dollar(-N) in GLR parsers" +$at_quiet $as_echo_n "221: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "221. glr-regression.at:118: testing ..." + $at_traceon + + +cat >glr-regr2a.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Regression Test: Improper handling of embedded actions and $-N */ +/* Reported by S. Eken */ + +%{ + #define YYSTYPE char * + + #include + #include + #include + #include + int yylex (void); + void yyerror (char const *); +%} + +%glr-parser + +%% + +command: + 's' var 't' + { printf ("Variable: '%s'\n", $2); } + 'v' 'x' 'q' + { free ($2); } + | 's' var_list 't' 'e' + { printf ("Varlist: '%s'\n", $2); free ($2); } + | 's' var 't' var_printer 'x' + { free ($2); } + ; + +var: + 'V' + { $$ = $1; } + ; + +var_list: + var + { $$ = $1; } + | var ',' var_list + { + char *s = (char *) realloc ($1, strlen ($1) + 1 + strlen ($3) + 1); + strcat (s, ","); + strcat (s, $3); + free ($3); + $$ = s; + } + ; + +var_printer: 'v' + { printf ("Variable: '%s'\n", $-1); } + +%% + +FILE *input; + +int +yylex (void) +{ + char buf[50]; + char *s; + if (feof (stdin)) + abort (); + switch (fscanf (input, " %1[a-z,]", buf)) { + case 1: + return buf[0]; + case EOF: + return 0; + default: + break; + } + if (fscanf (input, "%49s", buf) != 1) + return 0; + if (sizeof buf - 1 <= strlen (buf)) + abort (); + s = (char *) malloc (strlen (buf) + 1); + strcpy (s, buf); + yylval = s; + return 'V'; +} + +void +yyerror (char const *s) +{ printf ("%s\n", s); +} + +int +main (int argc, char **argv) +{ + input = stdin; + if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:214: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr2a.c glr-regr2a.y" +echo glr-regression.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr2a.c glr-regr2a.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr2a.c glr-regr2a.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:214: bison --xml=xml-tests/test.xml -o glr-regr2a.c glr-regr2a.y" +echo glr-regression.at:214 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr2a.c glr-regr2a.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr2a.c glr-regr2a.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:214: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:214: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:214 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:214: bison -o glr-regr2a.c glr-regr2a.y" +echo glr-regression.at:214 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr2a.c glr-regr2a.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr2a.c glr-regr2a.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr2a.y: conflicts: 2 shift/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:214" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:217: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr2a glr-regr2a.c \$LIBS" +echo glr-regression.at:217 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:217" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:219: \$PREPARSER echo s VARIABLE_1 t v x q | ./glr-regr2a" +echo glr-regression.at:219 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER echo s VARIABLE_1 t v x q | ./glr-regr2a"; then + ( $at_traceon; $PREPARSER echo s VARIABLE_1 t v x q | ./glr-regr2a ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER echo s VARIABLE_1 t v x q | ./glr-regr2a ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Variable: 'VARIABLE_1' +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:219" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:222: \$PREPARSER echo s VARIABLE_1 , ANOTHER_VARIABLE_2 t e | ./glr-regr2a" +echo glr-regression.at:222 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER echo s VARIABLE_1 , ANOTHER_VARIABLE_2 t e | ./glr-regr2a"; then + ( $at_traceon; $PREPARSER echo s VARIABLE_1 , ANOTHER_VARIABLE_2 t e | ./glr-regr2a ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER echo s VARIABLE_1 , ANOTHER_VARIABLE_2 t e | ./glr-regr2a ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Varlist: 'VARIABLE_1,ANOTHER_VARIABLE_2' +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:222" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:226: \$PREPARSER echo s VARIABLE_3 t v x | ./glr-regr2a" +echo glr-regression.at:226 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER echo s VARIABLE_3 t v x | ./glr-regr2a"; then + ( $at_traceon; $PREPARSER echo s VARIABLE_3 t v x | ./glr-regr2a ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER echo s VARIABLE_3 t v x | ./glr-regr2a ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Variable: 'VARIABLE_3' +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:226" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_221 +#AT_START_222 +# 222. glr-regression.at:237: Improper merging of GLR delayed action sets +at_setup_line='glr-regression.at:237' +at_func_banner 21 +at_desc="Improper merging of GLR delayed action sets" +$at_quiet $as_echo_n "222: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "222. glr-regression.at:237: testing ..." + $at_traceon + + +cat >glr-regr3.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +/* Regression Test: Improper merging of GLR delayed action sets. */ +/* Reported by M. Rosien */ + +%{ +#include +#include +#include + +static int MergeRule (int x0, int x1); +static void yyerror (char const * s); +int yylex (void); + +#define RULE(x) (1 << (x)) + +%} + +%glr-parser + +%token BAD_CHAR +%token P1 P2 T1 T2 T3 T4 O1 O2 + +%% + +S : P1 T4 O2 NT6 P2 { printf ("Result: %x\n", $4); } +; + +NT1 : P1 T1 O1 T2 P2 { $$ = RULE(2); } %merge +; + +NT2 : NT1 { $$ = RULE(3); } %merge + | P1 NT1 O1 T3 P2 { $$ = RULE(4); } %merge +; + +NT3 : T3 { $$ = RULE(5); } %merge + | P1 NT1 O1 T3 P2 { $$ = RULE(6); } %merge +; + +NT4 : NT3 { $$ = RULE(7); } %merge + | NT2 { $$ = RULE(8); } %merge + | P1 NT2 O1 NT3 P2 { $$ = RULE(9); } %merge +; + +NT5 : NT4 { $$ = RULE(10); } %merge +; + +NT6 : P1 NT1 O1 T3 P2 { $$ = RULE(11) | $2; } %merge + | NT5 { $$ = RULE(12) | $1; } %merge +; + +%% + +static int MergeRule (int x0, int x1) { + return x0 | x1; +} + +static void yyerror(char const * s) { + fprintf(stderr,"error: %s\n",s); +} + +FILE *input = NULL; + +int P[] = { P1, P2 }; +int O[] = { O1, O2 }; +int T[] = { T1, T2, T3, T4 }; + +int yylex (void) +{ + char inp[3]; + if (feof (stdin)) + abort (); + if (fscanf (input, "%2s", inp) == EOF) + return 0; + switch (inp[0]) + { + case 'p': return P[inp[1] - '1']; + case 't': return T[inp[1] - '1']; + case 'o': return O[inp[1] - '1']; + } + return BAD_CHAR; +} + +int main(int argc, char* argv[]) { + input = stdin; + if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:328: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr3.c glr-regr3.y" +echo glr-regression.at:328 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr3.c glr-regr3.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr3.c glr-regr3.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:328" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:328: bison --xml=xml-tests/test.xml -o glr-regr3.c glr-regr3.y" +echo glr-regression.at:328 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr3.c glr-regr3.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr3.c glr-regr3.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:328" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:328: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:328 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:328" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:328: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:328 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:328" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:328: bison -o glr-regr3.c glr-regr3.y" +echo glr-regression.at:328 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr3.c glr-regr3.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr3.c glr-regr3.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr3.y: conflicts: 1 shift/reduce, 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:328" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:331: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr3 glr-regr3.c \$LIBS" +echo glr-regression.at:331 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr3 glr-regr3.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr3 glr-regr3.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr3 glr-regr3.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:331" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:333: \$PREPARSER echo p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 | ./glr-regr3" +echo glr-regression.at:333 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER echo p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 | ./glr-regr3"; then + ( $at_traceon; $PREPARSER echo p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 | ./glr-regr3 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER echo p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 | ./glr-regr3 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Result: 1c04 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:333" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_222 +#AT_START_223 +# 223. glr-regression.at:346: Duplicate representation of merged trees +at_setup_line='glr-regression.at:346' +at_func_banner 21 +at_desc="Duplicate representation of merged trees" +$at_quiet $as_echo_n "223: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "223. glr-regression.at:346: testing ..." + $at_traceon + + +cat >glr-regr4.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%union { char *ptr; } +%type S A A1 A2 B +%glr-parser + +%{ + #include + #include + #include + static char *merge (YYSTYPE, YYSTYPE); + static char *make_value (char const *, char const *); + static void yyerror (char const *); + static int yylex (void); + static char *ptrs[100]; + static char **ptrs_next = ptrs; +%} + +%% + +tree: S { printf ("%s\n", $1); } ; + +S: + A %merge { $$ = make_value ("S", $1); } + | B %merge { $$ = make_value ("S", $1); } + ; + +A: + A1 %merge { $$ = make_value ("A", $1); } + | A2 %merge { $$ = make_value ("A", $1); } + ; + +A1: 'a' { $$ = make_value ("A1", "'a'"); } ; +A2: 'a' { $$ = make_value ("A2", "'a'"); } ; +B: 'a' { $$ = make_value ("B", "'a'"); } ; + +%% + +static int +yylex (void) +{ + static char const input[] = "a"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +int +main (void) +{ + int status = yyparse (); + while (ptrs_next != ptrs) + free (*--ptrs_next); + return status; +} + +static char * +make_value (char const *parent, char const *child) +{ + char const format[] = "%s <- %s"; + char *value = *ptrs_next++ = + (char *) malloc (strlen (parent) + strlen (child) + sizeof format); + sprintf (value, format, parent, child); + return value; +} + +static char * +merge (YYSTYPE s1, YYSTYPE s2) +{ + char const format[] = "merge{ %s and %s }"; + char *value = *ptrs_next++ = + (char *) malloc (strlen (s1.ptr) + strlen (s2.ptr) + sizeof format); + sprintf (value, format, s1.ptr, s2.ptr); + return value; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:432: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr4.c glr-regr4.y" +echo glr-regression.at:432 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr4.c glr-regr4.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr4.c glr-regr4.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:432" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:432: bison --xml=xml-tests/test.xml -o glr-regr4.c glr-regr4.y" +echo glr-regression.at:432 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr4.c glr-regr4.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr4.c glr-regr4.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:432" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:432: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:432 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:432" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:432: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:432 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:432" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:432: bison -o glr-regr4.c glr-regr4.y" +echo glr-regression.at:432 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr4.c glr-regr4.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr4.c glr-regr4.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr4.y: conflicts: 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:432" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:435: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr4 glr-regr4.c \$LIBS" +echo glr-regression.at:435 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr4 glr-regr4.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr4 glr-regr4.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr4 glr-regr4.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:435" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:437: \$PREPARSER ./glr-regr4" +echo glr-regression.at:437 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr4"; then + ( $at_traceon; $PREPARSER ./glr-regr4 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr4 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "merge{ S <- merge{ A <- A1 <- 'a' and A <- A2 <- 'a' } and S <- B <- 'a' } +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:437" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_223 +#AT_START_224 +# 224. glr-regression.at:449: User destructor for unresolved GLR semantic value +at_setup_line='glr-regression.at:449' +at_func_banner 21 +at_desc="User destructor for unresolved GLR semantic value" +$at_quiet $as_echo_n "224: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "224. glr-regression.at:449: testing ..." + $at_traceon + + +cat >glr-regr5.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); + enum { MAGIC_VALUE = -1057808125 }; /* originally chosen at random */ +%} + +%glr-parser +%union { int value; } +%type start + +%destructor { + if ($$ != MAGIC_VALUE) + { + fprintf (stderr, "Bad destructor call.\n"); + exit (EXIT_FAILURE); + } +} start + +%% + +start: + 'a' { $$ = MAGIC_VALUE; } + | 'a' { $$ = MAGIC_VALUE; } + ; + +%% + +static int +yylex (void) +{ + static char const input[] = "a"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse () != 1; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:505: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr5.c glr-regr5.y" +echo glr-regression.at:505 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr5.c glr-regr5.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr5.c glr-regr5.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:505" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:505: bison --xml=xml-tests/test.xml -o glr-regr5.c glr-regr5.y" +echo glr-regression.at:505 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr5.c glr-regr5.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr5.c glr-regr5.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:505" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:505: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:505 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:505" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:505: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:505 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:505" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:505: bison -o glr-regr5.c glr-regr5.y" +echo glr-regression.at:505 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr5.c glr-regr5.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr5.c glr-regr5.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr5.y: conflicts: 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:505" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:508: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr5 glr-regr5.c \$LIBS" +echo glr-regression.at:508 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr5 glr-regr5.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr5 glr-regr5.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr5 glr-regr5.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:508" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:510: \$PREPARSER ./glr-regr5" +echo glr-regression.at:510 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr5"; then + ( $at_traceon; $PREPARSER ./glr-regr5 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr5 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax is ambiguous +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:510" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_224 +#AT_START_225 +# 225. glr-regression.at:522: User destructor after an error during a split parse +at_setup_line='glr-regression.at:522' +at_func_banner 21 +at_desc="User destructor after an error during a split parse" +$at_quiet $as_echo_n "225: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "225. glr-regression.at:522: testing ..." + $at_traceon + + +cat >glr-regr6.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); +%} + +%glr-parser +%union { int value; } +%type 'a' + +%destructor { + printf ("Destructor called.\n"); +} 'a' + +%% + +start: 'a' | 'a' ; + +%% + +static int +yylex (void) +{ + static char const input[] = "a"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + return yyparse () != 1; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:570: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr6.c glr-regr6.y" +echo glr-regression.at:570 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr6.c glr-regr6.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr6.c glr-regr6.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:570" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:570: bison --xml=xml-tests/test.xml -o glr-regr6.c glr-regr6.y" +echo glr-regression.at:570 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr6.c glr-regr6.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr6.c glr-regr6.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:570" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:570: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:570 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:570" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:570: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:570 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:570" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:570: bison -o glr-regr6.c glr-regr6.y" +echo glr-regression.at:570 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr6.c glr-regr6.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr6.c glr-regr6.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr6.y: conflicts: 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:570" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:573: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr6 glr-regr6.c \$LIBS" +echo glr-regression.at:573 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr6 glr-regr6.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr6 glr-regr6.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr6 glr-regr6.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:573" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:575: \$PREPARSER ./glr-regr6" +echo glr-regression.at:575 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr6"; then + ( $at_traceon; $PREPARSER ./glr-regr6 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr6 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax is ambiguous +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Destructor called. +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:575" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_225 +#AT_START_226 +# 226. glr-regression.at:589: Duplicated user destructor for lookahead +at_setup_line='glr-regression.at:589' +at_func_banner 21 +at_desc="Duplicated user destructor for lookahead" +$at_quiet $as_echo_n "226: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "226. glr-regression.at:589: testing ..." + $at_traceon + + +cat >glr-regr7.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); + #define YYSTACKEXPANDABLE 0 + typedef struct count_node { + int count; + struct count_node *prev; + } count_node; + static count_node *tail; +%} + +%glr-parser +%union { count_node *node; } +%type 'a' + +%destructor { + if ($$->count++) + fprintf (stderr, "Destructor called on same value twice.\n"); +} 'a' + +%% + +start: + stack1 start + | stack2 start + | /* empty */ + ; +stack1: 'a' ; +stack2: 'a' ; + +%% + +static int +yylex (void) +{ + yylval.node = (count_node*) malloc (sizeof *yylval.node); + if (!yylval.node) + { + fprintf (stderr, "Test inconclusive.\n"); + exit (EXIT_FAILURE); + } + yylval.node->count = 0; + yylval.node->prev = tail; + tail = yylval.node; + return 'a'; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + int status = yyparse (); + while (tail) + { + count_node *prev = tail->prev; + free (tail); + tail = prev; + } + return status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:662: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr7.c glr-regr7.y" +echo glr-regression.at:662 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr7.c glr-regr7.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr7.c glr-regr7.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:662" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:662: bison --xml=xml-tests/test.xml -o glr-regr7.c glr-regr7.y" +echo glr-regression.at:662 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr7.c glr-regr7.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr7.c glr-regr7.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:662" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:662: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:662 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:662" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:662: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:662 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:662" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:662: bison -o glr-regr7.c glr-regr7.y" +echo glr-regression.at:662 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr7.c glr-regr7.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr7.c glr-regr7.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr7.y: conflicts: 2 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:662" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:665: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr7 glr-regr7.c \$LIBS" +echo glr-regression.at:665 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr7 glr-regr7.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr7 glr-regr7.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr7 glr-regr7.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:665" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:667: \$PREPARSER ./glr-regr7" +echo glr-regression.at:667 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr7"; then + ( $at_traceon; $PREPARSER ./glr-regr7 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr7 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "memory exhausted +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 2 $at_status "$at_srcdir/glr-regression.at:667" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_226 +#AT_START_227 +# 227. glr-regression.at:681: Incorrectly initialized location for empty right-hand side in GLR +at_setup_line='glr-regression.at:681' +at_func_banner 21 +at_desc="Incorrectly initialized location for empty right-hand side in GLR" +$at_quiet $as_echo_n "227: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "227. glr-regression.at:681: testing ..." + $at_traceon + + +cat >glr-regr8.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); + static void yyerror (char const *msg); +%} + +%token T_CONSTANT +%token T_PORT +%token T_SIGNAL + +%glr-parser + +%% + + +PortClause : T_PORT InterfaceDeclaration T_PORT + { printf("%d/%d - %d/%d - %d/%d\n", + @1.first_column, @1.last_column, + @2.first_column, @2.last_column, + @3.first_column, @3.last_column); } + ; + +InterfaceDeclaration : OptConstantWord %dprec 1 + | OptSignalWord %dprec 2 + ; + +OptConstantWord : /* empty */ + | T_CONSTANT + ; + +OptSignalWord : /* empty */ + { printf("empty: %d/%d\n", @$.first_column, @$.last_column); } + | T_SIGNAL + ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int lexIndex; + +int yylex (void) +{ + lexIndex += 1; + switch (lexIndex) + { + default: + abort (); + case 1: + yylloc.first_column = 1; + yylloc.last_column = 9; + return T_PORT; + case 2: + yylloc.first_column = 13; + yylloc.last_column = 17; + return T_PORT; + case 3: + return 0; + } +} + +int +main (void) +{ + yyparse(); + return 0; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:760: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr8.c glr-regr8.y" +echo glr-regression.at:760 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr8.c glr-regr8.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr8.c glr-regr8.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:760" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:760: bison --xml=xml-tests/test.xml -o glr-regr8.c glr-regr8.y" +echo glr-regression.at:760 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr8.c glr-regr8.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr8.c glr-regr8.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:760" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:760: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:760 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:760" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:760: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:760 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:760" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:760: bison -o glr-regr8.c glr-regr8.y" +echo glr-regression.at:760 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr8.c glr-regr8.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr8.c glr-regr8.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr8.y: conflicts: 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:760" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:763: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr8 glr-regr8.c \$LIBS" +echo glr-regression.at:763 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr8 glr-regr8.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr8 glr-regr8.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr8 glr-regr8.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:763" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:765: \$PREPARSER ./glr-regr8" +echo glr-regression.at:765 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr8"; then + ( $at_traceon; $PREPARSER ./glr-regr8 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr8 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "empty: 9/9 +1/9 - 9/9 - 13/17 +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:765" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_227 +#AT_START_228 +# 228. glr-regression.at:779: No users destructors if stack 0 deleted +at_setup_line='glr-regression.at:779' +at_func_banner 21 +at_desc="No users destructors if stack 0 deleted" +$at_quiet $as_echo_n "228: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "228. glr-regression.at:779: testing ..." + $at_traceon + + +cat >glr-regr9.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ +# include +# include + static void yyerror (char const *); + static int yylex (void); +# define YYSTACKEXPANDABLE 0 + static int tokens = 0; + static int destructors = 0; +# define USE(Var) +%} + +%glr-parser +%union { int dummy; } +%type 'a' + +%destructor { + destructors += 1; +} 'a' + +%% + +start: + ambig0 'a' { destructors += 2; USE ($2); } + | ambig1 start { destructors += 1; } + | ambig2 start { destructors += 1; } + ; + +ambig0: 'a' ; +ambig1: 'a' ; +ambig2: 'a' ; + +%% + +static int +yylex (void) +{ + tokens += 1; + return 'a'; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + int exit_status; + exit_status = yyparse (); + if (tokens != destructors) + { + fprintf (stderr, "Tokens = %d, Destructors = %d\n", tokens, destructors); + return 1; + } + return !exit_status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:843: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr9.c glr-regr9.y" +echo glr-regression.at:843 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr9.c glr-regr9.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr9.c glr-regr9.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:843: bison --xml=xml-tests/test.xml -o glr-regr9.c glr-regr9.y" +echo glr-regression.at:843 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr9.c glr-regr9.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr9.c glr-regr9.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:843: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:843 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:843: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:843 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:843: bison -o glr-regr9.c glr-regr9.y" +echo glr-regression.at:843 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr9.c glr-regr9.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr9.c glr-regr9.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr9.y: conflicts: 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:846: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr9 glr-regr9.c \$LIBS" +echo glr-regression.at:846 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr9 glr-regr9.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr9 glr-regr9.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr9 glr-regr9.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:846" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:848: \$PREPARSER ./glr-regr9" +echo glr-regression.at:848 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr9"; then + ( $at_traceon; $PREPARSER ./glr-regr9 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr9 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "memory exhausted +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:848" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_228 +#AT_START_229 +# 229. glr-regression.at:859: Corrupted semantic options if user action cuts parse +at_setup_line='glr-regression.at:859' +at_func_banner 21 +at_desc="Corrupted semantic options if user action cuts parse" +$at_quiet $as_echo_n "229: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "229. glr-regression.at:859: testing ..." + $at_traceon + + +cat >glr-regr10.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ +# include +# include + static void yyerror (char const *); + static int yylex (void); + #define GARBAGE_SIZE 50 + static char garbage[GARBAGE_SIZE]; +%} + +%glr-parser +%union { char *ptr; } +%type start + +%% + +start: + %dprec 2 { $$ = garbage; YYACCEPT; } + | %dprec 1 { $$ = garbage; YYACCEPT; } + ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return 0; +} + +int +main (void) +{ + int i; + for (i = 0; i < GARBAGE_SIZE; i+=1) + garbage[i] = 108; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:910: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr10.c glr-regr10.y" +echo glr-regression.at:910 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr10.c glr-regr10.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr10.c glr-regr10.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:910" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:910: bison --xml=xml-tests/test.xml -o glr-regr10.c glr-regr10.y" +echo glr-regression.at:910 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr10.c glr-regr10.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr10.c glr-regr10.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:910" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:910: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:910 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:910" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:910: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:910 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:910" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:910: bison -o glr-regr10.c glr-regr10.y" +echo glr-regression.at:910 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr10.c glr-regr10.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr10.c glr-regr10.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr10.y: conflicts: 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:910" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:913: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr10 glr-regr10.c \$LIBS" +echo glr-regression.at:913 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr10 glr-regr10.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr10 glr-regr10.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr10 glr-regr10.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:913" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:915: \$PREPARSER ./glr-regr10" +echo glr-regression.at:915 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr10"; then + ( $at_traceon; $PREPARSER ./glr-regr10 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr10 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:915" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_229 +#AT_START_230 +# 230. glr-regression.at:924: Undesirable destructors if user action cuts parse +at_setup_line='glr-regression.at:924' +at_func_banner 21 +at_desc="Undesirable destructors if user action cuts parse" +$at_quiet $as_echo_n "230: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "230. glr-regression.at:924: testing ..." + $at_traceon + + +cat >glr-regr11.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ +# include + static void yyerror (char const *); + static int yylex (void); + static int destructors = 0; +# define USE(val) +%} + +%glr-parser +%union { int dummy; } +%type 'a' +%destructor { destructors += 1; } 'a' + +%% + +start: + 'a' %dprec 2 { USE ($1); destructors += 1; YYACCEPT; } + | 'a' %dprec 1 { USE ($1); destructors += 1; YYACCEPT; } + ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static char const input[] = "a"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + return input[toknum++]; +} + +int +main (void) +{ + int exit_status = yyparse (); + if (destructors != 1) + { + fprintf (stderr, "Destructor calls: %d\n", destructors); + return 1; + } + return exit_status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:979: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr11.c glr-regr11.y" +echo glr-regression.at:979 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr11.c glr-regr11.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr11.c glr-regr11.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:979" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:979: bison --xml=xml-tests/test.xml -o glr-regr11.c glr-regr11.y" +echo glr-regression.at:979 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr11.c glr-regr11.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr11.c glr-regr11.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:979" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:979: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:979 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:979" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:979: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:979 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:979" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:979: bison -o glr-regr11.c glr-regr11.y" +echo glr-regression.at:979 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr11.c glr-regr11.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr11.c glr-regr11.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr11.y: conflicts: 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:979" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:982: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr11 glr-regr11.c \$LIBS" +echo glr-regression.at:982 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr11 glr-regr11.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr11 glr-regr11.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr11 glr-regr11.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:982" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:984: \$PREPARSER ./glr-regr11" +echo glr-regression.at:984 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr11"; then + ( $at_traceon; $PREPARSER ./glr-regr11 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr11 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:984" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_230 +#AT_START_231 +# 231. glr-regression.at:993: Leaked semantic values if user action cuts parse +at_setup_line='glr-regression.at:993' +at_func_banner 21 +at_desc="Leaked semantic values if user action cuts parse" +$at_quiet $as_echo_n "231: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "231. glr-regression.at:993: testing ..." + $at_traceon + + +cat >glr-regr12.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%glr-parser +%union { int dummy; } +%token PARENT_RHS_AFTER +%type parent_rhs_before merged PARENT_RHS_AFTER +%destructor { parent_rhs_before_value = 0; } parent_rhs_before +%destructor { merged_value = 0; } merged +%destructor { parent_rhs_after_value = 0; } PARENT_RHS_AFTER + +%{ +# include + static int merge (YYSTYPE, YYSTYPE); + static void yyerror (char const *); + static int yylex (void); + static int parent_rhs_before_value = 0; + static int merged_value = 0; + static int parent_rhs_after_value = 0; +# define USE(val) +%} + +%% + +start: + alt1 %dprec 1 + | alt2 %dprec 2 + ; + +alt1: + PARENT_RHS_AFTER { + USE ($1); + parent_rhs_after_value = 0; + } + ; + +alt2: + parent_rhs_before merged PARENT_RHS_AFTER { + USE (($1, $2, $3)); + parent_rhs_before_value = 0; + merged_value = 0; + parent_rhs_after_value = 0; + } + ; + +parent_rhs_before: + { + USE ($$); + parent_rhs_before_value = 1; + } + ; + +merged: + %merge { + USE ($$); + merged_value = 1; + } + | cut %merge { + USE ($$); + merged_value = 1; + } + ; + +cut: { YYACCEPT; } ; + +%% + +static int +merge (YYSTYPE s1, YYSTYPE s2) +{ + /* Not invoked. */ + char dummy = s1.dummy + s2.dummy; + return dummy; +} + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static int const input[] = { PARENT_RHS_AFTER, 0 }; + static size_t toknum; + if (! (toknum < sizeof input / sizeof *input)) + abort (); + if (input[toknum] == PARENT_RHS_AFTER) + parent_rhs_after_value = 1; + return input[toknum++]; +} + +int +main (void) +{ + int exit_status = yyparse (); + if (parent_rhs_before_value) + { + fprintf (stderr, "`parent_rhs_before' destructor not called.\n"); + exit_status = 1; + } + if (merged_value) + { + fprintf (stderr, "`merged' destructor not called.\n"); + exit_status = 1; + } + if (parent_rhs_after_value) + { + fprintf (stderr, "`PARENT_RHS_AFTER' destructor not called.\n"); + exit_status = 1; + } + return exit_status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1110: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr12.c glr-regr12.y" +echo glr-regression.at:1110 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr12.c glr-regr12.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr12.c glr-regr12.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1110" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1110: bison --xml=xml-tests/test.xml -o glr-regr12.c glr-regr12.y" +echo glr-regression.at:1110 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr12.c glr-regr12.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr12.c glr-regr12.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1110" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1110: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1110 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1110" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1110: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1110 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1110" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1110: bison -o glr-regr12.c glr-regr12.y" +echo glr-regression.at:1110 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr12.c glr-regr12.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr12.c glr-regr12.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr12.y: conflicts: 1 shift/reduce, 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1110" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1113: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr12 glr-regr12.c \$LIBS" +echo glr-regression.at:1113 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr12 glr-regr12.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr12 glr-regr12.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr12 glr-regr12.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1113" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1115: \$PREPARSER ./glr-regr12" +echo glr-regression.at:1115 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr12"; then + ( $at_traceon; $PREPARSER ./glr-regr12 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr12 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1115" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_231 +#AT_START_232 +# 232. glr-regression.at:1126: Incorrect lookahead during deterministic GLR +at_setup_line='glr-regression.at:1126' +at_func_banner 21 +at_desc="Incorrect lookahead during deterministic GLR" +$at_quiet $as_echo_n "232: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "232. glr-regression.at:1126: testing ..." + $at_traceon + + +cat >glr-regr13.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +/* Tests: + - Defaulted state with initial yychar: yychar == YYEMPTY. + - Nondefaulted state: yychar != YYEMPTY. + - Defaulted state after lookahead: yychar != YYEMPTY. + - Defaulted state after shift: yychar == YYEMPTY. + - User action changing the lookahead. */ + +%{ + #include + static void yyerror (char const *); + static int yylex (void); + static void print_lookahead (char const *); + #define USE(value) +%} + +%union { char value; } +%type 'a' 'b' +%glr-parser +%locations + +%% + +start: + defstate_init defstate_shift 'b' change_lookahead 'a' { + USE ($3); + print_lookahead ("start <- defstate_init defstate_shift 'b'"); + } + ; +defstate_init: + { + print_lookahead ("defstate_init <- empty string"); + } + ; +defstate_shift: + nondefstate defstate_look 'a' { + USE ($3); + print_lookahead ("defstate_shift <- nondefstate defstate_look 'a'"); + } + ; +defstate_look: + { + print_lookahead ("defstate_look <- empty string"); + } + ; +nondefstate: + { + print_lookahead ("nondefstate <- empty string"); + } + | 'b' { + USE ($1); + print_lookahead ("nondefstate <- 'b'"); + } + ; +change_lookahead: + { + yychar = 'a'; + } + ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static char const input[] = "ab"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = toknum + 1; + yylval.value = input[toknum] + 'A' - 'a'; + return input[toknum++]; +} + +static void +print_lookahead (char const *reduction) +{ + printf ("%s:\n yychar=", reduction); + if (yychar == YYEMPTY) + printf ("YYEMPTY"); + else if (yychar == YYEOF) + printf ("YYEOF"); + else + { + printf ("'%c', yylval='", yychar); + if (yylval.value > ' ') + printf ("%c", yylval.value); + printf ("', yylloc=(%d,%d),(%d,%d)", + yylloc.first_line, yylloc.first_column, + yylloc.last_line, yylloc.last_column); + } + printf ("\n"); +} + +int +main (void) +{ + yychar = '#'; /* Not a token in the grammar. */ + yylval.value = '!'; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1239: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr13.c glr-regr13.y" +echo glr-regression.at:1239 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr13.c glr-regr13.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr13.c glr-regr13.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1239" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1239: bison --xml=xml-tests/test.xml -o glr-regr13.c glr-regr13.y" +echo glr-regression.at:1239 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr13.c glr-regr13.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr13.c glr-regr13.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1239" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1239: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1239 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1239" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1239: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1239 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1239" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1239: bison -o glr-regr13.c glr-regr13.y" +echo glr-regression.at:1239 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr13.c glr-regr13.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr13.c glr-regr13.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1239" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1240: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr13 glr-regr13.c \$LIBS" +echo glr-regression.at:1240 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr13 glr-regr13.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr13 glr-regr13.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr13 glr-regr13.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1240" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1242: \$PREPARSER ./glr-regr13" +echo glr-regression.at:1242 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr13"; then + ( $at_traceon; $PREPARSER ./glr-regr13 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr13 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "defstate_init <- empty string: + yychar=YYEMPTY +nondefstate <- empty string: + yychar='a', yylval='A', yylloc=(1,1),(1,1) +defstate_look <- empty string: + yychar='a', yylval='A', yylloc=(1,1),(1,1) +defstate_shift <- nondefstate defstate_look 'a': + yychar=YYEMPTY +start <- defstate_init defstate_shift 'b': + yychar=YYEMPTY +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1242" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_232 +#AT_START_233 +# 233. glr-regression.at:1262: Incorrect lookahead during nondeterministic GLR +at_setup_line='glr-regression.at:1262' +at_func_banner 21 +at_desc="Incorrect lookahead during nondeterministic GLR" +$at_quiet $as_echo_n "233: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "233. glr-regression.at:1262: testing ..." + $at_traceon + + +cat >glr-regr14.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +/* Tests: + - Conflicting actions (split-off parse, which copies lookahead need, + which is necessarily yytrue) and nonconflicting actions (non-split-off + parse) for nondefaulted state: yychar != YYEMPTY. + - Merged deferred actions (lookahead need and RHS from different stack + than the target state) and nonmerged deferred actions (same stack). + - Defaulted state after lookahead: yychar != YYEMPTY. + - Defaulted state after shift: yychar == YYEMPTY. + - yychar != YYEMPTY but lookahead need is yyfalse (a previous stack has + seen the lookahead but current stack has not). + - Exceeding stack capacity (stack explosion), and thus reallocating + lookahead need array. + Note that it does not seem possible to see the initial yychar value during + nondeterministic operation since: + - In order to preserve the initial yychar, only defaulted states may be + entered. + - If only defaulted states are entered, there are no conflicts, so + nondeterministic operation does not start. */ + +%union { char value; } + +%{ + #include + #include + static void yyerror (char const *); + static int yylex (void); + static void print_lookahead (char const *); + static char merge (union YYSTYPE, union YYSTYPE); + #define USE(value) +%} + +%type 'a' 'b' 'c' 'd' stack_explosion +%glr-parser +%locations + +%% + +start: + merge 'c' stack_explosion { + USE ($2); USE ($3); + print_lookahead ("start <- merge 'c' stack_explosion"); + } + ; + +/* When merging the 2 deferred actions, the lookahead needs are different. */ +merge: + nonconflict1 'a' 'b' nonconflict2 %dprec 1 { + USE ($2); USE ($3); + print_lookahead ("merge <- nonconflict1 'a' 'b' nonconflict2"); + } + | conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2 { + USE ($3); USE ($5); + print_lookahead ("merge <- conflict defstate_look 'a' nonconflict2 'b'" + " defstate_shift"); + } + ; + +nonconflict1: + { + print_lookahead ("nonconflict1 <- empty string"); + } + ; +nonconflict2: + { + print_lookahead ("nonconflict2 <- empty string"); + } + | 'a' { + USE ($1); + print_lookahead ("nonconflict2 <- 'a'"); + } + ; +conflict: + { + print_lookahead ("conflict <- empty string"); + } + ; +defstate_look: + { + print_lookahead ("defstate_look <- empty string"); + } + ; + +/* yychar != YYEMPTY but lookahead need is yyfalse. */ +defstate_shift: + { + print_lookahead ("defstate_shift <- empty string"); + } + ; + +stack_explosion: + { $$ = '\0'; } + | alt1 stack_explosion %merge { $$ = $2; } + | alt2 stack_explosion %merge { $$ = $2; } + | alt3 stack_explosion %merge { $$ = $2; } + ; +alt1: + 'd' no_look { + USE ($1); + if (yychar != 'd' && yychar != YYEOF) + { + fprintf (stderr, "Incorrect lookahead during stack explosion.\n"); + } + } + ; +alt2: + 'd' no_look { + USE ($1); + if (yychar != 'd' && yychar != YYEOF) + { + fprintf (stderr, "Incorrect lookahead during stack explosion.\n"); + } + } + ; +alt3: + 'd' no_look { + USE ($1); + if (yychar != 'd' && yychar != YYEOF) + { + fprintf (stderr, "Incorrect lookahead during stack explosion.\n"); + } + } + ; +no_look: + { + if (yychar != YYEMPTY) + { + fprintf (stderr, + "Found lookahead where shouldn't during stack explosion.\n"); + } + } + ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static char const input[] = "abcdddd"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = toknum + 1; + yylval.value = input[toknum] + 'A' - 'a'; + return input[toknum++]; +} + +static void +print_lookahead (char const *reduction) +{ + printf ("%s:\n yychar=", reduction); + if (yychar == YYEMPTY) + printf ("YYEMPTY"); + else if (yychar == YYEOF) + printf ("YYEOF"); + else + { + printf ("'%c', yylval='", yychar); + if (yylval.value > ' ') + printf ("%c", yylval.value); + printf ("', yylloc=(%d,%d),(%d,%d)", + yylloc.first_line, yylloc.first_column, + yylloc.last_line, yylloc.last_column); + } + printf ("\n"); +} + +static char +merge (union YYSTYPE s1, union YYSTYPE s2) +{ + char dummy = s1.value + s2.value; + return dummy; +} + +int +main (void) +{ + yychar = '#'; /* Not a token in the grammar. */ + yylval.value = '!'; + return yyparse (); +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1455: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr14.c glr-regr14.y" +echo glr-regression.at:1455 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr14.c glr-regr14.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr14.c glr-regr14.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1455" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1455: bison --xml=xml-tests/test.xml -o glr-regr14.c glr-regr14.y" +echo glr-regression.at:1455 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr14.c glr-regr14.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr14.c glr-regr14.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1455" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1455: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1455 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1455" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1455: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1455 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1455" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1455: bison -o glr-regr14.c glr-regr14.y" +echo glr-regression.at:1455 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr14.c glr-regr14.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr14.c glr-regr14.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr14.y: conflicts: 3 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1455" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1458: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr14 glr-regr14.c \$LIBS" +echo glr-regression.at:1458 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr14 glr-regr14.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr14 glr-regr14.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr14 glr-regr14.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1458" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1460: \$PREPARSER ./glr-regr14" +echo glr-regression.at:1460 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr14"; then + ( $at_traceon; $PREPARSER ./glr-regr14 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr14 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "conflict <- empty string: + yychar='a', yylval='A', yylloc=(1,1),(1,1) +defstate_look <- empty string: + yychar='a', yylval='A', yylloc=(1,1),(1,1) +nonconflict2 <- empty string: + yychar='b', yylval='B', yylloc=(1,2),(1,2) +defstate_shift <- empty string: + yychar=YYEMPTY +merge <- conflict defstate_look 'a' nonconflict2 'b' defstate_shift: + yychar=YYEMPTY +start <- merge 'c' stack_explosion: + yychar=YYEOF +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1460" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_233 +#AT_START_234 +# 234. glr-regression.at:1482: Leaked semantic values when reporting ambiguity +at_setup_line='glr-regression.at:1482' +at_func_banner 21 +at_desc="Leaked semantic values when reporting ambiguity" +$at_quiet $as_echo_n "234: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "234. glr-regression.at:1482: testing ..." + $at_traceon + + +cat >glr-regr15.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%glr-parser +%destructor { parent_rhs_before_value = 0; } parent_rhs_before + +%{ +# include + static void yyerror (char const *); + static int yylex (void); + static int parent_rhs_before_value = 0; +# define USE(val) +%} + +%% + +start: + alt1 %dprec 1 + | alt2 %dprec 2 + ; + +/* This stack must be merged into the other stacks *last* (added at the + beginning of the semantic options list) so that yyparse will choose to clean + it up rather than the tree for which some semantic actions have been + performed. Thus, if yyreportAmbiguity longjmp's to yyparse, the values from + those other trees are not cleaned up. */ +alt1: ; + +alt2: + parent_rhs_before ambiguity { + USE ($1); + parent_rhs_before_value = 0; + } + ; + +parent_rhs_before: + { + USE ($$); + parent_rhs_before_value = 1; + } + ; + +ambiguity: ambiguity1 | ambiguity2 ; +ambiguity1: ; +ambiguity2: ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static int called; + if (called++) + abort (); + return 0; +} + +int +main (void) +{ + int exit_status = yyparse () != 1; + if (parent_rhs_before_value) + { + fprintf (stderr, "`parent_rhs_before' destructor not called.\n"); + exit_status = 1; + } + return exit_status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1559: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr15.c glr-regr15.y" +echo glr-regression.at:1559 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr15.c glr-regr15.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr15.c glr-regr15.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1559" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1559: bison --xml=xml-tests/test.xml -o glr-regr15.c glr-regr15.y" +echo glr-regression.at:1559 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr15.c glr-regr15.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr15.c glr-regr15.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1559" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1559: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1559 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1559" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1559: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1559 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1559" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1559: bison -o glr-regr15.c glr-regr15.y" +echo glr-regression.at:1559 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr15.c glr-regr15.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr15.c glr-regr15.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr15.y: conflicts: 2 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1559" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1562: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr15 glr-regr15.c \$LIBS" +echo glr-regression.at:1562 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr15 glr-regr15.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr15 glr-regr15.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr15 glr-regr15.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1562" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1564: \$PREPARSER ./glr-regr15" +echo glr-regression.at:1564 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr15"; then + ( $at_traceon; $PREPARSER ./glr-regr15 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr15 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax is ambiguous +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1564" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_234 +#AT_START_235 +# 235. glr-regression.at:1575: Leaked lookahead after nondeterministic parse syntax error +at_setup_line='glr-regression.at:1575' +at_func_banner 21 +at_desc="Leaked lookahead after nondeterministic parse syntax error" +$at_quiet $as_echo_n "235: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "235. glr-regression.at:1575: testing ..." + $at_traceon + +cat >glr-regr16.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%glr-parser +%destructor { lookahead_value = 0; } 'b' + +%{ +# include + static void yyerror (char const *); + static int yylex (void); + static int lookahead_value = 0; +# define USE(val) +%} + +%% + +start: alt1 'a' | alt2 'a' ; +alt1: ; +alt2: ; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + static char const input[] = "ab"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + if (input[toknum] == 'b') + lookahead_value = 1; + return input[toknum++]; +} + +int +main (void) +{ + int exit_status = yyparse () != 1; + if (lookahead_value) + { + fprintf (stderr, "Lookahead destructor not called.\n"); + exit_status = 1; + } + return exit_status; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1628: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr16.c glr-regr16.y" +echo glr-regression.at:1628 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr16.c glr-regr16.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr16.c glr-regr16.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1628" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1628: bison --xml=xml-tests/test.xml -o glr-regr16.c glr-regr16.y" +echo glr-regression.at:1628 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr16.c glr-regr16.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr16.c glr-regr16.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1628" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1628: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1628 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1628" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1628: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1628 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1628" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1628: bison -o glr-regr16.c glr-regr16.y" +echo glr-regression.at:1628 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr16.c glr-regr16.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr16.c glr-regr16.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr16.y: conflicts: 1 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1628" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1631: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr16 glr-regr16.c \$LIBS" +echo glr-regression.at:1631 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr16 glr-regr16.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr16 glr-regr16.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr16 glr-regr16.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1631" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1633: \$PREPARSER ./glr-regr16" +echo glr-regression.at:1633 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr16"; then + ( $at_traceon; $PREPARSER ./glr-regr16 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr16 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "syntax error +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1633" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_235 +#AT_START_236 +# 236. glr-regression.at:1644: Uninitialized location when reporting ambiguity +at_setup_line='glr-regression.at:1644' +at_func_banner 21 +at_desc="Uninitialized location when reporting ambiguity" +$at_quiet $as_echo_n "236: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "236. glr-regression.at:1644: testing ..." + $at_traceon + +cat >glr-regr17.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%glr-parser +%locations +%define api.pure +%error-verbose + +%union { int dummy; } + +%{ + static void yyerror (YYLTYPE *, char const *); + static int yylex (YYSTYPE *, YYLTYPE *); +%} + +%initial-action { + @$.first_line = 1; + @$.first_column = 1; + @$.last_line = 1; + @$.last_column = 1; +} + +%% + +/* Tests the case of an empty RHS that has inherited the location of the + previous nonterminal, which is unresolved. That location is reported as the + last position of the ambiguity. */ +start: ambig1 empty1 | ambig2 empty2 ; + +/* Tests multiple levels of yyresolveLocations recursion. */ +ambig1: sub_ambig1 | sub_ambig2 ; +ambig2: sub_ambig1 | sub_ambig2 ; + +/* Tests the case of a non-empty RHS as well as the case of an empty RHS that + has inherited the initial location. The empty RHS's location is reported as + the first position in the ambiguity. */ +sub_ambig1: empty1 'a' 'b' ; +sub_ambig2: empty2 'a' 'b' ; +empty1: ; +empty2: ; + +%% + +static void +yyerror (YYLTYPE *locp, char const *msg) +{ + fprintf (stderr, "Error at %d.%d-%d.%d: %s.\n", locp->first_line, + locp->first_column, locp->last_line, locp->last_column, msg); +} + +static int +yylex (YYSTYPE *lvalp, YYLTYPE *llocp) +{ + static char const input[] = "ab"; + static size_t toknum; + if (! (toknum < sizeof input)) + abort (); + lvalp->dummy = 0; + llocp->first_line = llocp->last_line = 2; + llocp->first_column = toknum + 1; + llocp->last_column = llocp->first_column + 1; + return input[toknum++]; +} + +int +main (void) +{ + return yyparse () != 1; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1715: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o glr-regr17.c glr-regr17.y" +echo glr-regression.at:1715 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr17.c glr-regr17.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o glr-regr17.c glr-regr17.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1715" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1715: bison --xml=xml-tests/test.xml -o glr-regr17.c glr-regr17.y" +echo glr-regression.at:1715 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o glr-regr17.c glr-regr17.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o glr-regr17.c glr-regr17.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1715" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1715: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1715 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1715" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1715: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo glr-regression.at:1715 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1715" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1715: bison -o glr-regr17.c glr-regr17.y" +echo glr-regression.at:1715 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o glr-regr17.c glr-regr17.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o glr-regr17.c glr-regr17.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr17.y: conflicts: 3 reduce/reduce +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1715" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1718: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr17 glr-regr17.c \$LIBS" +echo glr-regression.at:1718 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr17 glr-regr17.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr17 glr-regr17.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr17 glr-regr17.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1718" + +$at_failed && at_func_log_failure +$at_traceon; } + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1720: \$PREPARSER ./glr-regr17" +echo glr-regression.at:1720 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./glr-regr17"; then + ( $at_traceon; $PREPARSER ./glr-regr17 ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./glr-regr17 ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "Error at 1.1-2.3: syntax is ambiguous. +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/glr-regression.at:1720" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_236 +#AT_START_237 +# 237. glr-regression.at:1731: Missed %merge type warnings when LHS type is declared later +at_setup_line='glr-regression.at:1731' +at_func_banner 21 +at_desc="Missed %merge type warnings when LHS type is declared later" +$at_quiet $as_echo_n "237: $at_desc" +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "237. glr-regression.at:1731: testing ..." + $at_traceon + +cat >glr-regr18.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + +%glr-parser + +%{ + #include + static void yyerror (char const *); + static int yylex (); +%} + +%union { + int type1; + int type2; + int type3; +} + +%% + +sym1: sym2 %merge { $$ = $1; } ; +sym2: sym3 %merge { $$ = $1; } ; +sym3: %merge { $$ = 0; } ; + +%type sym1; +%type sym2; +%type sym3; + +%% + +static void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex () +{ + static int called; + if (called++) + abort (); + return 0; +} + +int +main (void) +{ + return yyparse (); +} +_ATEOF + + + + +{ $at_traceoff +$as_echo "$at_srcdir/glr-regression.at:1781: VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o glr-regr18.c glr-regr18.y" +echo glr-regression.at:1781 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison -o glr-regr18.c glr-regr18.y"; then + ( $at_traceon; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o glr-regr18.c glr-regr18.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison -o glr-regr18.c glr-regr18.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "glr-regr18.y:26.18-24: result type clash on merge function \`merge': != +glr-regr18.y:25.18-24: previous declaration +glr-regr18.y:27.13-19: result type clash on merge function \`merge': != +glr-regr18.y:26.18-24: previous declaration +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 1 $at_status "$at_srcdir/glr-regression.at:1781" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_237 +#AT_START_238 +# 238. push.at:23: Push Parsing: Memory Leak for Early Deletion +at_setup_line='push.at:23' +at_func_banner 22 +at_desc="Push Parsing: Memory Leak for Early Deletion" +$at_quiet $as_echo_n "238: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "238. push.at:23: testing ..." + $at_traceon + + +# Requires Valgrind. + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ + #include + #include + #define YYINITDEPTH 1 + void yyerror (char const *msg); +%} + +%define api.pure %define api.push_pull "push" + +%% + +start: 'a' 'b' 'c' ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +main (void) +{ + yypstate *ps; + + /* Make sure we don't try to free ps->yyss in this case. */ + ps = yypstate_new (); + yypstate_delete (ps); + + /* yypstate_delete used to leak ps->yyss if the stack was reallocated but the + parse did not return on success, syntax error, or memory exhaustion. */ + ps = yypstate_new (); + assert (yypush_parse (ps, 'a', NULL) == YYPUSH_MORE); + yypstate_delete (ps); + + ps = yypstate_new (); + assert (yypush_parse (ps, 'a', NULL) == YYPUSH_MORE); + assert (yypush_parse (ps, 'b', NULL) == YYPUSH_MORE); + yypstate_delete (ps); + + return 0; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/push.at:74: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo push.at:74 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:74" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/push.at:74: bison --xml=xml-tests/test.xml -o input.c input.y" +echo push.at:74 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:74" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/push.at:74: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo push.at:74 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:74" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/push.at:74: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo push.at:74 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:74" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/push.at:74: bison -o input.c input.y" +echo push.at:74 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:74" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/push.at:75: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo push.at:75 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:75" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/push.at:76: \$PREPARSER ./input" +echo push.at:76 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:76" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_238 +#AT_START_239 +# 239. push.at:84: Push Parsing: Multiple impure instances +at_setup_line='push.at:84' +at_func_banner 22 +at_desc="Push Parsing: Multiple impure instances" +$at_quiet $as_echo_n "239: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "239. push.at:84: testing ..." + $at_traceon + + + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ + #include + #include + void yyerror (char const *msg); + int yylex (void); +%} + +%define api.push_pull "both" + +%% + +start: ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +yylex (void) +{ + return 0; +} + +int +main (void) +{ + yypstate *ps; + int i; + + for (i = 0; i < 2; ++i) + { + ps = yypstate_new (); + assert (ps); + assert (yypstate_new () == NULL); + assert (yyparse () == 2); + yychar = 0; + assert (yypush_parse (ps) == 0); + assert (yypstate_new () == NULL); + assert (yyparse () == 2); + yypstate_delete (ps); + } + + return 0; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/push.at:144: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo push.at:144 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/push.at:144: bison --xml=xml-tests/test.xml -o input.c input.y" +echo push.at:144 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/push.at:144: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo push.at:144 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/push.at:144: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo push.at:144 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/push.at:144: bison -o input.c input.y" +echo push.at:144 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/push.at:144: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo push.at:144 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/push.at:144: \$PREPARSER ./input" +echo push.at:144 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:144" + +$at_failed && at_func_log_failure +$at_traceon; } + + + +cat >input.y <<'_ATEOF' +%code top { +#include +/* We don't need perfect functions for these tests. */ +#undef malloc +#undef memcmp +#undef realloc +} + + +%{ + #include + #include + void yyerror (char const *msg); + int yylex (void); +%} + +%define api.push_pull "push" + +%% + +start: ; + +%% + +void +yyerror (char const *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int +yylex (void) +{ + return 0; +} + +int +main (void) +{ + yypstate *ps; + int i; + + for (i = 0; i < 2; ++i) + { + ps = yypstate_new (); + assert (ps); + assert (yypstate_new () == NULL); + ; + yychar = 0; + assert (yypush_parse (ps) == 0); + assert (yypstate_new () == NULL); + ; + yypstate_delete (ps); + } + + return 0; +} +_ATEOF + + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/push.at:145: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot -o input.c input.y" +echo push.at:145 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/push.at:145: bison --xml=xml-tests/test.xml -o input.c input.y" +echo push.at:145 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/push.at:145: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo push.at:145 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/push.at:145: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo push.at:145 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/push.at:145: bison -o input.c input.y" +echo push.at:145 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison -o input.c input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/push.at:145: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" +echo push.at:145 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS"; then + ( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + +{ $at_traceoff +$as_echo "$at_srcdir/push.at:145: \$PREPARSER ./input" +echo push.at:145 >"$at_check_line_file" + +if test -n "$at_traceon" \ + && at_func_check_newline " $PREPARSER ./input"; then + ( $at_traceon; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $PREPARSER ./input ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:145" + +$at_failed && at_func_log_failure +$at_traceon; } + + + + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_239 +#AT_START_240 +# 240. push.at:155: Push Parsing: Unsupported Skeletons +at_setup_line='push.at:155' +at_func_banner 22 +at_desc="Push Parsing: Unsupported Skeletons" +$at_quiet $as_echo_n "240: $at_desc " +at_xfail=no +echo "# -*- compilation -*-" >> "$at_group_log" +( + $as_echo "240. push.at:155: testing ..." + $at_traceon + + +cat >input.y <<'_ATEOF' +%glr-parser +%define api.push_pull "push" +%% +start: ; +_ATEOF + + +if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then + mkdir xml-tests + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + { $at_traceoff +$as_echo "$at_srcdir/push.at:164: bison --report=all --report-file=xml-tests/test.output \\ + --graph=xml-tests/test.dot input.y" +echo push.at:164 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains an embedded newline)' + false; }; then + ( $at_traceon; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:164" + +$at_failed && at_func_log_failure +$at_traceon; } + + { $at_traceoff +$as_echo "$at_srcdir/push.at:164: bison --xml=xml-tests/test.xml input.y" +echo push.at:164 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison --xml=xml-tests/test.xml input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo stderr:; cat "$at_stderr" +echo stdout:; cat "$at_stdout" +at_func_check_status 0 $at_status "$at_srcdir/push.at:164" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.output expout + { $at_traceoff +$as_echo "$at_srcdir/push.at:164: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ + xml-tests/test.xml" +echo push.at:164 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:164" + +$at_failed && at_func_log_failure +$at_traceon; } + + cp xml-tests/test.dot expout + { $at_traceoff +$as_echo "$at_srcdir/push.at:164: \$XSLTPROC \\ + \`VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ + xml-tests/test.xml" +echo push.at:164 >"$at_check_line_file" + +if { echo 'Not enabling shell tracing (command contains a `...` command substitution)' + false; }; then + ( $at_traceon; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; $XSLTPROC \ + `VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +at_func_diff_devnull "$at_stderr" || at_failed=: +$at_diff expout "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:164" + +$at_failed && at_func_log_failure +$at_traceon; } + + rm -rf xml-tests expout +fi +{ $at_traceoff +$as_echo "$at_srcdir/push.at:164: bison input.y" +echo push.at:164 >"$at_check_line_file" + +if test -n "$at_traceon"; then + ( $at_traceon; bison input.y ) >"$at_stdout" 2>"$at_stder1" + at_func_filter_trace $? +else + ( :; bison input.y ) >"$at_stdout" 2>"$at_stderr" +fi +at_status=$? +at_failed=false +echo >>"$at_stderr"; $as_echo "input.y:2.9-21: warning: %define variable \`api.push_pull' is not used +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_func_diff_devnull "$at_stdout" || at_failed=: +at_func_check_status 0 $at_status "$at_srcdir/push.at:164" + +$at_failed && at_func_log_failure +$at_traceon; } + + + $at_traceoff + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 | eval $at_tee_pipe +at_status=`cat "$at_status_file"` +#AT_STOP_240 diff --git a/tests/testsuite.at b/tests/testsuite.at new file mode 100644 index 0000000..fa7d748 --- /dev/null +++ b/tests/testsuite.at @@ -0,0 +1,73 @@ +# Test suite for GNU Bison. -*- Autotest -*- + +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007 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 . + + +# Testing resistance to user bugs. +m4_include([input.at]) + +# Testing output file names. +m4_include([output.at]) + +# Testing skeleton support. +m4_include([skeletons.at]) + +# Testing the part of the engine that computes FOLLOW etc. +m4_include([sets.at]) + +# Testing grammar reduction. +m4_include([reduce.at]) + +# Testing that #lines are correct. +m4_include([synclines.at]) + +# Testing that headers are sane. +m4_include([headers.at]) + +# Testing that user actions are properly performed. +m4_include([actions.at]) + +# Testing conflicts detection and resolution. +m4_include([conflicts.at]) + +# Fulling testing (compilation and execution of the parser) on calc. +m4_include([calc.at]) + +# Huge artificial grammars. +# Torturing the stack expansion at runtime. +m4_include([torture.at]) + +# Checking big, real world grammars. +m4_include([existing.at]) + +# Some old bugs. +m4_include([regression.at]) + +# Some C++ specific tests. +m4_include([c++.at]) + +# And some Java specific tests. +m4_include([java.at]) + +# GLR tests: +# C++ types, simplified +m4_include([cxx-type.at]) +# Regression tests +m4_include([glr-regression.at]) + +# Push parsing specific tests. +m4_include([push.at]) diff --git a/tests/torture.at b/tests/torture.at new file mode 100644 index 0000000..753fc91 --- /dev/null +++ b/tests/torture.at @@ -0,0 +1,548 @@ +# Torturing Bison. -*- Autotest -*- +# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007 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 . + +AT_BANNER([[Torture Tests.]]) + + +# AT_INCREASE_DATA_SIZE(SIZE) +# --------------------------- +# Try to increase the data size to SIZE KiB if possible. +m4_define([AT_INCREASE_DATA_SIZE], +[data_limit=`(ulimit -S -d) 2>/dev/null` +case $data_limit in +[[0-9]]*) + if test "$data_limit" -lt $1; then + AT_CHECK([ulimit -S -d $1 || exit 77]) + ulimit -S -d $1 + fi +esac]) + + +## ------------------------------------- ## +## Creating a large artificial grammar. ## +## ------------------------------------- ## + +# AT_DATA_TRIANGULAR_GRAMMAR(FILE-NAME, SIZE) +# ------------------------------------------- +# Create FILE-NAME, containing a self checking parser for a huge +# triangular grammar. +m4_define([AT_DATA_TRIANGULAR_GRAMMAR], +[AT_DATA([[gengram.pl]], +[[#! /usr/bin/perl -w + +use strict; +my $max = $ARGV[0] || 10; + +print < +#include + +static int yylex (void); +static void yyerror (const char *msg); +%} +%union +{ + int val; +}; + +%token END "end" +%type exp input +EOF + +for my $size (1 .. $max) + { + print "%token t$size $size \"$size\"\n"; + }; + +print < $max) + return 0; + else if (inner > outer) + { + inner = 1; + ++outer; + return END; + } + return inner++; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\\n", msg); +} + +int +main (void) +{ + yydebug = !!getenv ("YYDEBUG"); + return yyparse (); +} +EOF +]]) + +AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout]) +mv stdout $1 +]) + + +## -------------- ## +## Big triangle. ## +## -------------- ## + +AT_SETUP([Big triangle]) + +# I have been able to go up to 2000 on my machine. +# I tried 3000, a 29Mb grammar file, but then my system killed bison. +# With 500 and the new parser, which consume far too much memory, +# it gets killed too. Of course the parser is to be cleaned. +AT_DATA_TRIANGULAR_GRAMMAR([input.y], [200]) +AT_BISON_CHECK_NO_XML([-v -o input.c input.y]) +AT_COMPILE([input]) +AT_PARSER_CHECK([./input]) + +AT_CLEANUP + + + +# AT_DATA_HORIZONTAL_GRAMMAR(FILE-NAME, SIZE) +# ------------------------------------------- +# Create FILE-NAME, containing a self checking parser for a huge +# horizontal grammar. +m4_define([AT_DATA_HORIZONTAL_GRAMMAR], +[AT_DATA([[gengram.pl]], +[[#! /usr/bin/perl -w + +use strict; +my $max = $ARGV[0] || 10; + +print < +#include + +static int yylex (void); +static void yyerror (const char *msg); +%} + +%token +EOF +for my $size (1 .. $max) + { + print " t$size $size \"$size\"\n"; + }; + +print < +# include +# include + +static int yylex (void); +static void yyerror (const char *msg); +%} +%union +{ + int val; +}; + +%type input exp +%token token +EOF + +print + wrap ("%type ", + " ", + map { "n$_" } (1 .. $max)), + "\n"; + +print "%token\n"; +for my $count (1 .. $max) + { + print " t$count $count \"$count\"\n"; + }; + +print < $max) + { + if (counter++ != $max + 1) + abort (); + return 0; + } + if (return_token) + { + return_token = 0; + return token; + } + return_token = 1; + return counter++; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\\n", msg); +} + +int +main (void) +{ + yydebug = !!getenv ("YYDEBUG"); + return yyparse (); +} +EOF +]]) + +AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout]) +mv stdout $1 +]) + + +## ------------------------ ## +## Many lookahead tokens. ## +## ------------------------ ## + +AT_SETUP([Many lookahead tokens]) + +AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR([input.y], [1000]) + +# GNU m4 requires about 70 MiB for this test on a 32-bit host. +# Ask for 200 MiB, which should be plenty even on a 64-bit host. +AT_INCREASE_DATA_SIZE(204000) + +AT_BISON_CHECK([-v -o input.c input.y]) +AT_COMPILE([input]) +AT_PARSER_CHECK([./input]) + +AT_CLEANUP + + + +# AT_DATA_STACK_TORTURE(C-PROLOGUE, [BISON-DECLS]) +# ------------------------------------------------ +# A parser specialized in torturing the stack size. +m4_define([AT_DATA_STACK_TORTURE], +[# A grammar of parens growing the stack thanks to right recursion. +# exp: +AT_DATA([input.y], +[[%{ +#include +#include +#include +#include +]$1[ + static int yylex (void); + static void yyerror (const char *msg); +%} +]$2[ +%error-verbose +%debug +%token WAIT_FOR_EOF +%% +exp: WAIT_FOR_EOF exp | ; +%% +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +static int +yylex (void) +{ + if (yylval < 0) + abort (); + if (yylval--) + return WAIT_FOR_EOF; + else + return EOF; +} + +int +main (int argc, const char **argv) +{ + char *endp; + YYSTYPE yylval_init; + if (argc != 2) + abort (); + yylval_init = strtol (argv[1], &endp, 10); + if (! (argv[1] != endp + && 0 <= yylval_init && yylval_init <= INT_MAX + && errno != ERANGE)) + abort (); + yydebug = 1; + { + int count; + int status; +]m4_bmatch([$2], [%push-], +[[ yypstate *ps = yypstate_new (); +]])[ for (count = 0; count < 2; ++count) + { + int new_status; + yylval = yylval_init; +]m4_bmatch([$2], [%push-], +[[ new_status = yypull_parse (ps); +]], +[[ new_status = yyparse (); +]])[ if (count > 0 && new_status != status) + abort (); + status = new_status; + } +]m4_bmatch([$2], [%push-], +[[ yypstate_delete (ps); +]])[ return status; + } +} +]]) +AT_BISON_CHECK([-o input.c input.y]) +AT_COMPILE([input]) +]) + + +## -------------------------------------- ## +## Exploding the Stack Size with Alloca. ## +## -------------------------------------- ## + +AT_SETUP([Exploding the Stack Size with Alloca]) + +m4_pushdef([AT_USE_ALLOCA], [[ +#if (defined __GNUC__ || defined __BUILTIN_VA_ARG_INCR \ + || defined _AIX || defined _MSC_VER || defined _ALLOCA_H) +# define YYSTACK_USE_ALLOCA 1 +#endif +]]) + +AT_DATA_STACK_TORTURE([AT_USE_ALLOCA]) + +# Below the limit of 200. +AT_PARSER_CHECK([./input 20], 0, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) +# Two enlargements: 2 * 2 * 200. +AT_PARSER_CHECK([./input 900], 0, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) +# Fails: beyond the limit of 10,000 (which we don't reach anyway since we +# multiply by two starting at 200 => 5120 is the last possible). +AT_PARSER_CHECK([./input 10000], 2, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) + +# The push parser can't use alloca since the stacks can't be locals. This test +# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect +# push parsers. +AT_DATA_STACK_TORTURE([AT_USE_ALLOCA], +[[%define api.push_pull "both" +]]) +AT_PARSER_CHECK([./input 20], 0, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) +AT_PARSER_CHECK([./input 900], 0, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) +AT_PARSER_CHECK([./input 10000], 2, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) + +m4_popdef([AT_USE_ALLOCA]) + +AT_CLEANUP + + + + +## -------------------------------------- ## +## Exploding the Stack Size with Malloc. ## +## -------------------------------------- ## + +AT_SETUP([Exploding the Stack Size with Malloc]) + +m4_pushdef([AT_USE_ALLOCA], [[#define YYSTACK_USE_ALLOCA 0]]) + +AT_DATA_STACK_TORTURE([AT_USE_ALLOCA]) + +# Below the limit of 200. +AT_PARSER_CHECK([./input 20], 0, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) +# Two enlargements: 2 * 2 * 200. +AT_PARSER_CHECK([./input 900], 0, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) +# Fails: beyond the limit of 10,000 (which we don't reach anyway since we +# multiply by two starting at 200 => 5120 is the possible). +AT_PARSER_CHECK([./input 10000], 2, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) + +AT_DATA_STACK_TORTURE([AT_USE_ALLOCA], +[[%define api.push_pull "both" +]]) +AT_PARSER_CHECK([./input 20], 0, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) +AT_PARSER_CHECK([./input 900], 0, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) +AT_PARSER_CHECK([./input 10000], 2, [], [ignore], + [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) + +m4_popdef([AT_USE_ALLOCA]) + +AT_CLEANUP